Test network using iPerf

iPerf3 — Installation and Usage Guide

iPerf is a widely used tool for measuring and tuning network performance. It is cross-platform and provides standardized metrics for network throughput. iPerf includes both client and server functionality and generates data streams to measure bandwidth between two endpoints — in one or both directions. A typical iPerf output includes a timestamped report showing the volume of data transferred and the measured bandwidth.


Table of Contents


How to Install iPerf3

CentOS 7 / RHEL / Fedora:

yum install iperf3

CentOS 8:

dnf install iperf3

Debian / Ubuntu:

sudo apt install iperf3

How to Use iPerf3

iPerf must be installed on both computers between which the connection is being tested. One computer runs in server mode, the other in client mode. The client connects to the server to test speed.


Default Test Mode (TCP Client and Server)

On the first server you plan to test, launch iPerf in server mode:

iperf3 -s
------------------------------------------------------------
 Server listening on TCP port 5201
------------------------------------------------------------

On the second server, connect to the first:

Server 2 (iPerf client)

iperf3 -c 212.6.44.32

Connecting to host 212.6.44.32, port 5201
[  5] local 77.73.67.143 port 57824 connected to 212.6.44.32 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  23.8 MBytes   200 Mbits/sec    0   1.67 MBytes     
[  5]   1.00-2.00   sec  23.8 MBytes   199 Mbits/sec    0   2.84 MBytes     
[  5]   2.00-3.00   sec  22.5 MBytes   189 Mbits/sec    0   3.00 MBytes     
[  5]   3.00-4.00   sec  23.8 MBytes   199 Mbits/sec    0   3.00 MBytes     
[  5]   4.00-5.00   sec  23.8 MBytes   199 Mbits/sec    0   3.00 MBytes     
[  5]   5.00-6.00   sec  22.5 MBytes   189 Mbits/sec    0   3.00 MBytes     
[  5]   6.00-7.00   sec  23.8 MBytes   199 Mbits/sec    0   3.00 MBytes     
[  5]   7.00-8.00   sec  23.8 MBytes   199 Mbits/sec    0   3.00 MBytes     
[  5]   8.00-9.00   sec  23.8 MBytes   199 Mbits/sec    0   3.00 MBytes     
[  5]   9.00-10.00  sec  22.5 MBytes   189 Mbits/sec    0   3.00 MBytes     
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   234 MBytes   196 Mbits/sec    0             sender
[  5]   0.00-10.02  sec   232 MBytes   194 Mbits/sec                  receiver

Server 1 (iPerf server)

Accepted connection from 77.73.67.143, port 57822
[  5] local 212.6.44.32 port 5201 connected to 77.73.67.143 port 57824
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  20.5 MBytes   172 Mbits/sec                
[  5]   1.00-2.00   sec  23.4 MBytes   197 Mbits/sec                
[  5]   2.00-3.00   sec  23.4 MBytes   196 Mbits/sec                
[  5]   3.00-4.00   sec  23.4 MBytes   196 Mbits/sec                
[  5]   4.00-5.00   sec  23.4 MBytes   196 Mbits/sec                
[  5]   5.00-6.00   sec  23.4 MBytes   196 Mbits/sec                
[  5]   6.00-7.00   sec  23.4 MBytes   196 Mbits/sec                
[  5]   7.00-8.00   sec  23.4 MBytes   196 Mbits/sec                
[  5]   8.00-9.00   sec  23.4 MBytes   197 Mbits/sec                
[  5]   9.00-10.00  sec  23.3 MBytes   196 Mbits/sec                
[  5]  10.00-10.02  sec   502 KBytes   193 Mbits/sec                
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.02  sec   232 MBytes   194 Mbits/sec                  receiver

During this test iPerf client was a sender and in the results we can see:

From client logs:

sender - is iPerf client, Upload speed from iPerf client to iPerf server is measured. receiver - is iPerf server, Download speed on iPerf server from iPerf client is measured.

From server logs:

receiver - is iPerf server, Download speed on iPerf server from iPerf client is measured.

TCP Client & Server (Reverse mode test):

Server 1 (iPerf server)

iperf3 -s

------------------------------------------------------------
 Server listening on TCP port 5201
------------------------------------------------------------

To run it in reverse mode where the server sends and the client receives, add the -R switch:

Server 2 (iPerf client)

iperf3 -c 212.6.44.32 -R

Connecting to host 212.6.44.32, port 5201
Reverse mode, remote host 212.6.44.32 is sending
[  5] local 77.73.67.143 port 34440 connected to 212.6.44.32 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  21.2 MBytes   178 Mbits/sec                 
[  5]   1.00-2.00   sec  23.4 MBytes   196 Mbits/sec                 
[  5]   2.00-3.00   sec  23.4 MBytes   196 Mbits/sec                 
[  5]   3.00-4.00   sec  23.3 MBytes   195 Mbits/sec                 
[  5]   4.00-5.00   sec  23.4 MBytes   196 Mbits/sec                 
[  5]   5.00-6.00   sec  23.4 MBytes   196 Mbits/sec                 
[  5]   6.00-7.00   sec  23.3 MBytes   195 Mbits/sec                 
[  5]   7.00-8.00   sec  23.4 MBytes   196 Mbits/sec                 
[  5]   8.00-9.00   sec  23.3 MBytes   196 Mbits/sec                 
[  5]   9.00-10.00  sec  23.4 MBytes   196 Mbits/sec                 
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   234 MBytes   197 Mbits/sec   18             sender
[  5]   0.00-10.00  sec   231 MBytes   194 Mbits/sec                  receiver

Server 1 (iPerf server)

Accepted connection from 77.73.67.143, port 34438
[  5] local 212.6.44.32 port 5201 connected to 77.73.67.143 port 34440
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  5]   0.00-1.00   sec  24.5 MBytes   205 Mbits/sec    6    675 KBytes      
[  5]   1.00-2.00   sec  22.5 MBytes   189 Mbits/sec   11    699 KBytes      
[  5]   2.00-3.00   sec  23.8 MBytes   199 Mbits/sec    0    724 KBytes      
[  5]   3.00-4.00   sec  23.8 MBytes   199 Mbits/sec    0    748 KBytes      
[  5]   4.00-5.00   sec  22.5 MBytes   189 Mbits/sec    0    772 KBytes      
[  5]   5.00-6.00   sec  23.8 MBytes   199 Mbits/sec    1    795 KBytes      
[  5]   6.00-7.00   sec  23.8 MBytes   199 Mbits/sec    0    816 KBytes      
[  5]   7.00-8.00   sec  22.5 MBytes   189 Mbits/sec    0    839 KBytes      
[  5]   8.00-9.00   sec  23.8 MBytes   199 Mbits/sec    0    860 KBytes      
[  5]   9.00-10.00  sec  23.8 MBytes   199 Mbits/sec    0    880 KBytes      
[  5]  10.00-10.02  sec  0.00 Bytes  0.00 bits/sec    0    880 KBytes      
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.02  sec   234 MBytes   196 Mbits/sec   18             sender
[  5]   0.00-10.02  sec  0.00 Bytes  0.00 bits/sec                  receiver
During this test iPerf server was a sender and in the results we can see:

From client logs:

sender - is iPerf server, Upload speed from iPerf server to iPerf client is measured receiver - is iperf client, Download speed on iPerf client from iPerf server is measured

From server logs:

sender - is iPerf server, Upload speed from iPerf server to iPerf client is measured receiver - is iPerf client, Download speed on iPerf client from iPerf server is measured

Note that we didn't specify the port, as in this case there is iperf3 on both sides, with ports defaulting to 5201.

How to Open a Port

CentOS / RHEL / Fedora:

sudo firewall-cmd --zone=public --add-port=5201/tcp

Debian / Ubuntu:

sudo ufw allow 5201

iPerf3 Flags

  • -R — run in reverse mode (server sends data).
  • -p — specify a port if 5201 is occupied.
  • -f — specify output format (k, m, g for bits; K, M, G for bytes).
  • -d — bidirectional test (measures bandwidth in both directions).
  • --get-server-output — display server output on the client.
  • -D — run the server in daemon mode.

For more detailed information, use the manual page:

man iperf3

Additional Resources

iPerf3 Homepage