To use iPerf3, run iperf3 -s on one machine and iperf3 -c <server-ip> on the other. The client pushes traffic for 10 seconds, and the receiver line at the bottom tells you what the path actually delivered. Speed test sites measure your path to someone else's server. iPerf3 measures the exact path you care about, between two machines you control.
Every output block below is real, captured on iperf 3.20 across a Cisco IOS XE 17.18.2 router built in my home lab. You get the commands, how to read each column, the errors you will hit, and one controlled failure: a 20 Mbit/s policer that a one-direction test would have missed. This article is part of our complete iPerf guide.
How iPerf3 Works
iPerf3 uses a client-server model. One machine runs as the server and listens on TCP port 5201. The other runs as the client, connects, and either pushes as much TCP traffic as it can or sends a paced UDP stream at the -b rate (1 Mbit/sec if you do not set one). Tests last 10 seconds by default. Both sides then report what was sent and what actually arrived.
That last distinction matters. The sender reports what it handed to the network. The receiver reports what survived the trip. On a healthy path the two numbers are nearly identical. When they diverge, the network is dropping or delaying traffic in between, and that gap is your first troubleshooting clue.
Lab Setup
The test path is deliberately simple: one routed hop, so every change in the numbers has one place to come from.
| Role | Address | Software |
|---|---|---|
| Client | 192.0.2.10/24, gateway 192.0.2.1 | Linux, iperf 3.20 |
| Router IP-R1 | Et0/1 192.0.2.1, Et0/2 198.51.100.1 | Cisco IOS XE 17.18.2 |
| Server | 198.51.100.10/24, gateway 198.51.100.1 | Linux, iperf 3.20 |
Ping RTT across the router averaged 1.375 ms. The router config is just two routed interfaces:
hostname IP-R1
!
interface Ethernet0/1
description TO-IPERF-CLIENT
ip address 192.0.2.1 255.255.255.0
no shutdown
!
interface Ethernet0/2
description TO-IPERF-SERVER
ip address 198.51.100.1 255.255.255.0
no shutdownAnd the two Linux hosts:
# client
sudo ip addr add 192.0.2.10/24 dev eth1
sudo ip route add 198.51.100.0/24 via 192.0.2.1
# server
sudo ip addr add 198.51.100.10/24 dev eth1
sudo ip route add 192.0.2.0/24 via 198.51.100.1Step 1: Install iPerf3
On Debian and Ubuntu:
sudo apt install iperf3On Red Hat family systems use sudo dnf install iperf3, and on macOS brew install iperf3. Check the version with iperf3 --version; both ends should run iperf 3.x. iPerf3 does not interoperate with iPerf2, so an iPerf2 client cannot talk to an iPerf3 server (see iPerf2 vs iPerf3 for why they are separate tools). Windows is covered in its own section below.
Step 2: Start the Server
iperf3 -sThat is the whole job. The server binds to port 5201 on all interfaces and waits:
-----------------------------------------------------------
Server listening on 5201 (test #1)
-----------------------------------------------------------An iPerf3 server handles exactly one test at a time. A second client connecting mid-test gets refused with a busy error, covered in the errors section below. For daemon mode, custom ports and logging, see running an iPerf3 server.
Step 3: Run the Client
From the other machine, point -c at the server's IP. Here is the baseline run from the lab client (192.0.2.10) to the server (198.51.100.10) through IP-R1:
$ iperf3 -c 198.51.100.10
Connecting to host 198.51.100.10, port 5201
[ 5] local 192.0.2.10 port 41942 connected to 198.51.100.10 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 14.8 MBytes 124 Mbits/sec 137 17.0 KBytes
[ 5] 1.00-2.00 sec 14.2 MBytes 119 Mbits/sec 127 29.7 KBytes
[ 5] 2.00-3.00 sec 15.5 MBytes 130 Mbits/sec 130 14.1 KBytes
[ 5] 3.00-4.00 sec 15.6 MBytes 131 Mbits/sec 174 17.0 KBytes
[ 5] 4.00-5.00 sec 16.0 MBytes 134 Mbits/sec 123 39.6 KBytes
[ 5] 5.00-6.00 sec 18.9 MBytes 158 Mbits/sec 172 15.6 KBytes
[ 5] 6.00-7.00 sec 20.6 MBytes 173 Mbits/sec 179 11.3 KBytes
[ 5] 7.00-8.00 sec 18.1 MBytes 152 Mbits/sec 192 25.5 KBytes
[ 5] 8.00-9.00 sec 15.4 MBytes 129 Mbits/sec 159 14.1 KBytes
[ 5] 9.00-10.00 sec 15.4 MBytes 129 Mbits/sec 174 12.7 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 164 MBytes 138 Mbits/sec 1567 sender
[ 5] 0.00-10.00 sec 164 MBytes 138 Mbits/sec receiver
iperf Done.The path delivered 138 Mbits/sec, and the sender and receiver lines agree to the megabyte. That is the baseline every later test gets compared against.
Reading the Output
One line per second by default. Transfer is data moved in that interval; Bitrate is the rate. The final sender and receiver lines are the numbers to quote.
TCP segments the sender resent. Retransmits usually point at loss on the path, but reordering and the sender's own NIC or queue can trigger them too, so treat the count as a symptom to correlate (UDP loss test, interface counters), not proof the network dropped packets. This lab path shows 835 retransmits even with TCP paced to 50 Mbit/s, so compare against your own baseline: a count that jumps under the same load points at congestion or loss.
How much unacknowledged data TCP is willing to keep in flight. Watch it grow, then get cut when loss occurs. Here it swings between 11.3 and 39.6 KBytes on the baseline, and collapses to as low as 1.41 KBytes behind the policer later in this article. This is TCP congestion control working in real time.
Sender = handed to the network. Receiver = actually delivered. In the UDP overload test below, the sender claims 200 Mbits/sec while the receiver got 187 and lost 6.7% of datagrams. The receiver line is the truth about the path.
The Flags You Will Actually Use
-t 30Run for 30 seconds instead of 10. Longer tests smooth out TCP slow start and give steadier numbers.-O 3Omit the first 3 seconds from the summary so slow start does not drag the average down. Omitted intervals are marked (omitted).-RReverse mode: the server sends, the client receives. Tests the download direction without touching the far machine.--bidirBoth directions at once on two streams, labeled [TX-C] and [RX-C] in the output.-u -b 50MUDP at a fixed 50 Mbit/sec, reporting jitter and loss. Without -b, UDP runs at only 1 Mbit/sec. See iPerf3 UDP testing.-b 50MOn a TCP test, pace the sender to 50 Mbit/sec instead of sending as fast as possible.-P 4Four parallel streams, summed on a [SUM] line. Reveals per-flow limits; see parallel streams and window size.-i 5Report every 5 seconds instead of every 1. Less noise on long tests.-f MPrint MBytes/sec instead of Mbits/sec (capital M = bytes, lowercase m = bits).-p 5202Use a different port. The server must be started with the same -p.-B 192.0.2.10Bind to one local address, so a host with several NICs tests the interface you meant.--connect-timeout 5000Give up after 5,000 ms if the server never answers, instead of waiting on TCP retries.-s -DRun the server as a background daemon. Details in running an iPerf3 server.-JJSON output for scripts and monitoring pipelines.
iPerf3 Quick Reference
Free with a PingLabz account · 4 pages · US Letter PDF
TCP, reverse mode, parallel streams, UDP, and JSON commands in one place. Includes Linux output examples and a worksheet for repeatable tests.
Already a member? Sign in.
Testing the Other Direction with -R
By default the client sends. Add -R and the server sends instead, which is how you test download speed from the client's point of view:
$ iperf3 -c 198.51.100.10 -R
Connecting to host 198.51.100.10, port 5201
Reverse mode, remote host 198.51.100.10 is sending
[ 5] local 192.0.2.10 port 37096 connected to 198.51.100.10 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 15.9 MBytes 133 Mbits/sec
...
[ 5] 9.00-10.00 sec 14.2 MBytes 120 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate RetrNote the first line: Reverse mode, remote host 198.51.100.10 is sending. In reverse mode the Retr count on the sender line belongs to the server, because the server is the one transmitting. Downloads ran at 125 Mbits/sec against 138 for uploads, which is normal variation on this path.
To load both directions at the same moment, use --bidir. Each stream gets a role tag: [TX-C] is the client transmitting, [RX-C] is the client receiving.
$ iperf3 -c 198.51.100.10 --bidir
[ ID][Role] Interval Transfer Bitrate Retr
[ 5][TX-C] 0.00-10.00 sec 85.9 MBytes 72.0 Mbits/sec 1189 sender
[ 5][TX-C] 0.00-10.00 sec 85.8 MBytes 71.9 Mbits/sec receiver
[ 7][RX-C] 0.00-10.00 sec 88.6 MBytes 74.3 Mbits/sec 1032 sender
[ 7][RX-C] 0.00-10.00 sec 88.4 MBytes 74.1 Mbits/sec receiverTogether the two directions moved about 146 Mbits/sec (71.9 + 74.1), close to the one-way ceiling. On a full-duplex path with headroom, each direction holds near its solo number. A flat total means something in the middle is shared, here the router's forwarding capacity.
Run both directions before drawing conclusions. Asymmetric results are common (policing in one direction, duplex issues, asymmetric routing), and testing only one way hides half the story. The failure test below proves it.
Parallel Streams with -P
$ iperf3 -c 198.51.100.10 -P 4
...
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 41.2 MBytes 34.6 Mbits/sec 810 sender
...
[ 11] 0.00-10.01 sec 44.6 MBytes 37.4 Mbits/sec receiver
[SUM] 0.00-10.00 sec 170 MBytes 143 Mbits/sec 3595 sender
[SUM] 0.00-10.01 sec 169 MBytes 142 Mbits/sec receiverRead the [SUM] receiver line: 142 Mbits/sec. Four streams barely beat one stream's 138, so a single TCP flow was not the limit here. The path was. On a long, fast WAN the opposite often happens: one stream stalls on its window, and -P 4 jumps well past it. That difference tells you whether to tune hosts or look at the network. Window tuning is covered in iPerf3 parallel streams and TCP window size.
UDP Testing: Jitter and Loss
UDP does not back off, so it measures loss and jitter at a rate you choose. Always set -b. Without it, iPerf3 sends just 1.05 Mbits/sec (906 datagrams in this lab), which tells you almost nothing. At 20 Mbit/s the path was clean:
$ iperf3 -c 198.51.100.10 -u -b 20M
[ 5] 0.00-10.00 sec 23.8 MBytes 20.0 Mbits/sec 0.000 ms 0/17267 (0%) sender
[ 5] 0.00-10.00 sec 23.8 MBytes 20.0 Mbits/sec 0.078 ms 0/17267 (0%) receiverPush past what the path can carry and the receiver line shows the damage:
$ iperf3 -c 198.51.100.10 -u -b 200M
[ 5] 0.00-10.00 sec 238 MBytes 200 Mbits/sec 0.000 ms 0/172670 (0%) sender
[ 5] 0.00-10.00 sec 223 MBytes 187 Mbits/sec 0.032 ms 11506/172670 (6.7%) receiverThe sender line always shows 0% loss, because the sender cannot know what was lost. The receiver counted 11,506 of 172,670 datagrams missing (6.7%) and delivered 187 Mbits/sec. Jitter is the variation in packet arrival time, and for voice and video it matters as much as loss. More on UDP in iPerf3 UDP testing: bandwidth, jitter, and packet loss.
JSON Output for Automation
Add -J and iPerf3 emits the entire test as structured JSON, ideal for monitoring systems or CI checks. Pull the number you care about with jq:
$ iperf3 -c 198.51.100.10 -J > run.json
$ jq '.end.sum_received.bits_per_second' run.json
151790271.35017678
$ jq '.end.sum_sent.retransmits' run.json
1361
$ jq '.start.version, .start.tcp_mss_default' run.json
"iperf 3.20"
1448That run delivered 151.8 Mbit/s with 1,361 retransmits. On fast links also check .end.cpu_utilization_percent: if host_total or remote_total nears 100%, the host CPU is the bottleneck, not the network. The server here sat at 29.1%.
What Breaks: A Policer Only One Direction Sees
Here is the failure that makes the both-directions rule concrete. I applied a 20 Mbit/s policer outbound on IP-R1's server-facing interface, the kind of rate limit a provider or a forgotten QoS policy leaves behind:
policy-map POLICE-20M
class class-default
police cir 20000000 conform-action transmit exceed-action drop
!
interface Ethernet0/2
service-policy output POLICE-20MThe upload test collapsed:
$ iperf3 -c 198.51.100.10
[ 5] 0.00-1.00 sec 2.75 MBytes 23.0 Mbits/sec 111 5.66 KBytes
[ 5] 1.00-2.00 sec 2.50 MBytes 21.0 Mbits/sec 79 2.83 KBytes
[ 5] 2.00-3.00 sec 2.12 MBytes 17.8 Mbits/sec 101 1.41 KBytes
...
[ 5] 0.00-10.00 sec 23.1 MBytes 19.4 Mbits/sec 922 sender
[ 5] 0.00-10.00 sec 22.9 MBytes 19.2 Mbits/sec receiverReceiver throughput fell from 138 to 19.2 Mbits/sec, just under the 20 Mbit/s CIR. Cwnd shrank to between 1.41 and 15.6 KBytes as TCP kept hitting the policer and backing off. The download test, run seconds later, barely noticed:
$ iperf3 -c 198.51.100.10 -R
[ 5] 0.00-10.00 sec 131 MBytes 110 Mbits/sec 1195 sender
[ 5] 0.00-10.00 sec 131 MBytes 110 Mbits/sec receiver110 Mbits/sec. If you only ran -R, or only tested from the server side, this path looks healthy. UDP at 30 Mbit/s showed the limit just as clearly: the receiver got 19.9 Mbits/sec and counted 34% loss.
$ iperf3 -c 198.51.100.10 -u -b 30M
[ 5] 0.00-10.00 sec 35.8 MBytes 30.0 Mbits/sec 0.000 ms 0/25901 (0%) sender
[ 5] 0.00-10.00 sec 23.7 MBytes 19.9 Mbits/sec 0.052 ms 8702/25899 (34%) receiverThe router confirms where the traffic went. After the policed TCP and UDP runs:
IP-R1#show policy-map interface Ethernet0/2
Ethernet0/2
Service-policy output: POLICE-20M
Class-map: class-default (match-any)
86900 packets, 67954456 bytes
...
police:
cir 20000000 bps, bc 625000 bytes
conformed 77380 packets, 53758446 bytes; actions:
transmit
exceeded 9514 packets, 14195300 bytes; actions:
dropThe exceeded ... drop counter is the decisive line: 9,514 packets dropped by policy, not by a bad cable or a busy CPU. Removing the policer with no service-policy output POLICE-20M brought the upload test back to 107 Mbits/sec on two consecutive runs, in line with the unpoliced range of 107 to 138 seen across this session.
The pattern to remember: one direction near a round number (19.2 against a 20 Mbit/s limit), the other direction normal, and TCP retransmits plus UDP loss only on the slow side. That is a rate limit until proven otherwise. For a full diagnosis workflow, see troubleshooting slow throughput with iPerf3, and to see what loss does to latency under load, read iPerf3 latency under load.
iPerf3 Errors and What They Mean
Every message below came from the same lab. Three of them start with the same words, so read to the end of the line.
| Error ends with | What happened in the lab | Fix |
|---|---|---|
Connection refused | Client used -p 5202; nothing listened there. The server host answered with a TCP reset. | Start the server, or match -p on both ends. |
No route to host | An ACL on IP-R1 denied TCP 5201 and the router sent an ICMP unreachable. Failed in 0.19 s. | Permit TCP 5201 (and UDP 5201 for -u) through the ACL or firewall. |
Connection timed out | Same ACL with no ip unreachables, so the deny was silent. Failed after 5.19 s with --connect-timeout 5000. | Same as above. Silent drops usually mean a firewall. |
the server is busy running a test. try again later | A second client connected while an 8-second test was running. | Wait, or run more servers on other ports with -p. |
The first three share the same long prefix, so only the last words differ:
iperf3: error - unable to connect to server - server may have stopped running or use a different port, firewall issue, etc.: Connection refusedThe ACL that produced the second and third errors, and its counter after the attempts:
ip access-list extended BLOCK-IPERF
10 deny tcp any host 198.51.100.10 eq 5201
20 permit ip any any
!
interface Ethernet0/1
ip access-group BLOCK-IPERF in
IP-R1#show ip access-lists BLOCK-IPERF
Extended IP access list BLOCK-IPERF
10 deny tcp any host 198.51.100.10 eq 5201 (6 matches)
20 permit ip any any-u, iPerf3 opens a TCP control connection to port 5201 first. A firewall that permits only UDP 5201 still fails the test with one of the connect errors above.How to Use iPerf3 on Windows
ESnet, which maintains iPerf3, officially supports Linux, FreeBSD and macOS only. Windows builds are community-compiled with Cygwin, and ESnet's download page points to third-party binaries. Download the zip, extract it, and run it from PowerShell in that folder:
.\iperf3.exe -s
.\iperf3.exe -c 198.51.100.10 -RIf the Windows machine is the server, allow port 5201 through Windows Defender Firewall from an elevated PowerShell:
New-NetFirewallRule -DisplayName "iperf3 TCP" -Direction Inbound -Protocol TCP -LocalPort 5201 -Action Allow
New-NetFirewallRule -DisplayName "iperf3 UDP" -Direction Inbound -Protocol UDP -LocalPort 5201 -Action AllowExpect lower peak numbers than Linux on the same hardware; ESnet explains why the Windows builds trail native tools. For multi-gigabit testing, put a Linux host on each end, or use iPerf2, which ESnet recommends for Windows.
A Sensible First Test, Step by Step
- Confirm reachability first:
ping -c 3 198.51.100.10. Note the round-trip time; you will want it later if throughput looks low. - Start the server:
iperf3 -son the far machine. - Run 30 seconds of TCP and drop slow start:
iperf3 -c 198.51.100.10 -t 30 -O 3. - Run the reverse direction: add
-R. Compare the two receiver lines. - Run UDP at a rate just below what you expect:
iperf3 -c 198.51.100.10 -u -b 50M. Any loss on the receiver line is worth chasing. - If numbers disappoint, do not guess. Follow the method in troubleshooting slow throughput with iPerf3, and capture the slow direction with Wireshark to see the retransmits on the wire.
FAQ
What port does iPerf3 use?
TCP 5201 by default, on the server. Every test opens a TCP control connection to 5201, and the data runs over TCP 5201 or, with -u, UDP 5201. Change it with -p on both ends.
Why is iPerf3 slower than my link speed?
Something in the path, or one of the hosts, is the limit: a policer or shaper, a duplex or speed mismatch, a busy firewall, a maxed-out host CPU, or a TCP window too small for the round-trip time. Compare -R against the normal direction, try -P 4, and check the JSON CPU figures. A result near a round number, like 19.2 Mbit/s against a 20 Mbit/s policer here, usually means a configured limit.
How do I test upload and download with iPerf3?
The default test is upload from the client. Add -R for download, or --bidir to run both at once. Quote the receiver line for each.
Should I use TCP or UDP with iPerf3?
Use TCP to find out how much throughput an application would get. Use UDP with -b to check loss and jitter at a specific rate, such as the bandwidth a voice or video stream needs.
Can I use a public iPerf3 server?
Yes, public servers exist, but they test the path to that server across the internet, and each runs one test at a time, so busy errors are common. For troubleshooting your own network, run the server on a host you control at the far end of the path in question.
Does iPerf3 work with iPerf2?
No. The protocols are different, so both ends must run iPerf3. See iPerf2 vs iPerf3.
Scope: this lab tested IPv4 over one routed hop; Windows commands are from ESnet and Microsoft documentation, not a lab run.
Key Takeaways
iperf3 -son one end andiperf3 -c <server>on the other is the whole tool. Quote the receiver line, not the sender's.- Always test both directions. A 20 Mbit/s policer cut upload to 19.2 Mbit/s while
-Rstill showed 110. - Retr and Cwnd only mean something against a baseline. A jump in retransmits with a collapsing Cwnd points at loss in the path.
- Read error messages to the end: refused, no route and timed out each point at a different cause. Reach for
-Jthe moment you want to script any of it.
For the full picture of what iPerf can do (UDP, parallel streams, version differences, server hardening), start at the iPerf complete guide.
Want the full troubleshooting sequence? Slow Network Throughput: A Troubleshooting Workbook adds 14 pages of worked cases, checks, and worksheets. Included with PingLabz Pro.