iperf is a free and open source cross-platform command-line tool used for checking network performance in terms of bandwidth and speed. It is a highly reliable tool in comparison to the many network bandwidth and speed testing tools. In addition, it is a highly effective tool when testing for network performance between 2 servers spread across different geographical regions. In this tutorial, we’ll take you through how you can test network throughput using iperf3 tool.
Requirements
Two networked Linux systems with iperf3 installed
Installation of iperf3
installation of iperf3 on Linux is a pretty easy task since it exists in official software repositories of most Linux distributions.
Install iperf3 on Debian/Ubuntu
# sudo apt-get install iperf3
Install iperf3 on RHEL/CentOS
# yum install epel-release # yum install iperf3
Install iperf3 on Fedora 22 and later
# dnf install iperf3
Install iperf3 from source
You can also choose to install iperf3 from source by running the commands below. To download the source package run
# wget https://sourceforge.net/projects/iperf/files/latest/download
Once downloaded, extract the package
# tar -xvf iperf-2.0.5.tar.gz
Next, navigate into the extracted folder
# cd iperf-2.0.5
Run the command to configure
# ./configure
Compile it using the make command
# make
Finally, install using make install
# make install
Testing network throughput between 2 Linux servers
So now that we have iperf3 installed, it’s now time to check the bandwidth between two systems. For that to happen, one system needs to be set as the client and the other one as the server. In this illustration, I have 2 servers:
- RedHat (iperf3 server) – IP 172.31.16.67
- Ubuntu (iperf3 client) – IP 172.31.21.90
To set an iperf3 server
To set the RedHat system as the iperf3 server, Open the terminal and run
# iperf3 -s
Output
Connecting Client to server
Now we are going to connect our Ubuntu client to the RedHat server system. To achieve this run
iperf3 -c 172.31.16.67
You will start getting the following statistics as shown below, both on the client and server
iperf3 client (Ubuntu) Output
iperf3 server (RedHat) Output
To reverse the direction of packets
iperf3 -c 172.31.16.67 -R
To print the output in JSON format
iperf3 -c 172.31.16.67 -J
To get help with commands run
iperf3 --help
To define interval times append the -i flag
iperf3 -c 172.31.16.67 -i 3
For more usage on iperf3 commands , visit mankier