wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
提示: configure: error: can’t find pcap.h You’re not going to get very far without libpcap. 需要先安装libpcap
wget http://www.tcpdump.org/release/libpcap-1.5.3.tar.gz
tar -xzvf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3/
./configure
提示:“Your operating system’s lex is insufficient to compile libpcap. flex is a lex replacement that has many advantages, including being able to compile libpcap. “ 系统中未安装flex,需要先安装
yum -y install flex
再次运行./configure命令,生成相应的Makefile文件,运行make报错:“yacc -d grammar.y make: yacc: Command not found make: *** [grammar.c] Error 127"
yum -y install byacc
重新运行 ./configure
make && make install #完成libpcap安装
cd iftop-0.17
./configure
提示:checking for a curses library containing mvchgat… none found configure: error: Curses! Foiled again! (Can’t find a curses library supporting mvchgat.) Consider installing ncurses. 找不到支持 mvchgat 的 curses 库,安装 ncurses。
yum -y install ncurses
yum -y install ncurses-devel
确保ncurses和ncurses-devel都装上
make && make install
安装完iftop工具后,直接输入iftop命令即可显示网卡实时流量信息
iftop详解:https://baijiahao.baidu.com/s?id=1694894374565529986&wfr=spider&for=pc