网速测试iperf3

作用

用于测试客户端到服务器的网速,评估客户端到服务器的网络质量。

测试软件

软件名称:iperf3

官网:iPerf - The TCP, UDP and SCTP network bandwidth measurement tool

文档:iPerf - iPerf3 and iPerf2 user documentation

测试环境

局域网中的两台电脑接在同一交换机下(本文使用虚拟机进行模拟演示)

客户端(192.168.21.136)-------交换机-------服务器(192.168.21.132)

命令帮助

# iperf3 -h
Usage: iperf3 [-s|-c host] [options]
       iperf3 [-h|--help] [-v|--version]

Server or Client:
  -p, --port      #         server port to listen on/connect to
  -f, --format   [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits
  -i, --interval  #         seconds between periodic throughput reports
  -I, --pidfile file        write PID file
  -F, --file name           xmit/recv the specified file
  -A, --affinity n/n,m      set CPU affinity
  -B, --bind <host>[%<dev>] bind to the interface associated with the address <host>
                            (optional <dev> equivalent to `--bind-dev <dev>`)
  --bind-dev <dev>          bind to the network interface with SO_BINDTODEVICE
  -V, --verbose             more detailed output
  -J, --json                output in JSON format
  --logfile f               send output to a log file
  --forceflush              force flushing output at every interval
  --timestamps<=format>     emit a timestamp at the start of each output line
                            (optional "=" and format string as per strftime(3))
  --rcv-timeout #           idle timeout for receiving data (default 120000 ms)
  --snd-timeout #           timeout for unacknowledged TCP data
                            (in ms, default is system settings)
  -d, --debug[=#]           emit debugging output
                            (optional optional "=" and debug level: 1-4. Default is 4 - all messages)
  -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
  --server-bitrate-limit #[KMG][/#]   server's total bit rate limit (default 0 = no limit)
                            (optional slash and number of secs interval for averaging
                            total data rate.  Default is 5 seconds)
  --idle-timeout #          restart idle server after # seconds in case it
                            got stuck (default - no timeout)
  --rsa-private-key-path    path to the RSA private key used to decrypt
                            authentication credentials
  --authorized-users-path   path to the configuration file containing user
                            credentials
  --time-skew-threshold     time skew threshold (in seconds) between the server
                            and client during the authentication process
Client specific:
  -c, --client <host>[%<dev>] run in client mode, connecting to <host>
                              (option <dev> equivalent to `--bind-dev <dev>`)
  --sctp                    use SCTP rather than TCP
  -X, --xbind <name>        bind SCTP association to links
  --nstreams      #         number of SCTP streams
  -u, --udp                 use UDP rather than TCP
  --connect-timeout #       timeout for control connection setup (ms)
  -b, --bitrate #[KMG][/#]  target bitrate in bits/sec (0 for unlimited)
                            (default 1 Mbit/sec for UDP, unlimited for TCP)
                            (optional slash and packet count for burst mode)
  --pacing-timer #[KMG]     set the timing for pacing, in microseconds (default 1000)
  --fq-rate #[KMG]          enable fair-queuing based socket pacing in
                            bits/sec (Linux only)
  -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, --length    #[KMG]    length of buffer to read or write
                            (default 128 KB for TCP, dynamic or 1460 for UDP)
  --cport         <port>    bind to a specific client port (TCP and UDP, default: ephemeral port)
  -P, --parallel  #         number of parallel client streams to run
  -R, --reverse             run in reverse mode (server sends, client receives)
  --bidir                   run in bidirectional mode.
                            Client and server send and receive data.
  -w, --window    #[KMG]    set send/receive socket buffer sizes
                            (indirectly sets TCP window size)
  -C, --congestion <algo>   set TCP congestion control algorithm (Linux and FreeBSD only)
  -M, --set-mss   #         set TCP/SCTP maximum segment size (MTU - 40 bytes)
  -N, --no-delay            set TCP/SCTP 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, 0-255.
                            The usual prefixes for octal and hex can be used,
                            i.e. 52, 064 and 0x34 all specify the same value.
  --dscp N or --dscp val    set the IP dscp value, either 0-63 or symbolic.
                            Numeric values can be specified in decimal,
                            octal and hex (see --tos above).
  -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              perform pre-test for N seconds and omit the pre-test statistics
  -T, --title str           prefix every output line with this string
  --extra-data str          data string to include in client and server JSON
  --get-server-output       get results from server
  --udp-counters-64bit      use 64-bit counters in UDP test packets
  --repeating-payload       use repeating pattern in payload, instead of
                            randomized payload (like in iperf2)
  --dont-fragment           set IPv4 Don't Fragment flag
  --username                username for authentication
  --rsa-public-key-path     path to the RSA public key used to encrypt
                            authentication credentials

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

iperf3 homepage at: https://software.es.net/iperf/
Report bugs to:     https://github.com/esnet/iperf

测试演示

# 服务器端
# iperf3 -f m -p 888 -s 
-----------------------------------------------------------
Server listening on 888 (test #1)
-----------------------------------------------------------
Accepted connection from 192.168.21.136, port 50366
[  5] local 192.168.21.132 port 888 connected to 192.168.21.136 port 50368
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   268 MBytes  2250 Mbits/sec                  
[  5]   1.00-2.00   sec   253 MBytes  2124 Mbits/sec                  
[  5]   2.00-3.00   sec   243 MBytes  2035 Mbits/sec                  
[  5]   3.00-4.00   sec   259 MBytes  2172 Mbits/sec                  
[  5]   4.00-5.00   sec   267 MBytes  2243 Mbits/sec                  
[  5]   5.00-6.00   sec   251 MBytes  2106 Mbits/sec                  
[  5]   6.00-7.00   sec   228 MBytes  1916 Mbits/sec                  
[  5]   7.00-8.00   sec   253 MBytes  2123 Mbits/sec                  
[  5]   8.00-9.00   sec   258 MBytes  2167 Mbits/sec                  
[  5]   9.00-10.00  sec   264 MBytes  2217 Mbits/sec                  
[  5]  10.00-10.00  sec   256 KBytes   521 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec  2.49 GBytes  2135 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 888 (test #2)
-----------------------------------------------------------


# 客户端
[root@client ~]# iperf3 -c 192.168.21.132 -p 888 -f m 
Connecting to host 192.168.21.132, port 888
[  4] local 192.168.21.136 port 50368 connected to 192.168.21.132 port 888
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   270 MBytes  2252 Mbits/sec    0   1.69 MBytes       
[  4]   1.00-2.00   sec   252 MBytes  2124 Mbits/sec    0   1.80 MBytes       
[  4]   2.00-3.00   sec   245 MBytes  2058 Mbits/sec   43   1.37 MBytes       
[  4]   3.00-4.00   sec   258 MBytes  2150 Mbits/sec    0   1.38 MBytes       
[  4]   4.00-5.00   sec   268 MBytes  2243 Mbits/sec    0   1.64 MBytes       
[  4]   5.00-6.00   sec   250 MBytes  2104 Mbits/sec    0   1.64 MBytes       
[  4]   6.00-7.00   sec   229 MBytes  1916 Mbits/sec    0   1.64 MBytes       
[  4]   7.00-8.00   sec   252 MBytes  2123 Mbits/sec    0   1.64 MBytes       
[  4]   8.00-9.00   sec   259 MBytes  2171 Mbits/sec    0   1.64 MBytes       
[  4]   9.00-10.00  sec   264 MBytes  2213 Mbits/sec    1   1.30 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  2.49 GBytes  2136 Mbits/sec   44             sender
[  4]   0.00-10.00  sec  2.49 GBytes  2136 Mbits/sec                  receiver

iperf Done.

以上测试基于虚拟机演示,显示的带宽很高

内容导览:计算机网络基础、进阶、安全实践

  • 5
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hougang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值