How to Start iperf3 Server in UDP Mode for Network Performance Testing


2 views

When you run iperf3 -s, the tool defaults to TCP mode, as shown in the socket listing:

root@srv ~# lsof -i -P | grep iperf3
iperf3    21030            root    3u  IPv4 15606995      0t0  TCP *:5201 (LISTEN)

To initiate a UDP server, use the following command:

iperf3 -s -u

This will create a UDP socket listening on port 5201 by default. Verify with:

netstat -ulnp | grep iperf3
# or
ss -ulnp | grep iperf3

For more control over the UDP test parameters:

iperf3 -s -u -p 5001 -V -i 5

Where:

- -p 5001 changes the listening port

- -V enables verbose output

- -i 5 sets interval reporting to 5 seconds

From a client machine, test with:

iperf3 -c server_ip -u -b 50M -t 30

This sends UDP traffic at 50Mbps for 30 seconds. Server-side output will show packet loss statistics which are crucial for UDP performance analysis.

To test VoIP quality simulation (low bandwidth, high sensitivity to packet loss):

# Server:
iperf3 -s -u -p 6001

# Client:
iperf3 -c server_ip -u -p 6001 -b 128K -l 160 -t 60

The -l 160 sets packet size to approximate G.711 codec frames (20ms packets). Monitor the jitter and loss metrics in server output.

If UDP packets aren't being received:

1. Verify firewall rules allow the port

2. Check tcpdump -i eth0 udp port 5201 for incoming traffic

3. Test with -p on non-standard ports to bypass potential ISP filtering


Unlike TCP which is connection-oriented, UDP (User Datagram Protocol) provides connectionless communication. When testing network performance with iperf3, UDP mode is particularly useful for:

  • Measuring raw bandwidth capacity
  • Testing packet loss characteristics
  • Simulating real-time traffic (VoIP, video streaming)

The simplest way to start an iperf3 server in UDP mode is:

iperf3 -s -p 5001

However, this alone doesn't activate UDP mode - you'll need a client to initiate UDP testing. The server automatically adapts to the protocol requested by the client.

To confirm your server is ready for UDP connections:

netstat -tulnp | grep iperf3
# or alternatively:
ss -ulnp | grep iperf3

You should see output similar to:

udp    UNCONN    0      0      *:5001     *:*    users:(("iperf3",pid=1234,fd=3))

Here's a full workflow for UDP testing:

Server side:

iperf3 -s -p 5201

Client side:

iperf3 -c server_ip -p 5201 -u -b 100M

Key client parameters:

  • -u: Enables UDP mode
  • -b 100M: Sets target bandwidth to 100Mbps
  • -l 1400: Optional - sets packet size (default 8KB)
  • -t 30: Optional - test duration in seconds

For more precise UDP testing:

iperf3 -s -p 5201
# Client with detailed reporting
iperf3 -c server_ip -p 5201 -u -b 50M --get-server-output -i 1

Additional useful parameters:

  • --get-server-output: Shows server-side statistics
  • -i 1: Shows interim reports every 1 second
  • --udp-counters-64bit: For high-speed networks

If you encounter problems:

  1. Verify firewall rules allow UDP traffic on the test port
  2. Check for network path MTU limitations
  3. Ensure both client and server use the same port number
  4. Try increasing the socket buffer size with -w parameter

For example:

iperf3 -c server_ip -u -b 1G -w 2M