这里有最新的使用文档和教程
perf是一个网络性能测试工具。
iperf3是用来测量一个网络最大带宽的工具。
rpm -i iperf3-3.1.3-1.fc24.x86_64.rpm
或
yum install iperf3.x86_64 -y
1、iperf
server端:
iperf -s -p 25001 -B 192.168.33.103 (-u)
- s 指定server端
- p 指定端口(要和客户端一致)
- B 绑定ip地址
- u udp协议,,默认是tcp协议
client端:
iperf -c -p 25001 -B 192.168.33.104 -4 -f K -n 10M -b 10M (-u)
- c 指定client端
- p 指定端口(要和服务器端一致)
- B 绑定客户端的ip地址
- 4 指定ipv4
- f 格式化带宽数输出
- n 指定传输的字节数
- b 使用带宽数量
- u 指定udp协议
2、iperf3
server端:
iperf3 -s -p 25001
- s 指定服务器端
- p 指定端口号
iperf3的server端不支持“-u”参数,,默认可以测试tcp和udp
client端:
iperf3 -c -p 25001 -B 192.168.33.104 -4 -f K -n 10M -b 10M --get-server-output(-u)
- c 指定client端
- p 指定端口(要和服务器端一致)
- B 绑定客户端的ip地址
- 4 指定ipv4
- f 格式化带宽数输出
- n 指定传输的字节数
- b 使用带宽数量
- u 指定udp协议
--get-server-output 获取来自服务器端的结果
区别:
1、iperf3不支持双工模式测试
iperf3 -s
iperf3 -c 127.0.0.1 -t 10
本例中t2向t1发送10秒中的数据包
[root@iZbp11sdj1sc8o3r17rnwgZ ~]# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 127.0.0.1, port 44816
[ 5] local 127.0.0.1 port 5201 connected to 127.0.0.1 port 44818
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 4.18 GBytes 35.9 Gbits/sec
[ 5] 1.00-2.00 sec 3.61 GBytes 31.0 Gbits/sec
[ 5] 2.00-3.00 sec 4.27 GBytes 36.7 Gbits/sec
[ 5] 3.00-4.00 sec 3.56 GBytes 30.5 Gbits/sec
[ 5] 4.00-5.00 sec 4.43 GBytes 38.1 Gbits/sec
[ 5] 5.00-6.00 sec 3.67 GBytes 31.5 Gbits/sec
[ 5] 6.00-7.00 sec 4.45 GBytes 38.2 Gbits/sec
[ 5] 7.00-8.00 sec 4.45 GBytes 38.2 Gbits/sec
[ 5] 8.00-9.00 sec 4.36 GBytes 37.5 Gbits/sec
[ 5] 9.00-10.00 sec 4.09 GBytes 35.1 Gbits/sec
[ 5] 10.00-10.04 sec 116 MBytes 25.0 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.04 sec 41.2 GBytes 35.2 Gbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
[root@iZbp11sdj1sc8o3r17rnwgZ ~]# iperf3 -c 127.0.0.1 -t 10
Connecting to host 127.0.0.1, port 5201
[ 5] local 127.0.0.1 port 44818 connected to 127.0.0.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 4.30 GBytes 36.9 Gbits/sec 1 3.06 MBytes
[ 5] 1.00-2.00 sec 3.61 GBytes 31.0 Gbits/sec 2 3.31 MBytes
[ 5] 2.00-3.00 sec 4.27 GBytes 36.7 Gbits/sec 1 3.31 MBytes
[ 5] 3.00-4.00 sec 3.56 GBytes 30.5 Gbits/sec 1 3.31 MBytes
[ 5] 4.00-5.00 sec 4.43 GBytes 38.1 Gbits/sec 0 3.31 MBytes
[ 5] 5.00-6.00 sec 3.67 GBytes 31.5 Gbits/sec 0 3.12 MBytes
[ 5] 6.00-7.00 sec 4.45 GBytes 38.2 Gbits/sec 0 3.12 MBytes
[ 5] 7.00-8.00 sec 4.44 GBytes 38.2 Gbits/sec 0 3.12 MBytes
[ 5] 8.00-9.00 sec 4.37 GBytes 37.5 Gbits/sec 0 3.12 MBytes
[ 5] 9.00-10.00 sec 4.09 GBytes 35.1 Gbits/sec 5 3.12 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 41.2 GBytes 35.4 Gbits/sec 10 sender
[ 5] 0.00-10.04 sec 41.2 GBytes 35.2 Gbits/sec receiver
iperf Done.
在并发度默认为 1 且未做任何调优的情况下,传输就达到了 41Mbps。