If you’re using a Linux VPS and want to test its bandwidth or identify the cause of slowdowns, iPerf is a must-have tool. iPerf is a powerful utility that accurately measures network bandwidth performance between two endpoints. In this article, VPSWindows will help you understand what iPerf is, why it’s important, and provide a clear, step-by-step guide on how to install and how to test bandwidth on a Linux VPS using iPerf in the simplest way possible.
Introduction to iPerf
What is iPerf?
If you’re looking for a lightweight, free, and easy-to-use tool to test network bandwidth between two servers or devices, Iperf is one of the best choices. Iperf is a command-line utility specifically designed to measure data transfer speeds between devices over TCP or UDP connections. It helps you accurately determine if your network connection is experiencing congestion, packet loss, or instability.
Particularly useful for Linux VPS environments, Iperf requires no graphical interface and runs smoothly even in minimal setups, making it a reliable tool for system administrators managing servers remotely.
Why Test Bandwidth on a Linux VPS Using iPerf Command?
When it comes to measuring network bandwidth, iPerf stands out as a preferred tool for many reasons.
- Lightweight and Easy to Use: iPerf is incredibly easy to install and doesn’t require significant system resources. With just a few simple commands, you can run a speed test between two servers.
- Accurate and Objective Measurements: iPerf provides reliable metrics for bandwidth, latency, and other performance factors without being influenced by external elements. This is crucial for analyzing real-world network performance without interference from hardware quality or user activity.
- Flexible and Highly Customizable: You can adjust test duration, set parallel data streams, define target bandwidth, and choose the protocol (TCP/UDP). This flexibility makes iPerf suitable for various scenarios, from testing within a local LAN to measuring performance between two VPS servers across different countries.
- Support for TCP and UDP: TCP tests deliver stable results and accurately reflect real-world transfer performance. UDP tests help identify packet loss, lag, or jitter — ideal for network checks involving gaming, video calls, or streaming services.
- Free and Compatible with Most Linux Systems: One of iPerf’s biggest advantages is that it’s completely free and runs seamlessly on popular Linux distributions like Ubuntu, Debian, CentOS, and Fedora. This eliminates the need for costly commercial bandwidth testing tools while still delivering accurate and reliable results.
Install iPerf on a Linux VPS
Before you test bandwidth on a Linux VPS using iPerf, you’ll need to install this tool on your VPS. Below, we’ll walk through the steps to install iPerf on popular Linux distributions like Ubuntu/Debian and CentOS/RHEL.
Installing iPerf on Ubuntu/Debian
To install iPerf on Ubuntu or Debian, follow these simple steps:
Step 1: Update Package Lists
Always start by updating the system to ensure you have the latest package information: sudo apt update
Step 2: Install iPerf
Once the package list is updated, install iPerf with the command below: sudo apt install iperf -y
This command will automatically download and install iPerf from the official Ubuntu or Debian repositories. The installation process usually takes just a few minutes, and you’ll receive a confirmation message once it’s complete.
Installing Iperf on CentOS/RHEL
For operating systems like CentOS or RHEL, you can install Iperf easily using the yum or dnf package manager. Iperf is usually available in the EPEL repository.
Step 1: Install the EPEL repository (if not already installed):
Before installing Iperf, make sure you have the EPEL repository. Run this command: sudo yum install epel-release -y
Step 2: Install Iperf
Once EPEL is ready, you can proceed to install Iperf with the command: sudo yum install iperf -y
This ensures you have the latest version of Iperf installed and ready for your bandwidth testing.
Check the Installed Iperf Version
After completing the installation, you can verify whether Iperf has been installed successfully by running the following command:
iperf --version
This command will display the detailed version information of Iperf, allowing you to confirm that the tool is ready for network performance testing.
Test Bandwidth on a Linux VPS using iPerf
After completing the installation, you’re now ready to test bandwidth on a Linux VPS using iPerf. This involves running tests in both server and client modes.
Step 1: Check Ports and Disable Firewall
Before you test bandwidth on a Linux VPS using Iperf, it’s important to check the port that Iperf will use. When Iperf runs in server mode, it listens on a specific port. This must be configured correctly to avoid connection issues.
By default, Iperf uses port 5001 (iperf) or 5201 (iperf3). Before running tests, you should:
- Disable the firewall (for internal tests), or
- Open the required port on the VPS:
sudo ufw allow 5201/tcp
sudo ufw allow 5201/udp
Step 2: Server Mode
After checking and opening the necessary ports, you can start Iperf in server mode.
To launch the Iperf server, use the following command: iperf -s
Once started, Iperf will listen for client requests on the default port 5201. During this process, the server remains active, and you can monitor any incoming connections.
Step 3: Client Mode
In this step, you will use another machine (client) to test the transfer speed to the server. For example, let’s assume the server IP address is 51.79.154.291.
Simply run the following command (replace this IP with your server’s IP):
iperf -c 51.79.154.291 -i1 -t 100 -m
Explanation of the parameters:
- -c 51.79.154.291: The IP address of the server you want to test.
- -i 1: Displays the test results every 1 second.
- -t 100: Total test duration is 100 seconds.
- -m: Shows information about TCP MSS and MTU headers for better network configuration insight.
Once you run the command, you will see output that includes transfer speed, packet loss, and retransmissions (for TCP). This data is easy to read and helps you evaluate your network bandwidth effectively.
When running the command iperf -c [IP] -t 100, the tool will perform a bandwidth test for 100 seconds before stopping automatically, which may make the process seem lengthy. If you only need a quick test, you can reduce the duration by using -t 5 or -t 10. To stop the test early, simply press the Ctrl + C keyboard shortcut.
Other Useful iPerf Commands
iPerf is not limited to simple bandwidth testing; it also offers a variety of advanced options and parameters for in-depth network analysis.
Long-Term UDP Testing:
To evaluate the stability of a UDP connection over a specific period.
iperf -c <Server_IP_Address> -u -b 50M -t 60
Long-Term TCP Testing with Periodic Reports:
This is a great way to monitor average bandwidth performance and detect fluctuations.
iperf -c <Server_IP_Address> -t 600 -i 10
Testing Multiple Parallel Connections:
To check how well your network handles multiple data streams, you can use the -P parameter.
iperf -c <Server_IP_Address> -P 5
The -P 5 option creates 5 parallel connections to the server, allowing you to assess how the network performs under heavy traffic conditions.
iPerf is a powerful and flexible tool that allows users to measure network performance with precision and ease. Its simple installation on Linux operating systems, combined with straightforward bandwidth testing steps, helps you effectively monitor your network’s health. We hope this guide makes it easier for you to install and test bandwidth on your Linux VPS using iPerf. Mastering iPerf will give you better control over network management and troubleshooting. If you have any questions or want to learn more VPS management tips, don’t forget to visit VPSWindows!