For plain bytes/second bandwidth testing – ie without taking things like encryption overhead and compression improvements into account – the netcat command-line utility is pretty handy.
Once installed on both servers (let’s call them serverA and serverB):
- start netcat to listen on one server and pipe the output through wc -c to both count the bytes (for confirmation) but also so that the bytes are not written to a filesystem or the terminal (which would cause a bottleneck and likely reduce the apparent bandwidth). By default nc will quit when the first network connection it accepts is closed:
serverA$ nc -l -p 12345 | wc -c
- start netcat to send data from the other server – using dd to send as quickly as possible (using /dev/zero is fast). Using -q 0 will cause netcat to quit as soon as it sees an end of file (EOF):
serverB$ dd if=/dev/zero bs=$((2**20)) count=$((2**10)) | nc -q 0 serverA 12345
- On the sending server (serverB) the output will show the number of bytes transmitted and the time it took to do that:
1048576+0 records in 1048576+0 records out 1073741824 bytes (1.1 GB) copied, 9.68678 s, 111 MB/s
- And on the other server (serverA) the number of bytes will be printed (confirming the transmission was complete):
Run this in both directions a few times to get a good feeling for the bandwidth between the servers.