iperf3 options and examples: a practical cheat sheet
iperf3 has dozens of options, but about twenty cover nearly every real test. This page lists them with a working example for each, checked against the iperf3 manual page for the current 3.22 release.
How options are passed
Almost every option is given on the client. The client sends the test parameters to the server over a separate control connection, so the server usually needs only -s (plus -p if you change the port). Most options have a short and a long form, for example -t and --time. Sizes and rates accept the suffixes K, M, G and T, as in -b 500M or -w 4M.
The cheat sheet
| Option | What it does | Example |
|---|---|---|
-s | Run as server. Listens on TCP port 5201 by default. | iperf3 -s |
-c host | Run as client and connect to host (name, IPv4 or IPv6 address). | iperf3 -c 192.0.2.10 |
-p n | Server port to listen on or connect to (default 5201). Use the same value on both sides. | iperf3 -c host -p 5202 |
-t n | Test length in seconds (default 10). | iperf3 -c host -t 60 |
-i n | Seconds between interval reports (default 1; 0 turns them off). | iperf3 -c host -t 60 -i 5 |
-P n | Number of parallel streams. From 3.16 each stream has its own thread. | iperf3 -c host -P 4 |
-R | Reverse: the server sends, the client receives. | iperf3 -c host -R |
--bidir | Send in both directions at the same time. | iperf3 -c host --bidir |
-u | Use UDP for the test data (the control connection stays TCP). | iperf3 -c host -u |
-b rate | Target bitrate. Default 1 Mbit/s for UDP, unlimited for TCP. Applies per stream with -P. 0 removes the limit. | iperf3 -c host -u -b 200M |
-l size | Read/write buffer length. TCP default 128 KB; UDP default based on path MTU, falling back to 1,460 bytes. | iperf3 -c host -u -b 50M -l 1200 |
-w size | Socket buffer (window) size, used on both client and server. | iperf3 -c host -w 8M |
-J | Output a JSON document instead of text, printed at the end of the test. | iperf3 -c host -J > result.json |
--logfile f | Write output to a file instead of the terminal. | iperf3 -c host --logfile run1.txt |
-O n | Run n extra seconds first and leave them out of the results, to skip TCP slow start. | iperf3 -c host -t 30 -O 3 |
-Z | Zero-copy sending, such as sendfile() instead of write(). Saves sender CPU. | iperf3 -c host -Z |
-4 / -6 | Force IPv4 or IPv6 when a name resolves to both. | iperf3 -c host.example.net -6 |
-B addr | Bind to the interface that owns addr. Works on client and server. | iperf3 -c host -B 198.51.100.5 |
--cport n | Use a fixed client port for the data streams (TCP and UDP only) instead of a random one. | iperf3 -c host --cport 40000 |
Useful extras
-Dand-1(server)-Druns the server in the background as a daemon.-1handles a single client and then exits, which is handy for one-off tests.-nand-k- Send a fixed number of bytes (
-n 1G) or blocks instead of running for a fixed time. You can use only one of-t,-nand-k. -f- Fix the units:
-f mfor Mbit/s,-f gfor Gbit/s. --get-server-output- Shows the server's own report at the end of the client output. It is only available if the test completes.
-C algo- Choose the TCP congestion control algorithm for the test, such as
-C bbr(Linux and FreeBSD only, and the algorithm must be available in the kernel). -M nand-N- Set the TCP maximum segment size, or disable Nagle's algorithm.
-A n- Pin iperf3 to CPU core n (Linux, FreeBSD and Windows). Useful on multi-socket servers.
-T textand--timestamps- Prefix every line with a label or a timestamp, which helps when several tests write to one log.
--forceflush- Flush output every interval, so you see lines immediately when piping to another program.
Examples for common jobs
A clean TCP baseline
iperf3 -c host -t 30 -O 3
Thirty seconds of measurement after three seconds of warm-up. Run it again with -R for the other direction.
Does more streams help?
iperf3 -c host -t 30 -P 1
iperf3 -c host -t 30 -P 8
If eight streams are much faster than one, a single TCP flow is being held back by window size, loss or CPU, not by link capacity.
Machine-readable results
iperf3 -c host -t 20 -J --logfile /var/tmp/iperf-$(date +%F-%H%M).json
Testing through a firewall that allows one port
# server
iperf3 -s -p 8443
# client: fixed source port as well
iperf3 -c host -p 8443 --cport 50000
Force the test over a specific link
iperf3 -c 2001:db8::10 -6 -B 2001:db8::5
About -w on Linux. Setting -w fixes the socket buffer and turns the request into a hard limit. Linux doubles the value you ask for (the extra is bookkeeping), and it caps it at net.core.rmem_max and wmem_max. If those maximums are small, a large -w is silently reduced. Usually it is better to leave -w out and let autotuning work; see Linux tuning.
Options that changed meaning
-bwas once spelled--bandwidth; it is now--bitrate, and the old name is deprecated but still accepted.-Creplaced--linux-congestion.- iperf 2 uses
-rand-dfor two-way tests. In iperf3 these do not exist; use-Ror--bidir. See iperf 2 vs iperf3.
Option lists change between releases. If an option is rejected, check iperf3 --version and iperf3 --help on both machines.