流量監控iftop安裝-CentOS7


繼之前撘的服務器后路由器一直崩潰,今天找到了原因.之前被下的木馬並沒有被刪掉,而是一直在傳輸數據.占用了所有寬帶.

官網(http://www.ex-parrot.com/pdw/iftop/download/

# yum install -y flex byacc libpcap ncurses-devel libpcap-devel   #先要安裝必需的軟件  
# mkdir iftop  
# cd iftop/  
# wget http://www.ex-parrot.com/pdw/iftop/download/iftop-1.0pre4.tar.gz #下載  
# tar zxvf iftop-1.0pre4.tar.gz #解壓  
# cd iftop-1.0pre4  
# ./configure #配置  
# make && make install #編譯安裝  

命令說明

語法: iftop -h | [-npblNBP] [-i interface] [-f filter code] [-F net/mask] [-G net6/mask6]  
   -h                  顯示本幫助(Help)信息  
   -n                  不進行主機名(hostName)查找  
   -N                  不將端口號(port Number)轉換成對應的服務 to services  
   -p                  混合(Promiscuous)模式(顯示網絡相關的其他主機信息)  
   -b                  不顯示流量圖形條(Bar)  
   -B                  以字節(Byte)為單位,顯示帶寬(Bandwidth);默認以比特(bit)顯示的  
   -i interface        監控的網卡接口(interface)  
   -f filter code      包統計時,使用過濾碼;默認:無,只統計IP包  
   -F net/mask         顯示特定IPv4網段的進出流量(Flow);如# iftop -F 10.10.1.0/24  
   -G net6/mask6       顯示特定IPv6網段的進出流量(Flow)  
   -l                  顯示並統計IPv6本地(Local)鏈接的流量(默認:關)  
   -P                  顯示端口(Port)  
   -m limit            設置顯示界面上側的帶寬刻度(liMit)  
   -c config file      指定配置(Config)文件  
   -t                  使用不帶窗口菜單的文本(text)接口  
  
   排序:  
   -o 2s                Sort by first column (2s traffic average)  
   -o 10s               Sort by second column (10s traffic average) [default]  
   -o 40s               Sort by third column (40s traffic average)  
   -o source            Sort by source address  
   -o destination       Sort by destination address  
  
   The following options are only available in combination with -t  
   -s num              print one single text output afer num seconds, then quit  
   -L num              number of lines to print 

# iftop

右側的三列數值:
第一列是:在此次刷新之前2s或10s或40s的平均流量(按B設置秒數); 
第二列是:在此次刷新之前10秒鍾的總流量的一半; 
第三列是:在此次刷新之前40秒鍾的總流量的1/5;
TX:發送(Transmit)流量;RX:接收(Receive)流量;TOTAL:總流量;
cum:運行iftop到目前時間的總和(Cum);peak:流量峰(Peak)值;
rates:分別表示過去 2s 10s 40s 的平均流量;

ifconfig不僅查看的是ip還可以查看總流量

 

運行一下top命令,查看占用資源情況,PID為1022的明顯有問題,應該就是那個發送數據包的程序了。

 kill -9 1022

OK了,進程關掉了。

查看哪個網卡消耗流量

ifconfig -a

iftop -i ens33 -n -P

 


免責聲明!

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



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