4.7.2. iperf3

iperf3 is a tool used for performing network throughput measurements. It can test TCP, UDP, or SCTP throughput. To conduct an iperf3 test, the user must set up both a server and a client. Upon completion of the test, a detailed test report is provided.

4.7.2.1. Syntax Description

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

4.7.2.2. Introduction to Common Options

  • -s, --server: Start iperf3 server.

  • -c, --client <host>: Run iperf3 client and connect to the specified server.

  • -p, --port <port number>: Specify the server port.

  • -t, --time <number>: Specify the duration of the transmission test in seconds. iperf3 repeatedly sends data packets of specified length during the given time (default is 10 seconds).

  • -i, --interval <number>: Set the time interval between reports in seconds. If set to a non-zero value, test reports will be output at this interval; the default value is zero.

  • -f, --format <format>: Set the report format. Optional values include Kbits, Mbits, Gbits, Tbits, etc.

  • -u, --udp: Use UDP instead of TCP.

  • -w, --window <size>: Set socket buffer size to the specified value. For TCP, this sets the TCP window size; for UDP, it sets the buffer size for receiving UDP packets, limiting the maximum packet size that can be accepted.

  • --logfile: Save the output test results to a file.

  • -J, --json: Output test results in JSON format.

  • -R, --reverse: Reverse test mode, where the client acts as the receiver and the server as the sender. Use the -R parameter on the client side to test download speed.

  • -h, --help: Display help information.

You can run the command iperf3 -h to learn more about available options.

4.7.2.3. Test Result Analysis

After the client successfully connects to the server, testing begins automatically, and both ends output corresponding test result information.

Server output includes: [ ID] Interval Transfer Bandwidth

Meaning of each field:

  • [ ID]: Identifies the stream ID of the test. Each test stream is assigned a unique ID to distinguish different data streams. This ID allows you to track the performance of a specific stream.

  • Interval: Indicates the reporting time interval of iperf3. The -i option in iperf3 sets the reporting interval, and the Interval field shows the time span for each report.

  • Transfer: Amount of data transferred. This refers to the volume of data transmitted over the test stream within a specific time interval, measured in bytes (e.g., KBytes, MBytes).

  • Bandwidth/Bitrate: Bandwidth represents the average transmission rate within a specific time interval. It is usually expressed in Kbits/s or Mbits/s, indicating the number of bits transmitted per second. This value is used to measure the speed and performance of a network connection.

Example:

iperf3 -s -p 5002
-----------------------------------------------------------
Server listening on 5002
-----------------------------------------------------------
Accepted connection from 192.168.1.10, port 44764
[  5] local 192.168.1.195 port 5002 connected to 192.168.1.10 port 44766
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec   109 MBytes   917 Mbits/sec
[  5]   1.00-2.00   sec   112 MBytes   942 Mbits/sec
[  5]   2.00-3.00   sec   113 MBytes   949 Mbits/sec

Client output includes: [ ID] Interval Transfer Bitrate Retr Cwnd

Meaning of each field:

  • [ ID]: Identifies the stream ID of the test. Each test stream is assigned a unique ID to distinguish different data streams.

  • Interval: The time interval of the test. The -i option in iperf3 sets the reporting interval, and the Interval field indicates the time span covered by each result.

  • Transfer: Amount of data transferred. Measured in bytes (Bytes), this represents the total data transmitted over the network during the test period.

  • Bitrate: Bit rate, representing the average transmission rate during the test. Typically measured in Kbits/s or Mbits/s, indicating the number of bits transmitted per second.

  • Retr: Number of retransmissions. This indicates how many packets were retransmitted during transmission. A high retransmission count may suggest network issues or congestion.

  • Cwnd: Congestion window size. Represents the window size in the TCP congestion control algorithm—the amount of data allowed to be sent without receiving an acknowledgment. Changes in this value can reflect the level of network congestion.

Example:

iperf3 -c 192.168.1.195 -i 1 -t 600 -p 5002
Connecting to host 192.168.1.195, port 5002
[  5] local 192.168.1.10 port 44766 connected to 192.168.1.195 port 5002
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   113 MBytes   946 Mbits/sec    0    227 KBytes       
[  5]   1.00-2.00   sec   113 MBytes   948 Mbits/sec    0    227 KBytes       
[  5]   2.00-3.00   sec   113 MBytes   948 Mbits/sec    0    227 KBytes

4.7.2.4. Usage Examples

  • Start iperf3 server:

iperf3 -s
  • Connect to iperf3 server:

iperf3 -c <host>
iperf3 -c <host> -p 5002
  • Specify test duration as 30 seconds:

iperf3 -c <host> -t 30
  • Perform UDP mode test with bandwidth set to 10 Mbits/s:

iperf3 -c <host> -u -b 10M
  • Run test in reverse mode:

iperf3 -c <host> -R