一、iftop是什么?
iftop是类似于top的实时流量监控工具。
官方网站:http://www.ex-parrot.com/~pdw/iftop/
二、iftop有什么用?
iftop可以用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息等,详细的将会在后面的使用参数中说明。
三、安装iftop
安装方法1、编译安装
如果采用编译安装可以到iftop官网下载最新的源码包。
安装前需要已经安装好基本的编译所需的环境,比如make、gcc、autoconf等。安装iftop还需要安装libpcap和libcurses。
CentOS上安装所需依赖包:
yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel
Debian上安装所需依赖包:
apt-get install flex byacc libpcap0.8 libncurses5
下载iftop
1 |
|
安装方法2:(懒人办法,最简单)
直接省略上面的步骤
CentOS系统:
1 |
|
Debian系统 运行:apt-get install iftop
四、运行iftop
直接运行: iftop
效果如下图:
五、相关参数及说明
1、iftop界面相关说明
界面上面显示的是类似刻度尺的刻度范围,为显示流量图形的长条作标尺用的。
中间的<= =>这两个左右箭头,表示的是流量的方向。
TX:发送流量
RX:接收流量
TOTAL:总流量
Cumm:运行iftop到目前时间的总流量
peak:流量峰值
rates:分别表示过去 2s 10s 40s 的平均流量
2、iftop相关参数
常用的参数
1 | -i 设定监测的网卡,如:# iftop -i eth1 |
进入iftop画面后的一些操作命令(注意大小写)
1 |
|
六、常见问题
1、make: yacc: Command not found
make: * [grammar.c] Error 127
解决方法:apt-get install byacc / yum install byacc
2、configure: error: Curses! Foiled again!
(Can’t find a curses library supporting mvchgat.)
Consider installing ncurses.
解决方法:apt-get install libncurses5-dev / yum install ncurses-devel