Ubuntu 16.04
Sponsored Link

ネットワーク帯域幅を測定する2016/09/08

 
iperf を利用してネットワークの帯域幅を測定します。
クライアント (送信側) とサーバー (受信側) の 2台のマシンが必要となります。
[1] 計測に使用する 2台双方に iperf3 をインストールします。
root@dlp:~#
apt-get -y install iperf3
[2] サーバー (受信側) で以下のようにコマンド実行し待ち受けます。
待ち受けポートを指定する場合は、以下のコマンドに続けて「-p (ポート番号)」を指定します。 指定しない場合のデフォルトは「5201」です。
root@dlp:~#
iperf3 -s

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
[3] クライアント (送信側) から以下のようにコマンド実行して、帯域幅を測定します。
# iperf3 -c (サーバーのホスト名またはIPアドレス)

root@www:~#
iperf3 -c 10.0.0.30

Connecting to host 10.0.0.30, port 5201
[  4] local 10.0.0.31 port 49300 connected to 10.0.0.30 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  2.90 GBytes  24.9 Gbits/sec    3   3.02 MBytes
[  4]   1.00-2.00   sec  3.47 GBytes  29.8 Gbits/sec    0   3.02 MBytes
[  4]   2.00-3.00   sec  3.39 GBytes  29.2 Gbits/sec    1   3.02 MBytes
[  4]   3.00-4.00   sec  3.44 GBytes  29.5 Gbits/sec    0   3.02 MBytes
[  4]   4.00-5.00   sec  3.46 GBytes  29.7 Gbits/sec    3   3.02 MBytes
[  4]   5.00-6.00   sec  3.44 GBytes  29.6 Gbits/sec   26   2.20 MBytes
[  4]   6.00-7.00   sec  3.47 GBytes  29.8 Gbits/sec    0   3.01 MBytes
[  4]   7.00-8.00   sec  3.47 GBytes  29.8 Gbits/sec    0   3.01 MBytes
[  4]   8.00-9.00   sec  3.36 GBytes  28.8 Gbits/sec    0   3.01 MBytes
[  4]   9.00-10.00  sec  2.11 GBytes  18.1 Gbits/sec    0   3.01 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  32.5 GBytes  27.9 Gbits/sec   33             sender
[  4]   0.00-10.00  sec  32.5 GBytes  27.9 Gbits/sec                  receiver

iperf Done.
[4] 他にもいろいろなオプションがあるので、試してみてください。
root@dlp:~#
iperf3 --help

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
関連コンテンツ