工具下載: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。