목차
본문으로 바로가기

iperf대역폭 체크

category OS/Linux 2025. 5. 15. 15:54

개요

  • 클라이언트와 서버간의 네트워크 대역폭을 체크 Tool
  • UDP 로 체크하면 패킷 유실사항을 확인 가능
  • MTU, 윈도우 사이즈, 프로토콜 변경 확인 가능

체크방법

  • Server IP : 20.0.1.51
  • Client IP : 20.0.1.32
[opc@bong-test-243736 ~]$ 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
  -F, --file name           xmit/recv the specified file
  -A, --affinity n/n,m      set CPU affinity
  -B, --bind      <host>    bind to the interface associated with the address <host>
  -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
  -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
  -I, --pidfile file        write PID file
  -1, --one-off             handle one client connection then exit
  --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
Client specific:
  -c, --client    <host>    run in client mode, connecting to <host>
  --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)
  -w, --window    #[KMG]    set window size / socket buffer 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              omit the first n seconds
  -T, --title str           prefix every output line with this string
  --get-server-output       get results from server
  --udp-counters-64bit      use 64-bit counters in UDP test packets
  --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: http://software.es.net/iperf/
Report bugs to:     https://github.com/esnet/iperf



Server

[opc@bong-test ~]$ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 20.0.1.32, port 50506
[  5] local 20.0.1.51 port 5201 connected to 20.0.1.32 port 50508
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   120 MBytes  1.01 Gbits/sec
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   120 MBytes  1.01 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   178 MBytes  1.49 Gbits/sec                  receiver

Client

  • iperf3 -c [Server IP ]
  • 기본값은 프로토콜 : TCP, 포트번호 : 5001, 윈도우 사이즈 : 16Kbyte, 시간 : 10초
[opc@bong-test-243736 ~]$ iperf3 -c 20.0.1.51
Connecting to host 20.0.1.51, port 5201
[  5] local 20.0.1.32 port 50508 connected to 20.0.1.51 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   129 MBytes  1.08 Gbits/sec    0   3.16 MBytes
^C[  5]   1.00-1.41   sec  50.0 MBytes  1.03 Gbits/sec    0   3.16 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-1.41   sec   179 MBytes  1.07 Gbits/sec    0             sender
[  5]   0.00-1.41   sec  0.00 Bytes  0.00 bits/sec                  receiver
iperf3: interrupt - the client has terminated

동시 세션 측정

  • iperf3 -c [Server IP] -P 세션수
  • 동시에 세션으로 호출 할 경우 SUM 값으로 확인
[opc@bong-test-243736 ~]$ iperf3 -c 20.0.1.51 -P 10
Connecting to host 20.0.1.51, port 5201
[  5] local 20.0.1.32 port 60790 connected to 20.0.1.51 port 5201
[  7] local 20.0.1.32 port 60802 connected to 20.0.1.51 port 5201
[  9] local 20.0.1.32 port 60806 connected to 20.0.1.51 port 5201
[ 11] local 20.0.1.32 port 60810 connected to 20.0.1.51 port 5201
[ 13] local 20.0.1.32 port 60814 connected to 20.0.1.51 port 5201
[ 15] local 20.0.1.32 port 60822 connected to 20.0.1.51 port 5201
[ 17] local 20.0.1.32 port 60838 connected to 20.0.1.51 port 5201
[ 19] local 20.0.1.32 port 60848 connected to 20.0.1.51 port 5201
[ 21] local 20.0.1.32 port 60856 connected to 20.0.1.51 port 5201
[ 23] local 20.0.1.32 port 60860 connected to 20.0.1.51 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  14.7 MBytes   123 Mbits/sec    0    778 KBytes
[  7]   0.00-1.00   sec  15.0 MBytes   126 Mbits/sec    0    786 KBytes
[  9]   0.00-1.00   sec  15.5 MBytes   130 Mbits/sec    0    813 KBytes
[ 11]   0.00-1.00   sec  15.5 MBytes   130 Mbits/sec    0    795 KBytes
[ 13]   0.00-1.00   sec  15.0 MBytes   126 Mbits/sec    0    786 KBytes
[ 15]   0.00-1.00   sec  14.1 MBytes   118 Mbits/sec    1    725 KBytes
[ 17]   0.00-1.00   sec  14.6 MBytes   122 Mbits/sec    0    760 KBytes
[ 19]   0.00-1.00   sec  14.0 MBytes   118 Mbits/sec    0    751 KBytes
[ 21]   0.00-1.00   sec  14.1 MBytes   118 Mbits/sec    0    760 KBytes
[ 23]   0.00-1.00   sec  14.4 MBytes   121 Mbits/sec    0    760 KBytes
[SUM]   0.00-1.00   sec   147 MBytes  1.23 Gbits/sec    1
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   1.00-2.00   sec  13.1 MBytes   110 Mbits/sec   11    961 KBytes
[  7]   1.00-2.00   sec  11.9 MBytes   100 Mbits/sec    7    952 KBytes
[  9]   1.00-2.00   sec  12.0 MBytes   100 Mbits/sec    9    970 KBytes
[ 11]   1.00-2.00   sec  12.0 MBytes   101 Mbits/sec    4   1.18 MBytes
[ 13]   1.00-2.00   sec  13.2 MBytes   110 Mbits/sec    7   1.05 MBytes
[ 15]   1.00-2.00   sec  11.6 MBytes  97.0 Mbits/sec    7    900 KBytes
[ 17]   1.00-2.00   sec  12.9 MBytes   109 Mbits/sec    2   1.24 MBytes
[ 19]   1.00-2.00   sec  12.9 MBytes   108 Mbits/sec    4   1.20 MBytes
[ 21]   1.00-2.00   sec  12.9 MBytes   108 Mbits/sec    2   1.29 MBytes
[ 23]   1.00-2.00   sec  12.9 MBytes   109 Mbits/sec    4   1.04 MBytes
[SUM]   1.00-2.00   sec   125 MBytes  1.05 Gbits/sec   57

Error

  • Server 단 방화벽 설정 확인
  • 임시로 방화벽 stop 또는 Server listening Port 오픈
    [opc@bong-test-243736 ~]$ iperf3 -c 20.0.1.51
    iperf3: error - unable to connect to server: No route to host