Linux Comm Iperf
[ Linux Command Reference](#)
* * *
iperf is a professional network performance testing tool used to measure TCP and UDP bandwidth performance. It can report network performance metrics such as bandwidth, latency jitter, and packet loss.
Main features of iperf:
* Supports TCP and UDP testing
* Can adjust various parameters such as TCP window size, UDP bandwidth, etc.
* Supports bidirectional testing (simultaneous upload and download)
* Cross-platform support (Linux, Windows, macOS, etc.)
* * *
## Install iperf
### Linux System Installation
In most Linux distributions, you can install via the package manager:
## Example
# Debian/Ubuntu
sudo apt-get install iperf3
# CentOS/RHEL
sudo yum install iperf3
# Fedora
sudo dnf install iperf3
# Arch Linux
sudo pacman -S iperf3
### Windows Installation
You can download pre-compiled binaries from the (https://iperf.fr/).
* * *
## Basic Usage
iperf works in a client-server model. You need to run the server on one machine and use another machine as the client to connect for testing.
### Start iperf Server
iperf3 -s
By default, it listens on port 5201. You can use the `-p` parameter to specify a different port:
iperf3 -s -p 5001
### Client Connection Test
iperf3 -c
For example, to test bandwidth to 192.168.1.100:
iperf3 -c 192.168.1.100
* * *
## Common Parameter Description
### General Parameters
| Parameter | Description |
| --- | --- |
| `-p` | Specify port number |
| `-t` | Test duration (seconds), default is 10 seconds |
| `-i` | Interval time (seconds) to report results |
| `-f` | Display unit (Kbits, Mbits, KBytes, MBytes) |
| `-V` | Display version information and exit |
| `-h` | Display help information |
### Server-side Parameters
| Parameter | Description |
| --- | --- |
| `-s` | Run in server mode |
| `-D` | Run in daemon mode |
### Client-side Parameters
| Parameter | Description |
| --- | --- |
| `-c` | Run in client mode, followed by server address |
| `-u` | Use UDP protocol instead of TCP |
| `-b` | Set target bandwidth (UDP mode) |
| `-w` | Set TCP window size |
| `-P` | Number of parallel connections |
| `-R` | Reverse test (server sends, client receives) |
* * *
## Practical Application Examples
### 1. Basic TCP Bandwidth Test
Server side:
iperf3 -s
Client side:
iperf3 -c 192.168.1.100
Output example:
Interval Transfer Bitrate 0.00-10.00 sec 1.10 GBytes 942 Mbits/sec
### 2. UDP Bandwidth Test
Server side:
iperf3 -s
Client side (test 100Mbps UDP):
iperf3 -c 192.168.1.100 -u -b 100M
### 3. Multi-threaded Test
Use 4 parallel connections:
iperf3 -c 192.168.1.100 -P 4
### 4. Bidirectional Simultaneous Test
Server side:
iperf3 -s
Client side:
iperf3 -c 192.168.1.100 --bidir
### 5. Long Duration Test (60 seconds)
iperf3 -c 192.168.1.100 -t 60
* * *
## Result Interpretation
iperf test results typically contain the following information:
1. **Interval**: Test time interval
2. **Transfer**: Amount of data transferred
3. **Bitrate**: Bandwidth (bit rate)
4. **Retr**: Number of TCP retransmissions (TCP only)
5. **Jitter**: Jitter (UDP only)
6. **Lost/Total Datagrams**: Packet loss rate (UDP only)
For network quality assessment:
* TCP testing is more suitable for measuring maximum available bandwidth
* UDP testing can measure jitter and packet loss rate, which is more important for real-time applications (such as VoIP, video conferencing)
* * *
## Advanced Usage
### 1. Set TCP Window Size
iperf3 -c 192.168.1.100 -w 256K
### 2. Test Specific Port
## Example
# Server
iperf3 -s-p 5001
# Client
iperf3 -c 192.168.1.100 -p 5001
### 3. Output to File
iperf3 -c 192.168.1.100 --logfile result.txt
### 4. JSON Format Output
iperf3 -c 192.168.1.100 -J
* * *
## Common Problem Solutions
### 1. Connection Refused
Ensure that:
* The server-side iperf is running
* The firewall allows iperf port (default 5201)
* The client is using the correct IP and port
### 2. Bandwidth Test Results Much Lower Than Expected
Possible causes:
* There is a bottleneck in the network (switch, router limitations)
* Network card settings issue (check duplex mode, speed)
* Insufficient system resources (high CPU, memory usage)
### 3. High Packet Loss Rate in UDP Test
Suggestions:
* Lower the UDP bandwidth target value
* Check network device QoS settings
* Test network conditions at different times
* * *
## Practical Application Scenarios
1. **Network Device Acceptance**: Verify the performance of newly deployed network devices
2. **Bandwidth Monitoring**: Regularly test network bandwidth changes
3. **Troubleshooting**: Locate network performance issues
4. **QoS Verification**: Test the effectiveness of quality of service policies
5. **Wireless Network Testing**: Evaluate WiFi signal strength and stability
* * *
## Summary
iperf is an essential bandwidth testing tool for network engineers. Through this article, you should have mastered:
* The basic working principle of iperf
* How to start server and client
* Common parameters and usage examples
* How to analyze test results
* Solutions to common problems
It is recommended to practice more tests in actual network environments to get familiar with the effects of different parameter combinations, so that you can quickly and accurately evaluate network performance when needed.
* * Linux Command Reference](#)
YouTip