Quick network speed test using Netcat


#1

Just learned a neat little trick to test the network speed between two servers running Linux using Netcat.

On machine one, open up the port using netcat.

nc -vvlnp 5203 >/dev/null

and on machine two, write to it using dd.

dd if=/dev/zero bs=1M count=1K | nc -vvn 192.168.149.69 5203

Your output should look something like this:

Connection to 192.168.149.69 5203 port [tcp/*] succeeded!
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.6777 s, 230 MB/s

These results show a network connection with a speed of 230 MB/s.

Hope it helps somebody.


#2

I love little tricks like this. If you only have SSH access to a box certain things feel limited due to no GUI, so this is great.