Linux Commands

Iperf command and usage


Iperf is an open source networking tool used to measure throughput or performance of a network. It can be used to test TCP and UDP. Iperf can be used in Windows, Linux, and MAC etc operation system.

Intention of this article:

There are different versions of Iperf, we will only focus on Iperf version 2.+ only. This version is widely used in all systems.

General Set up diagram:

Iperf works in server client model that means there should be one server and one client to start Iperf traffic flow.

Wireless Connection

From the diagram we can understand that PC1 and PC2 should have valid IP address.

Connection between two PCs can be wired or wireless.

Actual Set up:

  1. In our experiment PC1 is windows and PC2 is Linux.
  2. PC1 IP is and PC2 is
  3. PC1 iperf version


iperf --version
iperf version 2.0.5 (08 Jul 2010) pthreads

4. PC2 iperf version


iperf --version
iperf version 2.0.5 (08 Jul 2010) pthreads

Iperf Conditions:

There are some conditions before Iperf to work.

  1. PC1 should ping to PC2 and vice versa. We can use ping from PC1 console or command line to see if PC1 is able to reach PC2. Do ping from PC2 to PC1 to check the reachbility of PC1 from PC3.

Here is one screenshot for ping from PC1 to PC2

Here is one screenshot for ping from PC2 to PC1

  1. Both PCs should Iperf binary. It’s better to keep same version of Iperf or close versions. But remember Iperf 2.0 does not work with Iperf 3.0.

Note: UDP does not establish any UDP connection before transferring data and UDP does not need any ACK from other side. So even if IPERF server is not running client will able send data unlike TCP. So always check in server side for UDP data.

Important Iperf Arguments:

Argument Meaning
-s Run server
-c Run Client [Ex: -c]
-u UDP
-b Bandwidth [Used in UDP, Ex: 100M M->Mbits]
-i Output interval in Sec [Ex: -i1 1sec interval]
-t Time in sec [Ex: -t60 60sec]
-p Port number [Ex: -p 5555]
-w Windows size [Ex: -w 1M M->Mbits]
-d Bi-directional traffic
-l Length [Ex: -l 1046 1046bytes]
-V Used when IPv6 address is used instead of IPv4

There are other arguments but not used in general. We can use man iperf command in Linux to get all arguments.

Iperf commands:

There are many arguments for Iperf command, we will discuss on only important and useful arguments. Below are minimum arguments which can be used to run iperf.

TCP server:

iperf –s –i1

TCP client:

iperf –c –i1 –t60

UDP server:

iperf –s –i1 -u

UDP client:
iperf –c –i1 –t60 –u –b 1000M

Start Iperf:

Now we have PC1 and PC2 so below combinations can be run between these two PCs.

  1. TCP server in PC1 and TCP client PC2
  2. TCP client in PC1 and TCP server PC2
  3. UDP server in PC1 and UDP client PC2
  4. UDP client in PC1 and UDP server PC2

Experiment 1:

Let’s try combination A

Here is the screenshot of TCP server in PC1.

So first we have to start server and if it’s successful then it will be in listing mode.

Here is the screenshot of TCP client in PC2.

Here is the screenshot for TCP server side

Next if we want to try combination B, then we just need to run TCP server in PC2 and TCP client in PC1.

Experiment 2:

Let’s try combination D.

Here is the screenshot of UDP server in PC2.

So first we have to start server and if it’s successful then it will be in listing mode.

Here is the screenshot of UDP client in PC1.

Here is the screenshot of UDP server output in PC2

Known Errors:

  1. Connect failed or connection refused:

When we run TCP client without TCP server this error occurs.

Here is the screenshot

  1. UDP without server:

When we run UDP client without server, we can identify this with some observations

  1. After UDP client throughput is completed, we should not any server report for average. Check the point B in below screenshot.
  2. Throughput may be higher than the connected bandwidth. Check the point A in below screenshot.
  3. Here is the expected UDP client screenshot

Some experiemnt argument:


Window size can be increased.

Here is the screenshot for Default and Customized windows size:


Interval can be increased.

Here –t 20sec and –i 5sec so we should see Iperf output at 5sec interval. Here is the screenshot.


To measure any performance in Wired or Wireless network Iperf is the basic requirement. As it’s an open source so can used without any license. Iperf gives quite accurate results with comparison to license tool like IxChariot.

About the author

Bamdeb Ghosh

Bamdeb Ghosh is having hands-on experience in Wireless networking domain.He's an expert in Wireshark capture analysis on Wireless or Wired Networking along with knowledge of Android, Bluetooth, Linux commands and python. Follow his site: