Wednesday, April 4, 2012

How To Calculate Your Network Bandwidth Speed



There is a great software called IPERF you can easily use it for testing the network bandwidth speed.

Why IPERF is a great software to test bandwidth speed:
Testing you network speed by copying a file between two machines is not an accurate way, because there are many factors like (Disk I/Os,memory delays,OS delays) can slow down the copying process so you will end up with inaccurate speed result, also nowadays -specially with 10G/s networks- sometimes you find harddisk speed slower than network speed.

IPERF doesn't engage other factors like (Disk I/Os,memory delays,OS delays) during network speed test, the thing will give you an accurate result.

Download IPERF from:

http://sourceforge.net/projects/iperf/

First install IPERF:

Install it on the machines you want to test the bandwidth speed between them:

On Machine1:

#gunzip iperf-2.0.5.tar.gz
#tar xvf iperf-2.0.5.tar
#cd iperf-2.0.5
#./configure
#make install

On Machine2:


#gunzip iperf-2.0.5.tar.gz
#tar xvf iperf-2.0.5.tar
#cd iperf-2.0.5
#./configure 
#make install


How to use IPERF for testing bandwidth speed:

Now let's test the bandwidth speed between these two mahines:

Before starting the philosophy is that on one machine we will open a session listening on port 5001 which will be ready for accepting the packets from outside and from other machine we will send the test packets to the open port on the first machine using IPERF then IPERF automatically will show us the speed statistics.

On Machine 1:

We will run iperf server on that machine:

#iperf -s

------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

This will start to listen on port 5001,leave that session as it, don't interrupt it, then go to machine 2

On Machine 2:

Test the speed between machine 2 machine 1:

#iperf -c 192.168.0.1 -f g

192.168.0.1 -> Machine#1 IP
-f                  -> Argument display the result in a desired format (g)->giga bits/sec also(b->bit,B-
                                  >byte,m->Mega bit,M->Mega byte,g->giga bit,G->giga byte)

After some time the output will come out

------------------------------------------------------------
Client connecting to 192.168.0.1, TCP port 5001
TCP window size: 0.00 GByte (default)
------------------------------------------------------------
[  3] local 192.168.0.2 port 40094 connected with 192.168.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.09 GBytes  0.94 Gbits/sec

This means my network speed between machine1 and machine2 = 0.94 Gbits/sec which is near to 1 Gbits/sec

Also you can see the same result on machine1 if you go to the same session you executed "iperf -s" from.


Note: Generally speaking bits are usually being used in hardware world and bytes are being used in software world, this means (network bandwidth,network card,switch,cable,link,..) measured in bits, when I say my network bandwidth speed = 1Gbits/sec it's in bits which is = 128 Megabyte/sec

In software world when I say the speed of copying a file = 1M/sec it means in Mega bytes..,etc.

note also that 1 byte = 8 bits 

For more info:
http://openmaniak.com/iperf.php