一、iperf3工具
作用:是一款网络测试工具,可以测试网络的最大吞吐量,比特率、重发包数还有拥塞包大小等,是一款极其轻便,简单易用的一款测试工具。并且提供多平台的支持,支持Linux、Windows、Android、Mac、Iphone等平台。
二、iperf3相关参数说明
1、常规使用参数
参数 | 描述 |
---|---|
-p | 指定服务器监听的端口以及客户端连接的端口,这个端口要求在服务端和客户端保持一致,默认是5201 |
-V | 更详细的输出 |
–logfile file | 将输出发送到日志文件。 |
2、服务端特定参数
-s | 在服务器模式下运行 iPerf |
---|---|
-D | 后台运行 |
3、客户端命令行
-c | 表示远程服务器的IP地址; |
---|---|
-p | 表示远程服务器的端口号;默认5201 |
-t | 参数可以指定传输测试的持续时间,Iperf在指定的时间内,重复的发送指定长度的数据包,默认是10s |
-i | 设置每次报告之间的时间间隔,单位为秒,如果设置为非零值,就会按照此时间间隔输出测试报告,默认值为零; |
–logfile | 参数可以将输出的测试结果储存至文件中. |
-P | 网卡队列数;网卡多线程 |
-b | 指定UDP模式使用的带宽,单位bits/sec,默认值是1 Mbit/sec。 |
三、实验准备
本次实验使用linux系统测试机器;
1、server端192.168.1.2
2、client端192.168.1.1
注意:操作前,请关闭防火墙、安全组类的策略;两台服务器相互全部放开;
3、安装iperf3(两台都安装)
yum -y install iperf3
4、查看iperf3版本
iperf3 --version
iperf 3.1.7
Linux client 4.19.91-26.al7.x86_64 #1 SMP Tue May 24 12:11:55 CST 2022 x86_64
Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing
5、测试
【服务端执行】:
[root@server netperf]# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.1.1, port 58358
[ 5] local 192.168.1.2 port 5201 connected to 192.168.1.1 port 58360
[ 7] local 192.168.1.2 port 5201 connected to 192.168.1.1 port 58362
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 222 MBytes 1.87 Gbits/sec
[ 7] 0.00-1.00 sec 222 MBytes 1.87 Gbits/sec
[SUM] 0.00-1.00 sec 445 MBytes 3.73 Gbits/sec
【客户端执行】:
[root@client netperf]# iperf3 -c 192.168.1.2 -b 2048M -t 300 -P 2
Connecting to host 192.168.1.2, port 5201
[ 4] local 192.168.1.1 port 58360 connected to 192.168.1.2 port 5201
[ 6] local 192.168.1.1 port 58362 connected to 192.168.1.2 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 222 MBytes 1.87 Gbits/sec 659 1.13 MBytes
[ 6] 0.00-1.00 sec 222 MBytes 1.87 Gbits/sec 578 894 KBytes
[SUM] 0.00-1.00 sec 445 MBytes 3.73 Gbits/sec 1237
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 1.00-2.00 sec 245 MBytes 2.06 Gbits/sec 0 1.22 MBytes
[ 6] 1.00-2.00 sec 245 MBytes 2.05 Gbits/sec 0 1005 KBytes
[SUM] 1.00-2.00 sec 490 MBytes 4.11 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
参数说明:
如何查看服务端的网卡队列数:ethtool -l eth0获取;其中的Combined值代表网卡队列数
[root@server netperf]# ethtool -l eth0
Channel parameters for eth0:
Pre-set maximums:
RX: 0
TX: 0
Other: 0
Combined: 2
Current hardware settings:
RX: 0
TX: 0
Other: 0
Combined: 2
6、结果分析解释;只需要关注sum行即可
参数 | 说明 |
---|---|
Interval | 测试时间 |
Transfer | 数据传输量,分为 sender 发送量与 receiver 接收量 |
Bandwidth | 带宽,分为 sender 发送带宽与 receiver 接收带宽 |