Objectives
Understand and utilize the basic commands of the command line tool, iperf3, which is used for bandwidth testing in Linux machines.
Prerequisites
- Local Linux machine (IP Address: 10.10.10.10)
- Remote Linux machine (IP Address: 10.10.10.20)
Steps
Step 1: Install iperf3
Install iperf3 through the package manager (apt for Debian-based Linux, yum for CentOS) using the following command.
For Debian-based Linux:
apt-get install iperf3
For CentOS:
yum install iperf3
Step 2: Verify iperf3 Version
Verify your iperf3 installation version by using the following command.
iperf3 --version
Step 3: Setting up an iperf3 Server
On either one of the two machines, run the following command to start an iperf3 server on the machine.
In this case, the server will be set up on the local machine (10.10.10.10).
iperf3 -s
Step 4: Testing Bandwidth Between iperf3 Client and Server
On the other machine, now known as the client machine, test the connection and bandwidth by using the iperf3 command.
Use the -c tag to specify that you are running the command as a client.
Then, specify the server that you are connecting to. In this case, it is 10.10.10.10.
Next, use the -i tag specify the interval duration between each packet (in seconds). You are recommended to use this to avoid overloading the network card and have a more consistent result. In this case, a packet is going to be sent every 2 seconds.
Then specify the duration you want the test to be run (in seconds).
In overall, the following command means that you are connecting to 10.10.10.10 as a client and running the test with a sample size of 10 (20 second-test, one instance every 2 seconds).
iperf3 -c 10.10.10.10 -i 2 -t 20
Additionally, you can also run a reverse test using the tag -R, meaning that you will be testing the connection from the server to client, instead of client to server.
iperf3 -c 10.10.10.10 -i 2 -t 20 -R
Finally, you can run a bidirectional test in iperf3 version 3.7 or higher, using the newly added –bidir flag.
This feature will initiate both a normal test and a reverse test simulatenously.
iperf3 -c 10.10.10.10 -i 2 -t 20 --bidir