在類Unix系統(tǒng)中可以使用top查看系統(tǒng)資源,進(jìn)程,內(nèi)存占用等信息。查看網(wǎng)絡(luò)狀態(tài)可以使用netstat、nmap等工具。 若要查看實(shí)時(shí)的網(wǎng)絡(luò)流量,監(jiān)控TCP/IP連接,反向解析IP,顯示端口信息等,則可以使用iftop。 1、安裝由于使用yum install命令,無(wú)法進(jìn)行直接安裝。# yum install iftop //用命令直接安裝
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.skyshe.cn
* extras: centos.ustc.edu.cn
* updates: mirrors.skyshe.cn
Setting up Install Process
No package iftop available. //沒(méi)有可用的安裝包
Error: Nothing to do //什么都沒(méi)干 那么,就必須使用第二種安裝方式,即下載,解壓,配置,并編譯安裝。從其官網(wǎng)(http://www./pdw/iftop/download/)上,選擇一個(gè)最新版本(iftop-1.0pre4.tar.gz) # yum install -y flex byacc libpcap ncurses-devel libpcap-devel //先要安裝必需的軟件
# mkdir iftop
# cd iftop/
# wget http://www./pdw/iftop/download/iftop-1.0pre4.tar.gz //下載
# tar zxvf iftop-1.0pre4.tar.gz //解壓
# cd iftop-1.0pre4
# ./configure //配置
# make && make install //編譯安裝
2、命令說(shuō)明語(yǔ)法: iftop -h | [-npblNBP] [-i interface] [-f filter code] [-F net/mask] [-G net6/mask6]
-h 顯示本幫助(Help)信息
-n 不進(jìn)行主機(jī)名(hostName)查找
-N 不將端口號(hào)(port Number)轉(zhuǎn)換成對(duì)應(yīng)的服務(wù) to services
-p 混合(Promiscuous)模式(顯示網(wǎng)絡(luò)相關(guān)的其他主機(jī)信息)
-b 不顯示流量圖形條(Bar)
-B 以字節(jié)(Byte)為單位,顯示帶寬(Bandwidth);默認(rèn)以比特(bit)顯示的
-i interface 監(jiān)控的網(wǎng)卡接口(interface)
-f filter code 包統(tǒng)計(jì)時(shí),使用過(guò)濾碼;默認(rèn):無(wú),只統(tǒng)計(jì)IP包
-F net/mask 顯示特定IPv4網(wǎng)段的進(jìn)出流量(Flow);如# iftop -F 10.10.1.0/24
-G net6/mask6 顯示特定IPv6網(wǎng)段的進(jìn)出流量(Flow)
-l 顯示并統(tǒng)計(jì)IPv6本地(Local)鏈接的流量(默認(rèn):關(guān))
-P 顯示端口(Port)
-m limit 設(shè)置顯示界面上側(cè)的帶寬刻度(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
3、界面說(shuō)明
界面上面顯示的是類似刻度尺的刻度范圍,為顯示流量圖形的長(zhǎng)條作標(biāo)尺用的。 前面IP是本機(jī)的(Source),后面IP遠(yuǎn)程主機(jī)的(Dest); 中間的<= =>這兩個(gè)左右箭頭,表示的是流量的方向。 右側(cè)的三列數(shù)值: 第一列是:在此次刷新之前2s或10s或40s的平均流量(按B設(shè)置秒數(shù)); 第二列是:在此次刷新之前10秒鐘的總流量的一半; 第三列是:在此次刷新之前40秒鐘的總流量的1/5; TX:發(fā)送(Transmit)流量;RX:接收(Receive)流量;TOTAL:總流量; cum:運(yùn)行iftop到目前時(shí)間的總和(Cum);peak:流量峰(Peak)值; rates:分別表示過(guò)去 2s 10s 40s 的平均流量; 界面顯示時(shí)的交互命令: 主機(jī)顯示:
n - DNS主機(jī)解析的開(kāi)關(guān)
s - 源(Source)主機(jī)顯示的開(kāi)關(guān)
d - 目標(biāo)(Dest)主機(jī)顯示的開(kāi)關(guān)
t - 循環(huán)切換行顯示模式
端口顯示:
N - toggle service resolution
S - toggle show source port
D - toggle show destination port
p - toggle port display
排序:
1/2/3 - sort by 1st/2nd/3rd column
< - sort by source name
> - sort by dest name
o - freeze current order
普通:
P - 暫停(Pause)顯示
h - 本幫助(Help)的顯示或隱藏
b - 圖形條(Bar)的顯示或隱藏
B - cycle bar graph average
T - toggle cumulative line totals
j/k - scroll display
f - edit filter code
l - set screen filter
L - lin/log scales
! - shell command
q - quit
|
|