NewCode CLOUD — 20% off your first month on all cloud VPSClaim

How to Test Server Bandwidth with iperf3 (and Why Speed Tests Disagree)

Your plan says 1 Gbps, a browser speed test says 300 Mbps, and a file download from China crawls at 2 MB/s. Which number is right? All of them — they measure different things. iperf3 is the standard tool for measuring the throughput between two specific machines, and it lets you control the variables that make other tests disagree.

This guide shows how to run iperf3 properly, read its output, and interpret the results for long-distance and cross-border links.

What iperf3 measures

iperf3 runs as a server on one machine and a client on another. The client sends as much data as the network allows for a set time and reports the throughput, retransmissions and (for UDP) loss and jitter. Unlike a speed-test website, you choose both ends, so you test exactly the path your users take.

Install

sudo apt install iperf3          # Ubuntu / Debian
sudo dnf install iperf3          # AlmaLinux / Rocky
brew install iperf3              # macOS

On Windows, download a build from the iperf website and run iperf3.exe from a command prompt.

Run a basic test

On your server:

iperf3 -s

If a firewall is active, open port 5201 temporarily:

sudo ufw allow 5201/tcp          # remove the rule when you are done

On the client:

iperf3 -c 203.0.113.10

Example output:

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   112 MBytes  94.0 Mbits/sec   23   sender
[  5]   0.00-10.04  sec   111 MBytes  92.8 Mbits/sec        receiver
  • Bitrate (receiver) is the number to report.
  • Retr counts TCP retransmissions — lost packets that had to be sent again. A few are normal; hundreds per second point to loss on the path.

Test both directions

By default the client uploads to the server. Users mostly download from servers, so also run reverse mode:

iperf3 -c 203.0.113.10 -R

Or both at once (iperf 3.7+):

iperf3 -c 203.0.113.10 --bidir

Directions can differ dramatically, especially on routes into and out of China, where the two directions may use different networks.

Single vs parallel streams

iperf3 -c 203.0.113.10 -P 8 -t 30

-P 8 opens eight connections at once; -t 30 runs for 30 seconds.

Test Shows
1 stream What a single download or file copy can achieve
4–8 streams Total capacity of the path and the port

If one stream gives 40 Mbps but eight streams give 300 Mbps, the network has capacity, but a single TCP connection cannot use it — typically because of distance (latency) and packet loss, not because the port is slow.

Why single connections are slow over distance

TCP can only have a limited amount of unacknowledged data in flight. The maximum throughput of one connection is roughly:

throughput ≈ window size ÷ round-trip time

With a 4 MB window and 150 ms round trip (Asia to the US), one connection tops out around 220 Mbps even on a perfect link. Packet loss makes it much worse, because classic TCP algorithms halve their speed on every loss event.

Two fixes, both on the sending side:

  1. BBR congestion control copes with loss and long distances far better than the default CUBIC. See enabling BBR.
  2. Larger TCP buffers for high-bandwidth, high-latency paths (also covered in the BBR guide).

Test before and after; on lossy international paths, BBR often multiplies single-stream throughput.

UDP tests: loss and jitter

TCP hides loss by retransmitting. UDP shows it directly, which matters for voice, video and games:

iperf3 -c 203.0.113.10 -u -b 50M -t 30

-b 50M sends at 50 Mbps. The result shows:

[  5]  0.00-30.00 sec  179 MBytes  50.0 Mbits/sec  0.412 ms  210/129310 (0.16%)  receiver
  • Jitter (0.412 ms): variation in packet arrival time.
  • Lost/Total (0.16%): packets that never arrived.

Do not set -b higher than the plan’s bandwidth — you will just measure your own overload. For real-time apps, loss under 1% and jitter under ~10 ms are generally comfortable.

Testing to and from China

To test the path your Chinese users take, you need a machine inside mainland China — a cloud server in Shanghai or Guangzhou, or an office connection. Then:

  1. Run iperf3 -s on your Hong Kong / Japan / US server.
  2. From the machine in China, run single-stream tests in both directions (-R).
  3. Repeat at 21:00 Beijing time (evening peak).
  4. Run MTR at the same time to see where any loss occurs — see reading MTR reports.

A premium route such as CN2 GIA typically keeps evening throughput close to the daytime figure; a congested standard route can drop sharply with many retransmissions. Choosing a route is covered in China carrier routes explained.

Public iperf3 servers

Public iperf3 servers exist in many cities for quick tests. They are shared, so results vary with other users’ load, and many limit test length. For decisions that matter, test between machines you control.

Why different tests disagree

Test Measures Why it differs
Browser speed test Your connection to a nearby test server Not your server’s path at all
wget/curl of a file One TCP stream from server to you Limited by latency and loss on that path
iperf3 -P 8 Path capacity with parallel streams Closer to port speed
Plan bandwidth (e.g. 30 Mbps CN2 GIA) Guaranteed capacity at the port The ceiling, not every path’s result

Practical checklist

  • Test from where your users are, not just from another data centre
  • Run both directions (-R or --bidir)
  • Compare 1 stream and 8 streams
  • Note retransmissions and run UDP for real-time apps
  • Repeat at peak hours for China traffic
  • Close port 5201 and stop iperf3 -s afterwards