Debian 13 trixie

ネットワーク帯域幅を測定する2025/10/06

 

Iperf をインストールしてネットワークの帯域幅を測定します。
送信側と受信側の 2 台のマシンが必要です。

[1] 計測に使用する 2 台双方に [iperf3] をインストールします。
root@node01:~#
apt -y install iperf3
[2] 受信側で以下のようにコマンド実行して待ち受けます。
待ち受けポートを明示的に指定する場合は、以下のコマンドに続けて [-p (ポート番号)] を指定します。
指定しない場合のデフォルトは [5201] です。
root@node01:~#
iperf3 -s

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
[3] 送信側から以下のようにコマンド実行して、帯域幅を測定します。
下例では、10秒間で合計 21.6 GBytes を送受信し、平均 18.6 Gbits/sec の速度であったことが分かります。
# iperf3 -c (サーバーのホスト名 または IP アドレス)

root@node02:~#
iperf3 -c node01.srv.world

Connecting to host node01.srv.world, port 5201
[  5] local 10.0.0.30 port 48990 connected to 10.0.0.51 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  4.44 GBytes  38.1 Gbits/sec    0   4.21 MBytes
[  5]   1.00-2.00   sec  3.42 GBytes  29.3 Gbits/sec    0   4.21 MBytes
[  5]   2.00-3.00   sec  3.42 GBytes  29.4 Gbits/sec    0   4.21 MBytes
[  5]   3.00-4.00   sec  3.44 GBytes  29.5 Gbits/sec    0   4.21 MBytes
[  5]   4.00-5.00   sec  3.42 GBytes  29.4 Gbits/sec    0   4.21 MBytes
[  5]   5.00-6.00   sec  3.39 GBytes  29.1 Gbits/sec    0   4.21 MBytes
[  5]   6.00-7.00   sec  3.44 GBytes  29.6 Gbits/sec    0   4.21 MBytes
[  5]   7.00-8.00   sec  3.59 GBytes  30.9 Gbits/sec    0   4.21 MBytes
[  5]   8.00-9.00   sec  3.77 GBytes  32.4 Gbits/sec    0   4.21 MBytes
[  5]   9.00-10.00  sec  3.69 GBytes  31.6 Gbits/sec    0   4.21 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  36.0 GBytes  30.9 Gbits/sec    0            sender
[  5]   0.00-10.00  sec  36.0 GBytes  30.9 Gbits/sec                  receiver

iperf Done.
[4] その他、オプション指定により様々なテストが実施可能です。
root@node02:~#
iperf3 --help

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[,m]      set CPU affinity core number to n (the core the process will use)
                             (optional Client only m - the Server's core number for this test)
  -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
  --json-stream             output in line-delimited 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)
.....
.....
関連コンテンツ