安装
在ubuntu中直接使用apt install iperf3
进行安装iperf3
使用
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
以上为判断iperf3 -h
结果
常用如下
服务端(A端) 开启测试
iperf3 -s -p 50000
默认端口是5201,需要注意所开放端口不能被防火墙屏蔽了
客户端(B端)
iperf3 -c A端IP -p50000 -t 60
发送60秒的数据包
结果如下
Connecting to host 127.0.0.1, port 5201
[ 4] local 127.0.0.1 port 56292 connected to 127.0.0.1 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 2.32 GBytes 19.9 Gbits/sec 0 1.81 MBytes
[ 4] 1.00-2.00 sec 2.32 GBytes 19.9 Gbits/sec 0 2.87 MBytes
[ 4] 2.00-3.00 sec 2.31 GBytes 19.9 Gbits/sec 0 3.12 MBytes
[ 4] 3.00-4.00 sec 2.34 GBytes 20.1 Gbits/sec 0 3.12 MBytes
[ 4] 4.00-5.00 sec 2.44 GBytes 21.0 Gbits/sec 0 3.12 MBytes
[ 4] 5.00-6.00 sec 2.46 GBytes 21.2 Gbits/sec 0 3.12 MBytes
[ 4] 6.00-7.00 sec 2.47 GBytes 21.2 Gbits/sec 0 3.12 MBytes
[ 4] 7.00-8.00 sec 2.44 GBytes 21.0 Gbits/sec 0 3.12 MBytes
[ 4] 8.00-9.00 sec 2.45 GBytes 21.1 Gbits/sec 0 3.12 MBytes
[ 4] 9.00-10.00 sec 2.43 GBytes 20.9 Gbits/sec 0 3.12 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 24.0 GBytes 20.6 Gbits/sec 0 sender
[ 4] 0.00-10.00 sec 24.0 GBytes 20.6 Gbits/sec receiver
网友评论