Netcat is described as being a “feature-rich network debugging and exploration tool”. How to check network speed between two linux box using command line nc. It can be obtained from Source Forge, or it may already be available in your distribution.
To check the netcat installation in your linux, Use below commands.
To set up our test, we’ll use two machines, one to listen for a connection, and one to connect and send the data stream. In each test we’ll use a ten second session and we’ll test on three different LANs that differ in speed. The output file will be /dev/null in order to remove the disk from the equation.
Let’s Begin on a 100Mb network segment
On machine A, 192.168.0.8, start netcat as an ordinary user:
On machine B, send data to machine A, using the yes command over port 2222, using netcat – timing the session.
On machine A, notice:
#connect to [192.168.0.8] from (UNKNOWN) [192.168.0.4] 34111
Stop after 10 seconds by typing ctl-c and jot down the time taken:
#sent 87478272, rcvd 0
On machine A, note the data sent (in bytes)
#sent 0, rcvd 87478392
Now multiply the bytes rcvd by 8 to get total bits, then divide by the time: Result is 70Mb/s
Next up – Gb ethernet segment
#connect to [192.168.1.5] from cfms6-p [192.168.1.6] 33855
Lastly – a 10Mb ethernet segment
#nc -v -v -l -p 80 > /dev/null
#listening on [any] 80
. . . sent 0, rcvd 8437760
Result is 6.7Mb/s
We have seen a handy way to use netcat for testing ethernet throughput. At least we can show that the throughputs are somewhat consistent with their respective LAN segment speeds. I’d be interested in your comments, corrections or spam.