Skip to content

What is iperf?

iperf is a command-line tool that measures the maximum achievable bandwidth on IP networks. It works by generating traffic between two endpoints, typically a client and a server. The tool reports the throughput, packet loss, and other performance metrics, providing valuable insights into network performance.

Quick Start

# Server Mode
iperf -s

# Client Mode
iperf -c <server_IP>

# continuous mode
iperf -c <server_IP> -t 60 -i 5

#Reverse the direction of the test
iperf -c <server_IP> -R

#bidirectional mode
iperf -c <server_IP> -d

#UDP mode
iperf -c <server_IP> -u -b 100M -t 60

#IPv6 mode
iperf -c <server_IP> -6 -t 60

#JSON output
iperf -c <server_IP> --json -t 60

#Multi-Threaded Testing
iperf -c <server_IP> -P 10 -t 60

#Verbose mode
iperf -c <server_IP> -V

#ASCII output
iperf -c <server_IP> -A

Basic Usage

To get started with iperf, you'll need to install it on both the client and server machines. Once installed, follow these steps:

  1. Server Mode: On the server machine, run iperf -s to start the server in listening mode.
  2. Client Mode: On the client machine, run iperf -c <server_IP> to connect to the server and initiate the test.

iperf will automatically start transmitting data and measuring the throughput. You can adjust the test duration, packet size, and other parameters using various options.

Advanced Options

iperf offers a wide range of options for customizing tests and simulating real-world scenarios. Here are some advanced options for pro users:

  • -p <port_number>: Specify the port number to use for the test (default is 5001).
  • -t <time>: Set the test duration in seconds (default is 10 seconds).
  • -i <interval>: Specify the interval between reports in seconds (default is 1 second).
  • -u: Use UDP instead of TCP (default).
  • -b <bandwidth>: Set the target bandwidth in bits per second (e.g., -b 100M for 100 Mbps).
  • -l <packet_length>: Specify the packet length in bytes (default is 1470 bytes).
  • -P <parallel_streams>: Use multiple parallel streams to test multi-threaded performance (default is 1 stream).
  • -R: Reverse the direction of the test (i.e., server sends data to client).
  • -d: Enable debugging output.

Simulating Real-World Scenarios

iperf allows you to simulate various real-world scenarios to test network performance under different conditions. Here are a few examples:

  • Video Streaming: Use the -b option to set a target bandwidth, simulating a video streaming workload. For example: iperf -c <server_IP> -b 50M -t 60
  • File Transfer: Use the -l option to set a large packet length, simulating a file transfer workload. For example: iperf -c <server_IP> -l 1400 -t 300
  • Multi-User Scenario: Use the -P option to simulate multiple parallel streams, testing network performance under a multi-user workload. For example: iperf -c <server_IP> -P 10 -t 60

Interpreting Results

iperf reports various performance metrics, including:

  • Bandwidth: The average throughput achieved during the test.
  • Packet Loss: The percentage of packets lost during transmission.
  • Jitter: The variation in packet delay.
  • Latency: The average round-trip time for packets.

When interpreting results, consider the following:

  • Bandwidth: A higher bandwidth indicates better network performance.
  • Packet Loss: A lower packet loss percentage indicates better network reliability.
  • Jitter: A lower jitter value indicates better network stability.

Advanced iperf Features

iperf offers several advanced features that can help you fine-tune your tests and gain deeper insights into network performance.

1. Multi-Threaded Testing

iperf allows you to run multiple threads concurrently, simulating multi-user workloads and testing network performance under heavy loads. Use the -P option to specify the number of threads.

Example: iperf -c <server_IP> -P 10 -t 60

2. UDP Testing

iperf can test UDP performance using the -u option. This is useful for testing real-time applications like video streaming and VoIP.

Example: iperf -c <server_IP> -u -b 100M -t 60

3. IPv6 Testing

iperf supports IPv6 testing using the -6 option. This is useful for testing IPv6 networks and applications.

Example: iperf -c <server_IP> -6 -t 60

4. Bidirectional Testing

iperf can test bidirectional traffic using the -d option. This is useful for testing network performance in both directions.

Example: iperf -c <server_IP> -d -t 60

5. JSON Output

iperf can output results in JSON format using the --json option. This is useful for parsing and analyzing results programmatically.

Example: iperf -c <server_IP> --json -t 60

iperf3 vs. iperf2

iperf3 is the latest version of iperf, offering several improvements over iperf2, including:

  • Improved accuracy and reliability
  • Enhanced support for IPv6 and UDP testing
  • New features like multi-threaded testing and JSON output

If you're still using iperf2, it's recommended to upgrade to iperf3 for better performance and features.

Tips and Tricks for Using iperf

Here are some additional tips and tricks for using iperf:

  • Use the -V option to enable verbose mode and get detailed output.
  • Use the -A option to enable ASCII output and make results easier to read.
  • Use the -F option to specify a file for output and save results for later analysis.
  • Use the -T option to specify a title for the test and make results easier to identify.
The content provided is generated with the help of artificial intelligence (AI) and may contain inaccuracies or outdated information due to the limitations of AI. While I strive to review and validate the content, some errors or inaccuracies may still be present in the final output. Please use this content as a general guide only and verify any critical information through reputable sources before relying on it. I appreciate your understanding and feedback in helping us improve the accuracy and quality of our AI-generated content."