Skip to content

iperf3 Cheat Sheet

A comprehensive iperf3 cheat sheet with real-world server and client examples. Learn how to measure network bandwidth, throughput, latency, TCP and UDP performance, parallel streams, live speed monitoring, JSON output parsing, timestamps, and advanced tuning for accurate network performance testing


Install iperf version 2 on Gentoo Linux

  • iperf 2
emerge =net-misc/iperf-2.2.1

Install iperf3 version 3 on Gentoo Linux

  • iperf3
emerge =net-misc/iperf-3.19.1

Server

Run iperf3 server on custom port with interval output and timestamps

iperf3 -s -i 1 -f M -p 1337 --timestamp

Run as a daemon (background service)

iperf3 -s -D -p 1337

Bind to a specific interface or IP

iperf3 -s -B 192.168.1.10 -p 1337

One-shot server (exit after one test)

iperf3 -s -1 -p 1337

JSON output on the server

iperf3 -s -J -p 1337

Increase verbosity (debugging)

iperf3 -s -V -p 1337

Performance / behavior tuning (server-side)

Allow reverse tests (server → client)

  • (Client uses -R, server just needs to be running)

  • Server:

iperf3 -s -p 1337
  • Client:
iperf3 -c server -R

Limit server CPU usage (nice)

nice -n 10 iperf3 -s -p 1337

Run multiple servers on different ports

iperf3 -s -p 1337 &
iperf3 -s -p 1338 &
iperf3 -s -p 1339 &

TCP / UDP–specific server tricks

UDP mode support (client-driven)

Server will report:

  • Packet loss
  • Jitter
  • Out-of-order packets

  • Server

iperf3 -s -p 1337
  • Client:
iperf3 -c server -u -b 1G

Increase socket buffer limits (OS-level, critical)

  • iperf3 is often limited by kernel buffers, not iperf itself.
sysctl -w net.core.rmem_max=134217728
sysctl -w net.core.wmem_max=134217728

Server - Logging & observability tricks

Log server output with timestamps

iperf3 -s -i 1 --timestamps -p 1337 | tee /var/log/iperf3.log

!!! Example "Combine with ts for readable timestamps

```bash
iperf3 -s -i 1 -p 1337 | ts '%Y-%m-%d %H:%M:%S'
```

Run inside tmux with status context

tmux new -s iperf3 'iperf3 -s -i 1 -p 1337'

Security / safety considerations

Restrict access with firewall

  • iperf3 has no authentication — firewalling matters.
iptables -A INPUT -p tcp --dport 1337 -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 1337 -j DROP

Run as non-root (recommended)

useradd -r -s /usr/sbin/nologin iperf
sudo -u iperf iperf3 -s -p 1337

Power user server setup (recommended baseline)

iperf3 -s -i 1 -p 1337 --timestamps -1

10 parallel TCP streams (default output in Mbit/s)

iperf3 -c linux-shell.se -P 10

Client

Setup a simple server listening on port 1337

Format flag Output unit Description
iperf3 -f k Kbit/s Kilobits per second
iperf3 -f m Mbit/s Megabits per second (iperf3 default)
iperf3 -f g Gbit/s Gigabits per second
iperf3 -f t Tbit/s Terabits per second
iperf3 -f K KB/s Kilobytes per second
iperf3 -f M MB/s Megabytes per second
iperf3 -f G GB/s Gigabytes per second
iperf3 -f T TB/s Terabytes per second

Live current and peak throughput (MB/s)

Screenshot

iperf3 -c linux-shell.se -P 10 -J | awk '
$0 ~ /"sum":/ { seen=1 }
seen && /"bits_per_second"/ {
  bps=$2; gsub(/,/, "", bps)
  cur=bps/8/1024/1024
  if (cur>max) max=cur
  printf "\rCUR: %6.1f MB/s | PEAK: %6.1f MB/s", cur, max
  fflush()
}
END { print "" }
'

Live total throughput (simplified JSON parser)

iperf3 -c linux-shell.se -P 10 -J | awk '
$0 ~ /"sum":/ { seen_sum=1 }
seen_sum && /"bits_per_second"/ {
  bps=$2
  gsub(/,/, "", bps)
  printf "\rTOTAL: %.1f MB/s", bps/8/1024/1024
  fflush()
}
END { print "" }
'

Live total throughput (single-line MB/s output)

iperf3 -c linux-shell.se -P 10 -J | awk '
/"bits_per_second"/ && /"sum"/ { next }
/"bits_per_second"/ && seen_sum {
  bps=$2
  gsub(/,/, "", bps)
  mbps = bps/8/1024/1024
  printf "\rTOTAL: %.1f MB/s", mbps
  fflush()
}
$0 ~ /"sum":/ { seen_sum=1 }
'
echo

iperf3 live current and peak throughput with timestamps

iperf3 -c linux-shell.se -P 10 -J --timestamps | awk '
$0 ~ /"sum":/ { seen=1 }
seen && /"bits_per_second"/ {
  bps=$2; gsub(/,/, "", bps)
  cur=bps/8/1024/1024
  if (cur>max) max=cur
  printf "\rCUR: %6.1f MB/s | PEAK: %6.1f MB/s", cur, max
  fflush()
}
END { print "" }
'

10 parallel TCP streams with throughput shown in MB/s

iperf3 -c linux-shell.se -P 10 -f M

10 parallel TCP streams with throughput shown in MB/s and update every second

iperf3 -c linux-shell.se -P 10 -f M -i 1    

Live total throughput (single-line MB/s output)

iperf3 -c linux-shell.se -P 10 -J | awk '
/"bits_per_second"/ && /"sum"/ { next }
/"bits_per_second"/ && seen_sum {
  bps=$2
  gsub(/,/, "", bps)
  mbps = bps/8/1024/1024
  printf "\rTOTAL: %.1f MB/s", mbps
  fflush()
}
$0 ~ /"sum":/ { seen_sum=1 }
'
echo

Live total throughput (simplified JSON parser)

iperf3 -c linux-shell.se -P 10 -J | awk '
$0 ~ /"sum":/ { seen_sum=1 }
seen_sum && /"bits_per_second"/ {
  bps=$2
  gsub(/,/, "", bps)
  printf "\rTOTAL: %.1f MB/s", bps/8/1024/1024
  fflush()
}
END { print "" }
'

Live current and peak throughput (MB/s)

iperf3 -c linux-shell.se -P 10 -J | awk '
$0 ~ /"sum":/ { seen=1 }
seen && /"bits_per_second"/ {
  bps=$2; gsub(/,/, "", bps)
  cur=bps/8/1024/1024
  if (cur>max) max=cur
  printf "\rCUR: %6.1f MB/s | PEAK: %6.1f MB/s", cur, max
  fflush()
}
END { print "" }
'

Speedtest the listening server

iperf3 -c listening.server.ip

Run iperf3 in a daemon

iperf3 --daemon

Use udp rather then tcp

iperf3 --udp

Time in seconds to transmit

iperf3 --time 10

Number of bytes to transmit (instead of -t)

iperf3 --bytes 10K/M/G

Run test in 10 parallel threads

iperf3 -P 10 -c listening.server.ip

Run iperf3 on a custom port

iperf3 --port 9090

Report speed in prefered format

Kbits, Mbits, Gbits and TBits is available, use uppercase character for specify format

iper3 --format kmgtK/M/G/T

Set seconds between periodic throughput reports

iperf3 --interval 10

Write a pidfile when using iperf3

iperf --pidfile /var/run/iperf3.pid

xmit or recvieve the specified file

iperf3 --file foo.bin

Set CPU affinity

iperf3 --affinity n/n,m 

Bind nic interface to use

iperf3 --bind [host.on.ip__OR__interfaceNic]

Print report in JSON format

iperf3 --json

Run iperf3 in verbose mode

iperf3 -V

Force flush output at every interval

Format must be set with srftime(3)

iperf3  --forceflush=format

Run with debug mode enable

  • 1 = lowest
  • 4 = max
iperf3 --debug=[1-4]

Print iperf3 version

iperf3 --version

RSA private key used to decrypt authentication credentials

iperf3 --rsa-private-key-path    

Path to the configuration file containing user credentials

iperf3  --authorized-users-path   

Time skew threshold (in seconds) between the server

iperf3  --time-skew-threshold     

Set the IPv6 flow label (only supported on Linux)

iperf3 --flowlabel N         

Use a 'zero copy' method of sending data

iperf3 --zerocopy            

Perform network throughput tests

  • Server side
iperf -s -p 80
  • Client side
iperf -c <server IP address> --parallel 2 -i 1 -t 2 -p 80