IPerf is an open-source tool designed to test network bandwidth between two network nodes. The iPerf allows to generate TCP and UDP traffic/load between two hosts. You can use iPerf to quickly measure the maximum network bandwidth (throughput) between a server and a client, conduct stress testing of the ISP communication channel, router, network gateway (firewall), your Ethernet or Wi-Fi network.
In this post, we will show you how to install and use the iPerf tool to check the network throughput on Windows and Linux CentOS (there are iPerf versions for Android, MacOS, RouterOS from MikroTik and other platforms).
iPerf Versions: iPerf2 vs iPerf3
IPerf is a cross-platform tool and doesn’t require installation, just copy and run it on two devices, between which you want to test the network throughput.
IPerf works in a server-client mode. On the first device, the iPerf starts in server mode (it is waiting for traffic from the iPerf client). On the second computer, the iPerf starts in client mode, generates TCP or UDP traffic and measures the maximum data transfer rate.
There are currently two independent iPerf branches developing in parallel: iPerf2 and iPerf3. The functionality of these tools is mostly compatible, but they use different network ports by default. In iPerf1/2 it is 5001, in iPerf3 it is 5201.
- iPerf2 is preferably used for parallel threads, bidirectional tests, and this version is officially supported on Windows OS;
- iPerf3 has better implementation of high-speed UDP testing. IPerf3 code is significantly smaller and better optimized.
The remaining differences are not so significant, so no need to use a specific version of iPerf (even the CLI parameters are the same). In this post we will use the iperf3. iPerf3 is not officially supported for Windows platform, but it works quite fine. I did not notice any obvious bugs. You can send your bug report to the https://github.com/esnet/iperf.
How to Install iPerf on Windows?
You can download iPerf 3.1.3 for Windows from the following link https://iperf.fr/iperf-download.php. You do not need to install the tool, it is enough to download the iPerf archive and extract it to a local directory on the drive. There are only two files in the archive:
There are several iPerf GUI implementations for Windows. For example, Iperf3-Cygwin-GUI or jperf.
The jperf is written on Java (in order to run jperf, the Java VM must be installed on the computer). In addition to graphical form for the CLI interface, Jperf can build graphs bandwidth charts of the communication channel in real time.
To use it, just specify the iPerf server address and run the scan.
There is a separate iPerfAutomate module in the PowerShell Script Gallery that can be used to get network performance metrics from your PowerShell scripts. You can install the module with the command:
Install-Module -Name iPerfAutomate
Installing iPerf on CentOS Linux
In CentOS 8, the iperf3 package is included in the AppStream base repository (in CentOS 7 you can find iperf3 in the EPEL repo). You can install it with the dnf (yum) command:
# dnf install iperf3On Debian/Ubuntu distros you can install the iperf3 with the command:
sudo apt install iperf3
If you want to use your Linux instance as the iperf3 server, you need to open the TCP/UDP ports 5201 in firewalld (iptables):
# firewall-cmd --permanent --add-port=5201/udp
# firewall-cmd --permanent --add-port=5201/tcp
# firewall-cmd --reload
Using iPerf Command to Measure Network Speed/Bandwidth
Let’s look at a few examples of using iPerf to test network throughput. In this example, we will use a Linux CentOS host as the iPerf server. Run the iPerf3 tool in server mode:
# iperf3 –s
The iPerf server is running, it is waiting for connections on the 5201 TCP port.
Server listening on 5201.
Hint. iPerf arguments are case sensitive!
Depending on the firewall settings between the client and the server, you can change the listening port using the argument -p [port_number]. You can run the iPerf server with a large TCP window size and on a different TCP port. Use the command:
# iperf3 -s -w 32768 –p 5200
- -w 32768 – set TCP windows size to 32 kB (by default it is about 8 kB)
- –p 5200 – the port on which iPerf is waiting for connections (I remind you that iperf2 listens by default on port 5001 and the iperf3 on 5201).
I am using a computer with Windows 10 installed as an iPerf client. Run the command prompt and go to the directory with the iPerf executable:
In order to run a network bandwidth test from the client, specify the iPerf server address (or DNS name):
iperf3.exe -c 192.168.1.200
If you started the iPerf server with an increased TCP window size, you can use the following command to get the maximum network load:
iperf3.exe -c 192.168.1.200 -P 8 -t 30 -w 32768
- -c 192.168.1.200 – IP address of the iPerf server;
- -w 32768 – increase the TCP window size;
- -t 30 – is the time in seconds for the test to be done (by default, it is 10 seconds);
- -P 8 – is the number of parallel threads (streams) to get the maximum channel load;
In my example, the test lasted 30 seconds. In the final report, we are interested in the values of the Bandwidth column listed in the last [SUM] line. In this case the average network bandwidth between two hosts is 85.9 Mbit/s. 307 MB of data was transferred (Transfer column) with the symmetric speed (sender=receiver).
Using the -f argument, you can change the speed format (bits, kilobits or megabits). In the continuous tests, when you have to estimate the performance during several minutes (hours), you can set the period of time to display the intermediate results using the –i option.
You can run iPerf in reverse mode (the server sends data, and the client accepts). User the –R option on the client for this.
By default, the utility generates TCP traffic, if you need to check your network bandwidth for UDP packets, you must use the –u option. In this case, you should start the iPerf server with the command:
iperf3 -s –u).
If you need to test your Internet service provider bandwidth, you can use one of the public iPerf servers (iPerf public host list is available here):
iperf3 -c iperf.scottlinux.com
If you need to measure the maximum network speed in both directions (in a duplex mode), use the –d option on the client:
iperf3.exe -c IP -P 8 -t 30 -w 32768 –d
During the network test using iPerf, you can monitor your network connection throughput chart through the Task Manager. It is important to note that, during the test, iPerf uses all available bandwidth of the communication channel between the client and server, which can negatively affect productive apps and users.
You can display the full list of the options as follows:
Iperf is an easy-to-use and convenient network utility that helps you to measure network connection performance and maximum data transfer speed between two devices.