iperf
Introduction
This cheat sheet provides a quick reference for some common iperf commands and concepts. iperf is a command-line utility used to measure network bandwidth and performance by generating and analyzing network traffic.
iperf Concepts
Server and Client
iperf operates in two modes: server and client.
Server Mode: Start
iperfin server mode to listen for incoming connections.iperf -sClient Mode: Start
iperfin client mode to connect to a remote server for testing.iperf -c server_ip
TCP and UDP Tests
iperf can perform tests using TCP or UDP protocols.
TCP Test (Default): Measure TCP bandwidth.
iperf -s # Server
iperf -c server_ip # ClientUDP Test: Measure UDP bandwidth.
iperf -u -s # Server
iperf -u -c server_ip # Client
Test Duration
Specify the test duration using the -t option (in seconds).
- Run a test for 10 seconds:
iperf -t 10 -c server_ip
Bandwidth Units
You can control the display units for bandwidth results.
- Display results in Kbps (Kilobits per second):
iperf -u -b 1M -c server_ip
Parallel Streams
iperf can use multiple parallel streams for testing.
- Use 4 parallel streams:
iperf -P 4 -c server_ip
Reverse Test
Perform a reverse test (server sends data to client).
- Reverse test with TCP:
iperf -c server_ip -R
Interval Display
Display intermediate results at specified intervals.
- Display results every 5 seconds:
iperf -i 5 -c server_ip
iperf Command-Line
Start
iperfin server mode:iperf -sStart a TCP bandwidth test (client mode):
iperf -c server_ipStart a UDP bandwidth test (client mode):
iperf -u -c server_ipSet the test duration to 30 seconds (client mode):
iperf -t 30 -c server_ipUse 4 parallel streams (client mode):
iperf -P 4 -c server_ipDisplay results every 10 seconds (client mode):
iperf -i 10 -c server_ip
Conclusion
This cheat sheet covers some common iperf commands and concepts. iperf is a powerful tool for measuring network bandwidth and performance, making it useful for network diagnostics, tuning, and testing; refer to the official iperf documentation for more in-depth information and advanced usage.