How to install and run iperf in server mode?

What is iperf? #

Iperf is a versatile and widely used utility that is used to measure 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 this fact, because they are not interchangeable. You can’t run iperf3 on the server and connect to it with iperf2.

It provides pretty accurate information, but keep in mind that the output you’re getting is not the most precise.

Installation and usage #

In this part, instructions are for cases, when our engineers ask you to run iperf utility. If you want to use it by yourself, scroll to the “Checking bandwidth between 2 VPS” part.

Since “iperf3” is a newer tool, this tutorial shows the installation of exactly this version.

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 so that our engineers can make all required tests.

IMPORTANT, don’t close the console window after you’ve started this utility, in this case, iperf will be stopped. Stop it after all tests are done, so it won’t affect your speed and won’t run in the background.

Checking bandwidth between 2 VPS #

STEP 1. Connect to both servers using ssh.

STEP 2. In this case, you’ll need to install iperf3 on both servers so install it with this command:

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. Run the following command from the other server.

iperf3 -c ipAdress

In this case, the connection will be “client->server“. If you want to change their positions to “server->client” you need to add “-R“. Example:

iperf3 -c ipAdress -R

Using different protocols #

By default, iperf uses TCP for all the connections. If you want to test it using UDP, which is less reliable but faster, you’ll need to specify it by adding “-u” in the command. For example:

iperf3 -c yourIp -u -b 0

Don’t forget to add “-b 0“. “-b” is responsible for bandwidth. By default, the speed is equal to 1MB/s, so for full speed, you’ll need to turn this limit off. “-b 0” will do exactly this job.

Other options #

If you want to use more advanced options of “iperf3” you can type the following command in your console and explore different options and their descriptions.

man iperf3

Powered by BetterDocs