iPerf is a widely used tool for network performance measurement and tuning. It is significant as a cross-platform tool that can produce standardized performance measurements for any network. Iperf has client and server functionality, and can create data streams to measure the throughput between the two ends in one or both directions. Typical iperf output contains a time-stamped report of the amount of data transferred and the throughput measured.


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 the computers at both ends of the connection you’re testing. iPerf requires two systems because one system must act as a server, while the other acts as a client. The client connects to the server you’re testing the speed of.


TCP Client & Server (Default mode test):

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

Server 1 (iPerf server)
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



(warning) 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


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

If port 5201 is being used by another program on your server, you can specify a different port (e.g 3000) using the -p switch as shown.

You can specify the format (k, m, g for Kbits, Mbits, Gbits or K, M, G for KBytes, Mbytes, Gbytes) to report in, using the -f

To run a bi-directional test, meaning you measure bandwidth in both directions simultaneously, use the -d option.

If you want to get server results in the client output, use the --get-server-output option.

Optionally, you can run the server as a daemon, using the -D flag and write server messages to a log file.

For more information, see the iPerf3 man page.


iPerf3 Homepage: https://iperf.fr/


  • No labels