How to Test Network Speed on a Linux Server with iperf3
iperf3 is a popular network testing tool used to measure bandwidth between two servers. It can help you verify network performance, test 1Gbps or 10Gbps connections and identify possible throughput problems.
This guide explains how to install and use iperf3 on Ubuntu and Debian Linux servers.
Install iperf3
On Ubuntu or Debian, update the package list:
sudo apt update
Install iperf3:
sudo apt install iperf3 -y
Verify the installation:
iperf3 --version
How iperf3 Works
iperf3 requires two systems:
- One server running in server mode
- Another server running in client mode
Traffic is generated between the two systems to measure network throughput.
For accurate results, both servers and the network path between them should support the bandwidth you want to test.
Start iperf3 in Server Mode
On the first server, run:
iperf3 -s
By default, iperf3 listens on TCP port:
5201
You should see:
Server listening on 5201
Keep this terminal open while performing the test.
Run a Network Speed Test
On the second server, run:
iperf3 -c SERVER-IP
Replace SERVER-IP with the IP address of the server running iperf3.
For example:
iperf3 -c 192.0.2.10
After several seconds, iperf3 will display the measured throughput.
Test for a Longer Period
The default test is relatively short.
For a 30-second test:
iperf3 -c SERVER-IP -t 30
Longer tests can provide a better indication of sustained network performance.
Test with Multiple Connections
A single TCP connection may not always reach the maximum available bandwidth, especially on high-speed or higher-latency networks.
You can use multiple parallel streams:
iperf3 -c SERVER-IP -P 4
For eight parallel streams:
iperf3 -c SERVER-IP -P 8
This is particularly useful when testing multi-gigabit and 10Gbps connections.
Do not assume that increasing the number of parallel streams indefinitely will produce a more accurate result.
Test Reverse Direction
By default, traffic is sent from the client to the iperf3 server.
To test traffic in the opposite direction:
iperf3 -c SERVER-IP -R
Testing both directions can help identify asymmetric network performance.
Test UDP Performance
iperf3 can also test UDP traffic:
iperf3 -c SERVER-IP -u -b 100M
This example generates approximately 100 Mbps of UDP traffic.
For example, to request a 500 Mbps test:
iperf3 -c SERVER-IP -u -b 500M
UDP testing can help identify packet loss and jitter.
Use UDP tests carefully because they intentionally generate traffic at the specified rate.
Check Packet Loss and Jitter
During a UDP test, iperf3 reports information including:
- Bandwidth
- Jitter
- Lost packets
- Packet loss percentage
Packet loss can significantly affect real-time applications and other network-sensitive workloads.
Testing a 1Gbps Connection
For a 1Gbps server, start with:
iperf3 -c SERVER-IP -P 4 -t 30
Remember that protocol overhead means application throughput may not display exactly the nominal interface speed.
Testing a 10Gbps Connection
For high-speed networks, multiple streams may help utilize more available capacity:
iperf3 -c SERVER-IP -P 8 -t 30
If the result is significantly below the expected speed, the limitation may not necessarily be the network connection itself.
Possible bottlenecks include:
- CPU performance
- Network interface configuration
- TCP settings
- Network congestion
- Routing
- Latency
- Virtualization limits
- Traffic shaping
- The remote test server
The iperf3 destination must also be capable of receiving traffic at the expected speed.
Check Your Network Interface
Find your network interfaces:
ip link
Check interface statistics:
ip -s link
If ethtool is available, check the negotiated interface speed:
sudo ethtool eth0
Replace eth0 with your actual interface name.
Look for information similar to:
Speed: 10000Mb/s
Duplex: Full
Check for Network Errors
Run:
ip -s link
Look for increasing values under errors, dropped packets or other abnormal interface statistics.
These can indicate a network or interface problem.
Firewall Configuration
If you are running your own iperf3 server, TCP port 5201 must be reachable from the testing system.
If UFW is enabled, you can temporarily allow access from a specific trusted IP:
sudo ufw allow from CLIENT-IP to any port 5201 proto tcp
Replace CLIENT-IP with the IP address of the system performing the test.
After testing, remove unnecessary firewall rules and stop the iperf3 server.
Important: Do Not Rely on a Single Test
Network performance can vary depending on:
- Destination
- Routing
- Peering
- Time of day
- Network congestion
- Distance and latency
For better troubleshooting, test against multiple suitable servers or locations.
iperf3 measures the path between two specific endpoints. It does not automatically measure the total capacity of your Internet connection.
IDONCLOUD Network Infrastructure
IDONCLOUD provides VPS and Dedicated Server infrastructure with IPv4, IPv6 and high-bandwidth connectivity options for network-intensive workloads.
Reliable network performance depends on more than port speed. Routing, upstream connectivity, server hardware and network capacity all contribute to real-world performance.
Visit idoncloud.com for more information about our infrastructure.
Related Guides
- How to Diagnose Packet Loss with MTR on Linux
- How to Use Traceroute on Linux
- How to Check Network Interface Speed on Linux
- How to Optimize Ubuntu for 10Gbps Networking
- 1Gbps vs 10Gbps Dedicated Server
- How to Configure a Static IP Address on Ubuntu with Netplan