作用:基于TCP或UDP,对网络带宽吞吐量进行测试
安装:yum install iperf3 -y
服务端参数:
-s:表示启动服务端
-i:表示打印报告的时间间隔
-p:指定监听端口,默认为5201
-D:以后台方式运行(默认是前台运行,将测试结果打印在屏幕)
用法示例:iperf3 -s -i 1 -p 10000
客户端参数:
-c:表示启动客户端,后边跟上服务端IP
-b:指定目标的最大带宽(用ethtool 网卡名字可以查看)
-t:指定测试时间
-P:指定并发数
-p:指明服务端启动的端口
-R:逆向测试
-d:双向测试
用法示例:iperf3 -c 192.168.0.30 -b 1G -t 5 -P 2 -p 10000
举例说明:
#启动服务端 [root@test02 ~]# iperf3 -s -i 1 -p 10000 ----------------------------------------------------------- Server listening on 10000 ----------------------------------------------------------- Accepted connection from 192.168.10.121, port 40322 [ 5] local 192.168.10.122 port 10000 connected to 192.168.10.121 port 40324 [ ID] Interval Transfer Bandwidth [ 5] 0.00-1.00 sec 110 MBytes 926 Mbits/sec [ 5] 1.00-2.00 sec 121 MBytes 1.02 Gbits/sec [ 5] 2.00-3.00 sec 117 MBytes 980 Mbits/sec [ 5] 3.00-4.00 sec 119 MBytes 997 Mbits/sec [ 5] 4.00-5.00 sec 120 MBytes 1.01 Gbits/sec [ 5] 5.00-5.00 sec 0.00 Bytes 0.00 bits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 5] 0.00-5.00 sec 0.00 Bytes 0.00 bits/sec sender [ 5] 0.00-5.00 sec 587 MBytes 984 Mbits/sec receiver
#启动客户端 [root@test01 ~]# iperf3 -c 192.168.10.122 -t 5 -b 1G -P 1 -p 10000 -R Connecting to host 192.168.10.122, port 10000 Reverse mode, remote host 192.168.10.122 is sending [ 4] local 192.168.10.121 port 40328 connected to 192.168.10.122 port 10000 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 108 MBytes 909 Mbits/sec [ 4] 1.00-2.00 sec 122 MBytes 1.02 Gbits/sec [ 4] 2.00-3.00 sec 118 MBytes 992 Mbits/sec [ 4] 3.00-4.00 sec 119 MBytes 999 Mbits/sec [ 4] 4.00-5.00 sec 120 MBytes 1.00 Gbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-5.00 sec 587 MBytes 985 Mbits/sec 0 sender [ 4] 0.00-5.00 sec 587 MBytes 985 Mbits/sec receiver
可以看到发送方和接收方的Bandwidth(带宽)大概都是985M/s,很接近网卡的1000M/s;