Reverse Option: iPerf Version 2 vs 3

iPerf version 2 and 3 are currently maintained in parallel from two different teams. iPerf has been around for more than 15 years; iPerf 3 was created with the goal of a smaller and simpler code base, as well as offering a library for integrating with other code.

The two versions are incompatible with each other, and there are only a few differences in terms of the options and functionalities that they offer. In this post, I wanted to focus on a subtle difference that I often have to explain, even to network engineers that have been using iPerf for a while.

Regular iPerf Test

The client of an iPerf test is the host that sends data to the server, as depicted  in this image:

The sequence of events is as follows:

  1. The server iperf.netbeez.net starts listening on port 5000 (iperf -s -p 5000)
  2. The client starts the test towards the server (iperf -c iperf.netbeez.net -p 5000)
  3. The server accepts the connection
  4. The client detects that the connection with the server is successful
  5. The client starts uploading data to the server
  6. The client finishes the data upload prints the results and exits

This sequence is common on both versions.

This setup measures upload speed from the client to the server. Both iPerf versions have the option to measure download speed by setting the appropriate flag.

On version 2 the flag is “-r” and on version 3 it’s “-R”. However, the name of the option is not the only difference – let’s see how they differ.

Reverse iPerf Version 2

When you give the “-r” option there are two steps for the test:

Step 1: The client runs an upload speed exactly as described in the previous section:

Step 2: The server initiates a connection towards the client and uploads the test data

The problem with this implementation is that the host that initiates the test (iPerf client) needs to be accessible from the server in order to accept the new connection and receive the traffic. In many cases, this may not be possible. For example, if the client is NAT’ed or, if there are firewall rules that prevent incoming connections, then the reverse iPerf version 2 test fails.

Reverse iPerf Version 3

When you give the “-R” option to iPerf 3 then the test runs as follows:

The sequence of events is as follows:

  1. The server iperf.netbeez.net starts listening on port 5000 (iperf3 -s -p 5000)
  2. The client starts the test towards the server (iperf3 -c iperf.netbeez.net -p 5000 -R)
  3. The server accepts the connection
  4. The server starts uploading data to the client
  5. The server finishes the data upload and the client prints the results and exits

The subtle difference here is that the server uses the already established connection from the client to upload the data. This setup doesn’t have the problem that version 2 has, where the test fails if the client can’t accept the connection from the server.

Obviously, the version 3 reverse option is preferable for this reason. This gives you the option to run an upload and download test from and to the client without any restrictions.