Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux iperf command

Linux iperf command

Linux Command Reference 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.

The main features of iperf:


Install iperf

Installation on Linux systems

On most Linux distributions, it can be installed 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

A precompiled binary is available from the iperf official website You can download the precompiled binary file there.


Basic Usage

iperf works in a client-server mode. You need to run the server on one machine and use another machine as the client to connect for testing.

Start the iperf server

iperf3 -s

It listens on port 5201 by default; you can use the -p parameter to specify a different port:

iperf3 -s -p 5001

Client connection test

iperf3 -c 

For example, to test the bandwidth to 192.168.1.100:

iperf3 -c 192.168.1.100


Common parameters

General parameters

Parameters Description
-p Specify the port number
-t Test duration in seconds, 10 seconds by default
-i Report results once every interval in seconds
-f Display units (Kbits, Mbits, KBytes, MBytes)
-V Display version information and exit
-h Display help information

Server-side parameters

Parameters Description
-s Run in server mode
-D Run in daemon mode

Client-side parameters

Parameters Description
-c Run in client mode, followed by the server address
-u Use the UDP protocol instead of TCP
-b Set the target bandwidth (UDP mode)
-w Set the TCP window size
-P Number of parallel connections
-R Reverse test (the server sends and the client receives)

Practical Application Examples

1. Basic TCP bandwidth test

Server side:

iperf3 -s

Client:

iperf3 -c 192.168.1.100

Example output:

[ ID] Interval           Transfer     Bitrate

[  4]   0.00-10.00  sec  1.10 GBytes   942 Mbits/sec

2. UDP bandwidth test

Server side:

iperf3 -s

Client side (testing 100Mbps UDP):

iperf3 -c 192.168.1.100 -u -b 100M

3. Multi-threaded test

Using 4 parallel connections:

iperf3 -c 192.168.1.100 -P 4

4. Simultaneous bidirectional test

Server side:

iperf3 -s

Client:

iperf3 -c 192.168.1.100 --bidir

5. Long-duration test (60 seconds)

iperf3 -c 192.168.1.100 -t 60


Interpreting the results

iperf test results usually 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:


Advanced usage

1. Set the TCP window size

iperf3 -c 192.168.1.100 -w 256K

2. Test a specific port

Example

Server

iperf3

-s

-p

5001

Client Side

iperf3

-c

192.168.1.100

-p

5001

3. Output to a file

iperf3 -c 192.168.1.100 --logfile result.txt

4. Output in JSON format

iperf3 -c 192.168.1.100 -J


Common Problem Solutions

1. Connection refused

Make sure:

2. Bandwidth test result far below expectations

Possible reasons:

3. High packet loss rate in UDP tests

Note:


Practical Application Scenarios

  1. Network device acceptance testing: Verify the performance of newly deployed network devices
  2. Bandwidth monitoring: Regularly test changes in network bandwidth
  3. Troubleshooting: Locate network performance problems
  4. QoS verification: Test the effect of quality-of-service policies
  5. Wireless network testing: Assess WiFi signal strength and stability

Summary

iperf is an essential bandwidth testing tool for network engineers; through this article you should have mastered:

It is recommended to practice testing in real network environments and become familiar with the effects of different parameter combinations, so that you can assess network performance quickly and accurately when needed.


Linux Command Reference Linux Command Reference