2011年11月14日 星期一

Bandwidth testing with iperf

To test bandwidth between 2 linux servers, we would use a tools call iperf. Installing iperf from repository is easy, what we need to run is

[root@server ~]# yum -y install server.

Or,

You may want to run apt-get install iperf on debian or ubuntu.

Once we install the package on both machines, we will need to pick one node to run as server

[root@server ~]# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------


Once service is running, we could run iperf from the client machine to connect to server.
[root@client ~]# iperf -c 192.168.0.1
------------------------------------------------------------
Client connecting to 192.168.0.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.2 port 37476 connected with 192.168.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.38 GBytes  1.19 Gbits/sec

Now the bandwidth is 1.19Gbit/sec, which is pretty much correct on my VM.

There are some other common options could be used. For e.g. using -d would perform a bi-directional test, i.e testing the bandwidth from source-to-target and then target-to-source. Using -n $some_number would define the size to transfer.

Below example will send approximately 1000Mb of data to test.

[root@client ~]# iperf -n 1000000000 -c 192.168.0.1 
------------------------------------------------------------
Client connecting to 192.168.0.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.2 port 39375 connected with 192.168.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 7.8 sec   954 MBytes  1.03 Gbits/sec

1 則留言:

  1. Well your site is very informative and it will be equally worthwhile,I usually find the internet speed test fromopen Speed test

    回覆刪除