LinuxCommandLibrary

iperf3

Measure network bandwidth performance

TLDR

Run iperf3 as a server

$ iperf3 [[-s|--server]]
copy

Run an iperf3 server on a specific port
$ iperf3 [[-s|--server]] [[-p|--port]] [port]
copy

Start bandwidth test
$ iperf3 [[-c|--client]] [server]
copy

Run iperf3 in multiple parallel streams
$ iperf3 [[-c|--client]] [server] [[-P|--parallel]] [streams]
copy

Reverse direction of the test. Server sends data to the client
$ iperf3 [[-c|--client]] [server] [[-R|--reverse]]
copy

SYNOPSIS

iperf3 [options] -s | iperf3 [options] -c

PARAMETERS

-s, --server
    Run in server mode, listening for connections.

-c, --client
    Run in client mode, connecting to the specified server.

-p, --port
    Set the server port to listen on or the client port to connect to. Default is 5201.

-f, --format [kmgtKMGT]
    Format the output bandwidth measurements. 'k' = Kbits/sec, 'm' = Mbits/sec, 'g' = Gbits/sec, 't' = Tbits/sec. Uppercase versions are equivalent to kilobytes, megabytes, etc. Defaults to bits/sec.

-i, --interval
    Set the interval between periodic bandwidth reports in seconds. If non-zero, causes a periodic report to be generated at this interval. If zero, no periodic reports are generated. The default is zero.

-b, --bandwidth
    Set target bandwidth in bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP). Can also specify 'K' or 'M' for kilobits and megabits, respectively. For UDP, iperf3 will attempt to send data at this rate. For TCP, this sets the TCP window size.

-t, --time
    Set the time in seconds to transmit for (default 10 seconds).

-u, --udp
    Use UDP rather than TCP.

-w, --window
    TCP window size / socket buffer size (default 128 KB).

-n, --bytes
    Number of bytes to transmit (instead of -t).

-k, --blockcount
    Number of blocks (packets) to transmit (instead of -t or -n).

-l, --len
    Length of buffer to read or write. iperf3 increases the buffer size to the largest it can without fragmenting the packets at the IP layer. For IPv4, the maximum UDP payload is 65507 bytes. For IPv6, the minimum IPv6 MTU is 1280 bytes.

-R, --reverse
    Run in reverse mode (server sends, client receives).

-4, --version4
    Only use IPv4.

-6, --version6
    Only use IPv6.

-J, --json
    Output in JSON format

-V, --verbose
    More verbose output

-0, --omit
    Omit the first n seconds

DESCRIPTION

Iperf3 is a modern tool for performing network throughput measurements. It's a rewrite of the original Iperf and aims to provide accurate and consistent results for measuring bandwidth between two hosts.
It can test TCP, UDP, and SCTP. Iperf3 is crucial for diagnosing network bottlenecks, verifying network configuration, and assessing the impact of network changes.
It operates in a client/server model, where one host acts as the server, listening for connections, and another acts as the client, initiating the test.
The tool reports various statistics like bandwidth, jitter, and packet loss. It provides detailed analysis of network performance characteristics. It provides different parameters for setting the server and client ports, and the duration of the measurements.

CAVEATS

UDP tests might be affected by packet loss due to network conditions. Bandwidth measurements in UDP can be inaccurate if the specified bandwidth is too high or the network cannot support it. Iperf3 relies on accurate system time for reliable jitter measurements.

RETURN CODES

Iperf3 returns 0 on success and non-zero on failure. Check stderr for error messages to get more details.

TROUBLESHOOTING

If iperf3 client cannot connect to the server, ensure the server is running and the firewall allows traffic on the specified port. Check network connectivity between the client and server using ping or traceroute. Ensure client and server versions are compatible.

HISTORY

Iperf3 is a rewrite of the original Iperf, designed to be more modern, efficient, and accurate. Development started to address limitations and performance issues in the older versions. It quickly gained popularity for its ease of use and comprehensive feature set. Iperf3 has become a standard tool for network engineers and administrators for diagnosing network issues.

SEE ALSO

netcat(1), tcpdump(1), ss(1)

Copied to clipboard