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 [-s | -c host] [options]

PARAMETERS

-4
    IPv4 domain only

-6
    IPv6 domain only

-B address
    Bind to the specified address

-c host
    Run in client mode, connecting to host

-C id
    Set client id (zero-padded)

-d
    Dual-test mode: server sends then receives

-D
    Daemonize (run in background)

-f m|k|g
    Output format: bits/bytes (default Mbits/sec)

-F file
    Use file for input instead of random

-h
    Show help synopsis

-i n
    Reporting interval in ms or sec (default 1s)

-I n
    TCP MSS / UDP payload (default detected)

-L address
    Local address for client bind

-l n
    Length to read/write in bytes (def TCP 128KB, UDP 1470)

-M value
    Set DSCP value

-N
    Disable Nagle's algorithm (no delay)

-n n
    Number of bytes to send (instead of -t)

-o file
    Output data to file

-O
    Skip first N seconds of test data

-p n
    Server port to listen/connect (def 5201)

-P n
    Parallel client streams (def 1)

-r
    Reverse: server receives then sends

-R
    Reverse: server sends, client receives

-s
    Run in server mode

-S n
    Set IP TOS

-t n
    Test duration in sec (def 10s)

-T n
    Stream bit-stream number (0-32)

-u
    Use UDP rather than TCP

-V
    IPv6 domain (deprecated, use -6)

-v
    Show version info

-w n[,n]
    Set send/receive buffer to n bytes

--bind
    Same as -B

--cport n
    Client source port range

--debug
    Emit debugging output

--json
    JSON output

--logfile f
    Log to file f

--one-off
    Run once and exit

--rsa-private-key-file f
    Private key file for auth

--rsa-public-key-file f
    Public key file for auth

--set-mss
    Set TCP MSS

--version
    Show version

DESCRIPTION

iperf3 is a powerful, open-source tool for actively measuring maximum achievable bandwidth on IP networks. It supports TCP, UDP, and SCTP transport protocols, and can generate bidirectional traffic, allowing it to measure server-to-client capacity and client-to-server capacity independently.

iperf3 uses a client-server architecture: run iperf3 -s on the server to listen on TCP port 5201 by default, then iperf3 -c hostname on the client to connect and perform tests. It reports metrics like throughput, loss, jitter, retransmits, and MTU discovery. Features include parallel streams for higher throughput, reverse mode (-R), tunable buffers/window sizes, bandwidth limits for UDP (-b), and customizable intervals (-i).

Output formats include human-readable, JSON (--json) for scripting, and supports IPv4/IPv6. Ideal for diagnosing bottlenecks, validating QoS, and benchmarking networks from LAN to WAN. Requires no special privileges but firewall rules for port 5201.

CAVEATS

Requires two hosts (client/server); coordinate ports/firewalls (default 5201 TCP/UDP). UDP can flood networks if unbounded (-b). High-bandwidth tests need tuned buffers (-w, sysctls). Not for production traffic; root may be needed for raw sockets or low ports. IPv6 requires -6 flag.

BASIC EXAMPLE

Server: iperf3 -s
Client: iperf3 -c 192.168.1.1 -t 10 -P 4 (10s test, 4 streams)

UDP TEST

Client: iperf3 -c host -u -b 100M -t 20 (100Mbps UDP for 20s)

HISTORY

iperf3, released in 2014 by ESnet/LBNL, is a complete rewrite of iperf2 (2003) in C++. Focuses on accuracy, multi-core scaling, JSON output, authentication, and SCTP support. Maintained actively; current versions (3.1+) add zerocopy, control messages. Widely used in HPC, cloud, and ISPs.

SEE ALSO

iperf(1), netperf(1), nuttcp(1), netcat(1), socat(1)

Copied to clipboard