Linux網絡流量監控工具-iftop


參考:
http://blog.163.com/jgh2008@126/blog/static/28596246201092081139283/

 

 

一、獲得和安裝iftop 

 

Centos:yum install iftop

Ubuntu:  sudo apt-get install iftop

 

編譯安裝:


iftop也是免費大軍中的一員,下載地址如下:
點擊下載iftop 

iftop需要依賴兩個軟件包,分別是libpcap和tcpdump,安裝iftop前要先安裝這兩個家伙
點擊下載libpcap和tcpdump 

別急着下載和安裝libpcap和tcpdump,如果系統默認已經安裝了就無需再裝

#rpm -qa libpcap
#rpm -qa tcpdump


如圖我的機器本身已經安裝了,所以直接安裝iftop就ok~~呵呵!


iftop安裝非常簡單
#tar xzvf iftop-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 -i eth2         
表示檢測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 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 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 as well as hosts

   -m limit            sets the upper limit for the bandwidth 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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM