一、参考资料
Linux下iperf3移植到arm下测试100M网口-CSDN博客
Iperf3移植到ARM Linux及使用教程-CSDN博客
二、准备工作
1. 编译环境
- 宿主机:
Ubuntu 20.04.6 LTS
- Host:ARM32位
- 交叉编译器:
arm-linux-gnueabihf-gcc-11.1.0
2. 设置交叉编译工具链
在交叉编译之前,需要设置交叉编译工具链的环境变量。
export PATH=/path/to/toolchains/arm-linux-gnueabihf/bin:$PATH
3. apt安装mosquitto
在宿主机中直接安装iperf3。
sudo apt-get install iperf3 # iperf3(推荐)
sudo apt-get install iperf # iperf2
三、交叉编译iperf3
1. 下载源码
下载 iperf:https://downloads.es.net/pub/iperf/
下载并解压源码。
tar -xvzf iperf-3.18.tar.gz
cd iperf-3.18
mkdir arm32_install
2. 生成 configure 配置
./configure \--prefix=/path/to/iperf-3.18/arm32_install \--with-sysroot=/path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/libc \--host=arm-linux-gnueabihf \--enable-shared \--enable-static
输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ ./configure \
> --prefix=/path/to/iperf-3.18/arm32_install \
> --with-sysroot=/path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/libc \
> --host=arm-linux-gnueabihf \
> --enable-shared \
> --enable-static
checking for a BSD-compatible install... /usr/bin/install -c
checking whether sleep supports fractional seconds... yes
checking filesystem timestamp resolution... 0.01
checking whether build environment is sane... yes
checking for arm-linux-gnueabihf-strip... arm-linux-gnueabihf-strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking xargs -n works... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabihf
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking for arm-linux-gnueabihf-gcc option to enable C11 features... none needed
checking whether arm-linux-gnueabihf-gcc understands -c and -o together... yes
checking dependency style of arm-linux-gnueabihf-gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by arm-linux-gnueabihf-gcc... /path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/bin/ld
checking if the linker (/path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /path/to/toolchains/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -B
checking the name lister (/path/to/toolchains/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to arm-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/bin/ld option to reload object files... -r
checking for file... file
checking for arm-linux-gnueabihf-objdump... arm-linux-gnueabihf-objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-gnueabihf-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-gnueabihf-ranlib... arm-linux-gnueabihf-ranlib
checking for arm-linux-gnueabihf-ar... arm-linux-gnueabihf-ar
checking for archiver @FILE support... @
checking for arm-linux-gnueabihf-strip... (cached) arm-linux-gnueabihf-strip
checking command to parse /path/to/toolchains/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -B output from arm-linux-gnueabihf-gcc object... ok
checking for sysroot... /path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/libc
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for arm-linux-gnueabihf-mt... no
checking for mt... mt
configure: WARNING: using cross tools not prefixed with host triplet
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if arm-linux-gnueabihf-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-linux-gnueabihf-gcc option to produce PIC... -fPIC -DPIC
checking if arm-linux-gnueabihf-gcc PIC flag -fPIC -DPIC works... yes
checking if arm-linux-gnueabihf-gcc static flag -static works... yes
checking if arm-linux-gnueabihf-gcc supports -c -o file.o... yes
checking if arm-linux-gnueabihf-gcc supports -c -o file.o... (cached) yes
checking whether the arm-linux-gnueabihf-gcc linker (/path/to/toolchains/arm-linux-gnueabihf/arm-linux-gnueabihf/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for arm-linux-gnueabihf-gcc... (cached) arm-linux-gnueabihf-gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether arm-linux-gnueabihf-gcc accepts -g... (cached) yes
checking for arm-linux-gnueabihf-gcc option to enable C11 features... (cached) none needed
checking whether arm-linux-gnueabihf-gcc understands -c and -o together... (cached) yes
checking dependency style of arm-linux-gnueabihf-gcc... (cached) gcc3
checking whether ln -s works... yes
checking for library containing floor... -lm
checking for library containing socket... none required
checking for library containing inet_ntop... none required
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking for egrep -e... (cached) /usr/bin/grep -E
checking whether arm-linux-gnueabihf-gcc is Clang... no
checking whether pthreads work with "-pthread" and "-lpthread"... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for stdatomic.h... yes
checking whether libatomic is required... no
checking for poll.h... yes
checking for linux/tcp.h... yes
checking for sys/socket.h... yes
checking for netinet/sctp.h... no
checking for endian.h... yes
checking for arm-linux-gnueabihf-pkg-config... no
checking for pkg-config... pkg-config
checking for include/openssl/ssl.h in /usr/local/ssl... no
checking for include/openssl/ssl.h in /usr/lib/ssl... no
checking for include/openssl/ssl.h in /usr/ssl... no
checking for include/openssl/ssl.h in /usr/pkg... no
checking for include/openssl/ssl.h in /usr/local... no
checking for include/openssl/ssl.h in /usr... no
checking whether compiling and linking against OpenSSL works... no
checking TCP_CONGESTION socket option... yes
checking TCP_USER_TIMEOUT socket option... yes
checking IPv6 flowlabel support... yes
checking for cpuset_setaffinity... no
checking for sched_setaffinity... yes
checking for SetProcessAffinityMask... no
checking for daemon... yes
checking for sendfile... yes
checking for getline... yes
checking SO_MAX_PACING_RATE socket option... yes
checking SO_BINDTODEVICE socket option... yes
checking IP_MTU_DISCOVER socket option... yes
checking IP_DONTFRAG socket option... no
checking IP_DONTFRAGMENT socket option... no
checking any kind of DF socket option... yes
checking for struct tcp_info.tcpi_snd_wnd... no
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking for library containing nanosleep... none required
checking for nanosleep... yes
checking for library containing clock_nanosleep... none required
checking for clock_nanosleep... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/version.h
config.status: creating examples/Makefile
config.status: creating iperf3.spec
config.status: creating src/iperf_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
3. 编译安装
make -j8
make install
make
编译:
yoyo@yoyo:~/360Downloads/iperf-3.18$ make -j8
Making all in src
make[1]: Entering directory '/path/to/iperf-3.18/src'
make all-am
make[2]: Entering directory '/path/to/iperf-3.18/src'CC iperf3-main.oCC cjson.loCC iperf_api.loCC iperf_error.loCC iperf_auth.loCC iperf_locale.loCC iperf_client_api.loCC iperf_server_api.loCC iperf_tcp.loCC iperf_udp.loCC iperf_sctp.loCC iperf_util.loCC iperf_time.loCC iperf_pthread.loCC dscp.loCC net.loCC tcp_info.loCC timer.loCC units.loCC t_timer-t_timer.oCC t_units-t_units.oCC t_uuid-t_uuid.oCC t_api-t_api.oCC t_auth-t_auth.oCCLD libiperf.laCCLD t_timerCCLD iperf3CCLD t_uuidCCLD t_unitsCCLD t_apiCCLD t_auth
make[2]: Leaving directory '/path/to/iperf-3.18/src'
make[1]: Leaving directory '/path/to/iperf-3.18/src'
Making all in examples
make[1]: Entering directory '/path/to/iperf-3.18/examples'CC mic-mic.oCC mis-mis.oCCLD misCCLD mic
make[1]: Leaving directory '/path/to/iperf-3.18/examples'
make[1]: Entering directory '/path/to/iperf-3.18'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/path/to/iperf-3.18'
make install
安装:
yoyo@yoyo:~/360Downloads/iperf-3.18$ make install
Making install in src
make[1]: Entering directory '/path/to/iperf-3.18/src'
make[2]: Entering directory '/path/to/iperf-3.18/src'/usr/bin/mkdir -p '/path/to/iperf-3.18/arm32_install/lib'/bin/bash ../libtool --mode=install /usr/bin/install -c libiperf.la '/path/to/iperf-3.18/arm32_install/lib'
libtool: install: /usr/bin/install -c .libs/libiperf.so.0.0.0 /path/to/iperf-3.18/arm32_install/lib/libiperf.so.0.0.0
libtool: install: (cd /path/to/iperf-3.18/arm32_install/lib && { ln -s -f libiperf.so.0.0.0 libiperf.so.0 || { rm -f libiperf.so.0 && ln -s libiperf.so.0.0.0 libiperf.so.0; }; })
libtool: install: (cd /path/to/iperf-3.18/arm32_install/lib && { ln -s -f libiperf.so.0.0.0 libiperf.so || { rm -f libiperf.so && ln -s libiperf.so.0.0.0 libiperf.so; }; })
libtool: install: /usr/bin/install -c .libs/libiperf.lai /path/to/iperf-3.18/arm32_install/lib/libiperf.la
libtool: install: /usr/bin/install -c .libs/libiperf.a /path/to/iperf-3.18/arm32_install/lib/libiperf.a
libtool: install: chmod 644 /path/to/iperf-3.18/arm32_install/lib/libiperf.a
libtool: install: arm-linux-gnueabihf-ranlib /path/to/iperf-3.18/arm32_install/lib/libiperf.a
libtool: finish: PATH="/path/to/toolchains/arm-linux-gnueabihf/bin:/path/to/cmake-3.31.3-linux-x86_64/bin:/home/yoyo/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin" ldconfig -n /path/to/iperf-3.18/arm32_install/lib
----------------------------------------------------------------------
Libraries have been installed in:/path/to/iperf-3.18/arm32_install/libIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:- add LIBDIR to the 'LD_LIBRARY_PATH' environment variableduring execution- add LIBDIR to the 'LD_RUN_PATH' environment variableduring linking- use the '-Wl,-rpath -Wl,LIBDIR' linker flag- have your system administrator add LIBDIR to '/etc/ld.so.conf'See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------/usr/bin/mkdir -p '/path/to/iperf-3.18/arm32_install/bin'/bin/bash ../libtool --mode=install /usr/bin/install -c iperf3 '/path/to/iperf-3.18/arm32_install/bin'
libtool: install: /usr/bin/install -c .libs/iperf3 /path/to/iperf-3.18/arm32_install/bin/iperf3/usr/bin/mkdir -p '/path/to/iperf-3.18/arm32_install/include'/usr/bin/install -c -m 644 iperf_api.h '/path/to/iperf-3.18/arm32_install/include'/usr/bin/mkdir -p '/path/to/iperf-3.18/arm32_install/share/man/man1'/usr/bin/install -c -m 644 iperf3.1 '/path/to/iperf-3.18/arm32_install/share/man/man1'/usr/bin/mkdir -p '/path/to/iperf-3.18/arm32_install/share/man/man3'/usr/bin/install -c -m 644 libiperf.3 '/path/to/iperf-3.18/arm32_install/share/man/man3'
make[2]: Leaving directory '/path/to/iperf-3.18/src'
make[1]: Leaving directory '/path/to/iperf-3.18/src'
Making install in examples
make[1]: Entering directory '/path/to/iperf-3.18/examples'
make[2]: Entering directory '/path/to/iperf-3.18/examples'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/path/to/iperf-3.18/examples'
make[1]: Leaving directory '/path/to/iperf-3.18/examples'
make[1]: Entering directory '/path/to/iperf-3.18'
make[2]: Entering directory '/path/to/iperf-3.18'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/path/to/iperf-3.18'
make[1]: Leaving directory '/path/to/iperf-3.18'
4. 去除调试信息并压缩
使用交叉编译工具 strip 去除镜像的调试信息,在不影响使程序使用的情况下,程序大小一般可以减小50%左右。
cd arm32_install
arm-linux-gnueabihf-strip bin/iperf3 # 去除iperf3镜像调试信息
arm-linux-gnueabihf-strip lib/libiperf.so.0.0.0 # 去除共享库的调试信息
rm lib/libiperf.a lib/libiperf.la # 删除两个不用的库文件
tar -jcvf iperf-3.18.tar.bz2 bin lib # 压缩bin和lib目录
5. 移植到开发板
将打包后的 iperf-3.18.tar.bz2
压缩包通过U盘、FTP或者NFS等方式拷贝到目标板,并分别解压到 /bin
和 /sbin
目录。
cp iperf-3.18.tar.bz2 ~ # 将复制压缩包到目标板用户目录
tar -jxvf iperf-3.18.tar.bz2 bin -C /usr # 解压镜像到/usr/bin
tar -jxvf iperf-3.18.tar.bz2 lib -C /usr # 解压库文件到/usr/lib
三、快速体验iperf3
一文搞懂iperf:网络性能测试的秘密武器
1. 启动iperf3服务端
由于iperf3工具基于客户端(client)和服务器(server)的工作模式,在测试之前应启动iperf3服务端。
参数 | 说明 | 示例 |
---|---|---|
-s | 以服务端模式运行 | iperf3 -s |
-p <端口> | 指定监听端口(默认 5201) | iperf3 -s -p 6000 |
-D | 以守护进程(后台)模式运行 | iperf3 -s -D |
-B <IP> | 绑定到特定网络接口的 IP | iperf3 -s -B 192.168.1.100 |
-i <秒> | 输出报告间隔时间 | iperf3 -s -i 5 |
-L <日志文件> | 记录日志到指定文件 | iperf3 -s -L server.log |
-1 | 单次测试后自动退出 | iperf3 -s -1 |
--json | 输出 JSON 格式结果(iperf3) | iperf3 -s --json |
-u | 强制使用 UDP 协议(需与客户端配合) | iperf3 -s -u |
-6 | 启用 IPv6 监听 | iperf3 -s -6 |
-V | 启用兼容模式(iperf2 兼容) | iperf3 -s -V |
-K | 启用 TCP 快速打开(Fast Open) | iperf3 -s -K |
2. 启动iperf3客户端(TCP模式)
使用 iperf3 -c
命令来启动iperf3客户端,并链接到服务器。
基础参数
参数 | 说明 |
---|---|
-c <服务器IP> | 必填,指定 iperf3 服务端 IP 地址(如 -c 192.168.1.100 )。 |
-p <端口> | 指定服务端监听的端口(默认 5201 )。 |
-t <秒> | 测试持续时间(默认 10 秒 ,建议长时间测试用 -t 60 )。 |
-w <窗口大小> | 设置 TCP 窗口大小(如 -w 1M 表示 1MB,需结合网络延迟优化)。 |
-P <并发数> | 创建多个 并行 TCP 连接(如 -P 4 ,但 iperf3 需多实例模拟多线程)。 |
-R | 反向模式(服务端发送数据,客户端接收,用于测试上行/下行带宽)。 |
-O <秒> | 设置 warmup 时间(跳过前 N 秒的数据统计,如 -O 2 忽略前 2 秒)。 |
-J / --json | 输出 JSON 格式 结果(便于脚本解析)。 |
--logfile <文件> | 将结果输出到日志文件(如 --logfile result.txt )。 |
-B <本地IP> | 绑定客户端到指定本地 IP 或网卡(多网卡环境专用)。 |
高级调优参数
参数 | 说明 |
---|---|
-M <MSS> | 设置 TCP 最大报文段大小(默认根据 MTU 自动计算)。 |
-N | 禁用 Nagle 算法(减少小包延迟,适合低延迟场景)。 |
-Z / --zerocopy | 启用零拷贝模式(减少 CPU 占用,需内核支持)。 |
-C <拥塞控制算法> | 指定 TCP 拥塞控制算法(如 -C cubic 或 -C bbr )。 |
2.1 基础测试(默认参数)
测试 10 秒的 TCP 带宽,使用默认窗口大小。
iperf3 -c 192.168.33.1
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 44558 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 7.39 MBytes 61.9 Mbits/sec 0 165 KBytes
[ 5] 1.00-2.00 sec 6.90 MBytes 57.9 Mbits/sec 0 165 KBytes
[ 5] 2.00-3.00 sec 6.77 MBytes 56.8 Mbits/sec 0 165 KBytes
[ 5] 3.00-4.00 sec 7.21 MBytes 60.5 Mbits/sec 0 165 KBytes
[ 5] 4.00-5.00 sec 6.96 MBytes 58.3 Mbits/sec 0 165 KBytes
[ 5] 5.00-6.00 sec 6.96 MBytes 58.4 Mbits/sec 0 165 KBytes
[ 5] 6.00-7.00 sec 7.02 MBytes 58.9 Mbits/sec 0 165 KBytes
[ 5] 7.00-8.00 sec 7.08 MBytes 59.4 Mbits/sec 0 165 KBytes
[ 5] 8.00-9.00 sec 7.15 MBytes 59.9 Mbits/sec 0 165 KBytes
[ 5] 9.00-10.00 sec 6.90 MBytes 57.8 Mbits/sec 0 165 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 70.3 MBytes 59.0 Mbits/sec 0 sender
[ 5] 0.00-10.00 sec 69.8 MBytes 58.6 Mbits/sec receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 44546
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 44558
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 6.45 MBytes 54.1 Mbits/sec
[ 5] 1.00-2.00 sec 6.97 MBytes 58.5 Mbits/sec
[ 5] 2.00-3.00 sec 6.96 MBytes 58.3 Mbits/sec
[ 5] 3.00-4.00 sec 7.06 MBytes 59.2 Mbits/sec
[ 5] 4.00-5.00 sec 6.98 MBytes 58.5 Mbits/sec
[ 5] 5.00-6.00 sec 6.97 MBytes 58.5 Mbits/sec
[ 5] 6.00-7.00 sec 6.94 MBytes 58.2 Mbits/sec
[ 5] 7.00-8.00 sec 7.06 MBytes 59.2 Mbits/sec
[ 5] 8.00-9.00 sec 7.06 MBytes 59.2 Mbits/sec
[ 5] 9.00-10.00 sec 7.07 MBytes 59.3 Mbits/sec
[ 5] 10.00-10.05 sec 324 KBytes 58.4 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.05 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.05 sec 69.8 MBytes 58.3 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
解释说明
Connecting to host 192.168.33.1, port 5201
这行信息表明客户端正在尝试连接到指定 IP 地址(192.168.33.1
)和端口(5201
)的服务器。
[ 5] local 192.168.33.32 port 44558 connected to 192.168.33.1 port 5201
连接已成功建立。[ 5]
是该连接的标识符,local 192.168.33.32 port 44558
表示客户端本地的 IP 地址和端口,connected to 192.168.33.1 port 5201
表示成功连接到服务器的 IP 地址和端口。
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 7.39 MBytes 61.9 Mbits/sec 0 165 KBytes
[ ID]
:连接的标识符,用于区分不同的连接或流。Interval
:表示统计的时间间隔,这里是从测试开始的0.00
秒到1.00
秒。Transfer
:在该时间间隔内传输的数据量。Bandwidth
:该时间间隔内的传输速率,单位为Mbits/sec
(兆比特每秒)。Retr
:每个线程和汇总的 TCP 重传数据包数量,用于评估网络的性能和稳定性。
2.2 长时间测试+大窗口
测试 10 秒,窗口大小设为 100KB(适合高延迟网络)。
iperf3 -c 192.168.33.1 -t 10 -w 100KB
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -t 10 -w 100KB
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 47076 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 6.70 MBytes 56.2 Mbits/sec 0 141 KBytes
[ 5] 1.00-2.00 sec 6.93 MBytes 58.1 Mbits/sec 0 141 KBytes
[ 5] 2.00-3.00 sec 6.83 MBytes 57.3 Mbits/sec 0 141 KBytes
[ 5] 3.00-4.00 sec 6.85 MBytes 57.5 Mbits/sec 0 141 KBytes
[ 5] 4.00-5.00 sec 6.78 MBytes 56.9 Mbits/sec 0 141 KBytes
[ 5] 5.00-6.00 sec 6.80 MBytes 57.0 Mbits/sec 0 141 KBytes
[ 5] 6.00-7.00 sec 6.93 MBytes 58.2 Mbits/sec 0 141 KBytes
[ 5] 7.00-8.00 sec 6.69 MBytes 56.1 Mbits/sec 0 141 KBytes
[ 5] 8.00-9.00 sec 6.88 MBytes 57.7 Mbits/sec 0 141 KBytes
[ 5] 9.00-10.47 sec 5.25 MBytes 30.0 Mbits/sec 0 141 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.47 sec 66.6 MBytes 53.4 Mbits/sec 0 sender
[ 5] 0.00-10.47 sec 66.6 MBytes 53.4 Mbits/sec receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 47060
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 47076
[ 1807.087111] RTW: send eapol packet - WPA Group Key 1/2
[ 1807.107409] RTW: recv eapol packet - WPA Group Key 2/2
[ 1807.107910] RTW: set group key camid:0, addr:9a:03:cf:b5:cb:90, kid:2, type:AES
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 6.36 MBytes 53.3 Mbits/sec
[ 5] 1.00-2.00 sec 6.88 MBytes 57.7 Mbits/sec
[ 5] 2.00-3.00 sec 6.91 MBytes 58.0 Mbits/sec
[ 5] 3.00-4.00 sec 6.86 MBytes 57.5 Mbits/sec
[ 5] 4.00-5.00 sec 6.82 MBytes 57.2 Mbits/sec
[ 5] 5.00-6.00 sec 6.83 MBytes 57.3 Mbits/sec
[ 5] 6.00-7.00 sec 6.82 MBytes 57.2 Mbits/sec
[ 5] 7.00-8.00 sec 6.80 MBytes 57.1 Mbits/sec
[ 5] 8.00-9.00 sec 6.71 MBytes 56.3 Mbits/sec
[ 5] 9.00-10.00 sec 5.52 MBytes 46.3 Mbits/sec
[ 5] 10.00-10.50 sec 98.6 KBytes 1.62 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.50 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.50 sec 66.6 MBytes 53.2 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
2.3 反向模式测试(服务端到客户端)
iperf3 -c 192.168.33.1 -R
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -R
Connecting to host 192.168.33.1, port 5201
Reverse mode, remote host 192.168.33.1 is sending
[ 5] local 192.168.33.32 port 50130 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 5.62 MBytes 47.1 Mbits/sec
[ 5] 1.00-2.00 sec 5.56 MBytes 46.7 Mbits/sec
[ 5] 2.00-3.00 sec 5.50 MBytes 46.1 Mbits/sec
[ 5] 3.00-4.00 sec 5.60 MBytes 47.0 Mbits/sec
[ 5] 4.00-5.00 sec 5.61 MBytes 47.1 Mbits/sec
[ 5] 5.00-6.00 sec 5.58 MBytes 46.8 Mbits/sec
[ 5] 6.00-7.00 sec 5.50 MBytes 46.2 Mbits/sec
[ 5] 7.00-8.00 sec 5.67 MBytes 47.6 Mbits/sec
[ 5] 8.00-9.00 sec 5.65 MBytes 47.4 Mbits/sec
[ 5] 9.00-10.00 sec 5.66 MBytes 47.5 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 56.2 MBytes 47.2 Mbits/sec 0 sender
[ 5] 0.00-10.00 sec 56.0 MBytes 47.0 Mbits/sec receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 50118
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 50130
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 5] 0.00-1.00 sec 5.77 MBytes 48.4 Mbits/sec 0 495 KBytes
[ 5] 1.00-2.00 sec 5.58 MBytes 46.8 Mbits/sec 0 550 KBytes
[ 5] 2.00-3.00 sec 5.42 MBytes 45.5 Mbits/sec 0 550 KBytes
[ 5] 3.00-4.00 sec 5.59 MBytes 46.9 Mbits/sec 0 550 KBytes
[ 5] 4.00-5.00 sec 5.76 MBytes 48.3 Mbits/sec 0 550 KBytes
[ 5] 5.00-6.00 sec 5.38 MBytes 45.1 Mbits/sec 0 550 KBytes
[ 5] 6.00-7.00 sec 5.72 MBytes 48.0 Mbits/sec 0 550 KBytes
[ 5] 7.00-8.00 sec 5.65 MBytes 47.4 Mbits/sec 0 550 KBytes
[ 5] 8.00-9.00 sec 5.53 MBytes 46.4 Mbits/sec 0 550 KBytes
[ 5] 9.00-10.00 sec 5.65 MBytes 47.4 Mbits/sec 0 550 KBytes
[ 5] 10.00-10.03 sec 191 KBytes 54.3 Mbits/sec 0 550 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 5] 0.00-10.03 sec 56.2 MBytes 47.0 Mbits/sec 0 sender
[ 5] 0.00-10.03 sec 0.00 Bytes 0.00 bits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
2.4 多连接并发测试
iperf3 -c 192.168.33.1 -P 4
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -P 4
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 42346 connected to 192.168.33.1 port 5201
[ 7] local 192.168.33.32 port 42362 connected to 192.168.33.1 port 5201
[ 9] local 192.168.33.32 port 42368 connected to 192.168.33.1 port 5201
[ 11] local 192.168.33.32 port 42380 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 2.29 MBytes 19.2 Mbits/sec 0 156 KBytes
[ 7] 0.00-1.00 sec 2.47 MBytes 20.7 Mbits/sec 0 165 KBytes
[ 9] 0.00-1.00 sec 2.76 MBytes 23.1 Mbits/sec 0 165 KBytes
[ 11] 0.00-1.00 sec 2.06 MBytes 17.3 Mbits/sec 0 146 KBytes
[SUM] 0.00-1.00 sec 9.59 MBytes 80.3 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 1.00-2.00 sec 1.86 MBytes 15.7 Mbits/sec 0 167 KBytes
[ 7] 1.00-2.00 sec 1.86 MBytes 15.7 Mbits/sec 0 165 KBytes
[ 9] 1.00-2.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 11] 1.00-2.00 sec 1.80 MBytes 15.1 Mbits/sec 0 165 KBytes
[SUM] 1.00-2.00 sec 7.02 MBytes 58.9 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 2.00-3.00 sec 1.49 MBytes 12.5 Mbits/sec 0 167 KBytes
[ 7] 2.00-3.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 9] 2.00-3.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 11] 2.00-3.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[SUM] 2.00-3.00 sec 6.71 MBytes 56.3 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 3.00-4.00 sec 1.86 MBytes 15.6 Mbits/sec 0 167 KBytes
[ 7] 3.00-4.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 9] 3.00-4.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 11] 3.00-4.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[SUM] 3.00-4.00 sec 7.08 MBytes 59.4 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 4.00-5.00 sec 1.49 MBytes 12.5 Mbits/sec 0 167 KBytes
[ 7] 4.00-5.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 9] 4.00-5.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 11] 4.00-5.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[SUM] 4.00-5.00 sec 6.34 MBytes 53.2 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 5.00-6.00 sec 1.86 MBytes 15.6 Mbits/sec 0 167 KBytes
[ 7] 5.00-6.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 9] 5.00-6.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 11] 5.00-6.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[SUM] 5.00-6.00 sec 7.08 MBytes 59.4 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 6.00-7.00 sec 1.86 MBytes 15.6 Mbits/sec 0 167 KBytes
[ 7] 6.00-7.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 9] 6.00-7.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 11] 6.00-7.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[SUM] 6.00-7.00 sec 7.08 MBytes 59.5 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 7.00-8.00 sec 1.49 MBytes 12.5 Mbits/sec 0 167 KBytes
[ 7] 7.00-8.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 9] 7.00-8.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 11] 7.00-8.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[SUM] 7.00-8.00 sec 6.34 MBytes 53.1 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 8.00-9.00 sec 1.86 MBytes 15.6 Mbits/sec 0 167 KBytes
[ 7] 8.00-9.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 9] 8.00-9.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 11] 8.00-9.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[SUM] 8.00-9.00 sec 7.08 MBytes 59.4 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 9.00-10.00 sec 1.49 MBytes 12.5 Mbits/sec 0 167 KBytes
[ 7] 9.00-10.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[ 9] 9.00-10.00 sec 1.86 MBytes 15.6 Mbits/sec 0 165 KBytes
[ 11] 9.00-10.00 sec 1.49 MBytes 12.5 Mbits/sec 0 165 KBytes
[SUM] 9.00-10.00 sec 6.34 MBytes 53.2 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 17.6 MBytes 14.7 Mbits/sec 0 sender
[ 5] 0.00-10.00 sec 17.0 MBytes 14.3 Mbits/sec receiver
[ 7] 0.00-10.00 sec 17.8 MBytes 14.9 Mbits/sec 0 sender
[ 7] 0.00-10.00 sec 17.2 MBytes 14.5 Mbits/sec receiver
[ 9] 0.00-10.00 sec 18.0 MBytes 15.1 Mbits/sec 0 sender
[ 9] 0.00-10.00 sec 17.4 MBytes 14.6 Mbits/sec receiver
[ 11] 0.00-10.00 sec 17.3 MBytes 14.5 Mbits/sec 0 sender
[ 11] 0.00-10.00 sec 16.8 MBytes 14.1 Mbits/sec receiver
[SUM] 0.00-10.00 sec 70.7 MBytes 59.3 Mbits/sec 0 sender
[SUM] 0.00-10.00 sec 68.4 MBytes 57.4 Mbits/sec receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 42340
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 42346
[ 7] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 42362
[ 9] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 42368
[ 11] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 42380
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 1.55 MBytes 13.0 Mbits/sec
[ 7] 0.00-1.00 sec 1.82 MBytes 15.3 Mbits/sec
[ 9] 0.00-1.00 sec 1.99 MBytes 16.7 Mbits/sec
[ 11] 0.00-1.00 sec 1.45 MBytes 12.2 Mbits/sec
[SUM] 0.00-1.00 sec 6.82 MBytes 57.2 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 1.00-2.00 sec 1.69 MBytes 14.2 Mbits/sec
[ 7] 1.00-2.00 sec 1.69 MBytes 14.1 Mbits/sec
[ 9] 1.00-2.00 sec 1.69 MBytes 14.2 Mbits/sec
[ 11] 1.00-2.00 sec 1.66 MBytes 13.9 Mbits/sec
[SUM] 1.00-2.00 sec 6.73 MBytes 56.4 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 2.00-3.00 sec 1.71 MBytes 14.4 Mbits/sec
[ 7] 2.00-3.00 sec 1.71 MBytes 14.3 Mbits/sec
[ 9] 2.00-3.00 sec 1.70 MBytes 14.2 Mbits/sec
[ 11] 2.00-3.00 sec 1.69 MBytes 14.2 Mbits/sec
[SUM] 2.00-3.00 sec 6.81 MBytes 57.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 3.00-4.00 sec 1.72 MBytes 14.4 Mbits/sec
[ 7] 3.00-4.00 sec 1.71 MBytes 14.3 Mbits/sec
[ 9] 3.00-4.00 sec 1.70 MBytes 14.3 Mbits/sec
[ 11] 3.00-4.00 sec 1.70 MBytes 14.3 Mbits/sec
[SUM] 3.00-4.00 sec 6.83 MBytes 57.3 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 4.00-5.00 sec 1.69 MBytes 14.2 Mbits/sec
[ 7] 4.00-5.00 sec 1.68 MBytes 14.1 Mbits/sec
[ 9] 4.00-5.00 sec 1.68 MBytes 14.1 Mbits/sec
[ 11] 4.00-5.00 sec 1.69 MBytes 14.2 Mbits/sec
[SUM] 4.00-5.00 sec 6.74 MBytes 56.6 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 5.00-6.00 sec 1.72 MBytes 14.4 Mbits/sec
[ 7] 5.00-6.00 sec 1.71 MBytes 14.3 Mbits/sec
[ 9] 5.00-6.00 sec 1.70 MBytes 14.3 Mbits/sec
[ 11] 5.00-6.00 sec 1.70 MBytes 14.2 Mbits/sec
[SUM] 5.00-6.00 sec 6.82 MBytes 57.2 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 6.00-7.00 sec 1.72 MBytes 14.4 Mbits/sec
[ 7] 6.00-7.00 sec 1.72 MBytes 14.4 Mbits/sec
[ 9] 6.00-7.00 sec 1.72 MBytes 14.4 Mbits/sec
[ 11] 6.00-7.00 sec 1.71 MBytes 14.4 Mbits/sec
[SUM] 6.00-7.00 sec 6.87 MBytes 57.6 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 7.00-8.00 sec 1.67 MBytes 14.0 Mbits/sec
[ 7] 7.00-8.00 sec 1.67 MBytes 14.0 Mbits/sec
[ 9] 7.00-8.00 sec 1.66 MBytes 13.9 Mbits/sec
[ 11] 7.00-8.00 sec 1.66 MBytes 13.9 Mbits/sec
[SUM] 7.00-8.00 sec 6.65 MBytes 55.8 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 8.00-9.00 sec 1.70 MBytes 14.3 Mbits/sec
[ 7] 8.00-9.00 sec 1.70 MBytes 14.3 Mbits/sec
[ 9] 8.00-9.00 sec 1.71 MBytes 14.3 Mbits/sec
[ 11] 8.00-9.00 sec 1.70 MBytes 14.2 Mbits/sec
[SUM] 8.00-9.00 sec 6.81 MBytes 57.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 9.00-10.00 sec 1.71 MBytes 14.3 Mbits/sec
[ 7] 9.00-10.00 sec 1.70 MBytes 14.3 Mbits/sec
[ 9] 9.00-10.00 sec 1.70 MBytes 14.3 Mbits/sec
[ 11] 9.00-10.00 sec 1.69 MBytes 14.2 Mbits/sec
[SUM] 9.00-10.00 sec 6.80 MBytes 57.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 10.00-10.08 sec 144 KBytes 15.1 Mbits/sec
[ 7] 10.00-10.08 sec 139 KBytes 14.5 Mbits/sec
[ 9] 10.00-10.08 sec 124 KBytes 13.0 Mbits/sec
[ 11] 10.00-10.08 sec 136 KBytes 14.2 Mbits/sec
[SUM] 10.00-10.08 sec 543 KBytes 56.9 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.08 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.08 sec 17.0 MBytes 14.2 Mbits/sec receiver
[ 7] 0.00-10.08 sec 0.00 Bytes 0.00 bits/sec sender
[ 7] 0.00-10.08 sec 17.2 MBytes 14.4 Mbits/sec receiver
[ 9] 0.00-10.08 sec 0.00 Bytes 0.00 bits/sec sender
[ 9] 0.00-10.08 sec 17.4 MBytes 14.5 Mbits/sec receiver
[ 11] 0.00-10.08 sec 0.00 Bytes 0.00 bits/sec sender
[ 11] 0.00-10.08 sec 16.8 MBytes 14.0 Mbits/sec receiver
[SUM] 0.00-10.08 sec 0.00 Bytes 0.00 bits/sec sender
[SUM] 0.00-10.08 sec 68.4 MBytes 56.9 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
2.5 绑定本地网卡+JSON输出
iperf3 -c 192.168.33.1 -B 192.168.33.32 --json
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -B 192.168.33.32 --json
{"start": {"connected": [{"socket": 5,"local_host": "192.168.33.32","local_port": 38929,"remote_host": "192.168.33.1","remote_port": 5201}],"version": "iperf 3.7","system_info": "Linux ubuntu 5.15.0-127-generic #137~20.04.1-Ubuntu SMP Fri Nov 15 14:46:54 UTC 2024 x86_64","timestamp": {"time": "Fri, 07 Mar 2025 08:25:12 GMT","timesecs": 1741335912},"connecting_to": {"host": "192.168.33.1","port": 5201},"cookie": "cacdolyx3zqp4g23imznntfjrwnfcn5kuaea","tcp_mss_default": 1448,"sock_bufsize": 0,"sndbuf_actual": 16384,"rcvbuf_actual": 131072,"test_start": {"protocol": "TCP","num_streams": 1,"blksize": 131072,"omit": 0,"duration": 10,"bytes": 0,"blocks": 0,"reverse": 0,"tos": 0}},"intervals": [{"streams": [{"socket": 5,"start": 0,"end": 1.000917,"seconds": 1.0009169578552246,"bytes": 7681640,"bits_per_second": 61396821.702054478,"retransmits": 0,"snd_cwnd": 169416,"rtt": 19162,"rttvar": 4737,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 0,"end": 1.000917,"seconds": 1.0009169578552246,"bytes": 7681640,"bits_per_second": 61396821.702054478,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 1.000917,"end": 2.0001,"seconds": 0.99918299913406372,"bytes": 7297920,"bits_per_second": 58431098.257874288,"retransmits": 0,"snd_cwnd": 169416,"rtt": 23765,"rttvar": 904,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 1.000917,"end": 2.0001,"seconds": 0.99918299913406372,"bytes": 7297920,"bits_per_second": 58431098.257874288,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 2.0001,"end": 3.000746,"seconds": 1.0006459951400757,"bytes": 7167600,"bits_per_second": 57303782.035297245,"retransmits": 0,"snd_cwnd": 169416,"rtt": 18039,"rttvar": 2825,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 2.0001,"end": 3.000746,"seconds": 1.0006459951400757,"bytes": 7167600,"bits_per_second": 57303782.035297245,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 3.000746,"end": 4.000225,"seconds": 0.99947899580001831,"bytes": 7232760,"bits_per_second": 57892242.101281121,"retransmits": 0,"snd_cwnd": 169416,"rtt": 18355,"rttvar": 921,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 3.000746,"end": 4.000225,"seconds": 0.99947899580001831,"bytes": 7232760,"bits_per_second": 57892242.101281121,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 4.000225,"end": 5.000468,"seconds": 1.0002429485321045,"bytes": 7623720,"bits_per_second": 60974946.226319164,"retransmits": 0,"snd_cwnd": 169416,"rtt": 14811,"rttvar": 4217,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 4.000225,"end": 5.000468,"seconds": 1.0002429485321045,"bytes": 7623720,"bits_per_second": 60974946.226319164,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 5.000468,"end": 6.000275,"seconds": 0.99980700016021729,"bytes": 7102440,"bits_per_second": 56830488.275131874,"retransmits": 0,"snd_cwnd": 169416,"rtt": 15805,"rttvar": 4878,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 5.000468,"end": 6.000275,"seconds": 0.99980700016021729,"bytes": 7102440,"bits_per_second": 56830488.275131874,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 6.000275,"end": 7.000953,"seconds": 1.0006779432296753,"bytes": 6906960,"bits_per_second": 55218245.164536156,"retransmits": 0,"snd_cwnd": 169416,"rtt": 14148,"rttvar": 2077,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 6.000275,"end": 7.000953,"seconds": 1.0006779432296753,"bytes": 6906960,"bits_per_second": 55218245.164536156,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 7.000953,"end": 8.001069,"seconds": 1.0001159906387329,"bytes": 7297920,"bits_per_second": 58376588.86217083,"retransmits": 0,"snd_cwnd": 169416,"rtt": 16196,"rttvar": 4093,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 7.000953,"end": 8.001069,"seconds": 1.0001159906387329,"bytes": 7297920,"bits_per_second": 58376588.86217083,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 8.001069,"end": 9.000902,"seconds": 0.99983298778533936,"bytes": 7167600,"bits_per_second": 57350378.213677093,"retransmits": 0,"snd_cwnd": 169416,"rtt": 24556,"rttvar": 3826,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 8.001069,"end": 9.000902,"seconds": 0.99983298778533936,"bytes": 7167600,"bits_per_second": 57350378.213677093,"retransmits": 0,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 9.000902,"end": 10.000237,"seconds": 0.999334990978241,"bytes": 7428240,"bits_per_second": 59465465.070755146,"retransmits": 0,"snd_cwnd": 169416,"rtt": 14706,"rttvar": 4834,"pmtu": 1500,"omitted": false,"sender": true}],"sum": {"start": 9.000902,"end": 10.000237,"seconds": 0.999334990978241,"bytes": 7428240,"bits_per_second": 59465465.070755146,"retransmits": 0,"omitted": false,"sender": true}}],"end": {"streams": [{"sender": {"socket": 5,"start": 0,"end": 10.000237,"seconds": 10.000237,"bytes": 72906800,"bits_per_second": 58324057.71983204,"retransmits": 0,"max_snd_cwnd": 169416,"max_rtt": 24556,"min_rtt": 14148,"mean_rtt": 17954,"sender": true},"receiver": {"socket": 5,"start": 0,"end": 10.000237,"seconds": 10.000237,"bytes": 72163976,"bits_per_second": 57729812.6034413,"sender": true}}],"sum_sent": {"start": 0,"end": 10.000237,"seconds": 10.000237,"bytes": 72906800,"bits_per_second": 58324057.71983204,"retransmits": 0,"sender": true},"sum_received": {"start": 0,"end": 10.000237,"seconds": 10.000237,"bytes": 72163976,"bits_per_second": 57729812.6034413,"sender": true},"cpu_utilization_percent": {"host_total": 1.2980239879591693,"host_user": 0,"host_system": 1.298014040805413,"remote_total": 1.393921,"remote_user": 0.192229,"remote_system": 1.201686},"sender_tcp_congestion": "cubic"}
}
服务端输出示例:
Accepted connection from 192.168.33.32, port 56183
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 38929
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 6.46 MBytes 54.2 Mbits/sec
[ 5] 1.00-2.00 sec 6.85 MBytes 57.4 Mbits/sec
[ 5] 2.00-3.00 sec 6.93 MBytes 58.2 Mbits/sec
[ 5] 3.00-4.00 sec 6.97 MBytes 58.5 Mbits/sec
[ 5] 4.00-5.00 sec 6.96 MBytes 58.4 Mbits/sec
[ 5] 5.00-6.00 sec 6.85 MBytes 57.4 Mbits/sec
[ 5] 6.00-7.00 sec 6.76 MBytes 56.7 Mbits/sec
[ 5] 7.00-8.00 sec 6.99 MBytes 58.6 Mbits/sec
[ 5] 8.00-9.00 sec 6.90 MBytes 57.9 Mbits/sec
[ 5] 9.00-10.00 sec 6.84 MBytes 57.4 Mbits/sec
[ 5] 10.00-10.05 sec 322 KBytes 57.8 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.05 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.05 sec 68.8 MBytes 57.5 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
3. 启动iperf3客户端(UDP模式)
参数 | 说明 |
---|---|
-u | 启动UDP模式 |
-b <带宽> | 指定目标带宽(如 -b 100M 表示 100 Mbps) |
-l <包大小> | 设置数据包长度(默认 1470 Bytes) |
-t <秒> | 测试时长 |
--json | 以 JSON 格式输出结果(方便自动化处理) |
3.1 基础测试(默认参数)
基本 UDP 测试(默认带宽 1 Mbps)。
iperf3 -c 192.168.33.1 -u
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -u
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 48231 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 129 KBytes 1.05 Mbits/sec 91
[ 5] 1.00-2.00 sec 129 KBytes 1.05 Mbits/sec 91
[ 5] 2.00-3.00 sec 127 KBytes 1.04 Mbits/sec 90
[ 5] 3.00-4.00 sec 129 KBytes 1.05 Mbits/sec 91
[ 5] 4.00-5.00 sec 127 KBytes 1.04 Mbits/sec 90
[ 5] 5.00-6.00 sec 129 KBytes 1.05 Mbits/sec 91
[ 5] 6.00-7.00 sec 127 KBytes 1.04 Mbits/sec 90
[ 5] 7.00-8.00 sec 129 KBytes 1.05 Mbits/sec 91
[ 5] 8.00-9.00 sec 127 KBytes 1.04 Mbits/sec 90
[ 5] 9.00-10.00 sec 129 KBytes 1.05 Mbits/sec 91
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-10.00 sec 1.25 MBytes 1.05 Mbits/sec 0.000 ms 0/906 (0%) sender
[ 5] 0.00-10.00 sec 1.25 MBytes 1.05 Mbits/sec 0.966 ms 0/906 (0%) receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 52598
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 48231
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 122 KBytes 996 Kbits/sec 254195.098 ms 0/86 (0%)
[ 5] 1.00-2.00 sec 129 KBytes 1.05 Mbits/sec 716.354 ms 0/91 (0%)
[ 5] 2.00-3.00 sec 127 KBytes 1.04 Mbits/sec 3.403 ms 0/90 (0%)
[ 5] 3.00-4.00 sec 129 KBytes 1.05 Mbits/sec 1.341 ms 0/91 (0%)
[ 5] 4.00-5.00 sec 127 KBytes 1.04 Mbits/sec 1.079 ms 0/90 (0%)
[ 5] 5.00-6.00 sec 129 KBytes 1.05 Mbits/sec 1.065 ms 0/91 (0%)
[ 5] 6.00-7.00 sec 127 KBytes 1.04 Mbits/sec 1.258 ms 0/90 (0%)
[ 5] 7.00-8.00 sec 129 KBytes 1.05 Mbits/sec 0.483 ms 0/91 (0%)
[ 5] 8.00-9.00 sec 127 KBytes 1.04 Mbits/sec 1.027 ms 0/90 (0%)
[ 5] 9.00-10.00 sec 129 KBytes 1.05 Mbits/sec 0.991 ms 0/91 (0%)
[ 5] 10.00-10.06 sec 7.07 KBytes 1.04 Mbits/sec 0.966 ms 0/5 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-10.06 sec 0.00 Bytes 0.00 bits/sec 0.966 ms 0/906 (0%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
3.2 长时间测试+限制带宽
限制带宽为 50Mbps,测试 20 秒。
iperf3 -c 192.168.33.1 -u -b 100M -t 20
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -u -b 100M -t 20
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 59710 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 11.9 MBytes 99.9 Mbits/sec 8627
[ 5] 1.00-2.00 sec 11.9 MBytes 100 Mbits/sec 8632
[ 5] 2.00-3.00 sec 11.9 MBytes 100 Mbits/sec 8632
[ 5] 3.00-4.00 sec 11.9 MBytes 100 Mbits/sec 8635
[ 5] 4.00-5.00 sec 11.9 MBytes 100 Mbits/sec 8631
[ 5] 5.00-6.00 sec 11.9 MBytes 99.9 Mbits/sec 8632
[ 5] 6.00-7.00 sec 11.9 MBytes 100 Mbits/sec 8637
[ 5] 7.00-8.00 sec 11.9 MBytes 99.9 Mbits/sec 8631
[ 5] 8.00-9.00 sec 11.9 MBytes 100 Mbits/sec 8627
[ 5] 9.00-10.00 sec 11.9 MBytes 100 Mbits/sec 8635
[ 5] 10.00-11.00 sec 11.9 MBytes 100 Mbits/sec 8639
[ 5] 11.00-12.00 sec 11.9 MBytes 100 Mbits/sec 8627
[ 5] 12.00-13.00 sec 11.9 MBytes 100 Mbits/sec 8637
[ 5] 13.00-14.00 sec 11.9 MBytes 100 Mbits/sec 8633
[ 5] 14.00-15.00 sec 11.9 MBytes 100 Mbits/sec 8629
[ 5] 15.00-16.00 sec 11.9 MBytes 100 Mbits/sec 8634
[ 5] 16.00-17.00 sec 11.9 MBytes 99.9 Mbits/sec 8630
[ 5] 17.00-18.00 sec 11.9 MBytes 100 Mbits/sec 8639
[ 5] 18.00-19.00 sec 11.9 MBytes 99.9 Mbits/sec 8626
[ 5] 19.00-20.00 sec 11.9 MBytes 100 Mbits/sec 8637
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-20.00 sec 238 MBytes 100 Mbits/sec 0.000 ms 0/172650 (0%) sender
[ 5] 0.00-20.00 sec 238 MBytes 100 Mbits/sec 0.253 ms 0/172647 (0%) receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 58258
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 59710
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 7.06 MBytes 59.2 Mbits/sec 0.252 ms 0/5109 (0%)
[ 5] 1.00-2.00 sec 7.02 MBytes 58.9 Mbits/sec 0.200 ms 0/5087 (0%)
[ 5] 2.00-3.00 sec 7.32 MBytes 61.4 Mbits/sec 0.406 ms 0/5300 (0%)
[ 5] 3.00-4.00 sec 7.16 MBytes 60.1 Mbits/sec 0.244 ms 0/5187 (0%)
[ 5] 4.00-5.00 sec 7.20 MBytes 60.4 Mbits/sec 0.319 ms 0/5211 (0%)
[ 5] 5.00-6.00 sec 7.49 MBytes 62.8 Mbits/sec 0.150 ms 0/5422 (0%)
[ 5] 6.00-7.00 sec 7.30 MBytes 61.2 Mbits/sec 0.123 ms 0/5286 (0%)
[ 5] 7.00-8.00 sec 7.20 MBytes 60.4 Mbits/sec 0.294 ms 0/5213 (0%)
[ 5] 8.00-9.00 sec 7.18 MBytes 60.2 Mbits/sec 0.205 ms 0/5200 (0%)
[ 5] 9.00-10.00 sec 7.46 MBytes 62.6 Mbits/sec 0.164 ms 0/5401 (0%)
[ 5] 10.00-11.00 sec 7.26 MBytes 60.8 Mbits/sec 0.288 ms 0/5257 (0%)
[ 5] 11.00-12.00 sec 7.37 MBytes 61.9 Mbits/sec 0.303 ms 0/5340 (0%)
[ 5] 12.00-13.00 sec 7.20 MBytes 60.4 Mbits/sec 0.217 ms 0/5216 (0%)
[ 5] 13.00-14.00 sec 7.10 MBytes 59.6 Mbits/sec 0.195 ms 0/5144 (0%)
[ 5] 14.00-15.00 sec 7.15 MBytes 60.0 Mbits/sec 0.226 ms 0/5181 (0%)
[ 5] 15.00-16.00 sec 6.45 MBytes 54.1 Mbits/sec 0.334 ms 0/4669 (0%)
[ 5] 16.00-17.00 sec 7.46 MBytes 62.6 Mbits/sec 0.230 ms 0/5401 (0%)
[ 5] 17.00-18.00 sec 6.88 MBytes 57.7 Mbits/sec 0.221 ms 0/4979 (0%)
[ 5] 18.00-19.00 sec 7.41 MBytes 62.1 Mbits/sec 0.208 ms 0/5365 (0%)
[ 5] 19.00-20.00 sec 7.09 MBytes 59.5 Mbits/sec 0.316 ms 0/5135 (0%)
[ 5] 20.00-21.00 sec 7.30 MBytes 61.2 Mbits/sec 0.221 ms 0/5283 (0%)
[ 5] 21.00-22.00 sec 7.32 MBytes 61.4 Mbits/sec 0.291 ms 0/5304 (0%)
[ 5] 22.00-23.00 sec 7.38 MBytes 61.9 Mbits/sec 0.217 ms 0/5346 (0%)
[ 5] 23.00-24.00 sec 7.54 MBytes 63.2 Mbits/sec 0.211 ms 0/5460 (0%)
[ 5] 24.00-25.00 sec 7.39 MBytes 62.0 Mbits/sec 0.211 ms 0/5349 (0%)
[ 5] 25.00-26.00 sec 7.45 MBytes 62.5 Mbits/sec 0.215 ms 0/5397 (0%)
[ 5] 26.00-27.00 sec 7.43 MBytes 62.4 Mbits/sec 0.212 ms 0/5383 (0%)
[ 5] 27.00-28.00 sec 7.50 MBytes 62.9 Mbits/sec 0.256 ms 0/5432 (0%)
[ 5] 28.00-29.00 sec 7.40 MBytes 62.1 Mbits/sec 0.177 ms 0/5359 (0%)
[ 5] 29.00-30.00 sec 7.50 MBytes 62.9 Mbits/sec 0.244 ms 0/5430 (0%)
[ 5] 30.00-31.00 sec 7.63 MBytes 64.0 Mbits/sec 0.175 ms 0/5523 (0%)
[ 5] 31.00-32.00 sec 7.45 MBytes 62.5 Mbits/sec 0.242 ms 0/5393 (0%)
[ 5] 32.00-32.74 sec 5.36 MBytes 60.7 Mbits/sec 0.253 ms 0/3885 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-32.74 sec 0.00 Bytes 0.00 bits/sec 0.253 ms 0/172647 (0%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
3.3 指定带宽大小
iperf3 -c 192.168.33.1 -u -b 200M
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -u -b 200M
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 60743 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 23.8 MBytes 200 Mbits/sec 17253
[ 5] 1.00-2.00 sec 23.8 MBytes 200 Mbits/sec 17271
[ 5] 2.00-3.00 sec 23.8 MBytes 200 Mbits/sec 17266
[ 5] 3.00-4.00 sec 23.8 MBytes 200 Mbits/sec 17266
[ 5] 4.00-5.00 sec 23.8 MBytes 200 Mbits/sec 17266
[ 5] 5.00-6.00 sec 23.8 MBytes 200 Mbits/sec 17268
[ 5] 6.00-7.00 sec 23.8 MBytes 200 Mbits/sec 17262
[ 5] 7.00-8.00 sec 23.8 MBytes 200 Mbits/sec 17250
[ 5] 8.00-9.00 sec 2.58 MBytes 21.6 Mbits/sec 1869
[ 5] 9.00-10.00 sec 0.00 Bytes 0.00 bits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-10.00 sec 193 MBytes 162 Mbits/sec 0.000 ms 0/139971 (0%) sender
[ 5] 0.00-10.00 sec 193 MBytes 162 Mbits/sec 0.261 ms 0/139923 (0%) receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 36808
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 60743
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 7.15 MBytes 60.0 Mbits/sec 0.154 ms 0/5177 (0%)
[ 5] 1.00-2.00 sec 7.23 MBytes 60.7 Mbits/sec 0.285 ms 0/5237 (0%)
[ 5] 2.00-3.00 sec 7.28 MBytes 61.1 Mbits/sec 0.169 ms 0/5272 (0%)
[ 5] 3.00-4.00 sec 7.43 MBytes 62.3 Mbits/sec 0.151 ms 0/5377 (0%)
[ 5] 4.00-5.00 sec 7.20 MBytes 60.4 Mbits/sec 0.168 ms 0/5215 (0%)
[ 5] 5.00-6.00 sec 7.21 MBytes 60.5 Mbits/sec 0.185 ms 0/5219 (0%)
[ 5] 6.00-7.00 sec 7.39 MBytes 62.0 Mbits/sec 0.193 ms 0/5351 (0%)
[ 5] 7.00-8.00 sec 7.39 MBytes 62.0 Mbits/sec 0.134 ms 0/5353 (0%)
[ 5] 8.00-9.00 sec 7.44 MBytes 62.4 Mbits/sec 0.157 ms 0/5391 (0%)
[ 5] 9.00-10.00 sec 7.44 MBytes 62.4 Mbits/sec 0.185 ms 0/5386 (0%)
[ 5] 10.00-11.00 sec 7.43 MBytes 62.3 Mbits/sec 0.155 ms 0/5378 (0%)
[ 5] 11.00-12.00 sec 7.40 MBytes 62.1 Mbits/sec 0.128 ms 0/5359 (0%)
[ 5] 12.00-13.00 sec 7.30 MBytes 61.2 Mbits/sec 0.232 ms 0/5287 (0%)
[ 5] 13.00-14.00 sec 7.48 MBytes 62.8 Mbits/sec 0.199 ms 0/5419 (0%)
[ 5] 14.00-15.00 sec 7.33 MBytes 61.5 Mbits/sec 0.200 ms 0/5309 (0%)
[ 5] 15.00-16.00 sec 7.40 MBytes 62.1 Mbits/sec 0.203 ms 0/5357 (0%)
[ 5] 16.00-17.00 sec 7.28 MBytes 61.1 Mbits/sec 0.175 ms 0/5274 (0%)
[ 5] 17.00-18.00 sec 7.23 MBytes 60.7 Mbits/sec 0.127 ms 0/5239 (0%)
[ 5] 18.00-19.00 sec 7.46 MBytes 62.6 Mbits/sec 0.178 ms 0/5402 (0%)
[ 5] 19.00-20.00 sec 7.46 MBytes 62.6 Mbits/sec 0.157 ms 0/5405 (0%)
[ 5] 20.00-21.00 sec 7.43 MBytes 62.4 Mbits/sec 0.160 ms 0/5383 (0%)
[ 5] 21.00-22.00 sec 7.40 MBytes 62.0 Mbits/sec 0.164 ms 0/5356 (0%)
[ 5] 22.00-23.00 sec 7.33 MBytes 61.5 Mbits/sec 0.253 ms 0/5305 (0%)
[ 5] 23.00-24.00 sec 7.57 MBytes 63.5 Mbits/sec 0.238 ms 0/5485 (0%)
[ 5] 24.00-25.00 sec 7.40 MBytes 62.1 Mbits/sec 0.234 ms 0/5359 (0%)
[ 5] 25.00-26.00 sec 7.26 MBytes 60.9 Mbits/sec 0.216 ms 0/5256 (0%)
[ 5] 26.00-26.26 sec 1.89 MBytes 61.7 Mbits/sec 0.261 ms 0/1372 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-26.26 sec 0.00 Bytes 0.00 bits/sec 0.261 ms 0/139923 (0%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
3.4 指定传输包大小
指定带宽 100Mbps,包大小 1200 Bytes。
iperf3 -c 192.168.33.1 -u -b 100M -l 1200
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -u -b 100M -l 1200
Connecting to host 192.168.33.1, port 5201
[ 5] local 192.168.33.32 port 59747 connected to 192.168.33.1 port 5201
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 11.9 MBytes 99.9 Mbits/sec 10404
[ 5] 1.00-2.00 sec 11.9 MBytes 100 Mbits/sec 10423
[ 5] 2.00-3.00 sec 11.9 MBytes 100 Mbits/sec 10413
[ 5] 3.00-4.00 sec 11.9 MBytes 100 Mbits/sec 10422
[ 5] 4.00-5.00 sec 11.9 MBytes 100 Mbits/sec 10412
[ 5] 5.00-6.00 sec 11.9 MBytes 100 Mbits/sec 10420
[ 5] 6.00-7.00 sec 11.9 MBytes 100 Mbits/sec 10420
[ 5] 7.00-8.00 sec 11.9 MBytes 99.9 Mbits/sec 10409
[ 5] 8.00-9.00 sec 11.9 MBytes 100 Mbits/sec 10421
[ 5] 9.00-10.00 sec 11.9 MBytes 100 Mbits/sec 10418
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-10.00 sec 119 MBytes 100 Mbits/sec 0.000 ms 0/104162 (0%) sender
[ 5] 0.00-10.00 sec 119 MBytes 100 Mbits/sec 0.167 ms 0/104158 (0%) receiveriperf Done.
服务端输出示例:
Accepted connection from 192.168.33.32, port 51382
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 59747
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 6.81 MBytes 57.2 Mbits/sec 0.130 ms 0/5954 (0%)
[ 5] 1.00-2.00 sec 7.23 MBytes 60.7 Mbits/sec 0.296 ms 0/6322 (0%)
[ 5] 2.00-3.00 sec 7.34 MBytes 61.6 Mbits/sec 0.199 ms 0/6414 (0%)
[ 5] 3.00-4.00 sec 7.02 MBytes 58.9 Mbits/sec 0.197 ms 0/6133 (0%)
[ 5] 4.00-5.00 sec 7.30 MBytes 61.2 Mbits/sec 0.202 ms 0/6377 (0%)
[ 5] 5.00-6.00 sec 7.25 MBytes 60.9 Mbits/sec 0.189 ms 0/6339 (0%)
[ 5] 6.00-7.00 sec 7.31 MBytes 61.3 Mbits/sec 0.162 ms 0/6388 (0%)
[ 5] 7.00-8.00 sec 7.32 MBytes 61.4 Mbits/sec 0.189 ms 0/6396 (0%)
[ 5] 8.00-9.00 sec 7.30 MBytes 61.2 Mbits/sec 0.186 ms 0/6380 (0%)
[ 5] 9.00-10.00 sec 7.41 MBytes 62.2 Mbits/sec 0.175 ms 0/6478 (0%)
[ 5] 10.00-11.00 sec 7.22 MBytes 60.6 Mbits/sec 0.188 ms 0/6310 (0%)
[ 5] 11.00-12.00 sec 7.37 MBytes 61.8 Mbits/sec 0.204 ms 0/6441 (0%)
[ 5] 12.00-13.00 sec 7.28 MBytes 61.1 Mbits/sec 0.184 ms 0/6363 (0%)
[ 5] 13.00-14.00 sec 7.29 MBytes 61.1 Mbits/sec 0.188 ms 0/6366 (0%)
[ 5] 14.00-15.00 sec 7.28 MBytes 61.1 Mbits/sec 0.153 ms 0/6361 (0%)
[ 5] 15.00-16.00 sec 7.26 MBytes 60.9 Mbits/sec 0.192 ms 0/6342 (0%)
[ 5] 16.00-16.45 sec 3.20 MBytes 60.1 Mbits/sec 0.167 ms 0/2794 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-16.45 sec 0.00 Bytes 0.00 bits/sec 0.167 ms 0/104158 (0%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
3.5 显示抖动(jitter)和丢包率
iperf3 -c 192.168.33.1 -u -b 100M --json
客户端输出示例:
yoyo@yoyo:~/360Downloads/iperf-3.18$ iperf3 -c 192.168.33.1 -u -b 100M --json
{"start": {"connected": [{"socket": 5,"local_host": "192.168.33.32","local_port": 46474,"remote_host": "192.168.33.1","remote_port": 5201}],"version": "iperf 3.7","system_info": "Linux ubuntu 5.15.0-127-generic #137~20.04.1-Ubuntu SMP Fri Nov 15 14:46:54 UTC 2024 x86_64","timestamp": {"time": "Fri, 07 Mar 2025 09:09:26 GMT","timesecs": 1741338566},"connecting_to": {"host": "192.168.33.1","port": 5201},"cookie": "xfmy6xsuautcobc7addl5htinbdys2ne4t5l","sock_bufsize": 0,"sndbuf_actual": 212992,"rcvbuf_actual": 212992,"test_start": {"protocol": "UDP","num_streams": 1,"blksize": 1448,"omit": 0,"duration": 10,"bytes": 0,"blocks": 0,"reverse": 0,"tos": 0}},"intervals": [{"streams": [{"socket": 5,"start": 0,"end": 1.000053,"seconds": 1.00005304813385,"bytes": 12489000,"bits_per_second": 99906700.135998666,"packets": 8625,"omitted": false,"sender": true}],"sum": {"start": 0,"end": 1.000053,"seconds": 1.00005304813385,"bytes": 12489000,"bits_per_second": 99906700.135998666,"packets": 8625,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 1.000053,"end": 2.000048,"seconds": 0.99999499320983887,"bytes": 12506376,"bits_per_second": 100051508.93691055,"packets": 8637,"omitted": false,"sender": true}],"sum": {"start": 1.000053,"end": 2.000048,"seconds": 0.99999499320983887,"bytes": 12506376,"bits_per_second": 100051508.93691055,"packets": 8637,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 2.000048,"end": 3.000007,"seconds": 0.99995899200439453,"bytes": 12494792,"bits_per_second": 99962435.259105816,"packets": 8629,"omitted": false,"sender": true}],"sum": {"start": 2.000048,"end": 3.000007,"seconds": 0.99995899200439453,"bytes": 12494792,"bits_per_second": 99962435.259105816,"packets": 8629,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 3.000007,"end": 4.00001,"seconds": 1.0000029802322388,"bytes": 12502032,"bits_per_second": 100015957.92921779,"packets": 8634,"omitted": false,"sender": true}],"sum": {"start": 3.000007,"end": 4.00001,"seconds": 1.0000029802322388,"bytes": 12502032,"bits_per_second": 100015957.92921779,"packets": 8634,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 4.00001,"end": 5.000007,"seconds": 0.99999701976776123,"bytes": 12500584,"bits_per_second": 100004970.03803575,"packets": 8633,"omitted": false,"sender": true}],"sum": {"start": 4.00001,"end": 5.000007,"seconds": 0.99999701976776123,"bytes": 12500584,"bits_per_second": 100004970.03803575,"packets": 8633,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 5.000007,"end": 6.000171,"seconds": 1.0001640319824219,"bytes": 12503480,"bits_per_second": 100011434.92606422,"packets": 8635,"omitted": false,"sender": true}],"sum": {"start": 5.000007,"end": 6.000171,"seconds": 1.0001640319824219,"bytes": 12503480,"bits_per_second": 100011434.92606422,"packets": 8635,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 6.000171,"end": 7.000442,"seconds": 1.0002709627151489,"bytes": 12503480,"bits_per_second": 100000743.52701701,"packets": 8635,"omitted": false,"sender": true}],"sum": {"start": 6.000171,"end": 7.000442,"seconds": 1.0002709627151489,"bytes": 12503480,"bits_per_second": 100000743.52701701,"packets": 8635,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 7.000442,"end": 8.000018,"seconds": 0.99957597255706787,"bytes": 12490448,"bits_per_second": 99965972.315621212,"packets": 8626,"omitted": false,"sender": true}],"sum": {"start": 7.000442,"end": 8.000018,"seconds": 0.99957597255706787,"bytes": 12490448,"bits_per_second": 99965972.315621212,"packets": 8626,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 8.000018,"end": 9.000039,"seconds": 1.0000209808349609,"bytes": 12502032,"bits_per_second": 100014157.61946523,"packets": 8634,"omitted": false,"sender": true}],"sum": {"start": 8.000018,"end": 9.000039,"seconds": 1.0000209808349609,"bytes": 12502032,"bits_per_second": 100014157.61946523,"packets": 8634,"omitted": false,"sender": true}}, {"streams": [{"socket": 5,"start": 9.000039,"end": 10.00081,"seconds": 1.0007710456848145,"bytes": 12503480,"bits_per_second": 99950773.387485713,"packets": 8635,"omitted": false,"sender": true}],"sum": {"start": 9.000039,"end": 10.00081,"seconds": 1.0007710456848145,"bytes": 12503480,"bits_per_second": 99950773.387485713,"packets": 8635,"omitted": false,"sender": true}}],"end": {"streams": [{"udp": {"socket": 5,"start": 0,"end": 10.00081,"seconds": 10.00081,"bytes": 124995704,"bits_per_second": 99988464.134405121,"jitter_ms": 0.27399999999999997,"lost_packets": 0,"packets": 86323,"lost_percent": 0,"out_of_order": 0,"sender": true}}],"sum": {"start": 0,"end": 10.00081,"seconds": 10.00081,"bytes": 124995704,"bits_per_second": 99988464.134405121,"jitter_ms": 0.27399999999999997,"lost_packets": 0,"packets": 86323,"lost_percent": 0,"sender": true},"cpu_utilization_percent": {"host_total": 26.108550002461911,"host_user": 0.18748343181817051,"host_system": 25.921066570643742,"remote_total": 5.867906,"remote_user": 0.42318,"remote_system": 5.44472}}
}
服务端输出示例:
Accepted connection from 192.168.33.32, port 47688
[ 5] local 192.168.33.1 port 5201 connected to 192.168.33.32 port 46474
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 7.11 MBytes 59.6 Mbits/sec 0.234 ms 0/5148 (0%)
[ 5] 1.00-2.00 sec 7.50 MBytes 62.9 Mbits/sec 0.197 ms 0/5429 (0%)
[ 5] 2.00-3.00 sec 7.59 MBytes 63.7 Mbits/sec 0.267 ms 0/5495 (0%)
[ 5] 3.00-4.00 sec 7.50 MBytes 62.9 Mbits/sec 0.209 ms 0/5428 (0%)
[ 5] 4.00-5.00 sec 7.50 MBytes 62.9 Mbits/sec 0.242 ms 0/5429 (0%)
[ 5] 5.00-6.00 sec 7.30 MBytes 61.2 Mbits/sec 0.230 ms 0/5284 (0%)
[ 5] 6.00-7.00 sec 7.16 MBytes 60.1 Mbits/sec 0.191 ms 0/5185 (0%)
[ 5] 7.00-8.00 sec 7.29 MBytes 61.2 Mbits/sec 0.396 ms 0/5279 (0%)
[ 5] 8.00-9.00 sec 7.31 MBytes 61.3 Mbits/sec 0.332 ms 0/5294 (0%)
[ 5] 9.00-10.00 sec 7.52 MBytes 63.1 Mbits/sec 0.237 ms 0/5446 (0%)
[ 5] 10.00-11.00 sec 7.44 MBytes 62.4 Mbits/sec 0.157 ms 0/5390 (0%)
[ 5] 11.00-12.00 sec 7.44 MBytes 62.4 Mbits/sec 0.222 ms 0/5388 (0%)
[ 5] 12.00-13.00 sec 7.43 MBytes 62.4 Mbits/sec 0.195 ms 0/5383 (0%)
[ 5] 13.00-14.00 sec 7.41 MBytes 62.2 Mbits/sec 0.271 ms 0/5368 (0%)
[ 5] 14.00-15.00 sec 7.39 MBytes 62.0 Mbits/sec 0.274 ms 0/5352 (0%)
[ 5] 15.00-16.00 sec 7.46 MBytes 62.6 Mbits/sec 0.233 ms 0/5403 (0%)
[ 5] 16.00-16.12 sec 874 KBytes 61.3 Mbits/sec 0.274 ms 0/618 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-16.12 sec 0.00 Bytes 0.00 bits/sec 0.274 ms 0/86319 (0%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
解释说明
Jitter
:抖动,指数据包到达时间的变化量,单位为毫秒(ms)。SUM
行的抖动是所有线程抖动情况的综合体现。Lost/Total Datagrams
:丢失的数据包数量与发送的总数据包数量的信息,格式为 “丢失数 / 总数 (丢失率)”。SUM
行显示所有线程的汇总丢包情况