iftop 主要用来显示本机网络流量情况及各相互通信的流量集合,如单独同那台机器间的流量大小,非常适合于代理服务器和iptables服务器使用.
1、安装依赖
yum install libpcap-devel ncurses-devel
2、开始安装
wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
tar xzf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make && make install
如何使用: 直接执行iftop即可运行查看流量情况. 执行iftop -h得到帮助信息:
[root@www ~]#iftop -h
iftop: display bandwidth usage on an interface by host
Synopsis: iftop -h | [-npbBP] [-i interface] [-f filter coolcode] [-N net/mask]
-h display this message
-n don't do hostname lookups
-N don't convert port numbers to services
-p run in promiscuous mode (show traffic between other
hosts on the same network segment)
-b don't display a bar graph of traffic
-B Display bandwidth in bytes
-i interface listen on named interface
-f filter coolcode use filter coolcode to select packets to count
(default: none, but only IP packets are counted)
-F net/mask show traffic flows in/out of network
-P show ports as well as hosts
-m limit sets the upper limit for the bandwidth scale
-c config file specifies an alternative configuration file
监控某网卡:
iftop -i eth0 -n
同时显示是什么服务:
iftop -i eth0 -n -P