iperf3 is a free open-source, cross-platform command-line utility designed for real-time network throughput measurements. It ranks among the most effective tools for assessing maximum achievable bandwidth in IP networks (supporting both IPv4 and IPv6).
[ You might also like: 17 Useful Bandwidth Monitoring Tools for Linux ]
With iperf, users can adjust various parameters related to timing, buffers, and protocols such as TCP, UDP, and SCTP. This makes it particularly useful during network performance optimization tasks.
To achieve enhanced or maximum network performance, it's essential to improve both the throughput and latency of your network’s sending and receiving capabilities.
However, before proceeding with tuning, you should conduct tests to gather comprehensive network performance statistics that will guide your optimization strategy.
The results from iperf include time intervals in seconds, data transferred, bandwidth (transfer rate), loss, and other relevant network performance metrics. Its primary purpose is to aid in tuning TCP connections across a specific path, which is the focus of this article.
Prerequisites:
- Two networked systems with iperf3 installed on both.
How to Install iPerf3 on Linux Systems
Before utilizing iperf3, install it on both machines intended for benchmarking. Since iperf3 is available in the official repositories of most major Linux distributions, installation is straightforward using the appropriate package manager as shown below.
<code>$ sudo apt install iperf3 [On <strong>Debian, Ubuntu and Mint</strong>] $ sudo yum install iperf3 [On <strong>RHEL/CentOS/Fedora</strong> and <strong>Rocky/AlmaLinux</strong>] $ sudo emerge -a net-misc/iperf [On <strong>Gentoo Linux</strong>] $ sudo apk add iperf3 [On <strong>Alpine Linux</strong>] $ sudo pacman -S iperf3 [On <strong>Arch Linux</strong>] $ sudo zypper install iperf3 [On <strong>OpenSUSE</strong>] </code>
Once iperf3 is installed on both systems, you're ready to begin testing network throughput.
How to Test Network Speed Between Two Linux Servers
Begin by connecting to the remote machine that will act as the server, and start iperf3 in server mode using the -s
option. By default, it listens on port 5201.
You may specify the format (k, m, g for Kbits, Mbits, Gbits or K, M, G for KBytes, Mbytes, Gbytes) for output using the -f
parameter as shown.
<code>$ iperf3 -s -f K </code>
If port 5201 is already occupied by another process on the server, you can choose an alternate port (e.g., 3000) using the -p
switch.
<code>$ iperf3 -s -p 3000</code>
Optionally, run the server as a background process using the -D
flag and redirect messages to a log file.
<code>$ iperf3 -s -D > iperf3log </code>
Now, on your local machine, treated as the client (where the actual benchmarking occurs), launch iperf3 in client mode using the -c
option and provide the hostname, domain name, or IP address of the server.
<code>$ iperf3 -c 192.168.10.1 -f K</code>
After approximately 18–20 seconds, the client will finish running and display results showing the average throughput, as illustrated in the screenshot below.
As seen in the above screenshot, there may be differences between values reported by the server and the client. However, always rely on the results from the iperf client when analyzing test outcomes.
How to Conduct Advanced Network Throughput Testing in Linux
There are several advanced options specific to the client for more detailed tests, explained below.
One key factor influencing the amount of data present on the network at any given time is the TCP window size – crucial in optimizing TCP connections. You can adjust this using the -w
parameter as shown.
<code>$ iperf3 -c 192.168.10.1 -f K -w 500K </code>
To perform a test in reverse mode, where the server sends and the client receives, use the -R
flag.
<code>$ iperf3 -c 192.168.10.1 -f K -w 500K -R </code>
For a bi-directional test, measuring bandwidth in both directions simultaneously, apply the -d
option.
<code>$ iperf3 -c 192.168.10.1 -f K -w 500K -d</code>
If you wish to include server-side results in the client output, use the --get-server-output
parameter.
<code>$ iperf3 -c 192.168.10.1 -f K -w 500K -R --get-server-output</code>
Additionally, you can define the number of simultaneous parallel streams (e.g., two) using the -P
option.
<code>$ iperf3 -c 192.168.10.1 -f K -w 500K -P 2</code>
For more information, refer to the iperf3 manual page.
<code>$ man iperf3</code>
That concludes this guide! Always remember to conduct network performance tests before proceeding with actual tuning. iperf3 is a robust tool ideal for evaluating network throughput.
Do you have questions or thoughts to share? Use the comment section below.
The above is the detailed content of How to Test Network Speed Using iPerf3 Tool in Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

When encountering DNS problems, first check the /etc/resolv.conf file to see if the correct nameserver is configured; secondly, you can manually add public DNS such as 8.8.8.8 for testing; then use nslookup and dig commands to verify whether DNS resolution is normal. If these tools are not installed, you can first install the dnsutils or bind-utils package; then check the systemd-resolved service status and configuration file /etc/systemd/resolved.conf, and set DNS and FallbackDNS as needed and restart the service; finally check the network interface status and firewall rules, confirm that port 53 is not

As a system administrator, you may find yourself (today or in the future) working in an environment where Windows and Linux coexist. It is no secret that some big companies prefer (or have to) run some of their production services in Windows boxes an

In Linux systems, 1. Use ipa or hostname-I command to view private IP; 2. Use curlifconfig.me or curlipinfo.io/ip to obtain public IP; 3. The desktop version can view private IP through system settings, and the browser can access specific websites to view public IP; 4. Common commands can be set as aliases for quick call. These methods are simple and practical, suitable for IP viewing needs in different scenarios.

Built on Chrome’s V8 engine, Node.JS is an open-source, event-driven JavaScript runtime environment crafted for building scalable applications and backend APIs. NodeJS is known for being lightweight and efficient due to its non-blocking I/O model and

Linuxcanrunonmodesthardwarewithspecificminimumrequirements.A1GHzprocessor(x86orx86_64)isneeded,withadual-coreCPUrecommended.RAMshouldbeatleast512MBforcommand-lineuseor2GBfordesktopenvironments.Diskspacerequiresaminimumof5–10GB,though25GBisbetterforad

Written in C, MySQL is an open-source, cross-platform, and one of the most widely used Relational Database Management Systems (RDMS). It’s an integral part of the LAMP stack and is a popular database management system in web hosting, data analytics,

Ubuntu has long stood as a bastion of accessibility, polish, and power in the Linux ecosystem. With the arrival of Ubuntu 25.04, codenamed “Plucky Puffin”, Canonical has once again demonstrated its commitment to delivering a

MongoDB is a high-performance, highly scalable document-oriented NoSQL database built to manage heavy traffic and vast amounts of data. Unlike traditional SQL databases that store data in rows and columns within tables, MongoDB structures data in a J
