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: 3.6 (3271 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)

Can I test the link between my laptop and ONT using ethernet cable? How can I test that? Because as I understand you can test between two computer...


What if I only have 1 computer...?


I also want to know how to test its Wi-fi link..

mobile devices--------Router

Is it possible to test this?

By the way my ONT doesnt have a Iperf services as I read on others that some routers have this services

Thanks hope you reply

Sarath Pillai's picture

Yes. I would go with the first solution you mentioned (computer—router—computer), if your router does not have iperf binary(and does not let you install it).

If not iperf check if you have tools like netcat, scp(this one is very likely to be there),curl etc. With curl you can do some level of tests with http transfer from your computer to the device. Netcat can also help you redirect some junk from your computer to the devices /dev/null. But none of these can give the level of results given by iperf.



Glad to see this thread is still going.

I first ran iperf -c -i 2 -r to get an overall idea of my network speed, on average I get this:

[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.0 sec 7.49 GBytes 6.43 Gbits/sec

I then tried to open multiple TCP connection to my server by running iperf -c -P 20 and that all got refused. I'm not too sure why?

Also, if I try running iperf -c -u -b 100m, this is my results:
Client connecting to, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 160 KByte (default)
[ 3] local port 52137 connected with port 5001
read failed: Connection refused
[ 3] WARNING: did not receive ack of last datagram after 1 tries.
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 0.00 (null)s 146807685833932 Bytes/sec
[ 3] Sent 85454 datagrams

Any idea as to why my this could be happening?


Hi, I have made some test using Iperf between two linux machines and notice a large difference in performance between client and server. Between the two machines there is a 4G link. The server is on a 4G machine, in order to measure downlink rate.
As seen below the client appears to buffer up a lot of date and gives a much better throughput than the server. I find this a bit strange as I would expect TCP to ack when the data has been received at the final desination. Any good explanation? Does the window size has any impact? The example is easy to repeat.

root@localhost:~# iperf -c localhost -p 5001 -i 2
Client connecting to localhost, TCP port 5001
TCP window size: 2.50 MByte (default)
[ 3] local port 37198 connected with port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 2.0- 4.0 sec 4.38 MBytes 18.4 Mbits/sec
[ 3] 4.0- 6.0 sec 2.55 MBytes 10.7 Mbits/sec
[ 3] 6.0- 8.0 sec 4.62 MBytes 19.4 Mbits/sec
[ 3] 8.0-10.0 sec 4.38 MBytes 18.4 Mbits/sec
[ 3] 0.0-10.4 sec 30.6 MBytes 24.7 Mbits/sec

root@MiWire:~# iperf -s -p 5001 -i 2
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
[ 4] local port 5001 connected with port 35759
[ 4] 0.0- 2.0 sec 4.11 MBytes 17.2 Mbits/sec
[ 4] 2.0- 4.0 sec 4.25 MBytes 17.8 Mbits/sec
[ 4] 4.0- 6.0 sec 3.16 MBytes 13.2 Mbits/sec
[ 4] 6.0- 8.0 sec 4.28 MBytes 18.0 Mbits/sec
[ 4] 8.0-10.0 sec 4.19 MBytes 17.6 Mbits/sec
[ 4] 10.0-12.0 sec 4.44 MBytes 18.6 Mbits/sec
[ 4] 12.0-14.0 sec 3.34 MBytes 14.0 Mbits/sec
[ 4] 0.0-15.3 sec 30.6 MBytes 16.8 Mbits/sec


I am using iperf test my ipoib performance, but seems I got different result in every iteration, is there any idea why? how could I get fix result?

thanks a lot!


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.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.