IPERF - Guide

From IT-Arts.net
Revision as of 12:18, 3 July 2026 by Admin (talk | contribs) (Created page with "Category:Wiki '''''[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]''''' == Command Syntax == <nowiki> iperf3 [OPTIONS]</nowiki> Client mode: <nowiki> iperf3 -c <server></nowiki> Server mode: <nowiki> iperf3 -s</nowiki> == Client Options == === Server Selection === Connect to a server: <nowiki> iperf3 -c 192.168.1.10</nowiki> Connect using a hostname: <nowiki> iperf3 -c iperf.example.com</nowiki> Specify the server port: <nowiki...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Return to Wiki Index

Command Syntax

iperf3 [OPTIONS]

Client mode:

iperf3 -c <server>

Server mode:

iperf3 -s

Client Options

Server Selection

Connect to a server:

iperf3 -c 192.168.1.10

Connect using a hostname:

iperf3 -c iperf.example.com

Specify the server port:

iperf3 -c 192.168.1.10 -p 5202

Specify the source address:

iperf3 -c 192.168.1.10 -B 192.168.1.20

Specify the outgoing interface (Linux routing dependent):

iperf3 -c 192.168.1.10 -B 10.0.0.2

Test Duration

Run a test for 30 seconds:

iperf3 -c 192.168.1.10 -t 30

Run indefinitely until interrupted:

iperf3 -c 192.168.1.10 -t 0

Interval Reporting

Display statistics every second:

iperf3 -c 192.168.1.10 -i 1

Display statistics every 500 ms:

iperf3 -c 192.168.1.10 -i 0.5

Parallel Streams

Launch four simultaneous TCP streams:

iperf3 -c 192.168.1.10 -P 4

Launch sixteen TCP streams:

iperf3 -c 192.168.1.10 -P 16

Parallel streams are commonly used to fully utilize high-bandwidth links when a single TCP flow is limited by congestion control or latency.

Reverse Mode

Request the server to transmit data back to the client:

iperf3 -c 192.168.1.10 -R

Useful for validating asymmetric bandwidth.

Bidirectional Mode

Transmit simultaneously in both directions:

iperf3 -c 192.168.1.10 --bidir

Useful for evaluating full-duplex links.

TCP Window Size

Specify the socket buffer size:

iperf3 -c 192.168.1.10 -w 4M

Possible units:

  • K
  • M

Zero Copy

Reduce CPU utilization using sendfile():

iperf3 -c 192.168.1.10 -Z

Useful on high-speed links.

Omit Initial Seconds

Ignore the first seconds of a test:

iperf3 -c 192.168.1.10 -O 5

Useful for avoiding TCP slow-start measurements.

MSS

Specify the TCP Maximum Segment Size:

iperf3 -c 192.168.1.10 -M 1400

Mostly used for troubleshooting MTU issues.

IPv4 and IPv6

Force IPv4:

iperf3 -4 -c server.example.com

Force IPv6:

iperf3 -6 -c server.example.com

JSON Output

Produce JSON output:

iperf3 -c 192.168.1.10 -J

Useful for automation and monitoring.

Log File

Store client output:

iperf3 -c 192.168.1.10 --logfile iperf.log

Server Options

Start a server:

iperf3 -s

Specify a listening port:

iperf3 -s -p 5202

Bind to a specific interface:

iperf3 -s -B 192.168.1.10

Run only one test then terminate:

iperf3 -s -1

Enable daemon mode:

iperf3 -s -D

Create a log file:

iperf3 -s --logfile /var/log/iperf3.log

UDP Testing

Basic UDP Test

iperf3 -c 192.168.1.10 -u

Specify Bandwidth

Transmit at 100 Mbit/s:

iperf3 -c 192.168.1.10 -u -b 100M

Transmit at 1 Gbit/s:

iperf3 -c 192.168.1.10 -u -b 1G

Unlimited transmission speed:

iperf3 -c 192.168.1.10 -u -b 0

UDP Packet Length

Specify datagram size:

iperf3 -c 192.168.1.10 -u -l 1400

UDP Results

UDP reports include:

  • Throughput
  • Packet loss
  • Lost datagrams
  • Jitter
  • Out-of-order packets

Authentication

Generate credentials:

iperf3 --username user --rsa-private-key-path private.pem

Authenticate:

iperf3 -c server --username user --rsa-public-key-path public.pem

This feature is primarily intended for controlled environments where multiple users access the same server.

Examples

LAN Performance

Server:

iperf3 -s

Client:

iperf3 -c 192.168.1.10

10 Gbit/s Validation

Server:

iperf3 -s

Client:

iperf3 -c 192.168.1.10 -P 8 -O 5 -t 60 -Z

VPN Performance

Server:

iperf3 -s

Client:

iperf3 -c 10.10.10.1 -R

Internet Connection

iperf3 -c remote.example.com -P 4 -t 60

Wi-Fi Benchmark

iperf3 -c 192.168.1.10 -P 4 -t 30

Continuous Monitoring

watch -n 60 'iperf3 -c 192.168.1.10 -t 10'

Performance Considerations

TCP Congestion Control

Linux supports multiple congestion control algorithms.

Display the current algorithm:

sysctl net.ipv4.tcp_congestion_control

List available algorithms:

sysctl net.ipv4.tcp_available_congestion_control

CPU Limitations

High-speed links above 10 Gbit/s may become CPU-bound.

Recommendations:

  • Enable Zero Copy (-Z).
  • Increase parallel streams.
  • Disable CPU frequency scaling.
  • Pin processes to dedicated CPU cores.
  • Verify interrupt balancing.

MTU

Incorrect MTU values reduce throughput.

Validate MTU:

ping -M do -s 1472 remote-host

Socket Buffers

Display Linux socket limits:

sysctl net.core.rmem_max
sysctl net.core.wmem_max

Increase if necessary.

NUMA

On NUMA systems:

  • Place client and NIC on the same NUMA node.
  • Pin CPU affinity.
  • Reduce cross-node memory access.

Security

Network Exposure

iperf3 servers accept arbitrary client connections.

Restrict access using:

  • Firewall rules
  • VPN tunnels
  • Dedicated management VLANs
  • Access control lists

Firewall

Default TCP port:

5201/tcp

Restrict source addresses whenever possible.

Denial of Service

An unrestricted iperf3 server may generate significant traffic.

Recommendations:

  • Enable the server only during testing.
  • Use -1 for one-shot operation.
  • Restrict client IP addresses.
  • Avoid exposing iperf3 servers directly to the Internet.

Data Confidentiality

iperf3 traffic is not encrypted.

Use:

  • WireGuard
  • IPsec
  • SSH tunnel
  • TLS VPN

when testing across untrusted networks.

Authentication

If authentication is enabled:

  • Protect private keys.
  • Rotate credentials regularly.
  • Restrict filesystem permissions.

Troubleshooting

Connection Refused

Verify the server is running:

ss -lnt | grep 5201

Verify firewall rules.

Connection Timed Out

Verify:

  • Routing
  • NAT
  • Firewall
  • ACLs
  • VPN connectivity

Low Throughput

Increase parallel streams:

iperf3 -c server -P 8

Increase test duration:

iperf3 -c server -t 60

Ignore TCP slow-start:

iperf3 -c server -O 5

High CPU Usage

Enable Zero Copy:

iperf3 -c server -Z

Reduce logging.

Verify CPU frequency.

Poor UDP Results

Reduce requested bandwidth:

iperf3 -c server -u -b 500M

Reduce packet size:

iperf3 -c server -u -l 1200

Investigate switch buffering and packet drops.

Reverse Mode Works but Normal Mode Fails

Check:

  • Asymmetric routing
  • Firewall rules
  • NAT configuration
  • Policy-based routing

Packet Loss

Verify interface statistics:

ip -s link

Capture traffic:

tcpdump -i eth0

Check switch errors.

High Retransmissions

Possible causes:

  • Congestion
  • MTU mismatch
  • Packet loss
  • Duplex mismatch
  • Faulty cabling

Unexpected Results in Virtual Machines

Verify:

  • Virtio drivers
  • Hypervisor CPU scheduling
  • Host CPU saturation
  • Virtual NIC offloading
  • NUMA placement

Return to Wiki Index