IPERF: How to test network Speed,Performance,Bandwidth

Sarath Pillai's picture
Internet Speed Test in Linux

Testing network performance in terms of speed and bandwidth is a norm in both production and non-production environment.

A detailed report of speed and bandwidth analysis is very much necessary for the deployment of network dependent application servers. Also sometimes you need to double check the speed of your network throughput while troubleshooting. All these requires a reliable network performance testing tool. This post will be concentrating on one such tool called as "iperf".

IPERF is an open source tool that can be used to test network performance. Iperf is much more reliable in its test results compared to many other online network speed test providers.

An added advantage of using IPERF for testing network performance is the fact that, it is very reliable if you have two servers, both in geographically different locations, and you want to measure network performance between them.


How to install iperf?

Installing iperf is very much easy, if you have epel yum repository enabled(in redhat system's).

[root@slashroot1 ~]# yum install iperf

 Package          Arch            Version                 Repository       Size
 iperf            i386            2.0.5-1.el5             epel             52 k

Installing iperf from source is also very much easy. Just download the iperf source package from Iperf Source Package

And do a normal source installation steps as follows.

#tar -xvf iperf-2.0.5.tar.gz

The above command will extract the tar package You downloaded from the above link.

Now get inside the extracted directory and run the below command to configure, with the default options.

[root@slashroot2 ~]# cd iperf-2.0.5
[root@slashroot2 iperf-2.0.5]# ./configure


Now lets compile it with "make" command, and then install it using "make install" command.

[root@slashroot2 iperf-2.0.5]# make
[root@slashroot2 iperf-2.0.5]# make install

How to install iperf in windows machine?

Installing iperf in windows is also quite easy. Lets see how.

You can download iperf for windows from Iperf For windows. Now unzip this zip file to a folder named "iperf" and run the iperf.exe inside that directory.

For example i have extracted, the iperf zip in C:\iperf directory, so will open the Windows CMD, and navigate to that directory, to run the iperf.exe command.

C:\>cd C:\iperf


How to test the network speed between one windows machine and a linux machine?

As i told before, iperf can be used to perform speed test between remote machine's. It works in a client server model.

noteThe operating system does not matter, while you are using iperf. The commands for using iperf on windows is exactly the same as in linux. And also other operating system. Normally in the test environment, iperf client sends data to the server for the test.

Before going ahead with the test, lets understand some networking concepts related to speed test.

Network Throughput

Transfer rate of data from one place to another with respect to time is called as throughput. Throughput is considered a quality measuring metric for hard disks,network etc. Its measured in Kbps(Kilo bits per second),Mbps(Mega bits per second),Gbps(Giga bits per second.)

TCP Window

TCP (Transmission Control Protocol), is a reliable transport layer protocol used for network communications. How TCP works, is beyond the scope of this article. TCP works on a reliable manner, by sending messages and waiting for acknowledgement from the receiver.

Whenever two machine's are communicating with each other, then each of them will inform the other, about the amount of bytes it is ready to receive at one time.

In other words, the maximum amount of data that a sender can send the other end, without an acknowledgement is called as Window Size. This TCP window size affects network throughput very badly sometimes. Lets take an example.

Suppose you want to send a 500MB of data from one machine to the other, with the tcp window size of 64KB.

Which means for sending the whole 500MB data, the sending machine has to wait 800 times for an acknowledgement from the receiver.

500MB / 64KB = 800

So you can clearly see that, if you increase the Window size a little bit to tune TCP, it can bring significant difference to the throughput achieved.

Suppose you have a windows machine and want to measure the speed between it and another Linux machine, then you need to make one as client, and another as the server. Lets see how.

We will make our windows machine the server and the Linux machine as the client.

C:\iperf>iperf.exe -s
Server listening on TCP port 5001
TCP window size: 64.0 KByte (default)

-S argument is used for specifying server

The above command, starts iperf server on the windows machine, and it bydefault runs on the port 5001 by default.(It also reports that the default TCP window size is 64.0KB).

Lets test the throughput from the Linux client machine, as shown below.

[root@slashroot2 ~]# iperf -c
Client connecting to, TCP port 5001
TCP window size: 16.0 KByte (default)
[  3] local port 47326 connected with port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   308 MBytes   258 Mbits/sec

From the above output, you can see that i got a speed of 258Mbits/sec. The ouput shows something more.

Interval:  Interval specifies the time duration for which the data is transferred.

Transfer: All data transferred using iperf is through memory, and is flushed out after completing the test. So there is no need to clear the transferred file after the test. This column shows the transferred data size.

Bandwidth: This shows the rate of speed with which the data is transferred.


You can start your iperf server on your desired port with the following method.

C:\iperf>iperf.exe -s -p 2000
Server listening on TCP port 2000
TCP window size: 64.0 KByte (default)

Also you can tell the client to connect to your desired server port and also tweak some more connection and reporting parameter's as shown below.

root@slashroot2 ~]# iperf -c -t 20 -p 2000 -w 40k

Client connecting to, TCP port 2000
TCP window size: 80.0 KByte (WARNING: requested 40.0 KByte)
[  3] local[02 port 60961 connected with port 2000
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-20.0 sec  1.74 GBytes   747 Mbits/sec

-t  option used in the above command tells to transfer data for 20 seconds.

-p  will tell the client to connect the port 2000 on the server

-w will specify your desired window size value. As i told before, window size tuning will improve TCP transfer rate to a certain extent.

And you can clearly see from the above output that the bandwidth for the whole transfer has increased, as we have increased the window size(I am using two virtual machine's in one physical box for this iperf demonstration, which is the reason am getting exceptional transfer rate's).

You can also tell the iperf client to show the transfer rate at an interval of 1 second, for the whole 10 second transfer, as shown below with -i option.

[root@slashroot2 ~]# iperf -c -P 1 -i 1
Client connecting to, TCP port 5001
TCP window size: 16.0 KByte (default)
[  3] local port 49597 connected with port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec  28.6 MBytes   240 Mbits/sec
[  3]  1.0- 2.0 sec  25.9 MBytes   217 Mbits/sec
[  3]  2.0- 3.0 sec  26.5 MBytes   222 Mbits/sec
[  3]  3.0- 4.0 sec  26.6 MBytes   223 Mbits/sec
[  3]  4.0- 5.0 sec  26.0 MBytes   218 Mbits/sec
[  3]  5.0- 6.0 sec  26.2 MBytes   220 Mbits/sec
[  3]  6.0- 7.0 sec  26.8 MBytes   224 Mbits/sec
[  3]  7.0- 8.0 sec  26.0 MBytes   218 Mbits/sec
[  3]  8.0- 9.0 sec  25.8 MBytes   216 Mbits/sec
[  3]  9.0-10.0 sec  26.4 MBytes   221 Mbits/sec
[  3]  0.0-10.0 sec   265 MBytes   222 Mbits/sec

Until now we have only seen the throughput of one TCP connection. Because when you run iperf, by default if only creates one TCP connection with the remote server.


noteYou Might have noticed that some internet Download manager's are so fast while they download any content from the internet, compared to the normal operating system downloader. The main reason behind it is the fact that they work on "Parallel TCP connections." One such download manager, that i remember is "Internet Download Manager".

Let's check the throughput report by increasing the number of parallel connections using "iperf".

[root@slashroot2 ~]# iperf -c -P 20
Client connecting to, TCP port 5001
TCP window size: 16.0 KByte (default)
[ 15] local port 57258 connected with port 5001
[  3] local port 57246 connected with port 5001
[  4] local port 57247 connected with port 5001
[  5] local port 57248 connected with port 5001
[  7] local port 57250 connected with port 5001
[  6] local port 57249 connected with port 5001
[ 10] local port 57253 connected with port 5001
[  8] local port 57251 connected with port 5001
[  9] local port 57252 connected with port 5001
[ 16] local port 57259 connected with port 5001
[ 19] local port 57261 connected with port 5001
[ 18] local port 57260 connected with port 5001
[ 20] local port 57262 connected with port 5001
[ 17] local port 57263 connected with port 5001
[ 21] local port 57264 connected with port 5001
[ 11] local port 57254 connected with port 5001
[ 12] local port 57255 connected with port 5001
[ 13] local port 57256 connected with port 5001
[ 14] local port 57257 connected with port 5001
[ 22] local port 57265 connected with port 5001
[ ID] Interval       Transfer     Bandwidth
[  8]  0.0-10.6 sec  16.6 MBytes  13.1 Mbits/sec
[ 16]  0.0-10.6 sec  16.6 MBytes  13.1 Mbits/sec
[ 18]  0.0-10.6 sec  16.5 MBytes  13.1 Mbits/sec
[ 17]  0.0-10.7 sec  16.6 MBytes  13.0 Mbits/sec
[ 21]  0.0-10.7 sec  15.6 MBytes  12.3 Mbits/sec
[ 12]  0.0-10.7 sec  17.5 MBytes  13.7 Mbits/sec
[ 22]  0.0-10.7 sec  16.6 MBytes  13.0 Mbits/sec
[ 15]  0.0-10.8 sec  17.8 MBytes  13.8 Mbits/sec
[  3]  0.0-10.7 sec  18.5 MBytes  14.5 Mbits/sec
[  4]  0.0-10.8 sec  18.1 MBytes  14.1 Mbits/sec
[  5]  0.0-10.7 sec  17.6 MBytes  13.9 Mbits/sec
[  7]  0.0-10.8 sec  18.4 MBytes  14.3 Mbits/sec
[  6]  0.0-10.8 sec  17.0 MBytes  13.2 Mbits/sec
[ 10]  0.0-10.8 sec  16.8 MBytes  13.1 Mbits/sec
[  9]  0.0-10.8 sec  16.8 MBytes  13.0 Mbits/sec
[ 19]  0.0-10.6 sec  16.5 MBytes  13.0 Mbits/sec
[ 20]  0.0-10.7 sec  16.5 MBytes  12.9 Mbits/sec
[ 11]  0.0-10.7 sec  18.0 MBytes  14.0 Mbits/sec
[ 13]  0.0-10.7 sec  17.8 MBytes  13.9 Mbits/sec
[ 14]  0.0-10.8 sec  18.2 MBytes  14.1 Mbits/sec
[SUM]  0.0-10.8 sec   344 MBytes   266 Mbits/sec

In the above shown example i have told iperf client to create 20 parallel TCP connections to the remote host while the data transfer. And if observe the output, you can see clearly that 20 different ports on the client is connected to the default 5001 port on the server.

And all of the connections had different transfer rate, and at the end we got a combined throughput of 266Mbits/s.(Which is much better that a single TCP connection.)


Conducting a UDP speed test in iperf

Conducting a UDP speed test using iperf will provide you with a couple of more information about your network which will be very much useful in finding network bottlenecks.

As we discussed before, not only TCP window size but network parameter's like the following also affects the throughput achieved during a connectionn.

  • Out of order delivery
  • Network Jitter
  • Packet loss out of total number of packets

For conduction an iperf udp test, you need to start the server with the -u option so that the UDP port 5001 is opened on the server side.

C:\iperf>iperf.exe -s -u
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 64.0 KByte (default)

Now lets start the data transfer from the client side by sending UDP traffic.

[root@slashroot2 ~]# iperf -c -u -b 100m
Client connecting to, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size:  107 KByte (default)
[  3] local port 50836 connected with port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  97.4 MBytes  81.7 Mbits/sec
[  3] Sent 69508 datagrams
[  3] Server Report:
[  3]  0.0-10.0 sec  97.4 MBytes  81.8 Mbits/sec   0.167 ms   49/69507 (0.07%)
[  3]  0.0-10.0 sec  1 datagrams received out-of-order
[root@slashroot2 ~]#


In the above example, i have used -b option to specify the bandwidth to use(because by default iperf UDP only used 1Mbps, i will recommend using your full available bandwidth to get an idea)

-u options needs to be also used on the client side for specifying UDP traffic.

The ouput tells us the following information.

Bandwidth = 81.7Mbits/sec

Network jitter = 0.167 ms (network jitter is the deviation in time for periodic arrival of data gram's. If you are doing the test with server's on the other side of the globe, then you might see higher jitter values in iperf output.)

Out of Order = 1 datagram


0.07 percent datagram loss is not at all significant, infact you can say that you got a nice network packet loss ratio.

VOIP require's a very less datagram loss because its voice communication.  A high data gram loss can drop the call altogether. So UDP testing with iperf will be very much helpful if you have VOIP or other such critical applications on your infrastructure.

You can get all the option's related to iperf with the following command.

[root@slashroot2 ~]# iperf --help
Rate this article: 
Average: 4.9 (104 votes)


I appreciate the walk through. Gave me some good tests to see if our 1Gbps link is performing as expected.

[ 3] local port 33796 connected with port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.11 GBytes 957 Mbits/sec
[ 3] Sent 813920 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0-10.0 sec 1.11 GBytes 957 Mbits/sec 0.016 ms 0/813920 (0%)

This was my results. Pretty happy with that.

Sarath Pillai's picture

Hi Jeff,

Nice to know that the tutorial was helpful in putting your link to test..

And yeah.. Welcome to slashroot..


Simple, nicely explained

Hi, from my testing on regular windows machines, the UDP performance when using two computers with windows , versus 1 windows > 1 linux and obviously linux-linux varies greatly, not only does windows seem to be much weaker in terms of achieving stable performance and higher speeds, above 100Mbits, also the packet loss phenomena seems to be much higher when a windows machine is involved, and also there is a big difference between using that windows machine as a server (weaker) or as i client.

When using Linux there is no packet loss. Note that for the specific testing i'm indicating, the setup is just two PCs back to back with a 2-meter ethernet cable.

Is that consistent with your findings?


Sarath Pillai's picture

Hi Romer,

If you are experiencing very high packet loss in windows machine, its probably a NIC driver issue (provided you have recently upgraded your windows or applied some hotfix..try installing the original vendor driver.). Any ways upgrade the NIC driver to the latest stable version from the official nic vendor site.

Secondly for achieving higher speeds, try tweaking some tcp settings on your windows machine.Like flow control, RDC, LSO etc.


Hi ,

Here is my case

Virtualization host :- Xenserver ,
2 Windows 2008 R2 VM's
One is samba client and another is server
net view command returns after 17seconds delay

Tcpdump suggests me , there is retransmission happening once payload increases to 1464.
While re-transmission, it breaks the payload , and this works .

What i want to know:-
1) Is there any way , i can test this behaviour with iperf. I mean try to send the packets with more payload
2) DO anyone know in this situation what all things can be tried to nail down the issue ?

Thanks for any sane insane advice .


Did you get any answers to your query?
Please share here.

Thanks & Regards,

when i use this command iperf -c -u -b 100m to test UDP performance, i don't get the true result. And i have this message all time "WARNING: did not receive ack of last datagram after 10 tries"

I need you to help me to solve this issue
Thanks and best Regards


I see that when in the past I left the server in TCP. Make sure the server is setup with iperf -s -u

Thanks for making this so easier to understand.

I appreciate the walkthrough. I’am going to implement this iperf tool in ubuntu. I just want to know can we able to get the hostname of the client machine. If that is possible how to achieve that? Is there any way to modify the source code to get the hostname of the client machine?

Sarath Pillai's picture

Hi Ranjith,
Why do you need the hostname of the client machine?
This is a test which you can conduct by having ip addresses of the server and the client. Can you elaborate your requirement?


Hostname is required when the client or server is in the Microsoft Azure cloud. You do not have a public IP for such a machine...

Is there any cURL software that is run in to windows?

how can i test the payload here in iperf what will be the exact to type

A good tip is to use -R, --reverse run in reverse mode (server sends, client receives).

It is good to test upload without having to open firewalls the other direction etc.

It is possible to use in iperf3, not sure about iperf (2)

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.