iPerf is an open-source, cross-platform command-line tool designed to test the throughput of a network connection between two nodes. The iPerf
tool generates TCP and UDP traffic (load) between two hosts in order to measure and evaluate the network performance. Perf can be used to quickly measure the maximum network bandwidth (throughput) between a server and a client and perform stress testing on your network link, router, gateway, firewall, Ethernet, or Wi-Fi network
In this article, we will show how to use the iPerf3 tool to test the network speed (throughput) between different nodes, such as Windows, Linux, and VMware ESXi. iPerf is also available for other platforms, including Android, macOS, and MikroTik’s RouterOS.
The iPerf tool is cross-platform and is available for almost all operating systems. It operates in client-server mode, with all functionality included within a single executable binary. The tool must be run on both devices between which the network throughput needs to be tested.
The iPerf3 version is now used in most cases (it supports high-speed UDP testing and uses port 5201 by default for TCP/UDP).
- iPerf server – can be run on any device; it listens to a specific port and receives traffic from the client. The server is started using the command:
iperf3 -s
- iPerf client – generates test TCP/UDP traffic and sends it to the server. When starting the client, specify the name or IP address of the server running iPerf as a parameter:
iperf3 -c 192.168.10.20
How to Use iPerf on Windows
A pre-compiled binary of iPerf3 for Windows is available to download from GitHub https://github.com/ar51an/iperf3-win-builds/releases. There are versions of iPerf3 that support OpenSSL and authentication. However, for the simplest case, the basic version is sufficient. Download and extract the archive with the latest version to disk (iperf-3.19.1-win64.zip in this example).
No installation is required for the iPerf3 tool. Simply copy the two files, cygwin1.dll
and iperf3.exe
.
Iperf is a console tool that needs to be run from the command prompt. Running iperf3.exe without parameters will list the available options.
If you are planning to run iPerf3 in server mode in Windows (using the -s
parameter), you will need to open inbound port 5201 for both the TCP and UDP protocols in the Windows Defender Firewall. You can create and enable firewall rules using PowerShell.
New-NetFirewallRule -DisplayName 'iPerf-Server-Inbound-TCP' -Direction Inbound -Protocol TCP -LocalPort 5201 -Action Allow | Enable-NetFirewallRule
New-NetFirewallRule -DisplayName 'iPerf-Server-Inbound-UDP' -Direction Inbound -Protocol UDP -LocalPort 5201 -Action Allow | Enable-NetFirewallRule
Several implementations of the iPerf GUI are available for Windows. For example, Iperf3-Cygwin-GUI or jperf.
The jperf is written on Java (to run jperf, the Java VM must be installed on the computer). In addition to the graphical CLI interface, Jperf can generate real-time bandwidth charts showing the load on the communication channel.
Using it is simple: just specify the iPerf server address and run the network throughput test.
Installing iPerf on Linux
The iperf3 package can be found in the base AppStream repository on CentOS, RHEL, Fedora, Rocky Linux, and Oracle Linux (in CentOS 7, you can find iperf3 in the EPEL repo).
You can install it using the DNF (YUM) command.
# dnf install iperf3
To install iperf3 on Debian/Ubuntu/Mint distros, run:
$ sudo apt install iperf3
When installing the package on Debian, you will be offered the option to run iperf as a system daemon. If you frequently use iperf testing with this host in server mode, confirm this.
If a Linux host is to be used as an iPerf server, the appropriate TCP port needs to be opened in the firewall to allow incoming connections:
Debian/Ubuntu:
$ sudo ufw allow 5201/tcp
$ sudo ufw allow 5201/udp
To open port 5201 in firewalld (or iptables) on RHEL-based Linux distros:
# firewall-cmd --permanent --add-port=5201/udp
# firewall-cmd --permanent --add-port=5201/tcp
# firewall-cmd --reload
How to Use iPerf on VMware ESXi Host
The iperf3 utility is available by default in VMware ESXi 8 (as part of vSAN), but due to security restrictions, it cannot be run from the console.
In order to use iPerf on ESXi 8, connect to the ESXi via SSH and run the following commands for both the iPerf client and server:
# temporarily disable the host firewall
# esxcli network firewall set --enabled false
# allow running copied binaries
# localcli system settings advanced set -o /User/execInstalledOnly -i 0
# cp /usr/lib/vmware/vsan/bin/iperf3 /usr/lib/vmware/vsan/bin/iperf3.copy
When running the iPerf server on an ESXi host, it must be bound to the IP address of the vmkernel interface.
Find out the VMkernel IP address:
# esxcli network ip interface ipv4 get
# cd /usr/lib/vmware/vsan/bin/
# ./iperf3.copy -s -B <vmkernel-IP> -p <port>
Run the iPerf client on the ESXi host:
# cd /usr/lib/vmware/vsan/bin/
# ./iperf3.copy -c <Server-IP> -u -b 10M -l 1400 -i 1 -t 300 -p <port>
Once the network throughput test is complete, restore your firewall and security settings to their original configurations
# localcli system settings advanced set -o /User/execInstalledOnly -i 1
# esxcli network firewall set --enabled true
Testing Network Speed and Bandwidth with iPerf
Now, let’s take a look at some examples of how iPerf can be used to test network throughput.
Run iPerf3 in server mode on any host (in our case, Linux).
# iperf3 –s
The iPerf3 server starts up with support for both TCP and UDP, and listens for incoming client connections on port 5201.
Server listening on 5201.
To run the iPerf server in the background (daemon mode), add the -D switch:
-p [port_number]
. To run the iperf server with a larger TCP window size and on a different port:# iperf3 -s -w 32768 –p 5200
- w 32768 – change the TCP window size to 32 KB (it is about 8 KB by default);
- –p 5200 – the port on which iPerf is waiting for connections (note that iperf2 listens on port 5001 by default and iperf3 listens on port 5201).
I am using a Windows 11 computer as an iPerf client. Open a command prompt and change to the directory with the iPerf executable:
cd c:\tools\iperf
To run a network bandwidth test from the client, specify the iPerf server IP address or its DNS name:
iperf3.exe -c 192.168.1.200
The client will start generating traffic to load the network bandwidth. With the default settings, iPerf uses only TCP, the test lasts 10 seconds, and there is no maximum speed limit.
- Interval – testing interval (in seconds)
- Transfer – the size of the transferred data
- Bitrate – average network throughput
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 -i 5 -f g
- -c 192.168.1.200 – the IP address of the iPerf server
- -w 32768 – socket buffer sizes (indirectly increases TCP window size)
- -t 30 – test duration in seconds (10 seconds by default)
- -P 8 – is the number of parallel threads to get the maximum channel load
- -i 5 – output iPerf stat every 5 seconds. The parameter is convenient to use for long tests (several minutes, hours)
- -f m — display results in Mbps. Here you can use the kmgKMG values (kilobits, megabits, megabytes, gigabits, etc.)
- -n 1G – the total volume of data that will be transmitted to the iPerf server during the test.
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. This shows the average speed at which data is sent (sender) and received (receiver) over the network.
In our case, the average network throughput between two hosts is 85.9 Mbit/s. 307 MB of data has been transferred (Transfer column) with the symmetric speed (sender=receiver).
To run iPerf in reverse mode, where the server sends data and the client receives it, add the -R option on the client.
The iPerf generates TCP traffic by default. If you need to check your network bandwidth for UDP packets, use the –u option.
Internet Speed Test with iPerf
If you need to check your internet connection’s bandwidth using a speed test, you can use one of the many public iPerf servers available (for example, use this iPerf public server list). For example:
iperf3 -c iperf.he.net
Note that the iPerf3 server only accepts a single client connection at a time (although multiple simultaneous client tests are allowed in iPerf2). The same applies to public iPerf servers, which can only support one iPerf client at a time. If the iPerf server is currently servicing a client connection, you will receive an error when attempting to connect to it from another client: iperf3: error, the server is busy running a test. try again later.
To measure the network throughput in both directions (full-duplex mode), add the –bidir option on the client.
iperf3.exe -c IP -P 8 -t 30 -w 32768 –-bidir
You can use the Task Manager to monitor your network connection throughput chart while running a network test using iPerf.
To see all the available iperf arguments, run:
iperf3 –-help
When testing a channel, the iPerf3 allows you to configure time, buffer, and protocol parameters (TCP, UDP, or SCTP). This tool is useful for measuring network connection performance, tuning network connections, stress-testing communication channels, identifying bottlenecks, and testing Ethernet and Wi-Fi networks.
5 comments
Thanks!
The major feature differences between iperf 2 vs iperf 3 is that iperf 2 supports latency related tests, video traffic profiles and multicast including source specific multicast while iperf 3 supports sctp tests and json output. The client’s and server’s clocks have to be synchronized to for the latency tests to work. Latency measurements consist of packet latencies, video frame latencies, and and tcp write tor read latencies. Iperf 2 also has a few new metrics per latency which include network power and end/end queue depth (per Little’s law)
I don’t know that iperf 3 is better with UDP. I’ll need to check into that as both tools should provide very similar performance measurements as the tools should be designed to provide accurate metrics.
is the default test using the server or client side hard disks or just memory?
It doens’t test disk
on iperf3 -d is for debug output. –bidir adds bidirectional/duplex testing (added in iperf 3.7)
-d, –debug emit debugging output
-R, –reverse run in reverse mode (server sends, client receives)
–bidir run in bidirectional mode.