This is a complete guide to using iPerf for testing network bandwidth and throughput.
In this guide, you will learn:
- What is iPerf
- How to Install iPerf
- How to Use iPerf
- Understand the iPerf Output (test results)
- Iperf Examples
Let’s dive in.
What is iPerf
Iperf is a bandwidth monitor tool that is used to test the transmit and receive speeds on a network. It is a small command line utility that is supported on multiple platforms (Windows, MacOS X, and Linux).
iPerf can be used for:
- Testing the throughput between two systems
- Troubleshoot network performance problems
- Verify bandwidth usage
- Tuning TCP and UDP connections
In the above diagram, I used iPerf to test the throughput between two networks. By using iPerf I was able to see how fast I could transmit data from the client computer to the server going over multiple switches and a router. The computer transmitted data at 3.12 Gbits/sec and the server received the data at 2.99 Gbits/sec.
When testing network performance it is important to know the difference between bandwidth and throughput. Your throughput will typically be lower than your bandwidth so keep that in mind when running your tests.
How to install iPerf
iPerf is very easy to install, below I walk through installing iPerf on a Windows 10 computer.
Step 1: Download iPerf
In this example, I’m downloading iPerf 3.13 64 bit version. There may be a later release by the time you read this article.
When the download is complete extract the zip file.
Step 2: Copy iperf Files to Both Computers
There is no installer file, you just need to copy the exe and dll to both two computers. One will act as a server and one will act as a client. Both systems can be the same OS such as Windows 10, it doesn’t matter.
For example, I created a folder called iperf on PC1 and Server1 and copied the two files to this folder.
How to use iPerf
Here is a video I created that demonstrates how to use iPerf.
To use iPerf one computer needs to act as the server and the other will be the client.
Important: iPerf will use real bandwidth on your network and by default will use all that is available. If you have a 1 gig connection it will try to consume all of that bandwidth. This could impact production applications. In the examples section, I’ll show you how to control how much bandwidth can be used.
Step 1: Start iPerf Server
On the computer you want to act as the server, open the command prompt and browse to the folder that has the iperf3.exe and dll files. Then type the command below and hit enter.
The command prompt should say “server listening on 5201”, like the below screenshot.
The server is now running and you can start running bandwidth tests from a client machine.
Step 2: Run iPerf Client
On the client machine, open the command prompt, browse to the iperf folder and run this command. Replace TARGET with the IP or hostname of your iPerf server.
iperf3 -c TARGET
Good job! You just ran a bandwidth test using iperf. Pretty easy right?
When running iPerf you can open task manager, go to the performance tab, and see the throughput on your Ethernet adapter. This is useful to see bandwidth utilization in real time.
Understanding the iperf Test Results
So you successfully ran a bandwidth test with iPerf but what does it mean? Let’s look at the screenshot below.
- This is the interval at which iperf is sending data to the server. The default is every 1 second for 10 seconds.
- This is how much data is sent at each interval.
- The bandwidth (or speed) at which data is being transmitted from the client to the server
- The total amount of data sent and received.
- Your average throughput speed.
iPerf has many command line options. You can view them all by typing iperf3 –help. I won’t go over them all but here are the ones I find the most useful.
-p, use this command to change the port the server is listening on (default is TCP 5201).
-i, seconds between periodic bandwidth tests, default is 1 second.
-V, verbose output (display more details during a test).
-u, use UDP rather than TCP.
-b, limit how much bandwidth is used (by default TCP is unlimited, UDP is 1 Mbit/sec).
-t, time in seconds to run the bandwidth test (default is 10 seconds).
-R, run in reverse mode. This changes the server as the sender and the client as a receiver.
Example 1: Change iperf Server Listening Port
If you want to change the server listening port use this -p command followed by the port number.
iperf3 -s -p 5202
If you change the server port you need to specify which port to use on the client-side.
iperf -c 192.168.100.10 -p 5202
Example 2: Change Interval (time between each test)
Use the -i command to change the time between each test. In this example, I’m changing the interval to 10 seconds. If you change the interval you may need to increase the test time (-t).
iperf -c 192.168.100.10 -i 10
Example 3: Test iPerf with UDP
To test using UDP use the -u command from the client. Nothing needs to change on the server, it will automatically start listening on UDP port 5201 when it receives UDP traffic.
iperf -c 192.168.100.10 -u
Example 4: Limit Bandwidth Usage
iPerf will try to use all available bandwidth by default. This could impact production networks. You can limit how much bandwidth is used with the -b command. In this example, I will change it to use 100 megabits per second.
iperf -c 192.168.100.10 -b 100m
In the below screenshot you can see the bandwidth usage difference when using the -b command.
Example 5: Change Test Time (Run a longer test)
By default, iPerf runs for 10 seconds, this may not be long enough to fully test your network. Change the time with the -t command. In this example, I’ll change it to 60 seconds.
iperf -c 192.168.100.10 -t 60
Example 6: Reverse The Test (server sends, client receives)
By default, the client is the sender and the server is the receiver. To reverse this use the -R
iperf -c 192.168.100.10 -R
You can verify this by looking at the performance metrics on your ethernet adapter.
An example of using iPerf in the real world is when you are shaping network traffic. For example, you need to limit the bandwidth on a Cisco switch or router and need a quick way to test the bandwidth. iPerf works great for this and I’ve used it many times in production networks to check the bandwidth on Cisco routers and switches.
iPerf Command line options
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
-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
-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
In this guide, I showed you several examples for using iPerf to test network throughput. iPerf is a great little program that can be used on multiple operating systems. As a Network Administrator, I’ve used this program numerous times to test throughput speeds between multiple networks. When someone reports a network slowness issue this tool works great as it removes the application and isolates to testing only the network.
One final thing to mention is that iPerf was designed to help tune TCP connections by finding issues with the TCP windows size. I did not cover TCP window size in this article because I don’t think it’s a major issue in today’s networks.