We use cookies to understand how the site is used and to display ads. Analytics and advertising only run after you accept. You can change your choice anytime. Privacy policy

Skip to content
devvkit
$devvkit learn --librarie iperf3-guide

iperf3 Guide

[networking][bandwidth][throughput][benchmark]
Network Diagnostics
Install
sudo apt install iperf3
brew install iperf3
# Windows: download from iperf.fr
# Cross-platform: works between any OS combos

iperf3 measures real-world network throughput between a client and server. You run `iperf3 -s` on one host (server mode) and `iperf3 -c <server>` on another. It reports bandwidth, retransmissions, and CPU utilization for each test stream.

Key flags: `-P` for parallel streams (saturate multi-core), `-R` for reverse test (download instead of upload), `-t` for duration, `-u` for UDP test (shows jitter and packet loss), `-b` to set target bandwidth for UDP. Use `--bidir` for simultaneous upstream/downstream.

For baseline tests: run on the same VLAN to measure max throughput, then test across VPN or internet to see overhead. Combine with `-J` (JSON output) for automated benchmarking pipelines. GUI: JPerf (Java GUI wrapper), or iPerf3 for macOS.

Server Mode

Start server· Listen mode.
iperf3 -s                           # Default port 5201
iperf3 -s -p 8888                    # Custom port
iperf3 -s -D                         # Daemon mode (background)
# iperf3 -s -1                       # Single client, then exit

Client Tests

Basic throughput· Default TCP test.
iperf3 -c 192.168.1.10                          # Default 10s test
iperf3 -c 192.168.1.10 -t 30                     # 30-second test
iperf3 -c 192.168.1.10 -t 10 -i 1                # Report every 1 second
iperf3 -c 192.168.1.10 -P 4                      # 4 parallel streams
iperf3 -c 192.168.1.10 -R                        # Reverse (download test)
Bidirectional· Up + down simultaneously.
iperf3 -c 192.168.1.10 --bidir
# Shows both directions interleaved
# Great for testing VPN or proxy overhead
Wi-Fi test· Measure wireless quality.
iperf3 -c 192.168.1.10 -t 60 -i 5 -P 2 -R
# 60s test, 5s intervals, 2 streams, reverse direction
# Watch for: bandwidth fluctuations, retransmits = interference

UDP Tests

UDP bandwidth· Jitter and packet loss.
iperf3 -c 192.168.1.10 -u -b 100m              # UDP at 100 Mbps
iperf3 -c 192.168.1.10 -u -b 500m -l 1400        # 1400-byte packets
iperf3 -c 192.168.1.10 -u -b 0                   # Saturated UDP (flood)
# Output: bandwidth, jitter (ms), lost/total packets, loss %

Advanced

JSON output· Machine-readable results.
iperf3 -c 192.168.1.10 -J > results.json
# Parse with jq:
jq '.end.sum_received.bits_per_second' results.json
jq '.end.sum_sent.retransmits' results.json

# Compare multiple runs:
for i in 1 2 3; do
  iperf3 -c 10.0.0.1 -J -t 5 | jq '.end.sum_received.bits_per_second'
done
Bandwidth over time· Check stability.
iperf3 -c 192.168.1.10 -t 60 -i 1 -J | \
  jq -r '.intervals[].sum.bits_per_second' | \
  awk '{print NR, $1/1000000 " Mbps"}'  # Plot later

# Also: check CPU usage on server:
# iperf3 server-side output shows CPU utilization per test

Troubleshooting

Throughput to specific port· Test firewall rules.
# The -p on client matches server's -p:
iperf3 -s -p 5201                        # Server
iperf3 -c 192.168.1.10 -p 5201          # Client

# Test through NAT/firewall:
iperf3 -c external-server.com -p 5201 -P 1 -t 5
# If 0 bits/sec → firewall blocking port 5201
Trick: find MTU· Determine optimal MTU.
# Use --dont-fragment and vary --len to find MTU:
iperf3 -c 192.168.1.10 -M 1472 -l 1472 --dont-fragment   # Should work
iperf3 -c 192.168.1.10 -M 1473 -l 1473 --dont-fragment   # Should fail

# Also check with ping:
ping -M do -s 1472 192.168.1.10  # Max standard Ethernet MTU = 1500