Mastering iperf: Install, Configure, and Run TCP/UDP Bandwidth Tests
This guide explains how to install iperf on Windows and Linux, configure it for TCP and UDP bandwidth testing, adjust UDP buffer settings, and interpret the resulting performance metrics, providing practical command examples and visual output for accurate network performance analysis.
iperf Installation
iperf is a network performance testing tool that can measure TCP and UDP bandwidth, packet loss, and transmission quality. Download the appropriate version from https://iperf.fr/iperf-download.php . For Windows, copy iperf.exe and cygwin1.dll to the %systemroot% directory. For Linux, install with:
yum -y install iperfTCP Bandwidth Test
Start the server: iperf -s -i 1 -p 3389 Start the client: iperf -c 172.19.16.97 -p 3389 -i 1 You can also omit the port and interval:
iperf -s iperf -c 172.19.16.97Example output (server on 10.0.0.14, client on 10.0.0.3) shows simultaneous upstream and downstream bandwidth:
Key parameters:
-s : start in server mode
-c : start in client mode
-t : test duration in seconds (e.g., -t 30)
-i : reporting interval (e.g., -i 5)
-d : simultaneous bidirectional test
-r : reverse test (server connects back to client)
-L : specify port for reverse connection
-w : set TCP window size
UDP Bandwidth Test
UDP mode is used to measure maximum bandwidth, jitter, and packet loss.
Server command: iperf -u -s Client command (example with 1000 Mbps target and 3‑second interval): iperf -u -c 10.0.0.14 -b 1000M -i 3 Result screenshot:
When testing high packet rates, adjust the UDP buffer size in /etc/sysctl.conf:
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216Apply the changes:
sysctl -pNetwork Packet Performance Test
Run the server with reporting interval and custom port: iperf -u -s -i 1 -p 3389 Run the client specifying packets per second and packet size:
iperf -u -c 172.19.16.97 -b 300000pps -l 100bit -i 1 -p 3389Result images show no packet loss up to 300 kpps, with loss appearing around 320 kpps, indicating the network’s practical packet‑per‑second limit.
Summary of important iperf options:
-s: start server
-c: start client
-t: test duration (seconds)
-i: reporting interval (seconds)
-d: bidirectional test
-L: port for reverse connection
-w: TCP window size
-b: set UDP bandwidth (bit/s) or packet rate (pps)
-l: set packet size (default 8 KB for TCP, 1470 B for UDP)
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
