Table of Contents
Overview
iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning various parameters related to timing, buffers, and protocols (TCP, UDP, SCTP).
Key Features
- Measure bandwidth, loss, and jitter
- Support for IPv4 and IPv6
- Client and server functionality
- Multiple simultaneous connections
- TCP window size adjustment
- UDP bandwidth specification
Installation
Ubuntu (22.04/24.04)
sudo apt update
sudo apt install iperf3MacOS
brew install iperf3Basic Syntax
Server Mode
# Basic server
iperf3 -s
# Server on specific port
iperf3 -s -p 5201
# Server with detailed output
iperf3 -s -VClient Mode
# Basic client test
iperf3 -c SERVER_IP
# Client with specific duration (in seconds)
iperf3 -c SERVER_IP -t 30
# Client with specific port
iperf3 -c SERVER_IP -p 5201Common Use Cases
1. TCP Bandwidth Test
# Server
iperf3 -s
# Client
iperf3 -c SERVER_IP -t 30 -i 1-t 30: Run for 30 seconds-i 1: Output interval every 1 second
2. UDP Bandwidth Test
# Server
iperf3 -s
# Client
iperf3 -c SERVER_IP -u -b 100M-u: Use UDP-b 100M: Set bandwidth target to 100 Mbits/sec
3. Multiple Parallel Streams
# Test with 10 parallel streams
iperf3 -c SERVER_IP -P 104. Reverse Mode Test
# Server sends, client receives
iperf3 -c SERVER_IP -RAdvanced Options
TCP Window Size
# Set TCP window size
iperf3 -c SERVER_IP -w 256KJSON Output
# Output results in JSON format
iperf3 -c SERVER_IP -JBidirectional Test
# Run bidirectional test
iperf3 -c SERVER_IP --bidirBest Practices
-
Testing Methodology
- Always run multiple tests
- Test at different times of day
- Use consistent test durations
- Monitor system resources during tests
-
Security Considerations
# Bind to specific IP iperf3 -s --bind SERVER_IP # Set authentication iperf3 -s --rsa-private-key-path /path/to/private_key -
Performance Tips
- Disable system sleep during tests
- Close unnecessary applications
- Monitor CPU usage
- Consider network conditions
Troubleshooting
Common Issues and Solutions
-
Connection Refused
# Check if server is running ps aux | grep iperf3 # Verify port is open ss -tulpn | grep 5201 -
Poor Performance
# Check CPU usage top -n 1 # Monitor network interface ifconfig INTERFACE_NAME -
Permission Issues
# Check firewall rules sudo ufw status # Check port availability sudo lsof -i :5201
Debug Mode
# Run with debug output
iperf3 -s -d
iperf3 -c SERVER_IP -dExample Test Scenarios
1. Network Baseline Test
# Run a 5-minute test with 1-second intervals
iperf3 -c SERVER_IP -t 300 -i 12. Maximum Performance Test
# Multiple streams with maximum buffer size
iperf3 -c SERVER_IP -P 10 -w 2M3. Network Stability Test
# Long duration test with JSON output
iperf3 -c SERVER_IP -t 3600 -J > network_test.jsonQuick Reference
Essential Commands
# Start server
iperf3 -s
# Basic client test
iperf3 -c SERVER_IP
# UDP test
iperf3 -c SERVER_IP -u
# Reverse mode
iperf3 -c SERVER_IP -R
# JSON output
iperf3 -c SERVER_IP -J
# Multiple streams
iperf3 -c SERVER_IP -P 4Common Flags
-s: Server mode-c: Client mode-p: Port number-t: Time duration-i: Interval timing-u: UDP mode-b: Bandwidth target-R: Reverse mode-P: Parallel streams-J: JSON output-V: Verbose output