Wednesday, August 17, 2011

Bandwidth testing using command

Sometime we need to test bandwidth between two linux system. Here in this post i am showing by example to test bandwidth without any network monitoring tool.


Suppose you need to test bandwidth between two linux hosts one in Host1 and another is Host2. Execute following command on Host1

root@Host1# nc -u -l 7654 >/dev/null

On Host2 run following command

root@Host2# dd if=/dev/zero bs=1MB
nc -u Host1 7654 & pid=$(pidof dd)

while((1)) ; do kill -USR1 $pid; sleep 2; done

Now analyze the output, How much data copied in how many seconds and calculate your network bandwidth.