iftop是什么

簡介

iftop是一款實(shí)時(shí)流量監(jiān)控工具,監(jiān)控TCP/IP連接等,缺點(diǎn)就是無報(bào)表功能。必須以root身份才能運(yùn)行。

配置流程

1.配置編譯環(huán)境

安裝相關(guān)依賴包。

yum install wget libpcap libpcap-devel ncurses-y

2.獲取源碼

獲取“iftop-0.17”源碼包。

cd/usr/local/src
wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz

3.編譯和安裝

1)解壓軟件包。

tar-zxvf iftop-0.17.tar.gz

2)進(jìn)入iftop的安裝目錄。

cd iftop-0.17

3)修改配置“config.sub”。

vim config/config.sub

查找“x86”內(nèi)容的位置,在其位置后面增加“aarch64”類型。

在“case$basic_machine in”區(qū)域的兩個(gè)位置修改。

a.修改下述內(nèi)容。

|x86|xscale|xstormy16|xtensa

修改后為:

|x86|aarch64|xscale|xstormy16|xtensa

b.修改下述內(nèi)容。

|x86-*|x86_64-*|xps100-*|xscale-*|xstormy16-*

修改后為:

|x86-*|aarch64-*|x86_64-*|xps100-*|xscale-*|xstormy16-*

4)配置iftop生成Makefile。

./configure--host=aarch64--build=aarch64

5)編譯和安裝iftop。

make&&make install

4.運(yùn)行和驗(yàn)證

執(zhí)行如下命令,查看iftop信息。

iftop-h

回顯信息如下,則表示iftop安裝成功。

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