Understanding how to test your network speed can help you optimize
your server’s performance and troubleshoot any issues that may arise. In
this guide, we will walk you through testing your network speed using
terminal commands. However, please note that there are no
accurate test results. That’s because each test has two
sides.
During the tests, your server gets connected to another server, and
therefore, both your server’s speed, and the other server’s speed affect
the results shown to you. This is why it’s a good idea to do your tests
using multiple servers and tools.
Testing
Network Speed Using Terminal Commands
One of the most effective ways to test your network speed is by using
terminal commands. This method is more accurate than using online
websites to do network tests. Also, mastering command line tools allows
you to test different aspects of your network, such as download speed,
upload speed, and latency.
Step 1: Connect to Your
Server
First and foremost, log in to your Linux server using either SSH or
VNC and then choose either of the tools we introduce below to follow
along.
Step
2: Use speedtest-cli for a General Speed, Jitter, and Ping
Measurement
The easiest tool to test network speed is the
speedtest-cli. This tool uses the Speedtest.net
infrastructure to measure network speed and latency, providing a simple
and convenient way to test your server’s connection. Here’s how to use
it:
1. Install speedtest-cli
Based on the Linux distro you are using, choose one of the following
commands to install speedtest-cli:
- For Debian or Ubuntu:
$ sudo apt-get install curl
$ curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
$ sudo apt-get install speedtest
- For Fedora/CentOS/AlmaLinux/Redhat:
$ curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh | sudo bash
$ sudo yum install -y speedtest
2. Running the tests
Once speedtest-cli is installed, you can run a
network speed test by simply typing speedtest-cli in the terminal and
pressing Enter. This will automatically select the best
server based on ping and perform a speed test.
$ speedtest
The upload and download speed will then be shown to you
Step
3: Use ‘iperf3’ for Testing Connections Between a Server and a
Client
The iperf3 tool is a versatile utility for testing
network speed. It works by creating a data stream between a server and a
client. Therefore, it allows you to measure the speed between two
devices, one which should be a server and the other is the server’s
client. Here’s a step-by-step guide on how to use it:
1. Installation
Again, based on your Linux distro, use one of the following commands
to install iperf3:
- For Debian or Ubuntu:
$ sudo apt-get update
$ sudo apt-get install iperf3
- For Fedora/CentOS/Alma/Redhat
$ sudo yum makecache --refresh
$ sudo yum -y install iperf3
2. Running speed tests between two servers using
iperf3
Once iperf3 is installed, you can start your own server by running
the command iperf3 -s. This will start the iperf3’s
server mode. However, this is for when you want to measure the speed
between two specific devices that you own.
In our case, we just want to know how good our server’s speed is in
general.
3. Choose a public server
To be able to run a general test with iperf3, we can use one of the
public iperf3 servers. Here’s a list of them.
Note that each public server has a limited link bandwidth. Therefore,
if you choose a server with a 1Gbps link, for example, your test won’t
show speed results more than 1Gb, even if your own server has a 10Gbps
link attached to it.
You should first sort the servers by their speed, then choose the one
closest to you. This is an important factor, as you will definitely
experience a huge latency if you don’t choose servers that are close to
you.
How can you know which servers are the closest to you? You can ping
them and choose one with the lowest latency.
4. Start iperf3 in client mode and run the test
After choosing a public server from iperf3serverlist.net, copy the
command that appears in the site’s table. Then, paste that command into
your SSH or VNC session.
For example, since I’m using one of Cloudzy’s Frankfort VPSs, I’ll
choose a 10Gbps German server among the public servers:
$ iperf3 -c speedtest.wobcom.de
The command above tests uploads. For testing download speed, you
should also add a -R to the end of the command:
$ iperf3 -c speedtest.wobcom.de -R
Regularly testing your network speed is an essential part of managing
a VPS. By using tools like iperf3 and speedtest-cli, you can keep a
close eye on your server’s performance and ensure that it’s always
running at its best. If you have any questions on running network tests,
don’t hesitate to contact us by submitting a
ticket.