Testing network throughput with nc command

A lot of network testing tools requires certain level of installation. However, it is not possible or highly difficult to install tools at production environment.

In such cases, nc command may be your savior.

To do so, you can perform the following


Server side

Run

nc -l 8989 > /dev/null

The above command will run a server listening at port 8989 and redirect the output to /dev/null 

Client side

Run

$dd if=/dev/zero bs=1M count=1 | nc abc.hello.com 8989 

1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 6.91052 s, 152 kB/s

The dd command create NULL bytes (if=/dev/zero) in 1 MB block (bs=1M) for 1 time (count=1). The output of dd is redirect to nc command and send to the mentioned host and port.

The output will tell you the speed of transfer between client and server.

Comments

Popular Posts