Skip to content
System

Iperf3 on Linux: measuring network throughput before blaming Wi-Fi or the server

Avatar illustré de Julien Macé 4 min read
Deux serveurs Linux reliés par un câble réseau pour mesurer leur débit
Un test iperf3 compare le débit entre deux hôtes Linux contrôlés.

A capped transfer can come from Wi-Fi, a negotiated Ethernet link that is too low, a VPN, or the server receiving the data. Before modifying Samba, NFS, or the firewall, iperf3 allows you to measure the path between two machines that you control.

This test does not measure your Internet connection or the speed of an application. It sends traffic between a client and a server iperf3, then displays the throughput and, in TCP, the retransmissions. This way, you can isolate a local network problem before blaming the wrong component.

Two Linux servers connected by a network cable to measure their throughput
Iperf3 measures the path between two hosts, not the theoretical speed indicated on a technical sheet.

Prepare two hosts and the test port

You need two machines accessible from each other: two PCs, two VMs, or one workstation and one server. Note the IP address of the test server and the interface that is actually used. On a remote server, keep your SSH session open during the entire operation.

Install iperf3 on both hosts. The package bears the same name on Debian, Ubuntu, Fedora, and Arch Linux:

sudo apt update && sudo apt install iperf3
sudo dnf install iperf3
sudo pacman -S iperf3

The server listens by default on TCP port 5201. Open this port temporarily in the firewall between the two concerned addresses, or choose an isolated test network. Do not expose iperf3 on the Internet: the tool is meant for a one-time test between known hosts.

On the server, start listening. If the machine has multiple interfaces, the -B option limits the service to the chosen address:

iperf3 -s
# or, to listen only on the test interface
iperf3 -s -B 192.0.2.20

Measure throughput in both directions

From the client, first run a simple TCP test for twenty seconds. Replace the address with that of the iperf3 server:

iperf3 -c 192.0.2.20 -t 20

The last line gives the average throughput. In TCP, also look at the Retr column: repeated retransmissions may indicate losses, an unstable Wi-Fi connection, or an intermediate device that is saturating. A high result without retransmissions does not explain a slow application transfer: disk, encryption, protocol, or processor may still limit the application.

Then reverse the flow with -R. The client keeps the connection, but the server sends the data. A significant difference between the two measurements warrants a check of the driver, Wi-Fi, switch, or asymmetric filtering:

iperf3 -c 192.0.2.20 -t 20 -R

Start with a single flow. You can then test four TCP flows with -P 4 if an application opens multiple connections, for example, to check a NAS or perform parallel backups. Do not compare this result with that of a single download: the two scenarios do not stress the network stack in the same way.

iperf3 -c 192.0.2.20 -t 20 -P 4

Check the link before concluding a Wi-Fi failure

A throughput around 94 Mbit/s between two machines connected via Gigabit suggests a link negotiated at 100 Mbit/s. Check the link parameters with ethtool. Also, ensure that the client is not going through a Wi-Fi access point or a VPN while the server is connected via Ethernet.

When the throughput varies greatly or Retr increases, retest near the access point and then with a cable. To track losses and latency toward a remote host, MTR under Linux complements the diagnosis. Iperf3 remains the right tool for comparing two specific endpoints, as it does not depend on a public server or a browser.

Test UDP with a specific limit

An UDP test allows you to measure jitter and lost packets, but it can saturate the link if you request an unrealistic throughput. Start with a value close to the expected traffic, and only increase if the network remains stable:

iperf3 -c 192.0.2.20 -u -b 50M -t 20

The displayed loss rate does not directly compare to TCP retransmissions. UDP passes packets without resending them, so it is mainly used to test a real-time need or defined load. For a file server, I would start with TCP and a single flow, then document the result before modifying the network configuration.

Stop the server and keep useful measurements

Stop the iperf3 server with Ctrl + C once the tests are complete. Also close the temporary firewall rule. For each test, note the client address, server address, flow direction, link type, and observed throughput. A reproducible measurement will prevent you from modifying a service that was not responsible for the slowdown.

The official documentation of iperf3 and the Debian manual page detail additional options. Keep these commands on controlled hosts: iperf3 measures a given path, not the entire Internet journey or the performance of a business software.

Share Facebook X WhatsApp LinkedIn Pinterest Reddit Email