In our connected world, it is good to now in what shape our network is, from the end-user perspective. While we may not be able to change the network environment, knowing it's limits is useful. If you have to upload a large ISO image to the server, you can decide to go grab a coffee after the transfer starts, if you know your corporate network will not be able to transfer that much data in the next hour. This is of course just a random fictional nightmare, but knowing the network throughput means knowing how our systems will perform regarding network communication, and have another known area when debugging.

iperf is a handy application allowing easy client-server setup, and able to measure network bandwidth, jitter, and packet loss ratio. While it has many options to tweak our measurements, we'll use only the defaults to test the application's work.

In this tutorial you will learn:
  • How to install iperf on Red Hat Enterprise Linux 8.
  • How to test network bandwidth to the system.
  • How to test network bandwidth from the system.
Measuring network bandwidth with iperf3.
Measuring network bandwidth with iperf3.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat Enterprise Linux 8
Software iperf3-3.5-1
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

How to install iperf on RHEL 8 step by step instructions


SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


iperf3 is in the default repositories after enabling Subscription Management repositories, so installing it is quite easy.

  1. dnf install iperf3
  2. To test the network using our lab machine as a server (the target), we start it in server mode:
    $ iperf3 -s
    -----------------------------------------------------------
    Server listening on 5201
    -----------------------------------------------------------
    

    Note that iperf3 is listening on another port by default, as earlier versions (the client in this test included) use port 5001.

    And from the remote testing machine, we start the test (we need to specify the port as it is non-default to iperf):

    $ iperf -c 192.168.1.14 -p 5201
    ------------------------------------------------------------
    Client connecting to 192.168.1.14, TCP port 5201
    TCP window size: 85.0 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.1.7 port 55366 connected with 192.168.1.14 port 5201
    write failed: Connection reset by peer
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0- 5.5 sec   888 MBytes  1.36 Gbits/sec
    
  3. To test network using our lab machine as a client (the source), we start iperf in server mode on the remote machine (this time in a different network, using iperf3 on the other side too):
    $ iperf3 -s
    -----------------------------------------------------------
    Server listening on 5201
    -----------------------------------------------------------
    

    And run the test from our lab machine:

    $ iperf3 -c 192.168.1.2
    Connecting to host 192.168.1.2, port 5201                                                                                                                                                                   
    [  5] local 192.168.1.14 port 51736 connected to 192.168.1.2 port 5201                                                                                                                                      
    [ ID] Interval           Transfer     Bitrate         Retr  Cwnd                                                                                                                                            
    [  5]   0.00-1.00   sec  3.21 MBytes  26.9 Mbits/sec    0    160 KBytes                                                                                                                                     
    [  5]   1.00-2.00   sec  3.48 MBytes  29.2 Mbits/sec    0    301 KBytes                                                                                                                                     
    [  5]   2.00-3.00   sec  3.79 MBytes  31.8 Mbits/sec    0    448 KBytes                                                                                                                                     
    [  5]   3.00-4.02   sec  3.04 MBytes  25.0 Mbits/sec    0    380 KBytes                                                                                                                                     
    [  5]   4.02-5.01   sec  3.36 MBytes  28.6 Mbits/sec    0    434 KBytes                                                                                                                                     
    [  5]   5.01-6.00   sec  2.11 MBytes  17.8 Mbits/sec    0    332 KBytes                                                                                                                                     
    [  5]   6.00-7.00   sec  2.24 MBytes  18.7 Mbits/sec    0    351 KBytes                                                                                                                                     
    [  5]   7.00-8.00   sec  1.06 MBytes  8.88 Mbits/sec    0    368 KBytes                                                                                                                                     
    [  5]   8.00-9.00   sec  3.17 MBytes  26.6 Mbits/sec    0    372 KBytes                                                                                                                                     
    [  5]   9.00-10.00  sec  2.17 MBytes  18.2 Mbits/sec    0    372 KBytes                                                                                                                                     
    - - - - - - - - - - - - - - - - - - - - - - - - -                                                                                                                                                           
    [ ID] Interval           Transfer     Bitrate         Retr                                                                                                                                                  
    [  5]   0.00-10.00  sec  27.6 MBytes  23.2 Mbits/sec    0             sender                                                                                                                                
    [  5]   0.00-10.00  sec  25.8 MBytes  21.7 Mbits/sec                  receiver                                                                                                                              
    
    iperf Done.
    

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

    And we can see the results more verbose on the server side as well:

    Accepted connection from 192.168.1.14, port 51734
    [  5] local 192.168.1.2 port 5201 connected to 192.168.1.14 port 51736
    [ ID] Interval           Transfer     Bandwidth
    [  5]   0.00-1.00   sec  2.63 MBytes  22.0 Mbits/sec                  
    [  5]   1.00-2.00   sec  2.92 MBytes  24.5 Mbits/sec                  
    [  5]   2.00-3.00   sec  2.80 MBytes  23.5 Mbits/sec                  
    [  5]   3.00-4.00   sec  2.80 MBytes  23.5 Mbits/sec                  
    [  5]   4.00-5.00   sec  2.99 MBytes  25.1 Mbits/sec                  
    [  5]   5.00-6.00   sec  2.75 MBytes  23.1 Mbits/sec                  
    [  5]   6.00-7.00   sec  1.50 MBytes  12.6 Mbits/sec                  
    [  5]   7.00-8.00   sec  1.80 MBytes  15.1 Mbits/sec                  
    [  5]   8.00-9.00   sec  2.60 MBytes  21.8 Mbits/sec                  
    [  5]   9.00-10.00  sec  2.77 MBytes  23.2 Mbits/sec                  
    [  5]  10.00-10.12  sec   279 KBytes  19.5 Mbits/sec                  
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bandwidth
    [  5]   0.00-10.12  sec  0.00 Bytes  0.00 bits/sec                  sender
    [  5]   0.00-10.12  sec  25.8 MBytes  21.4 Mbits/sec                  receiver
    

We can see that in the first testing case the two systems have much better connection then in the last one. We can also see how ports and outputs differ depending on iperf version, and we verified that our tool is working in both server and client mode as well.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions