Overview – iperf3
iperf is a network testing tool used to measure the bandwidth and performance of network links. It is a versatile tool that can create TCP and UDP data streams and measure the throughput of a network that is carrying them. iperf can be used to test network performance between two hosts and is often used by network administrators and engineers to diagnose network issues, optimize network performance, and validate network configurations.

Key Features of iperf
- Cross-Platform: Available on multiple platforms, including Linux, Windows, and macOS.
- Client-Server Model: Uses a client-server model to test network throughput.
- TCP and UDP Support: Measures throughput for both TCP and UDP protocols.
- Customizable Parameters: Allows customization of various parameters, such as buffer size, bandwidth, and duration.
- Bidirectional Testing: Can test network performance in both directions (from client to server and vice versa).
- Multiple Streams: Can test multiple parallel streams to measure aggregated throughput.
Installing iperf
To install iperf, use the package manager for your operating system:
- Debian/Ubuntu:
sudo apt-get install iperf3
sudo apt install iperf3
- CentOS/RHEL:
sudo yum install iperf3
- Fedora:
sudo dnf install iperf3
- Windows: Download the executable from the official website.
Basic Usage of iperf
Syntax
The basic syntax for iperf is:
iperf3 [options]
Example Commands
1. Running an iperf Server
To start an iperf server, run the following command on the server host:
iperf3 -s
This command starts iperf in server mode and listens for incoming connections.
2. Running an iperf Client
To start an iperf client, run the following command on the client host:
iperf3 -c [server_ip]
Replace [server_ip] with the IP address of the iperf server.
3. Running a TCP Test
To run a TCP throughput test, use the default command:
iperf3 -c [server_ip]
4. Running a UDP Test
To run a UDP throughput test, use the -u option:
iperf3 -u -c [server_ip]
5. Testing Bidirectional Throughput
To test bidirectional throughput, use the –bidir option:
iperf3 -c [server_ip] --bidir
6. Customizing Test Parameters
To customize the bandwidth, duration, and other parameters, use additional options:
iperf3 -c [server_ip] -b 10M -t 30
- -b 10M: Sets the bandwidth to 10 Mbps.
- -t 30: Sets the test duration to 30 seconds.
Advantages of iperf
- Precision and Accuracy: Provides precise and accurate measurements of network bandwidth and performance.
- Ease of Use: Simple command-line interface with clear output.
- Cross-Platform: Works on multiple operating systems, making it versatile.
- Customizable: Allows extensive customization of test parameters.
- Real-Time Statistics: Provides real-time statistics during the test.
- Network Protocols: Supports both TCP and UDP protocols.
Disadvantages of iperf
- Limited by Network Conditions: Results can be affected by existing network traffic and conditions.
- Requires Two Hosts: Needs both a client and server to run tests.
- Security Concerns: Running an iperf server can pose security risks if not properly managed.
- Resource Intensive: Can consume significant network and system resources during testing.
- Single-Use Focus: Primarily focused on bandwidth testing, lacks comprehensive network diagnostic features.
Practical Use Cases
1. Network Troubleshooting
Scenario: A network administrator suspects there is a bandwidth issue between two locations. Solution:
- Start iperf in server mode at one location:
iperf3 -s
- Run the iperf client at the other location:
iperf3 -c [server_ip]
- Analyze the output to identify any bandwidth bottlenecks.
2. Network Performance Validation
Scenario: An organization has upgraded its network infrastructure and needs to validate the performance improvements. Solution:
- Deploy iperf servers at various network points.
- Use iperf clients to test throughput between these points:
iperf3 -c [server_ip] -b 100M -t 60
- Compare the results with previous performance metrics.
3. Capacity Planning
Scenario: A company is planning to deploy a new application that requires high bandwidth. Solution:
- Use iperf to simulate the application’s bandwidth requirements:
iperf3 -c [server_ip] -b 50M -t 120
- Evaluate if the current network can handle the additional load.
Example of iperf Output
Running iperf with the command:
iperf3 -c [server_ip]
might produce output like this:
Connecting to host [server_ip], port 5201 [ 4] local [client_ip] port 52082 connected to [server_ip] port 5201 [ ID] Interval Transfer Bandwidth Retr Cwnd [ 4] 0.00-1.00 sec 112 MBytes 939 Mbits/sec 0 241 KBytes [ 4] 1.00-2.00 sec 113 MBytes 947 Mbits/sec 0 256 KBytes [ 4] 2.00-3.00 sec 112 MBytes 942 Mbits/sec 0 272 KBytes [ 4] 3.00-4.00 sec 112 MBytes 942 Mbits/sec 0 287 KBytes [ 4] 4.00-5.00 sec 113 MBytes 946 Mbits/sec 0 302 KBytes [ 4] 5.00-6.00 sec 112 MBytes 942 Mbits/sec 0 317 KBytes [ 4] 6.00-7.00 sec 113 MBytes 946 Mbits/sec 0 332 KBytes [ 4] 7.00-8.00 sec 112 MBytes 941 Mbits/sec 0 346 KBytes [ 4] 8.00-9.00 sec 112 MBytes 943 Mbits/sec 0 361 KBytes [ 4] 9.00-10.00 sec 113 MBytes 947 Mbits/sec 0 376 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-10.00 sec 1.10 GBytes 944 Mbits/sec 0 sender [ 4] 0.00-10.00 sec 1.10 GBytes 944 Mbits/sec receiver iperf Done.
Summary
iperf is a powerful and versatile network testing tool that allows administrators and engineers to measure the bandwidth and performance of network links. It supports both TCP and UDP protocols and provides detailed metrics on network throughput, latency, and packet loss. While it is easy to use and highly customizable, it requires a good understanding of network conditions and proper security measures when running the iperf server. Despite its focus on bandwidth testing, iperf remains an essential tool for network troubleshooting, performance validation, and capacity planning.
Useful Links
https://sanchitgurukul.com/tutorials-cat
iperf3 Installation and Usage: Simplifying Network Performance Testing
This article provided insights on the topic. For latest updates and detailed guides, stay connected with Sanchit Gurukul.
