How to Run a Network Speed Test from a Headless Linux Server
Run a networking speed test on your headless Linux servers by installing a simple Python script and following these steps.
From time to time, administrators should run a speed test to find out how their network is performing. Sometimes we just do it to brag about the speeds we achieve – that’s okay to admit. Fortunately, running a speed test is quite simple: open a browser and point it to Speed test by Ookla.
But what if you’re on a headless Linux server and want to troubleshoot, through a speed test. Maybe everything is fine on your network, but something is bothering you on this particular server. Fortunately, there is a way to run a speed test on this headless server with just one command.
I will walk you through the process of installing and using this command. I’m going to demo on Ubuntu 16.04, but the process works on almost all Linux distributions.
What we do is upload a Python script, which should tell you about the requirements for this tool. You must have at least Python 2.4-3.4 installed. That said, here are the installation steps:
- Open a terminal window
- Download the necessary file with the command wget https://raw.githubusercontent.com/sivel/speedtest…
- Give the newly downloaded file the necessary permissions with the command chmod u+x speedtest.py
- Move the file with the command sudo mv speedtest.py /usr/local/bin
That’s all there is to install. We are now ready to run our test.
Execution of the test
Go back to your terminal window and run the command sudo speedtest.py. The command will locate the nearest test server and get it. Once the command completes, you will have your results (Figure A).
If you’re interested, you can have the test generate a .png image so you can share it with your colleagues or use it for documentation purposes. To do this, run the command sudo speedtest.py –share. When the command completes, it produces a link that you can copy and paste into a browser. This link will display the image created by your test. You can then save the image and use it later.
Troubleshooting or bragging
Whether you need to fix a network problem or brag to your fellow IT pros, running a network speed test is a great place to start. If you are running headless Linux servers, these machines should not be left out.