• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
  • VPS
    • VPS Hosting
    • Flex VPS
  • Reseller
  • Email
  • Gaming
  • Domains
  • Website Builder
  • Account
  • Blog Home
  • Categories
  • Authors

How To Use The Iperf Command On Linux

CJ Saathoff

Published on: October 11, 2024

Categories: Linux Command Line 0

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?
  • What Is Iperf?
    • What’s the difference between Iperf, Iperf2, and Iperf3?
  • How To Install
  • Basic Usage
    • Iperf Server
    • Client Mode
  • Advanced Flags
    • Iperf2
      • Server Specific:
      • Client Specific:
    • Iperf3
      • Server Specific
      • Client Specific
  • Conclusion
  • Looking For More

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.

  • For Iperf2 search for iperf
  • For Iperf3 search for iperf3

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:

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:

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.

-e, –enhanced use enhanced reporting giving more tcp/udp and traffic information

–hide-ips hide ip addresses and host names within outputs

-o, –output <filename> output the report or error message to this specified file

-p, –port # client/server port to listen/send on and to connect

–sum-only output sum only reports

-u, –udp use UDP rather than TCP

-B, –bind <host>[:<port>][%<dev>] bind to <host>, ip addr (including multicast address) and optional port and device

-C, Enables compatibility mode

Server Specific:

-p, –port #[-#] server port(s) to listen on/connect to

-1, –singleclient run one server at a time

-t, –time # time in seconds to listen for new connections as well as to receive traffic (default not set)

-B, –bind <ip>[%<dev>] bind to multicast address and optional device

-U, –single_udp run in single threaded UDP mode

-D, –daemon run the server as a daemon

Client Specific:

-c, –client <host> run in client mode, connecting to <host>

-d, –dualtest Do a bidirectional test simultaneously (multiple sockets)

–full-duplex run full duplex test using the same socket

-r, –tradeoff Do a full-duplex test individually

-B, –bind [<ip> | <ip:port>] bind ip (and optional port) from which to source traffic

-L, –listenport # port to receive full-duplex tests back on

-P, –parallel # number of parallel client threads to run

-X, –peer-detect performs server version detection and version exchange

Iperf3

For the full list of Iperf3commands checkout the man page.

-p, –port # server port to listen on/connect to

-B, –bind <host> bind to the interface associated with the address <host>

-J, –json output in JSON format

–logfile f sends output to a log file

-d, –debug emit debugging output

Server Specific

-s, –server run in server mode

-D, –daemon runs 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

-t, –time # time in seconds to transmit for (default 10 secs)

–cport <port> bind to a specific client port (TCP and UDP, default: ephemeral port)

-P, –parallel # number of parallel client threads to run

–bidir run in bidirectional mode.

-4, –version4 only use IPv4

-6, –version6 only use IPv6

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?

  • Traceroute and Ping
  • MTR
  • Nmap
CJ Saathoff

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.

Related Posts

How to List Cron Jobs: Master Cron on Linux

Trying to figure out how to list cron jobs quickly and easily in command line? Check out our easy to understand guide.

How to Use Bash Sleep and Why

Here's what the "sleep" command does in the bash environment, and how to use it to delay execution or implement code to retry scripts.

How to Use the “Find” Command on Linux

The "find" command in Linux is one of the most common commands, and using it is easy. However, there are a few twists to be aware of.

How to Create and Remove Symlink

Check out our guide to learn everything you need to know about symlinks - how to create and remove them as well as many tips and tricks.

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup (2024)

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • Email Hosting
  • Game Hosting
  • Domains
  • Website Builder
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2025 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA