一、简介 iperf3 是一个 TCP、UDP 和 SCTP 网络带宽测量工具。是用于主动测量 IP 网络上可达到的最大带宽的工具。它支持调整与时序,协议和缓冲区有关的各种参数。对于每个测试,它都会报告测得的吞吐量 / 比特率,损耗和其他参数。
此版本有时称为 iperf3,是对 NLANR/DAST 开发的原始版本的重新设计。iperf3 是从头开始的新实现,其目标是使代码库更小,更简单,以及该库的版本可在其他程序中使用。iperf3 还具有其他工具(例如 nuttcp 和 netperf)中发现的许多功能,但是原始 iperf 中却没有这些功能。例如,其中包括零复制模式和可选的 JSON 输出。注意,iperf3 与原始 iperf 向后不兼容。
iperf3 的主要开发在 CentOS Linux,FreeBSD 和 macOS 上进行。目前,这是唯一受官方支持的平台,但是已经有一些关于 OpenBSD,NetBSD,Android,Solaris 和其他 Linux 发行版成功的报道。 二、用途 基于C/S模式,用于点对点测量带宽大小; 三、搭建 安装比较简单,服务端和客户端均需安装,操作如下: [root@localhost ~]# yum install -y iperf3 已加载插件:fastestmirror, refresh-packagekit, security 设置安装进程 Loading mirror speeds from cached hostfile
- epel: d2lzkl7pfhq30w.cloudfront.net 解决依赖关系 --> 执行事务检查 ---> Package iperf3.x86_64 0:3.0.12-1.el6 will be 安装 --> 完成依赖关系计算
依赖关系解决
============================================================================================================================================================================================================================================= 软件包 架构 版本 仓库 大小
正在安装: iperf3 x86_64 3.0.12-1.el6 epel 65 k
事务概要
Install 1 Package(s)
总下载量:65 k
Installed size: 158 k
下载软件包:
iperf3-3.0.12-1.el6.x86_64.rpm | 65 kB 00:00
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : iperf3-3.0.12-1.el6.x86_64 1/1
Verifying : iperf3-3.0.12-1.el6.x86_64 1/1
已安装: iperf3.x86_64 0:3.0.12-1.el6
完毕! 以上安装就ok了
服务端开启: [root@localhost ~]# iperf3 -s
Server listening on 5201
可以使用 netstat -untlp 查看iperf3是否已运行,确认服务端已开启服务,接下来在客户端进行测试;
客户端运行:
[root@bogon ~]# iperf3 -c serverIP
运行客户端+serverIP不加任何参数,可以看出传输速度,带宽大小等参数;
[root@bogon ~]# iperf3 -c 192.168.10.109
Connecting to host 192.168.10.109, port 5201
[ 4] local 192.168.10.111 port 35526 connected to 192.168.10.109 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 415 MBytes 3.48 Gbits/sec 0 902 KBytes
[ 4] 1.00-2.00 sec 674 MBytes 5.65 Gbits/sec 0 969 KBytes
[ 4] 2.00-3.00 sec 674 MBytes 5.66 Gbits/sec 0 1.06 MBytes
[ 4] 3.00-4.00 sec 674 MBytes 5.65 Gbits/sec 0 1.10 MBytes
[ 4] 4.00-5.00 sec 690 MBytes 5.78 Gbits/sec 0 1.14 MBytes
[ 4] 5.00-6.00 sec 616 MBytes 5.17 Gbits/sec 0 1.16 MBytes
[ 4] 6.00-7.00 sec 690 MBytes 5.78 Gbits/sec 0 1.19 MBytes
[ 4] 7.00-8.00 sec 588 MBytes 4.93 Gbits/sec 0 1.23 MBytes
[ 4] 8.00-9.00 sec 690 MBytes 5.78 Gbits/sec 0 1.25 MBytes
[ 4] 9.00-10.00 sec 640 MBytes 5.37 Gbits/sec 0 1.25 MBytes
[ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-10.00 sec 6.20 GBytes 5.33 Gbits/sec 0 sender [ 4] 0.00-10.00 sec 6.20 GBytes 5.32 Gbits/sec receiver
iperf Done.
下面可以通过iperf3 -h 查看iperf3 相关参数,可以根据不同的参数设置对应的属性,例如端口号,测试格式,测试文件等等; [root@localhost ~]# iperf3 -h Usage: iperf [-s|-c host] [options] iperf [-h|--help] [-v|--version]
Server or Client: -p, --port # server port to listen on/connect to -f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes -i, --interval # seconds between periodic bandwidth reports -F, --file name xmit/recv the specified file -A, --affinity n/n,m set CPU affinity -B, --bind <host> bind to a specific interface -V, --verbose more detailed output -J, --json output in JSON format -d, --debug emit debugging output -v, --version show version information and quit -h, --help show this message and quit Server specific: -s, --server run in server mode -D, --daemon run the server as a daemon -1, --one-off handle one client connection then exit Client specific: -c, --client <host> run in client mode, connecting to <host> -u, --udp use UDP rather than TCP -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited) (default 1 Mbit/sec for UDP, unlimited for TCP) (optional slash and packet count for burst mode) -t, --time # time in seconds to transmit for (default 10 secs) -n, --bytes #[KMG] number of bytes to transmit (instead of -t) -k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n) -l, --len #[KMG] length of buffer to read or write (default 128 KB for TCP, 8 KB for UDP) -P, --parallel # number of parallel client streams to run -R, --reverse run in reverse mode (server sends, client receives) -w, --window #[KMG] set window size / socket buffer size -C, --linux-congestion <algo> set TCP congestion control algorithm (Linux only) -M, --set-mss # set TCP maximum segment size (MTU - 40 bytes) -N, --nodelay set TCP no delay, disabling Nagle's Algorithm -4, --version4 only use IPv4 -6, --version6 only use IPv6 -S, --tos N set the IP 'type of service' -L, --flowlabel N set the IPv6 flow label (only supported on Linux) -Z, --zerocopy use a 'zero copy' method of sending data -O, --omit N omit the first n seconds -T, --title str prefix every output line with this string --get-server-output get results from server
[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-
iperf3 homepage at: http://software.es.net/iperf/ Report bugs to: https://github.com/esnet/iperf
标签:MBytes,iperf3,set,Gbits,centos,--,sec,测试工具 From: https://blog.51cto.com/u_9840752/6317665