吸烟
有害健康!

iPerf3一款TCP、UDP和SCTP的终极速度测试工具

一、什么是iPerf / iPerf3?

iPerf3是一个用于主动测量IP网络上可实现的最大带宽的工具。它支持调整与定时、缓冲区和协议相关的各种参数(TCP、UDP、带有IPv4和IPv6的SCTP1)。对于每个测试,它都会报告带宽、损失和其他参数,跨平台:同时支持在Windows、Linux、macOS系统上运行。

官网地址:https://iperf.fr

二、安装iPerf3

1.macOS系统安装iPerf3

在终端里面输入一下命令进行安装:

 brew install iperf3

提示已经是最新版本了

Warning: iperf3 3.16 is already installed and up-to-date.
To reinstall 3.16, run:
  brew reinstall iperf3

通过“iperf3 –version”命令显示已安装的iPerf3版本信息。

macOS ~ % iperf3 --version

iperf 3.16 (cJSON 1.7.15)
Darwin ZCWmac.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:12 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8103 arm64
Optional features available: sendfile / zerocopy, authentication, support IPv4 don't fragment, POSIX threads
zcw@ZCWmac ~ % 

2.Windows系统安装iPerf3

Windows系统需要先到官网下载
windows版本iPerf3下载链接

之后将文件解压出来的iperf.exe和cygwin1.dll复制到%systemroot%目录2,即可完成安装。

三、使用iPerf3

这里以macOS设备作为客户端,Windows11设备做服务端,测试两台设备之间的带宽。

首先在服务端终端里里面输入“ierf3 -s”开启服务,默认是TCP模式

C:\Users\zcw>iperf3 -s
Cygwin WARNING:
  Couldn't compute FAST_CWD pointer.  This typically occurs if you're using
  an older Cygwin version on a newer Windows.  Please update to the latest
  available Cygwin version from https://cygwin.com/.  If the problem persists,
  please see https://cygwin.com/problems.html

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

可以看到服务已启动,并且通过TCP 5201端口监听客户端的测试

然后在客户端输入“iperf3 -c [服务器IP地址]”开始测试

macOS ~ % iperf3 -c 192.168.0.4
Connecting to host 192.168.0.4, port 5201
[  5] local 192.168.0.123 port 55163 connected to 192.168.0.4 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   121 MBytes  1.01 Gbits/sec                  
[  5]   1.00-2.00   sec   109 MBytes   913 Mbits/sec                  
[  5]   2.00-3.00   sec   118 MBytes   988 Mbits/sec                  
[  5]   3.00-4.00   sec   120 MBytes  1.01 Gbits/sec                  
[  5]   4.00-5.01   sec   125 MBytes  1.05 Gbits/sec                  
[  5]   5.01-6.00   sec   151 MBytes  1.27 Gbits/sec                  
[  5]   6.00-7.00   sec   142 MBytes  1.19 Gbits/sec                  
[  5]   7.00-8.00   sec   168 MBytes  1.41 Gbits/sec                  
[  5]   8.00-9.00   sec   151 MBytes  1.27 Gbits/sec                  
[  5]   9.00-10.00  sec   139 MBytes  1.16 Gbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec  1.31 GBytes  1.13 Gbits/sec                  sender
[  5]   0.00-10.00  sec  1.31 GBytes  1.13 Gbits/sec                  receiver

iperf Done.
macOS ~ % 

实时回显带宽值

再回到客户端,也同样看到测试的结果。

C:\Users\zcw>iperf3 -s
Cygwin WARNING:
  Couldn't compute FAST_CWD pointer.  This typically occurs if you're using
  an older Cygwin version on a newer Windows.  Please update to the latest
  available Cygwin version from https://cygwin.com/.  If the problem persists,
  please see https://cygwin.com/problems.html

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.123, port 55162
[  5] local 192.168.0.4 port 5201 connected to 192.168.0.123 port 55163
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.01   sec   121 MBytes  1.01 Gbits/sec
[  5]   1.01-2.00   sec   109 MBytes   916 Mbits/sec
[  5]   2.00-3.00   sec   118 MBytes   988 Mbits/sec
[  5]   3.00-4.07   sec   120 MBytes   951 Mbits/sec
[  5]   4.07-5.00   sec   125 MBytes  1.12 Gbits/sec
[  5]   5.00-6.00   sec   151 MBytes  1.27 Gbits/sec
[  5]   6.00-7.00   sec   142 MBytes  1.19 Gbits/sec
[  5]   7.00-8.00   sec   168 MBytes  1.41 Gbits/sec
[  5]   8.00-9.00   sec   152 MBytes  1.27 Gbits/sec
[  5]   9.00-10.00  sec   138 MBytes  1.16 Gbits/sec
[  5]  10.00-10.00  sec   675 KBytes  1.34 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.00  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.00  sec  1.31 GBytes  1.13 Gbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

更多使用方法通过命令“iperf3 -help”查看。例如:

您需要先支付 0.1元 才能查看此处内容!立即支付

四、脚注内容

  1. SCTP(Stream Control Transmission Protocol,流控制传输协议,RFC 2960、RFC 3286、RFC 3309)是一个 IP 协议之上的、可靠的、面向控制信令的、传输层协议。SCTP 可以在 “尽力而为(无连接、不可靠)” 的 IP 网络之上为电信级信令传输提供高效、可靠的信令传输服务,例如 5GC 中的 N4 接口就使用了 SCTP 协议。SCTP 的诞生是为了弥补 TCP/UDP 在电信网络控制信令传输场景中的不足,它们都难以完全满足在电信网络中信令承载的要求。 ↩︎
  2. %systemroot% 是一个环境变量,指向Windows操作系统的安装目录。在大多数情况下,它默认指向Windows的安装目录,通常是 C:\Windows。也就是CMD命令行的默认路径。 ↩︎
赞(0) 打赏
未经允许不得转载:交换云生 » iPerf3一款TCP、UDP和SCTP的终极速度测试工具
分享到

评论 抢沙发

交换云生

始于1908

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫