How to use iperf to test network bandwith

测试Linux机器之间的网络互联带宽,有一个很简单的工具,iperf

下载的是源码,编译过程如下:

./configure
make
make install

安装完毕以后,iperf的路径:

# which iperf
/usr/local/bin/iperf

然后在需要测试的两台Linux机器上,一台启动服务器模式。

# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

另外一台启动客户端模式,其中IP地址为启动服务器模式的机器的IP,稍等片刻,即可出现测试结果。

# iperf -c 192.168.0.19
------------------------------------------------------------
Client connecting to 192.168.0.19, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.18 port 16265 connected with 192.168.0.19 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   114 MBytes  95.5 Mbits/sec

同时,启动服务器模式的机器上也会显示:

[  4] local 192.168.0.19 port 5001 connected with 192.168.0.18 port 16265
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.1 sec   114 MBytes  94.9 Mbits/sec

可知,这两台机器之间的互联带宽仅仅达到百兆网的速度。

Leave a Reply

Your email address will not be published. Required fields are marked *