What is iperf3?
iperf3 is a widely used command-line utility designed for actively measuring the maximum achievable network throughput between two endpoints. In short, it's a powerful tool for testing and analyzing network performance.
It facilitates testing using both TCP and UDP protocols, offering valuable insights into bandwidth, latency, jitter, and packet loss. It is commonly used by network and system administrators to diagnose bottlenecks and verify link performance.
- Bandwidth
- Jitter
- Packet loss
- Retransmits
- TCP & UDP
- IPv4 & IPv6
How iperf3 Works
iperf3 operates using a simple client-server model:
1 Server Mode
One machine runs iperf3 in server mode using the -s flag. It listens for incoming connections on port 5201 (default).
iperf3 -s
2 Client Mode
Another machine runs iperf3 in client mode using the -c flag, followed by the hostname or IP address of the server.
iperf3 -c server.example.com
Once connected, the client initiates the test by sending data to the server. iperf3 then measures performance metrics like throughput, retransmissions (TCP), jitter, and packet loss (UDP).
Installation
iperf3 is available for most common operating systems. Pick yours:
Debian / Ubuntu
sudo apt update && sudo apt install -y iperf3
CentOS / RHEL / Rocky Linux
Requires the EPEL repository.
sudo yum install -y epel-release && sudo yum install -y iperf3
Fedora
sudo dnf install iperf3 -y
Windows
Download the latest pre-compiled Windows binaries from iperf.fr or directly from ar51an/iperf3-win-builds (recommended).
winget install -e --id ar51an.iPerf3
macOS (using Homebrew)
brew install iperf3
Basic Usage
Connecting a Client
To run a default 10-second TCP test connecting to a server:
iperf3 -c iperf-ams-nl.eranium.net
To connect to a server running on a non-default port:
iperf3 -c iperf-ams-nl.eranium.net -p 5205
To connect to a server on a random port between 5201 and 5210:
iperf3 -c iperf-ams-nl.eranium.net -p $((5201+(RANDOM%10)))
4.1 Common Command-Line Options
-s--server- Run in server mode
-c--client<host>- Run in client mode, connecting to host
-p--port<port>- Set server port (default: 5201)
-i--interval<sec>- Interval between reports (default: 1s)
-t--time<sec>- Test duration (default: 10s)
-P--parallel<num>- Number of parallel streams (client only)
-R--reverse- Reverse direction (test download speed)
-u--udp- Use UDP instead of TCP
-b--bitrate<bits/s>- Target bitrate (e.g., 100M, 1G)
--bidir- Run bidirectional test
-4--version4- Use IPv4 only
-6--version6- Use IPv6 only
-J--json- Output results in JSON format
Example: 30-second TCP test with 5 parallel streams
iperf3 -c ams.speedtest.clouvider.net -t 30 -P 5
Example: 20-second UDP test targeting 100 Mbps
iperf3 -c ams.speedtest.clouvider.net -t 20 -u -b 100M
Caution: UDP has no congestion control and will send at the full -b rate regardless of your connection. Start below your known upload speed and increase gradually, otherwise you will saturate your line and disrupt other traffic on your network.
Test Scenarios & Protocol Differences
Choosing between TCP and UDP depends on what aspect of network performance you want to measure.
5.1 TCP Testing (default)
TCP provides reliable, ordered, and error-checked delivery. It's the foundation for most common internet traffic like web browsing (HTTP/S), file transfers (FTP, SMB), and email.
When to use: To measure realistic, usable throughput for applications that rely on reliable data transfer.
- Simulates common application traffic, measures effective throughput
- Throughput can be impacted by latency and packet loss
Reliable: YesBest for: Web, file transfer
5.2 UDP Testing (-u)
UDP is a connectionless protocol that prioritizes speed over reliability. Used for real-time applications like VoIP, online gaming, and video streaming.
- Minimal protocol overhead, measures jitter and packet loss
- Unreliable by nature, requires manual bitrate setting
Important: UDP tests require a target bitrate (-b); without it, iperf3 defaults to ~1 Mbps.
Reliable: NoBest for: VoIP, games, video
5.3 Reverse Mode (-R)
By default, the client sends data to the server. The -R flag reverses this to test download speed from the client's perspective.
iperf3 -c ams.speedtest.clouvider.net -t 15 -R
5.4 Bidirectional Mode (--bidir)
Runs tests simultaneously in both directions. Useful for simulating full-duplex traffic like video conferences.
iperf3 -c ams.speedtest.clouvider.net --bidir
Advanced Usage & Tips
Find & Test Script
Automatically locates the closest server and runs a test against it.
curl -s https://raw.githubusercontent.com/R0GGER/public-iperf3-servers/main/findtest.sh | bash
Requires: curl, bash, jq, and iperf3
Using Docker
Run as client:
docker run -it --rm ghcr.io/r0gger/public-iperf3-servers:main -c iperf-ams-nl.eranium.net -p 5208
Run as server:
docker run -it --rm -p 5201:5201 -p 5201:5201/udp ghcr.io/r0gger/public-iperf3-servers:main -s
Understanding Output
- [ ID] Interval
- Time window for the measurement line
- Transfer
- Amount of data moved during the interval
- Bitrate
- Throughput achieved (Mbps or Gbps)
- Retr (TCP)
- TCP segments retransmitted - a high number indicates packet loss
- Jitter (UDP)
- Variation in packet arrival times (lower is better)
- Lost/Total Datagrams (UDP)
- Number and percentage of lost packets
- Sender/Receiver
- Summary for the entire test duration