iperf 是一个可以在两个服务器上安装以测试这两台设备间网速的工具。

iperf.png

应用使用

环境介绍:

a 服务器:10.1.1.2
b 服务器:10.1.1.3

iperf 使用 S/C 模式工作,a 服务器以 server 方式启动,b 服务器作为客户端连接 a,根据客户端的参数来测试网络。

举例:

a 服务器启动服务端:

iperf -s

b 服务器进行测试:

  1. 使用默认设置测试
iperf -c 10.1.1.2
  1. 传输 10G 后停止
iperf -c 10.1.1.2 -n 10G
  1. 传输 20 秒后停止
iperf -c 10.1.1.2 -t 20

测试成功后,两端都会显示速度。

[root@linux01 ~]# iperf -c 10.1.1.2 -t 15
------------------------------------------------------------
Client connecting to 10.1.1.2, TCP port 5001
TCP window size: 19.3 KByte (default)
------------------------------------------------------------
[  3] local 10.1.1.3 port 53420 connected with 10.1.1.2 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-15.0 sec  2.80 GBytes  1.60 Gbits/sec

更多使用方法请参考下面帮助:

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

Client/Server:
  -f, --format    [kmKM]   format to report: Kbits, Mbits, KBytes, MBytes
  -i, --interval  #        seconds between periodic bandwidth reports
  -l, --len       #[KM]    length of buffer to read or write (default 8 KB)
  -m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)
  -o, --output    <filename> output the report or error message to this specified file
  -p, --port      #        server port to listen on/connect to
  -u, --udp                use UDP rather than TCP
  -w, --window    #[KM]    TCP window size (socket buffer size)
  -B, --bind      <host>   bind to <host>, an interface or multicast address
  -C, --compatibility      for use with older versions does not sent extra msgs
  -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)
  -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm
  -V, --IPv6Version        Set the domain to IPv6

Server specific:
  -s, --server             run in server mode
  -U, --single_udp         run in single threaded UDP mode
  -D, --daemon             run the server as a daemon

Client specific:
  -b, --bandwidth #[KM]    for UDP, bandwidth to send at in bits/sec
                           (default 1 Mbit/sec, implies -u)
  -c, --client    <host>   run in client mode, connecting to <host>
  -d, --dualtest           Do a bidirectional test simultaneously
  -n, --num       #[KM]    number of bytes to transmit (instead of -t)
  -r, --tradeoff           Do a bidirectional test individually
  -t, --time      #        time in seconds to transmit for (default 10 secs)
  -F, --fileinput <name>   input the data to be transmitted from a file
  -I, --stdin              input the data to be transmitted from stdin
  -L, --listenport #       port to receive bidirectional tests back on
  -P, --parallel  #        number of parallel client threads to run
  -T, --ttl       #        time-to-live, for multicast (default 1)
  -Z, --linux-congestion <algo>  set TCP congestion control algorithm (Linux only)

Miscellaneous:
  -x, --reportexclude [CDMSV]   exclude C(connection) D(data) M(multicast) S(settings) V(server) reports
  -y, --reportstyle C      report as a Comma-Separated Values
  -h, --help               print this message and quit
  -v, --version            print version information and quit

[KM] Indicates options that support a K or M suffix for kilo- or mega-

The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_<long option name>, such as IPERF_BANDWIDTH.

Report bugs to <iperf-users@lists.sourceforge.net>

应用获取

直接使用包管理器进行安装。

如果您使用 Windows 或不提供包管理器的操作系统,您可以点击下面按钮进行下载。