Web Server internet Speed Test

How to test your server internet or network connection speed from command line

Spread the love

I bet many of you have seen the bottom bar of wget utility when you downloading something:

wget

In most of the cases this should be enough to see your server internet connection speed. But what if you want to test/check your real server internet or network connection speed, even more – with multi threads connection?

In this article I will discover some of the utilities which can help you to test your server internet or network connection speed from command line.

Aria, Aria2

One of the option is to use the aria2 utility.

Install on Ubuntu/Debian

# --no-install-recommends - do not install recommended software
# -y - automatically reply yes when/if prompted
sudo apt-get update && sudo apt-get install aria2 --no-install-recommends -y

How to use it

All the details about how to use it you will find in the Aria2 Manual itself, but the most common command example I will post here though:

aria2c -x 4 http://cachefly.cachefly.net/100mb.test

This command will download 100 MB file to your local current folder.

Parameter -x 4 sets the amount of simultaneous connection to be opened.

The following example will try to download the latest Ubuntu release ISO file in -x 8 simultaneous connections:

aria2c -x 8 https://old-releases.ubuntu.com/releases/kinetic/ubuntu-22.10-desktop-amd64.iso

In the result CN will show us how many simultaneous connections were open to the remote host/server really (how many simultaneous connections the end-server allows to open):

Speed Test

I’m sure everyone at least once used this tool, if not from the app but from the browser for sure.

But did you know that this utility can be used from command line as well?

Oh yeah, it can!

Install on Ubuntu/Debian

curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest

How to use it

More details you can find on their online website, but I will post some examples of how I use it here.

# To list the nearest servers for testing
speedtest -L
# This command should test your internet connection speed against the nearest test Ookla server and show the results in human-readable format (-f), with 100 ms interval (--progress-update-interval), 4 decimals after comma precision (-P) and with progress bar (-p)
speedtest -f human-readable -p yes -P 4 --progress-update-interval 100

The result would be something similar to this:

DD linux built-in utility

If you don’t want to install any 3rd-party utilities on your server and you are pretty good in linux, you can use built-in utility – DD

dd if=/dev/zero bs=1M count=4000 | ssh [email protected] 'cat > /dev/null'

The command above will send 4GB (1 Megabyte * 4000) of data from the local host (from /dev/zero) to the other host (host.tld) over the network, without consuming any unnecessary disk on either the client nor the host. This is a quick and dirty way to benchmark network speed without wasting any time or disk space. This command also doesn’t rely on any extra 3rd party utilities, as dd, ssh, cat, /dev/zero and /dev/null are installed on all major Unix-like operating systems.

SSH connection is adding overhead with encryption (compression), so Instead of ssh you can use nc (netcat, nc should be also installed on the other host (host.tld) and be open for listening on the port 2112):

dd if=/dev/zero bs=1M count=4000 | nc host.tld 2112

The results of this test will be even more realistic (precise), since there will be no overhead (compression or encryption) added to the connection.

This is basically it for today.
Have a nice internet/network connection speed testing 🙂