工具下载:https://iperf.fr/iperf-download.php
测试环境:
服务端(CentOS7):
1、快速安装
wget -O /usr/lib/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0_3.1.3 wget -O /usr/bin/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3 chmod +x /usr/bin/iperf3
2、排错
注:在CentOS 7下安装iperf3时可能会出现如下错误
iperf3: error while loading shared libraries: libiperf.so.0: cannot open shared object file: No such file or directory
一般情况下是因为wget了iperf3的动态链接库,而共享库未能及时更新,需要手动执行 ldconfig 命令以创建连接和缓存文件。
3、安装测试
iperf3 -v 查看版本
带宽测试:
1、服务器端开始监听:
[root@test]# iperf3 -s ----------------------------------------------------------- Server listening on 5201 -----------------------------------------------------------
2、客户端连接测试
本地客户端日志:
D:iperf-3.1.3-win64>iperf3.exe -c 192.168.99.240 Connecting to host 192.168.99.240, port 5201 [ 4] local 192.168.167.28 port 58926 connected to 192.168.99.240 port 5201 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 13.6 MBytes 114 Mbits/sec [ 4] 1.00-2.00 sec 8.25 MBytes 69.2 Mbits/sec [ 4] 2.00-3.00 sec 7.62 MBytes 64.0 Mbits/sec [ 4] 3.00-4.00 sec 10.4 MBytes 87.0 Mbits/sec [ 4] 4.00-5.00 sec 8.75 MBytes 73.4 Mbits/sec [ 4] 5.00-6.00 sec 10.8 MBytes 90.2 Mbits/sec [ 4] 6.00-7.00 sec 8.25 MBytes 69.2 Mbits/sec [ 4] 7.00-8.00 sec 7.75 MBytes 65.0 Mbits/sec [ 4] 8.00-9.00 sec 11.0 MBytes 92.3 Mbits/sec [ 4] 9.00-10.00 sec 10.4 MBytes 87.0 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 4] 0.00-10.00 sec 96.8 MBytes 81.2 Mbits/sec sender [ 4] 0.00-10.00 sec 96.6 MBytes 81.1 Mbits/sec receiver iperf Done.
远程服务器端日志
[root@ATopencanaryAQ01 admin]# iperf3 -s ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- Accepted connection from 192.168.167.28, port 58925 [ 5] local 192.168.99.240 port 5201 connected to 192.168.167.28 port 58926 [ ID] Interval Transfer Bandwidth [ 5] 0.00-1.00 sec 11.9 MBytes 100 Mbits/sec [ 5] 1.00-2.00 sec 8.01 MBytes 67.2 Mbits/sec [ 5] 2.00-3.00 sec 7.12 MBytes 59.7 Mbits/sec [ 5] 3.00-4.00 sec 10.8 MBytes 90.8 Mbits/sec [ 5] 4.00-5.00 sec 9.03 MBytes 75.7 Mbits/sec [ 5] 5.00-6.00 sec 10.8 MBytes 90.9 Mbits/sec [ 5] 6.00-7.00 sec 8.56 MBytes 71.8 Mbits/sec [ 5] 7.00-8.00 sec 8.52 MBytes 71.5 Mbits/sec [ 5] 8.00-9.00 sec 11.6 MBytes 97.3 Mbits/sec [ 5] 9.00-9.95 sec 10.2 MBytes 90.5 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 5] 0.00-9.95 sec 0.00 Bytes 0.00 bits/sec sender [ 5] 0.00-9.95 sec 96.6 MBytes 81.5 Mbits/sec receiver ----------------------------------------------------------- Server listening on 5201 -----------------------------------------------------------
简单来说,可以认为局域网两台机器之间的带宽是 81.5 Mbits/sec。