Troubleshooting Client Speed using iPerf
iPerf is a tool which can be used to test LAN and WLAN speeds and throughput. It works by generating traffic from a computer acting as a client which is sent to the IP address of a computer acting as the server. Bandwidth is then measured by TCP tests which are geared to show an actual representation of the network speeds you are receiving. iPerf can also be used to determine the quality of a link or test latency, jitter and datagram loss. This article explains how to use iPerf and iPerf3 to test LAN and WLAN speeds.
Note: To run this test you will need two networked computers which have access to each other through your local LAN. Each computer will have to have a copy of iPerf or iPerf3 software installed.
iPerf3
Running iPerf3 tests
After downloading iPerf3:
1. Open a command prompt and navigate to the folder containing the iperf3.exe file.
Example: If the file is on your desktop, then you would use the following in the command prompt:
cd C:\Users\Administrator\Desktop\iperf-3.1.3-win64
2. In the command prompt on the server side, run this command. This will tell it to listen over port 5201 (default port) for the client data:
iperf3 -s
3. In the command prompt on the client side, run this command:
iperf3 -c 10.0.0.105
As long as the client and server have connectivity on the same network, you should receive a result similar to the following on the server and client side, respectively:
Windows
Client
Server
Linux
Client
Server
There are also several options that can be run on the client side to change the type of data that is being sent.
To measure bandwidth in both directions, use option -R, for example:
- iperf3 -c 10.0.0.105 -R
Note: A lowercase ' r ' will NOT work and must be capitalized in iPerf3
To measure bandwidth in both directions at the same time, use option -d, for example:
- iperf3 -c 10.0.0.105 -d
TCP Window Size
Sending large streams of data over fast connections can generate a lot of CPU usage, especially when testing over 1Gbps links. Specifying a larger window size reduces the amount of processing that needs to be done on both the client and server side computers. The window size sets the amount of data that can be passed before it has to be SYN'd. To specify the window size while using iperf3, please use the option w command. The default number is in bytes, but you can also specify K and M for Kilobytes and Megabytes, respectively.
Client:
iperf3 -c 10.0.0.105 -w 2000
-w allows for the option to manually set a window size. This can be set to be between 2 and 65,535. In the previous example, the window size is set to 2000 Bytes
Server:
iperf3 -s
Parallel Streams
iPerf3 also allows for sending parallel streams at the same time. This sends multiple streams of traffic through the tunnel in order to more fully test the link.
Note: If using 1Gbps links, you want to utilize using window sizing and parallel streams. Use more parallel streams if trying to completely saturate a high-speed link.
Client:
iperf3 -c 10.0.0.105 -P 2
This has iPerf run 2 parallel streams
Server:
iperf3 -s
The server side does not have to include the parallel streams options since it is already listening for any of the traffic.
Original iPerf
Running iPerf tests
After downloading iPerf:
1. Open a command prompt and navigate to the folder containing the iperf.exe file.
Example: If the file is on your desktop, then you would use the following in the command prompt:
cd C:\Users\Administrator\Desktop\iperf-2.0.5-2-win32
2. In the command prompt on the server side, run this command. This will tell it to listen over port 5001 (default port) for the client data:
iperf -s
3. In the command prompt on the client side, run this command:
iperf -c 10.0.0.105
As long as the client and server have connectivity on the same network, you should receive a result similar to the following on the server and client side, respectively:
Windows
Client
Server
There are also several options that can be run on the client side to change the type of data that is being sent.
To measure bandwidth in both directions, use option r.
iperf -c 10.0.0.105 -r
To measure bandwidth in both directions at the same time, use option d.
iperf -c 10.0.0.105 -d
TCP Window Size
Sending large streams of data over fast connections can generate a lot of CPU usage, especially when testing over 1Gbps links. Specifying a larger window size reduces the amount of processing that needs to be done on both the client and server side computers. The window size sets the amount of data that can be passed before it has to be SYN'd. To specify the window size while using iperf, please use the option w command. The default number is in bytes, but you can also specify K and M for Kilobytes and Megabytes, respectively.
Client:
iperf -c 10.0.0.105 -w 2000
-w allows for the option to manually set a window size. This can be set to be between 2 and 65,535. In the previous example, the window size is set to 2000 Bytes
Server:
iperf -s -w 4000K
In the previous example, the window size is set to 4000 Kilobytes
Parallel Streams
iPerf also allows for sending parallel streams at the same time. This sends multiple streams of traffic through the tunnel in order to more fully test the link.
Note: If using 1Gbps links, you want to utilize using window sizing and parallel streams. Use more parallel streams if trying to completely saturate a high-speed link.
Client:
iperf -c 10.0.0.105 -P 2
This has iPerf run 2 parallel streams
Server:
iperf -s
The server side does not have to include the parallel streams options since it is already listening for any of the traffic.
Additional Flags
Using UDP Ports for Testing
Both iPerf 3 and original iPerf allow the use of UDP ports for testing purposes with the -u flag on the client side of the connection.
Client:
(iperf OR iperf3) -c 10.0.0.105 -u 5001
This will initiate a connection from the client to a server at 10.0.0.105, using UDP port 5001.
Server:
(iperf OR iperf3) -s
No special configuration is required on the server side.
Setting Target Bandwidth for Connections
Both iPerf 3 and original iPerf support the setting of a custom target bandwidth for UDP and TCP connections with the -b flag on the client side. The default target bandwidth for UDP connections is 1Mbps, and the default target bandwidth for TCP connections is unlimited. In the case of multiple streams with the -P flag, the target is set for each individual stream.
Client:
(iperf OR iperf3) -c 10.0.0.105 -u 6789 -b 5M
This will initiate a connection from the client to a server at 10.0.0.105, using UDP port 6789, with a target bandwidth of 5Mbps. The letter "K" can be used to indicate Kbps, and solely a numeric value will be interpreted as bits/second.
Server:
(iperf OR iperf3) -s
No special configuration is required on the server side.
Using Burst Mode with Target Bandwidth
In addition to the target bandwidth feature, there is a functionality called "Burst Mode" that can be set with either TCP or UDP connections to allow a series of packets to be sent in succession from the client, without pause. This can be done by adding a forward slash and a number after the bandwidth signifier, where the number after the slash is the number of packets to be transmitted rapidly even if it temporarily exceeds the target bandwidth.
Client:
(iperf OR iperf3) -c 10.0.0.105 -p 3456 -b 8K/5
This will initiate a connection from the client to a server at 10.0.0.105, on TCP port 3456, with a target bandwidth of 8Kbps and allowing burst mode transmission of 5 packets without pause even if this means the bandwidth temporarily exceeds 8Kbps.
Server:
(iperf OR iperf3) -s
No special configuration is required on the server side.
Additional Resources
If you prefer a GUI-based tool similar to iPerf for testing LAN and WLAN speeds, see Troubleshooting client speed and traffic shaping using jPerf.
For additional iperf or iperf3 flags and options, please refer to iperf's official documentation.