SimpleTechGuy

Well-Known Member
Mar 22, 2021
64
21
8
United States
cPanel Access Level
Root Administrator
Hi guys,
I've downloaded speedtest-cli to /usr/local/src and marked it as executable like this:
Code:
$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
$ chmod +x speedtest-cli

# ls -la
-rwxr-xr-x.  speedtest-cli
But when I run ./speedtest-cli it doesn't seem to want to give me any results:
Code:
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by School District of Philadelphia (Philadelphia, PA) [1971.67 km]: 1800000.0 ms
Testing download speed................................................................................
Download: 0.00 Mbit/s
Testing upload speed................................................................................................
Upload: 0.00 Mbit/s
Maybe it has something to do with firewall? Any suggestions would be much appreciated!
Thanks,
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,651
2,636
363
cPanel Access Level
Root Administrator
Hey there! Attempting to disable the firewall is a good idea, as that can be done temporarily while you perform the test. I do also need to point out that this wouldn't be related to the cPanel software on the machine.

If this is a Ubuntu system, you may need some additional packages for that tool to work properly:

 
  • Like
Reactions: SimpleTechGuy

SimpleTechGuy

Well-Known Member
Mar 22, 2021
64
21
8
United States
cPanel Access Level
Root Administrator
@cPRex, thanks for looking into this for me!
If this is a Ubuntu system, you may need some additional packages for that tool to work properly:
Sorry, forgot to mention it's running CentOS 7
Hey there! Attempting to disable the firewall is a good idea
Thanks! Disabled the firewall in csf - ConfigServer Firewall and speedtest worked, looks like firewall was blocking it somehow.
I do also need to point out that this wouldn't be related to the cPanel software on the machine.
Yes, sorry about that, since this server is only used for WHM/Cpanel I just default to coming here when there is an issue. I guess I figured it must have been the firewall settings in WHM that was blocking it. Maybe I should go over to ConfigServer forums for this?
 

SimpleTechGuy

Well-Known Member
Mar 22, 2021
64
21
8
United States
cPanel Access Level
Root Administrator
So in testing I found that in CSF Firewall Configuration the Allow outgoing TCP ports is limited to certain ports. When I checked the logs /var/logs/messages when attempting to run speedtest-cli I found it was using random source ports in the upper 55000 range. So I guess that explains the issue.

So for future reference, instead of disabling the firewall for the test, a person could temporarily add all outgoing ports:
Code:
TCP_OUT=1:65535
UDP_OUT=1:65535
to
Code:
ConfigServer Security & Firewall - csf - Firewall Configuration - IPv4 Port Settings - TCP_OUT and UDP_OUT
Then just remember to remove the ports you added from the firewall configuration when done testing.
 
  • Like
Reactions: cPRex

Spirogg

Well-Known Member
Feb 21, 2018
700
163
43
chicago
cPanel Access Level
Root Administrator
So in testing I found that in CSF Firewall Configuration the Allow outgoing TCP ports is limited to certain ports. When I checked the logs /var/logs/messages when attempting to run speedtest-cli I found it was using random source ports in the upper 55000 range. So I guess that explains the issue.

So for future reference, instead of disabling the firewall for the test, a person could temporarily add all outgoing ports:
Code:
TCP_OUT=1:65535
UDP_OUT=1:65535
to
Code:
ConfigServer Security & Firewall - csf - Firewall Configuration - IPv4 Port Settings - TCP_OUT and UDP_OUT
Then just remember to remove the ports you added from the firewall configuration when done testing.
as per the speedtest website:

ports 8080 or 5060 need to be open in /out in firewall


[to run test run the commands below]

speedtest cli ( this will choose an automatic location for you and run the test)
speedtest cli --servers ( this will give you a list of server you can choose from to run your test)
speedtest cli --server-id=10723 ( this will run a test on this selected server )

here is xml page with server ID's I found online. This will get you a list of servers - ID's close to your location

https://www.speedtest.net/speedtest-servers.php

* (10723is an example of the server id number from the --servers list you got running speedtest cli --servers )


my servers test results



PING ms
2
DOWNLOAD Mbps
9301.83
UPLOAD Mbps
8698.72

hope this helps you and others as well.
 

SimpleTechGuy

Well-Known Member
Mar 22, 2021
64
21
8
United States
cPanel Access Level
Root Administrator
my servers test results


PING ms
2
DOWNLOAD Mbps
9301.83
UPLOAD Mbps
8698.72
First of all, WOW, I've never even seen a 10gig connection before, So Jealous! lol, If you ever need anyone to play on your network let me know! :cool:

I'm supposed to be on a 1 gig server, but I guess it's just a busy farm here because my best results so far have been:
Download: 530.73
Upload: 352.18

as per the speedtest website:

ports 8080 or 5060 need to be open in /out in firewall
You are awesome! I did see those ports were required on ookla website for speedtest server , but never thought to try them for the cli client since it seemed to be using higher numbers in the logs. I guess it defaulted to higher numbers when it realized the 5060,8080 were closed. For me 5060 and 8080 did work and no need to open all outgoing ports for the connection to work, just 8080 and 5060!

Also, a side note, since I'm not using the server I did not open the ports incoming, only opened the ports outgoing and it worked fine.
speedtest cli --servers ( this will give you a list of server you can choose from to run your test)
speedtest cli --server-id=10723 ( this will run a test on this selected server )
So For me the command for listing servers was speedtest-cli --list, and to run on selected server was speedtest-cli --server 'id' but that could be different because I used the version of speedtest-cli from github, and I didn't install anything, just downloaded the python script and marked it executable.

So Thank you so much @Spirogg for all that information!!
 
  • Like
Reactions: Spirogg and cPRex

Spirogg

Well-Known Member
Feb 21, 2018
700
163
43
chicago
cPanel Access Level
Root Administrator
  • Like
Reactions: SimpleTechGuy

Spirogg

Well-Known Member
Feb 21, 2018
700
163
43
chicago
cPanel Access Level
Root Administrator
Nice! Tried to PM you but doesn't look like it's allowed on your account. Was going to ask about that 10g network and also about xenspec.
I just turn on in privacy settings to allow PM but I tried to send you one and did not work either

in privacy settings says ( start conversations with you I tried followers and now tried members only.

and still could not send to you a PM.

so maybe on your end you have to make this change as well?
or the forum is not working right

Screen Shot 2022-05-07 at 12.30.30 AM.png
 

Spirogg

Well-Known Member
Feb 21, 2018
700
163
43
chicago
cPanel Access Level
Root Administrator
Update on installing speedtest.net
speedtest on Almalinux
- not from yum or dnf

first go to speedtest.net/apps/cli
then at bottom of the page you will see Download for Linux
in the dropdown find X86_64 and right mouse click on the downloadable file to copy the link only

Screenshot 2022-05-09 055421.jpg

next

login to WHM terminal

and mkdir speedtest

then cd /speedtest

then type: wget https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-x86_64.tgz
( this is the file you right moused click to copy the url. you can paste it after wget )

then tar -xvzf ookla-speedtest-1.1.1-linux-x86_64.tgz
- ( just fyi dir or ls while in speedtest directory you created to see the correct file name to use incase the file gets updated )

then chmod +x speedtest

then mv speedtest /usr/bin

last type: speedtest to run the test. that's it!!


as mentioned earlier

[per the speedtest,net website]

ports 8080 or 5060 need to be open in /out in firewall


[to run test run the commands below]

speedtest ( this will choose an automatic location for you and run the test)

speedtest --servers ( this will give you a list of server you can choose from to run your test)

speedtest --server-id=10723 ( this will run a test on this selected server )

* (10723 is an example of the server id number from the --servers list you got running speedtest --servers )

here is xml page with server ID's I found online. This will get you a list of server ID's close to your location.
https://www.speedtest.net/speedtest-servers.php




now you can run speedtest in terminal and get speedtest.net correct speeds on your vps or server.
.
I found a huge mistake with the speedtest-cli from rpm pkg ( if installed from yum or dnf)
speeds were showing 680 780 down and 500 600 up

when I install speedtest with above instruction. it was the actual speeds that matched my server speed.
7800 - 9000 down 7000 - 9000 up

that's a huge difference. ;)

hope this helps someone else with installing speedtest.net speedtest


Spiro
 
Last edited:
  • Like
Reactions: SimpleTechGuy

SimpleTechGuy

Well-Known Member
Mar 22, 2021
64
21
8
United States
cPanel Access Level
Root Administrator
Excellent instructions! Thanks for sharing. I verified this does work on my system as well.

Just one note:
ports 8080 or 5060 need to be open in /out in firewall
I only had to allow the ports outbound, opening inbound ports is generally not required unless you're going to host a speedtest server, but just for testing speeds you should only need outbound ports open in csf.
 
  • Like
Reactions: cPRex and Spirogg