Using iperf3 to Help Troubleshoot Speed and Throughput Issues

There are many cool options you can use with iperf but I think it’s important to use multiple simultaneous streams. I’ve seen people use this tool without the -P option which will only utilize 1 stream and doesn’t really tell you much when it comes to speed and throughput. You’ll see what I mean when you run the commands.

#Defaults (these can be changed):
default run time 10 seconds
port 5001
window size of 64k :Windows max size is 1024k.

Below I’m going to do multiple streams while changing the windows sizes. I find this the best way to see if you have speed or throughput issues.

iperf3 -c -P 20 -w 128K -T 20Streams			
iperf3 -c -P 30 -w 512K -T 30Streams	
iperf3 -c -P 40 -w 1024K -T 40Streams	

-c is the end device running in server mode
-P is the amount of streams
-w is the windows size
-T is the label for the test

So lets say you want to run the same tests above but in the other direction. Add a -R to the end of the command:

iperf3 -c -P 40 -w 1024K -T 40Streams -R

Now there may be times where you need to run more than one instance at a time. This is usually the case when troubleshooting 40G+ links. In this situation, you can actually start up multiple server and client instances of iperf using different ports:

Start multiple server instances of iperf with different port numbers:

iperf3 -s -p 5101
iperf3 -s -p 5102
iperf3 -s -p 5103 

Then run multiple clients instances using the different port numbers from above:

iperf3 -c hostname -T test1 -p 5101
iperf3 -c hostname -T test2 -p 5102
iperf3 -c hostname -T test3 -p 5103

Again, this tool has so many options and you should play around with them. Below are all the options:

iperf3: parameter error - must either be a client (-c) or server (-s)

Usage: iperf [-s|-c host] [options]

    iperf [-h|--help] [-v|--version]

Server or Client:

  -p, --port      #         server port to listen on/connect to
  -f, --format    [kmgKMG]  format to report: Kbits, Mbits, KBytes, MBytes
  -i, --interval  #         seconds between periodic bandwidth reports
  -F, --file name           xmit/recv the specified file
  -B, --bind          bind to a specific interface
  -V, --verbose             more detailed output
  -J, --json                output in JSON format
  --logfile f               send output to a log file
  -d, --debug               emit debugging output
  -v, --version             show version information and quit
  -h, --help                show this message and quit

Server specific:

  -s, --server              run in server mode
  -D, --daemon              run the server as a daemon
  -I, --pidfile file        write PID file
  -1, --one-off             handle one client connection then exit

Client specific:

  -c, --client        run in client mode, connecting to 
  -u, --udp                 use UDP rather than TCP
  -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
                           (default 1 Mbit/sec for UDP, unlimited for TCP)
                            (optional slash and packet count for burst mode)
  -t, --time      #         time in seconds to transmit for (default 10 secs)
  -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)
  -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)
  -l, --len       #[KMG]    length of buffer to read or write
                            (default 128 KB for TCP, 8 KB for UDP)
  --cport             bind to a specific client port (TCP and UDP, default: ephemeral port)
  -P, --parallel  #         number of parallel client streams to run
  -R, --reverse             run in reverse mode (server sends, client receives)
  -w, --window    #[KMG]    set window size / socket buffer size
  -M, --set-mss   #         set TCP/SCTP maximum segment size (MTU - 40 bytes)
  -N, --no-delay            set TCP/SCTP no delay, disabling Nagle's Algorithm
  -4, --version4            only use IPv4
  -6, --version6            only use IPv6
  -S, --tos N               set the IP 'type of service'
  -Z, --zerocopy            use a 'zero copy' method of sending data
  -O, --omit N              omit the first n seconds
  -T, --title str           prefix every output line with this string
  --get-server-output       get results from server
  --udp-counters-64bit      use 64-bit counters in UDP test packets

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-
More Stories
DNS Basics