How to Use iPerf to Test Network Bandwidth

In this tutorial you will learn how to use iPerf3 to measure throughput and simulate network loads on your networking infrastructure. iPerf3 is a useful, simple command-line tool for testing network throughput and performance. We will provide step-by-step instructions as well as a few common examples and use cases of ways to effectively use iPerf in your environment.

Install iPerf on Windows

iPerf can be installed on and ran from any windows based machine including Windows 10, Windows 11, and Windows Server.

Step 1. Download the latest iPerf3 package for your operating system from https://iperf.fr/iperf-download.php

Screenshot showing how to download iperf3 for windows 10 and 11 64 bit.

Step 2. Extract the zip file.

Step 3. Copy the iperf3 executable and any required DLLs to the computers you want to use for testing. One computer will act as the server and the other the client. Here I created a folder named ‘TEMP’ on each machine.

Screenshot showing the location we extracted the iperf3 executable and where we will open it from via command line or powershell.

Install iPerf on Linux (Ubuntu in this Case)

Step 1. Update the package repository:

sudo apt update

Step 2. Install iperf3 package:

sudo apt install iperf3

Step 3. Verify iperf3 is installed:

iperf3 -v

You should see output like:

iperf 3.1.3

Step 4. To start iperf3 in server mode:

iperf3 -s

Step 5. To start iperf3 in client mode, connect to a server IP:

iperf3 -c SERVER_IP

Replace SERVER_IP with the IP address of your iperf3 server.

Fun fact, you can even run iperf directly on some networking equipment such as Cisco’s Cat9k series switches.

Run iPerf

To test network throughput between two computers using iPerf, you will need to set up one computer as the iPerf server and the other as the iPerf client. You do this by specifying command-line parameters to indicate which system will assume the role of the server and which will become the client.

Diagram showing topology used during iperf demonstration

On the iPerf Server:

Step 1. Open a command prompt or terminal and navigate to the folder containing iperf3.exe.

C:\Users\Chase>cd C:\TEMP\

C:\TEMP>dir
 Volume in drive C has no label.
 Volume Serial Number is C44B-B620

 Directory of c:\TEMP

08/23/2023  03:08 PM    <DIR>          .
08/23/2023  03:08 PM         3,539,372 cygwin1.dll
08/23/2023  03:08 PM           468,748 iperf3.exe
               2 File(s)      4,008,120 bytes
               1 Dir(s)  567,597,051,904 bytes free

C:\TEMP>

Step 2. Type the command iperf3 -s to start the iPerf server.

C:\TEMP\iperf3 -s
-------------------------------------------------------------------
Server listening on 5201
-------------------------------------------------------------------

Step 3. The server will display “server listening on 5201” when ready.

On the iPerf Client:

Step 1. Open a command prompt or terminal and navigate to the iperf3 executable.

Step 2. Type iperf3 -c SERVER-IP-OR-NAME to start the iPerf client, replacing SERVER-IP-OR-NAME with the IP address or hostname of the iPerf server.

C:\TEMP\iperf3 -c 10.2.0.10
Connecting to host 10.2.0.10, port 5201
[  4] local 10.2.0.89 port 32777 connected to 10.2.0.10 port 5201
[ ID]  Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec   109 MBytes   916 Mbits/sec

The test will run for 10 seconds by default and display results when finished. If you’re on a windows machine you can open Task Manager and see the bandwidth utilization on the performance tab.

Screenshot of the performance tab within task manager in Windows 11 64 bit. The screenshot shows the bandwidth consumption and connection speed being affected by iperf.

Interpreting iPerf Test Results

The iPerf output will display report intervals and throughput information. Key stats:

  1. Interval – The periodic reporting interval.
  2. Transfer – The bytes transferred during this interval.
  3. Bandwidth – The throughput measured over this interval.
  4. Transfer Total – Total bytes transferred and the average bandwidth over the whole test.
  5. Bandwidth Average – Average throughput throughout the duration of the test.
Screenshot showing the output from running iperf3. The screenshot is labeled with an explanation as to what each label means.

Useful iPerf Options

iPerf comes with multiple command switches you can use for adjusting settings and performing various tests. Here are some common iPerf options to tweak your throughput tests:

  • -i – Sets the interval time between periodic bandwidth reports in seconds. Useful for longer tests.
  • -t – Sets the total time in seconds to transmit for. Default is 10 seconds.
  • -p – Changes the listening port on the server..
  • -u – Use UDP instead of TCP.
  • -b – Limit bandwidth to a specified amount. Useful for not saturating a network.
  • -R – Reverse direction – server sends data, client receives.
  • -bidir – Bidirectional – data transmitted from both server and client in the same test.

See the official documentation or  ‘iperf3 –help‘ for the complete list of options.

C:\TEMP> iperf3 --help
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      <host>    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    <host>    run in client mode, connecting to <host>
  -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         <port>    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-

Now, let’s step through a few common examples of using iPerf to test network bandwidth.

Practical iPerf Examples

Here are a few examples that provide a mix of TCP and UDP tests, with options to adjust duration, direction, bandwidth, ports, and parallel streams. 

Example 1. Basic iperf3 TCP test

Run a simple 10 second TCP test between iperf3 server and client.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP

Example 2. 60 second TCP test

Extend the test duration to 60 seconds.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP -t 60

Example 3. UDP test

Switch to UDP instead of TCP.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP -u

Once the server receives a udp packet from the client it will switch to listening on udp.

Example 4. Reverse direction

Reverse the direction so the server sends and client receives data.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP -R

Example 5. Limit bandwidth

Limit bandwidth to 50 megabits per second.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP -b 50M

By default iPerf target bandwidth for UDP connections is 1Mbps, and the default target bandwidth for TCP connections is unlimited. It’s a good idea to set a custom bandwidth limit when testing so you don’t saturate the links and bring down the network (unless that’s your intention).

Example 6. Change port

Use port 5002 instead of default 5201.

Command:

Server: iperf3 -s -p 5002
Client: iperf3 -c SERVER_IP -p 5002

Notice that the port needs to be changed on both the server and the client for the connection to work.

Example 7. Parallel streams

Use 5 parallel streams.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP -P 5

Example 8. Change interval

Set the test interval to 5 seconds.

Command:

Server: iperf3 -s
Client: iperf3 -c SERVER_IP -i 5

When changing the interval, it’s a good idea to change the test time as well if you want to get much data.

Use cases for using iPerf

iPerf has come in handy numerous times for me as a Network Engineer. Off the top of my head some of the things I’ve used iPerf for that were particular handy have been:

  • Running iPerf between VMs or systems in different data centers to test latency and throughput
  • Verifying I was getting the bandwidth we were paying for from our ISP
  • Testing the speed between wireless clients and access points
  • Benchmarking NAS and SAN performance
  • Generate TCP and UDP traffic to load test applications and infrastructure
  • Checking the impact of network or firewall changes
  • Troubleshooting slow networks
  • Checking for packet loss ( UDP tests will show packet loss percentage if there is any)
  • Showing clients actual measured throughput during a site visit

What about you? Have any interesting use cases where iPerf has come in handy for you?

Recommended Tool: ManageEngine OpManager

  • Multi-vendor Network Monitoring
  • Simple Installation & Setup
  • Intuitive UI
  • Complete Visibility
  • Intelligent Detections
  • Easy Resolutions

One Comment

  1. is there anywhere I can get a comprehensive breakdown on how to use Iperf3, but break it down charlie brown style so a dummy like me can use it for diagnostics?

Leave a Reply

Your email address will not be published. Required fields are marked *