How to install and run iperf in server mode?
This guide provides step-by-step instructions on how to install and run iperf in server mode to measure network performance.
What is iperf?
Iperf is a versatile and widely used utility that measures network bandwidth. This tool is freely available on multiple platforms, offering a wealth of built-in options and the flexibility to measure network performance using various protocols.
There are two widely used versions of iperf: iperf2 and iperf3. Remember, they are not interchangeable; you can’t run iperf3 on the server and connect to it with iperf2.
It provides fairly accurate information, but keep in mind that the output may not be the most precise.
Installation and usage
This section provides instructions for running the iperf utility, particularly for engineers. If you want to use it yourself, see the “Checking bandwidth between 2 VPS” section.
Since iperf3 is the newer tool, this tutorial focuses on its installation.
STEP 1. Connect to your server via SSH.
STEP 2. Install iperf3.
Ubuntu/Debian:
apt-get install iperf3
CentOS/Alma/Rocky:
dnf install iperf3
STEP 3. Run the following command:
iperf3 -s
This command runs iperf in server mode for testing.
IMPORTANT: Do not close the console window after starting this utility; it will be stopped. Stop it only after all tests are complete to avoid affecting your speed.
Checking bandwidth between 2 VPS
STEP 1. Connect to both servers using SSH.
STEP 2. Install iperf3 on both servers using:
Ubuntu/Debian:
apt-get install iperf3
CentOS/Alma/Rocky:
dnf install iperf3
STEP 3. Choose one of the servers and run iperf in server mode:
iperf3 -s
STEP 4. From the other server, run:
iperf3 -c *ipAddress*
This creates a connection from client->server. To reverse roles to server->client, add -R:
iperf3 -c *ipAddress* -R
Using different protocols
By default, iperf uses TCP. To test UDP (less reliable but faster), specify it with -u:
iperf3 -c *yourIp* -u -b 0
Don’t forget to include -b 0, which removes the bandwidth limit (default is 1MB/s).
Other options
To explore more advanced options for iperf3, run the following command:
man iperf3
Related Articles
Browse more articles in these categories.