How To Use The Iperf Command On Linux

In this blog post we will explore background, what is Iperf, how to install, and everything from basic to more advanced usage.

On this page
  1. What is throughput?
  2. What Is Iperf?
  3. How To Install
  4. Basic Usage
  5. Advanced Flags
  6. Conclusion
  7. Looking For More

Most readers have heard likely heard of services like speedtest.net, fast.com, or speed.cloudflare.com used to test internet speed also known as network bandwidth. The downsides of services like these is that they reply on your internet connection and more often than not a web browser. If we flip both these and are looking for a way to speed test a local connection without replying on third party services like the Internet or someone else’s servers, this is where something like Iperf comes into play.

In this blog post we will explore background, what is Iperf, how to install, and everything from basic to more advanced usage.

#What is throughput?

You can think of throughput as the maximum practical bandwidth between the two servers.

#What Is Iperf?

The Iperf utility, is a tool that is used to run speed tests locally without the need to an internet connection. This requires two servers one in client mode and the other in server mode. This allows you to test the throughput between the two networked computers to its limits.

What’s the difference between Iperf, Iperf2, and Iperf3?

The package named Iperf in most Linux package managers is typically iperf2 and was created as a successor to the original software released under that name.

My understanding is that iperf3 was created during a lull in development of Iperf2. Although afterwords development was then resumed of iperf2. Causing there to be two versions which are both of which are actively maintained.

Note: If you use one for the server you will be required to use the same for the client device.

#How To Install

On most Linux systems the package should be available via your Linux distributions package manager.

#Basic Usage

For both versions of Iperf the basic operation is the same you use the -s flag for server mode and -c for client mode. In the example below I run tests on localhost showing some rather fun numbers.

Iperf Server

For server mode, you append the -s flag to your preferred version of iperf.

In this example, the following command was used:

Code
iperf3 -s

Results of the iperf3 -s flag after connecting and running a test from a client.

Client Mode

For client mode you will run the command followed by the -c flag and the host or IP you want to connect to

In this example, the we show the client connecting to localhost:

Code
iperf3 -c localhost

Results of the iperf3 -c flag after connecting to localhost.

#Advanced Flags

Here are some flags I cherry-picked from the man pages for both applications, that I feel your most someone else would be most likely to use.

Iperf2

For the full list of Iperf2 commands check out the man page.

Server Specific:

Client Specific:

Iperf3

For the full list of Iperf3commands checkout the man page.

Server Specific

Client Specific

#Conclusion

If you’re looking to run speed tests between two hosts the tool to use is Iperf. Iperf uses a client-server model meaning one host needs to be running in server and the other in client mode. Both the client and server are part of the same package, so there is no need to worry about needing to install different packages. In this blog post we will cover background, what is Iperf, how to install it, and move on to everything from basic to more advanced flags.

#Looking For More

Done reading, and looking for another network testing tool, then check these posts out?

Illustrated avatar of CJ Saathoff
Written by

CJ Saathoff

CJ Saathoff writes for the NameHero blog.

More from CJ →