iperf3带宽测试工具安装及使用方法分享

iperf3是一款带宽测试工具,它支持调节各种参数,比如通信协议,数据包个数,发送持续时间,测试完会报告网络带宽,丢包率和其他参数。喜欢折腾网络的小伙伴应该经常用到,最近搞了个新软路由折腾了下,总结分享下,大家也可以没事凡尔赛一下自家的网络速度。

一:先说说群晖的安装方法:

1、Docker的使用方法,不仅限于群晖,只要能用Docker的都可以用:

Iperf3 Server模式

docker run  -it --rm --name=iperf3-server -p 5201:5201 networkstatic/iperf3 -s

Iperf3 Client模式

docker run  -it --rm networkstatic/iperf3 -c 172.17.0.163

2、群晖SSH命令行安装方法:摘自官网安装教程:https://iperf.fr/iperf-download.php#archlinuxLinux manual Installation

sudo wget -O /usr/lib/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0_3.1.3
sudo wget -O /usr/bin/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3
sudo chmod +x /usr/bin/iperf3

3、Ubuntu、Debian一键安装

~$ sudo apt install iperf3

二:Windows安装和使用方法

下载地址:https://iperf.fr/iperf-download.php#windows,其他系统都在这个页面,自己根据系统去选吧

使用方法都差不多,在命令提示符下输入下载包解压缩路径,闲麻烦的可以直接把iperf3.exe文件拖到窗口里,后面的命令参数跟linux都一样了

iperf3带宽测试工具安装及使用方法分享

三:iperf3命令行使用方法

目的一:测试TCP吞吐量
1、先让B(外)做server端,开启iperf服务器模式,指定TCP端口1314:不指定默认为5201,如果没有端口冲突可以用默认的就行,省事

iperf3 -s -i 1 -p 1314

做client端,连接服务器端1314端口:

iperf3 -c 192.168.1.2 -i 1 -t 60 -p 1314

iperf3带宽测试工具安装及使用方法分享

其中:
① Interval表示时间间隔。
② Transfer表示时间间隔里面转输的数据量。
③ Bandwidth是时间间隔里的传输速率。

目的二:测试UDP吞吐量
1、B(外)server端开启iperf的服务器模式:

iperf3 -s -i 1 -p 1314

2、然后打开A(内)做client端,连接服务器端1314端口:

iperf3 -c 10.10.0.2 -i 1 -t 60 -p 1314

目的三:进行上下行带宽测试(TCP双向传输)

iperf3 -c 192.168.0.120 -d -t 60

目的四:测试多线程TCP吞吐量
如果没有指定发送方式,iPerf客户端只会使用单线程。

iperf3 -c 192.168.0.120 -P 30 -t 60

目的五:测试多线程UDP吞吐量
如果没有指定发送方式,iPerf客户端只会使用单线程。

iperf3 -u -c  192.168.1.1 -b 5M -P 30 -t 60

目的六:测试上下行带宽(UDP双向传输)

iperf3 -u -c  192.168.1.1 -b 100M -d -t 60

2、A(内)client端启动iperf的客户端模式,连接服务器端:

iperf3 -u -c 10.10.0.2 -b 100m -t 60 -p 1314

四、iperf3常用参数,摘自官网https://iperf.fr/iperf-doc.php

iPerf 3 user documentation

GENERAL OPTIONS
Command line option Description
-p, --port n The server port for the server to listen on and the client to connect to. This should be the same in both client and server. Default is 5201.
--cport n Option to specify the client-side port. (new in iPerf 3.1)
-f, --format [kmKM] A letter specifying the format to print bandwidth numbers in. Supported formats are
    'k' = Kbits/sec           'K' = KBytes/sec
    'm' = Mbits/sec           'M' = MBytes/sec

The adaptive formats choose between kilo- and mega- as appropriate.

-i, --interval n Sets the interval time in seconds between periodic bandwidth, jitter, and loss reports. If non-zero, a report is made every interval seconds of the bandwidth since the last report. If zero, no periodic reports are printed. Default is zero.
-F, --file name client-side: read from the file and write to the network, instead of using random data;
server-side: read from the network and write to the file, instead of throwing the data away.
-A, --affinity n/n,m-F Set the CPU affinity, if possible (Linux and FreeBSD only). On both the client and server you can set the local affinity by using the n form of this argument (where n is a CPU number). In addition, on the client side you can override the server’s affinity for just that one test, using the n,m form of argument. Note that when using this feature, a process will only be bound to a single CPU (as opposed to a set containing potentialy multiple CPUs).
-B, --bind host Bind to host, one of this machine's addresses. For the client this sets the outbound interface. For a server this sets the incoming interface. This is only useful on multihomed hosts, which have multiple network interfaces.
-V, --verbose give more detailed output
-J, --json output in JSON format
--logfile file send output to a log file. (new in iPerf 3.1)
--d, --debug emit debugging output. Primarily (perhaps exclusively) of use to developers.
-v, --version Show version information and quit.
-h, --help Show a help synopsis and quit.
SERVER SPECIFIC OPTIONS
Command line option Description
-s, --server Run iPerf in server mode. (This will only allow one iperf connection at a time)
-D, --daemon Run the server in background as a daemon.
-I, --pidfilefile write a file with the process ID, most useful when running as a daemon. (new in iPerf 3.1)
CLIENT SPECIFIC OPTIONS
Command line option Description
-c, --client host Run iPerf in client mode, connecting to an iPerf server running on host.
--sctp Use SCTP rather than TCP (Linux, FreeBSD and Solaris). (new in iPerf 3.1)
-u, --udp Use UDP rather than TCP. See also the -b option.
-b, --bandwidth n[KM] Set target bandwidth to n bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP). If there are multiple streams (-P flag), the bandwidth limit is applied separately to each stream. You can also add a ’/’ and a number to the bandwidth specifier. This is called "burst mode". It will send the given number of packets without pausing, even if that temporarily exceeds the specified bandwidth limit.
-t, --time n The time in seconds to transmit for. iPerf normally works by repeatedly sending an array of len bytes for time seconds. Default is 10 seconds. See also the -l-k and -n options.
-n, --num n[KM] The number of buffers to transmit. Normally, iPerf sends for 10 seconds. The -n option overrides this and sends an array of len bytes num times, no matter how long that takes. See also the -l-k and -t options.
-k, --blockcount n[KM] The number of blocks (packets) to transmit. (instead of -t or -n) See also the -t-l and -n options.
-l, --length n[KM] The length of buffers to read or write. iPerf works by writing an array of len bytes a number of times. Default is 128 KB for TCP, 8 KB for UDP. See also the -n-k and -t options.
-P, --parallel n The number of simultaneous connections to make to the server. Default is 1.
-R, --reverse Run in reverse mode (server sends, client receives).
-w, --window n[KM] Sets the socket buffer sizes to the specified value. For TCP, this sets the TCP window size. (this gets sent to the server and used on that side too)
-M, --set-mss n Attempt to set the TCP maximum segment size (MSS). The MSS is usually the MTU - 40 bytes for the TCP/IP header. For ethernet, the MSS is 1460 bytes (1500 byte MTU).
-N, --no-delay Set the TCP no delay option, disabling Nagle's algorithm. Normally this is only disabled for interactive applications like telnet.
-4, --version4 only use IPv4.
-6, --version4 only use IPv6.
-S, --tos n The type-of-service for outgoing packets. (Many routers ignore the TOS field.) You may specify the value in hex with a '0x' prefix, in octal with a '0' prefix, or in decimal. For example, '0x10' hex = '020' octal = '16' decimal. The TOS numbers specified in RFC 1349 are:
    IPTOS_LOWDELAY     minimize delay        0x10
    IPTOS_THROUGHPUT   maximize throughput   0x08
    IPTOS_RELIABILITY  maximize reliability  0x04
    IPTOS_LOWCOST      minimize cost         0x02
-L, --flowlabel n Set the IPv6 flow label (currently only supported on Linux).
-Z, --zerocopy Use a "zero copy" method of sending data, such as sendfile(2), instead of the usual write(2). This uses much less CPU.
-O, --omit n Omit the first n seconds of the test, to skip past the TCP TCP slowstart period.
-T, --title str Prefix every output line with this string.
-C, --linux-congestion algo Set the congestion control algorithm (Linux only for iPerf 3.0, Linux and FreeBSD for iPerf 3.1).

-> 加入科技玩家交流群组:点击加入 注意:
1.文中二维码和链接可能带有邀请性质,请各位玩家自行抉择。
2.请勿通过链接填写qq号与密码、银行卡号与密码等个人隐私信息。
3.禁止纯拉人头,拉app注册等信息,发现必小黑屋。
4.同一种信息仅发一次,多发会被删除。
5.文章中源码或APP等,无法保证其绝对安全,需自行辨别。
6.文章关联方不想展示也可以微信站长“socutesheep”删除。
本文由 @Felix1 发布。如若转载,请注明出处: 科技玩家 » iperf3带宽测试工具安装及使用方法分享

给TA买糖
共{{data.count}}人
人已买糖
教程玩家投稿精选文章

解决Github或Github pages 无法访问

2022-1-28 20:26:02

教程玩家投稿精选文章

利用GitHub+jsdelivr搭建一个图床

2022-2-3 20:41:38

29 条回复 A文章作者 M管理员
贴心提醒
请认真对待作者付出,勿发表无意义言论,触发过滤规则的评论将无法提交,包含敏感词的评论会自动变成待审核状态哦。
  1. 七年

    mark一下。

  2. slimei

    感谢分享,插眼学习

  3. slimei

    感谢分享,让我好好学习一下

  4. 这把看我表演

    谢谢分享,学习了

  5. slimei

    真棒,感谢分享!

  6. 84896150

    感谢分享 升级打卡

  7. slimei

    辛苦大佬分享了,我先学习一下

  8. 七年

    谢谢大佬分享,谢谢!

  9. 七年

    打卡升级

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索