通过接口监控networkingstream量

有没有一种方法可以通过特定的networking接口来监控stream量(例如,获取利用率的实时视图),比如eth0?

这里的问题是盒子上的一套工具是固定的,而且几乎是一个RHEL的部署,所以不能使用附加工具。

寻找一些基本的东西,通常在这里像iostat一样。

你想看到的数据显示在旧的ifconfig。

watch ifconfig eth0 

或者让事情更加突出:

 watch -n 1 -d ifconfig eth0 

我使用iftop命令。 它实时显示统计数据。

 iftop -i eth0 

这里检查一些sceenshots:

http://www.thegeekstuff.com/2008/12/iftop-guide-display-network-interface-bandwidth-usage-on-linux/

无需安装新工具:

while ifconfig eth0 | grep 'RX bytes'; do sleep 10; done

看看ntop 。 它提供了很多详细的数据。

有很多工具:

  1. Nethogs
  2. iptraf
  3. iptables可以是一个很好的解决scheme,但如果你使用防火墙设置将有点难以正确地重新定位的规则

你也可以使用iptables来做这样的事情:

iptables -A INPUT -p tcp --dport $port -i eth0

iptables -A OUTPUT -p tcp --sport $port -i eth0

然后,iptables -L -n -v会打印你接口有多less包,iptables -Z把这个数清零