Linux iftop --网络流量监控

来源:互联网 发布:淘宝被同行刷直接访问 编辑:程序博客网 时间:2024/05/17 22:46

一、获得和安装iftop 

 

Centosyum installiftop

Ubuntu:  sudoapt-get install iftop

 

编译安装:

 

iftop也是免费大军中的一员,下载地址如下:

点击下载iftop 

 

iftop需要依赖两个软件包,分别是libpcaptcpdump,安装iftop前要先安装这两个家伙

点击下载libpcaptcpdump 

 

别急着下载和安装libpcaptcpdump,如果系统默认已经安装了就无需再装

 

#rpm -qa libpcap

#rpm -qa tcpdump

 

如图我的机器本身已经安装了,所以直接安装iftopok~~呵呵!

 

 

iftop安装非常简单

#tar xzvfiftop-0.17pre3.tar.gz

#cd iftop-0.17pre3

 

#./configure

#make

#make install

 

安装完毕~

二、使用iftop监控网卡流量 

 

如果在安装iftop是没有自定义安装路径,那么直接运行iftop就可以调处流量监控控制台

 

#iftop

 

如图可以很直观地实时观察网卡的数据流量变化,那个ip占流量多少一目了然,令人眼前一亮!

 

退出iftop按“q~~

iftop备忘录 ~

 

iftop界面说明 

第一行:带宽显示

 

中间部分:外部连接列表,即记录了哪些ip正在和本机的网络连接

 

中间部分右边:实时参数分别是该访问ip连接到本机2秒,10秒和40秒的平均流量

 

=>代表发送数据,<=代表接收数据

 

底部三行:表示发送,接收和全部的流量

 

底部三行第二列:为你运行iftop到目前流量

 

底部三行第三列:为高峰值

 

底部三行第四列:为平均值

 

#iftop-i 网络接口           //设置检测本机的具体网卡

如:

#iftop -ieth2         

表示检测eth2网卡的流量状况

更具体详细的用法请参考:

root@Y460:~# iftop -h

iftop:display bandwidth usage on an interface by host

 

Synopsis:iftop -h | [-npbBP] [-i interface] [-f filter code] [-N net/mask]

 

  -h                  display thismessage

  -n                  don't dohostname lookups

  -N                  don't convertport numbers to services

  -p                  run inpromiscuous mode (show traffic between other

                      hosts onthe same network segment)

  -b                  don't displaya bar graph of traffic

  -B                  Displaybandwidth in bytes

  -i interface        listen on named interface

  -f filter code      use filter code 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 aswell as hosts

  -m limit            sets the upper limit for thebandwidth scale

  -c config file      specifies an alternative configuration file

 

iftop,version 0.17

copyright(c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors

常用的组合为:

#iftop -i interface -n  -B

 

0 0
原创粉丝点击