LinuxCommandLibrary

iperf

Measure network bandwidth performance

TLDR

Run on server

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

Run on server using UDP mode and set server port to listen on 5001
$ iperf [[-u|--udp]] [[-s|--server]] [[-p|--port]] [5001]
copy

Run on client
$ iperf [[-c|--client]] [server_address]
copy

Run on client every 2 seconds
$ iperf [[-c|--client]] [server_address] [[-i|--interval]] [2]
copy

Run on client with 5 parallel threads
$ iperf [[-c|--client]] [server_address] [[-P|--parallel]] [5]
copy

Run on client using UDP mode
$ iperf [[-u|--udp]] [[-c|--client]] [server_address] [[-p|--port]] [5001]
copy

SYNOPSIS

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

PARAMETERS

-4
    IPv4 address family only

-6
    IPv6 address family only

-B address
    bind to the specific address

-V, --version
    show program version

-h, --help
    show help synopsis

-v, --verbose
    verbose output

-d, --debug
    emit debug output

-s, --server
    run in server mode

-c, --client host
    run in client mode connecting to host

-p, --port #
    server port (default 5201)

-u, --udp
    use UDP (default TCP)

-b, --bandwidth #[KMG]
    UDP bandwidth target, e.g. 10M (default 1M)

-t, --time #
    test duration in seconds (default 10)

-i, --interval #
    report every # seconds (default 1)

-P, --parallel #
    number of parallel streams (default 1)

-l, --len #[KMG]
    buffer length (default 128KB)

-w, --window #[KMG]
    TCP window/buffer size

-O, --omit #
    omit first # seconds from report

-T, --tos N
    type-of-service value

-N, --nodelay
    disable Nagle's algorithm (TCP_NODELAY)

-R, --reverse
    reverse direction (server sends first)

-d, --dualtest
    bidirectional test simultaneously

-L, --listenport #
    local port to bind for reverse

-Z, --zerocopy
    use zerocopy sends/receives

--set-mss #
    set IP maximum segment size

-J, --json
    JSON output

-f, --format [kmgKMG]
    output units (default auto)

--logfile file
    send output to file

DESCRIPTION

iperf3 (commonly invoked as iperf on many systems) is a powerful open-source tool for measuring IP network performance. It actively tests TCP, UDP, and SCTP bandwidth between two endpoints in client-server mode. Start the server with -s to listen on a port (default 5201), then run clients with -c specifying the server host.

Key features include support for multiple parallel streams (-P), bidirectional testing (-R or -d), customizable test duration (-t), reporting intervals (-i), buffer sizes (-l, -w), UDP rate limiting (-b), and IPv4/IPv6. Output shows throughput, jitter, packet loss, retransmits, and CPU usage. JSON format (-J) enables parsing for scripts.

iperf3 excels at diagnosing bottlenecks, verifying link speeds, tuning MTU, or testing QoS. It's cross-platform, lightweight, and precise for both LAN/WAN. Install via package managers like apt install iperf3. Requires matching versions on both hosts and open firewall ports.

CAVEATS

Server mode runs indefinitely (use Ctrl+C to stop); client timeouts apply via -t. Requires identical iperf3 versions on both hosts. UDP tests need firewall rules for the port. High rates may saturate CPU/link. Not for production traffic.

BASIC TCP TEST

Server: iperf3 -s
Client: iperf3 -c 192.168.1.1

UDP TEST

Server: iperf3 -s -u
Client: iperf3 -c 192.168.1.1 -u -b 100M -t 30

BIDIRECTIONAL

iperf3 -c host -d or iperf3 -c host -R

HISTORY

Originally developed 1997-2003 by NLANR/DAST as thrulay precursor. iperf 2.x maintained post-2004. iperf3 (2014+) rewritten by ESnet/LBNL for better accuracy, JSON support, authentication, and portability. Now standard for network benchmarking.

SEE ALSO

netperf(1), ttcp(8), nuttcp(1)

Copied to clipboard