If you’re looking for a basic network speed test, one classic method is to use a basic file transfer protocol to send random large files back-and-forth. If you’re working with Linux systems and SSH is enabled, you can use the standard “scp” utility (SSH Copy or Secure Copy). SCP is the modern replacement for the old insecure “rcp” program.
Here are some example steps to generate a random large file and send it to and from a remote system. You will likely need to do some math to convert the file bytes per second to bits per second numbers. Remember that TCP, Encryption, and SSH control messages add overhead, so your true throughput will be a little higher than the number reported by SCP for the file transfer. This example assumes two hypothetical systems with IP of SYS1=10.1.1.1 and SYS2=10.2.2.2 respectively. Exaple is run from SYS1.
dd if=/dev/urandom of=~/randfile bs=1M count=100# create 100MB random file
scp ~/randfile 10.2.2.2:./# copy your random file to remote system
- # take note of reported transfer speed, usually in file size per second like MB/s
ssh -t 10.2.2.2 scp ~/randfile 10.1.1.1:./# send the random file back to source system
- # take note of return transfer speed
- # calculate bits per second, here’s an example using Bash & Python for 3.3 MB/s
printf "%'.0f bps\n" `python -c 'print (3.3*2.0**20.0*8.0)'`
- 27,682,406 bps # sample output for the above 3.3 MB/s conversion
- The Python math includes 1MB = 2^20 Bytes and 1 Byte = 8 bits.
- The Bash printf adds the thousand separator (comma)
If you’re using scp for automated or scripted bandwidth testing, you will likely need the “scp -v” verbose option along with a redirect of standard error like “2>&1” to capture the output. This verbose output has a lot of extra unneeded debug information, so I recommend piping it through “egrep” to filter out just the items you want to see in your script log-file.
There are many ways to test bandwidth between systems, this is a quick and easy way that should work for most Linux systems.