How to Test Network Throughput with iperf3: Server, Client and Results

Learn how to test network throughput with iperf3: set up server and client, run TCP and UDP tests, and read the results accurately for real network diagnosis.

A Speedtest score tells you how fast your connection to the public Internet is. It says almost nothing about how quickly a file server in the same building feeds a workstation two floors up. When an application feels sluggish while Speedtest looks healthy, our engineers usually reach for iperf3. It measures raw throughput between two endpoints you control, free from web page overhead, disk bottlenecks, or a distant CDN sitting in the middle. Learning how to test network throughput with iperf3 is one of the fastest ways to separate a real network fault from a symptom that merely looks like one.

Why a Speedtest result is not enough for internal networks

Speedtest measures the path from your site to a test server somewhere on the open Internet. Internal traffic behaves very differently. It rarely leaves the building, and it crosses switches, VLANs, firewalls and often a routed core on the way. A perfectly healthy Internet line can hide a failing uplink or a misconfigured trunk sitting between two floors.

We see this pattern constantly. A database copy crawls, the ISP line tests fine, and everyone blames “the network” in general. Running iperf3 between the two real endpoints usually points to the bottleneck within minutes. The tool pushes a stream of data and reports the bandwidth it actually achieved, and that is precisely the figure you need before you can make a decision.

Installing iperf3 on both sides

You need iperf3 on both ends of the path. On Linux, install it from your package manager with apt or yum. On Windows, download the official binary. On macOS, Homebrew is the quickest route. Keep the versions identical on both machines. Mismatched builds can refuse to talk to each other, and we have lost more than one afternoon to exactly that problem.

Next, confirm that TCP port 5201 is open between the two machines. That is the default port, and a host firewall or a core-switch ACL will block it silently. If you cannot change the rules, pick another port with -p and open that instead. The test itself is harmless, but a blocked port looks identical to a broken network, so rule it out before you start diagnosing anything else.

Starting the server and running the first client test

The server simply waits for an incoming connection. On the receiving machine, run iperf3 -s. To listen on a different port, add -p 5202. On the sending machine, run iperf3 -c <server_IP> -t 30. The -t 30 flag keeps the test running for thirty seconds, long enough to smooth out short bursts that would otherwise distort the average.

By default the client sends data to the server, and that direction matters when your link is asymmetric. Add -R to reverse it, so the server sends and the client receives. Always run both directions. If a line delivers 900 Mbps upstream but only 300 Mbps downstream, that tells you something about provisioning or duplex settings that a single test would never reveal.

Parallel streams and when one TCP flow falls short

A single TCP connection does not always fill a long, fast pipe. Latency and the TCP window together cap how much data can be in flight at any moment. Adding -P 4 opens four streams in parallel. If four streams reach a much higher combined total than one, the single flow was the limiting factor rather than the link itself.

Do not push the stream count too far. Each stream consumes CPU on both test machines, and beyond a certain point the figure reflects how busy the hosts are instead of how fast the network is. Compare one stream against a few, and stop increasing once the gains flatten out.

TCP or UDP: choosing the right test

TCP is what your applications really use. It includes congestion control and retransmissions, so a TCP result approximates what a genuine file transfer would achieve. UDP sends at a fixed rate you specify, with no backoff at all. Use -u -b 500M to push 500 Mbps of UDP traffic, then read jitter and packet loss from the report that follows.

UDP earns its place when you validate voice, video or QoS policy, where a steady rate matters more than raw file-copy speed. Be careful with the target rate, though. Set it above what the path can carry and the loss figure describes your test setup rather than the network you meant to measure. Lower the rate until loss disappears, then raise it in small steps.

The TCP window is how much unacknowledged data a sender keeps in flight. On a link with high round-trip time, a small window caps throughput regardless of the bandwidth you purchased. Try -w 512K to test with a larger window. As a rough guide, the achievable rate is about the window size divided by the RTT. Measure the RTT with ping first so you know what to expect before the test begins.

If throughput stays stubbornly low, check MTU and MSS. A mismatch causes fragmentation or silently drops large packets. Verify the correct values against your operating system and device documentation rather than guessing.

Reading the output without fooling yourself

The Bitrate column shows average throughput over the run. Always compare the sender and receiver lines, because a large gap between them points to loss or buffer trouble somewhere along the path. For TCP, a high Retr count means packets were lost or congestion was hit. For UDP, watch Jitter and the Lost/Total ratio, since those two figures decide whether a voice call will sound clean.

For automation and history, add -J to produce JSON output. Store each result with a timestamp and compare them over time. A single run is only a snapshot. Trends are what expose a degrading link before users start filing tickets.

Common mistakes and how we avoid them

Disappointing numbers often originate on the test machine rather than the network. If the CPU sits near full load during the run, move the test to a stronger host or lower the target rate. A refused connection usually means the server is not running, or a firewall between the two ends is dropping port 5201.

Wi-Fi and NAT make results swing widely. For a reliable baseline, use a wired connection along the same path your users take. Never compare results across different iperf3 versions, or across devices with different configurations, unless you have recorded the conditions. A number without its context is not evidence of anything.

A field example from an office network

In one office of roughly 120 people, a file server on the second floor fed workstations on the fifth. Copies that should have been quick dragged on, yet the Internet line tested flawlessly. We ran iperf3 between the file server and a workstation, three runs each in TCP and UDP mode, and logged the time of day, the stream count, the ping RTT and the average throughput for every run.

The averages exposed a clear gap that individual runs had partly hidden. The culprit was a cable and switch port that had negotiated a lower link speed. The lesson is to record your conditions every time, because the same test on different switches, cabling or QoS policy will return different answers. Validate on your own hardware before drawing any conclusion.

Scheduling the measurement

A one-off test catches a problem only if you happen to run it at the right moment. For a steady picture, we schedule iperf3 with cron. A short shell script runs the test, writes JSON output and appends it to a log. We set an alert whenever throughput drops below the baseline recorded while the network was healthy. That baseline matters far more than any absolute number, because every network behaves differently.

Throughput testing and load validation answer different questions, so use each where it fits. If you are preparing a system for launch and want to model traffic patterns, our notes on kernel-level observability show how to pair active tests with passive telemetry for a fuller view. For the wider picture of how these measurements feed into network testing practice, our team also keeps a main library of infrastructure guides covering SD-WAN, integration testing and zero trust.

Frequently asked questions

Can iperf3 measure my Internet bandwidth?

It can, but only if you run the server on the far side and control it, such as a cloud virtual machine. Public Speedtest servers are the better choice for a quick check of your ISP line. iperf3 earns its keep between two endpoints you own.

Why is TCP slower than UDP in my test?

TCP backs off when it sees loss and waits for acknowledgements, which limits its rate. UDP sends at the rate you set regardless of loss, so it can report a higher figure while quietly dropping packets. Always check the loss number before celebrating the throughput.

Do I need iperf3 on both ends?

Yes. One side runs the server and the other runs the client. Install the same build on both machines so the versions match.

How long should a test run?

Thirty seconds is a sensible default. Very short runs catch bursts and mislead you. For a stable picture, repeat the test several times and average the results.

Can iperf3 replace a network monitoring tool?

No. iperf3 gives you a controlled measurement at a moment you choose, while monitoring tools watch the network continuously and keep history. Use iperf3 to validate a path, and use monitoring to watch it over time.

Related topics