发布时间:2018/1/3 13:53:00 阅读次数: |
Linux中查看网卡流量工具有iptraf、iftop以及nethogs等,iftop可以用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息等。 安装iftop的命令如下: CentOS系统为“yum install iftop -y” CentOS上安装所需依赖包: yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel 或者下载源码安装 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 make && make install Debian/Ubuntu系统为“apt-get install iftop” 常用参数说明: -i设定监测的网卡,如:# iftop -i eth1,其中eth1是服务器的公网网卡,(网卡名称可以通过ifconfig查看),
-B 以Byte为单位显示流量(默认是bits),如:# iftop -B -F显示特定网段的进出流量,如# iftop -F 182.92.***.0/24或# iftop -F 182.92.***.0/255.255.255.0 如:iftop -i eth1 -B -F 182.92.***.20 显示182.92.***.20这个IP与服务器的网卡eth1交互的数据量,单位是Byte。
界面说明: "<="与"=>",表示的是流量的方向 "TX":从网卡发出的流量 "RX":网卡接收流量 "TOTAL":网卡发送接收总流量 "cum":iftop开始运行到当前时间点的总流量 "peak":网卡流量峰值 "rates":分别表示最近2s、10s、40s 的平均流量 可以通过键盘的"q"键退出iftop 大家可以自己操作试试 |