iperf3 is a network performance testing tool that measures the maximum achievable bandwidth on an IP network.
Let’s see it in action. We’ll set up a simple test between two machines.
First, on the server machine, start iperf3 in server mode:
iperf3 -s
On the client machine, start iperf3 to connect to the server. By default, it runs a TCP test for 10 seconds:
iperf3 -c <server_ip_address>
You’ll see output like this on the client:
Connecting to host <server_ip_address>, port 5201
[...]
[ 5] local <client_ip_address> port 50000 connected to <server_ip_address> port 5201
[ ID] Interval Transfer Bit-rate
[ 5] 0.00-10.00 sec 100 MBytes 83.9 Mbits/sec sender
[ 5] 0.00-10.00 sec 99.5 MBytes 83.5 Mbits/sec receiver
iperf Done.
The key metrics are Transfer (how much data was sent) and Bit-rate (the throughput achieved). Higher bit-rate means a faster network connection between the two points.
iperf3 can also test UDP throughput, which is important for real-time applications like video conferencing or VoIP, where packet loss is more critical than a slight delay. To run a UDP test, specify the -u flag and a bandwidth target with -b. For example, to test UDP at 10 Mbits/sec:
iperf3 -c <server_ip_address> -u -b 10M
The output will now include packet loss information:
[...]
[ 5] Interval Transfer Bit-rate Jitter Lost/Total Datagrams
[ 5] 0.00-10.00 sec 12.5 MBytes 10.5 Mbits/sec 0.050 ms 0/8000 (0%) sender
[ 5] 0.00-10.00 sec 12.4 MBytes 10.4 Mbits/sec 0.045 ms 0/7936 (0%) receiver
iperf Done.
Here, Jitter measures the variation in packet delay, and Lost/Total Datagrams shows how many packets were dropped. For UDP, you want low jitter and 0% packet loss.
The core problem iperf3 solves is quantifying network performance. It’s not just about whether you can connect, but how fast you can transfer data. This is crucial for network troubleshooting, capacity planning, and verifying service level agreements (SLAs).
Internally, iperf3 uses sockets to establish connections and send/receive data. For TCP, it dynamically adjusts the send window size to push as much data as possible. For UDP, it sends packets at a specified rate and reports on their reception. The -P flag allows you to run multiple parallel streams, simulating more realistic network conditions where multiple applications might be competing for bandwidth. Running iperf3 -c <server_ip_address> -P 4 will initiate four simultaneous connections.
The -i flag controls the reporting interval in seconds. So, iperf3 -c <server_ip_address> -i 5 will show results every 5 seconds, giving you a view of performance over time, which can be useful for detecting transient issues.
A common misconception is that iperf3 tests your internet speed directly. It tests the throughput between the two machines you run it on. The performance you see is limited by the slowest link in the path, which could be your local network, a router, your ISP’s connection, or even the server’s network.
When you run iperf3 with the -t flag, you specify the duration of the test in seconds. For instance, iperf3 -c <server_ip_address> -t 30 will run the test for 30 seconds, providing a longer measurement period than the default 10 seconds. This can help smooth out short-term fluctuations and give a more representative average throughput.
The --get-server-version flag is invaluable for ensuring compatibility between your client and server versions of iperf3, preventing unexpected behavior or errors due to differing feature sets or bug fixes.
The next step in understanding network performance is exploring how different network devices, like firewalls or load balancers, can impact the throughput measured by iperf3.