iperf3: Network Performance Measurement Tool

iperf3 is a command-line tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning various parameters related to timing, protocols (TCP, UDP, SCTP), and buffers. iperf3 is invaluable for network administrators and engineers to diagnose network bottlenecks, test QoS settings, and verify throughput between two endpoints.

Core Concepts: TCP vs. UDP for Packet Loss

  • TCP: When testing with TCP, iperf3 measures achievable throughput. Packet loss is typically not directly visible in the results because TCP handles retransmissions, effectively masking packet drops from the application layer. The effect of packet loss will be a reduction in overall throughput.
  • UDP: To directly observe packet loss and jitter, UDP is the preferred protocol. iperf3 will report packet loss statistics, which can help diagnose network reliability issues.

1. iperf3 Server Mode

First, you need to start iperf3 in server mode on one of the machines. The server listens for incoming connections from clients.

iperf3 -s
  • -s: Runs iperf3 in server mode.

Server on a Custom Port

To listen on a port other than the default (5201):

iperf3 -s -p 5555
  • -p <port_number>: Specifies the port for the server to listen on.

2. iperf3 Client Mode

Run iperf3 in client mode on the other machine, connecting to the server and initiating the traffic flow.

Basic TCP Test (Default)

Measures TCP bandwidth to the server.

iperf3 -c <server_ip>
# Example:
iperf3 -c 10.1.0.7
  • -c <server_ip>: Runs iperf3 in client mode and connects to the specified server IP address.

TCP Test with Custom Port and Parallel Streams

iperf3 -c <server_ip> -p 5555 -P 2 -t 30
  • -p 5555: Connects to the server listening on port 5555.
  • -P 2: Uses 2 parallel client streams (useful for saturating high-bandwidth links or testing multi-core performance).
  • -t 30: Runs the test for 30 seconds (default is 10 seconds).

UDP Test (to check Packet Loss and Jitter)

iperf3 -c <server_ip> -u -b 100M -t 30
  • -u: Specifies UDP protocol.
  • -b 100M: Sets the target UDP bandwidth to 100 Mbps.
  • Packet loss and jitter will be reported in the client and server output.

Reverse Mode (Server Sends, Client Receives)

By default, the client sends data to the server. In reverse mode, the server sends data to the client, measuring bandwidth in the opposite direction.

iperf3 -c <server_ip> -R
  • -R: Runs in reverse mode (server sends, client receives).

Setting TCP Window Size (for advanced tuning)

iperf3 -c <server_ip> -w 1024k
  • -w 1024k: Sets the TCP window size to 1024 kilobytes. This can impact throughput, especially over high-latency links.

Outputting Results as JSON

Useful for programmatic parsing of results.

iperf3 -c <server_ip> -J
  • -J: Outputs results in JSON format.