Once, when running the Speedtest CLI on one Linux server, I noticed the following error:
speedtest --selection-details
Speedtest by Ookla
Selecting server:
2933: Failed; Thüga SmartService - Hof
4578: Failed; SWW Wunsiedel GmbH - Wunsiedel
25733: Failed; TaNET West s.r.o. - Tachov
6518: Failed; Thueringer Netkom GmbH - Weimar
11519: Failed; TELE AG - Leipzig
3313: Failed; suec//dacor GmbH - Coburg
3823: Failed; Newone - Ilmenau
6416: Failed; ForWiFi s.r.o. - Plzen
10708: Failed; PilsFree, z.s - Plzen
2495: Failed; IBH IT-Service GmbH - Dresden
[error] Server Selection - Failed to find a working test server. (NoServers)
I tried to specify the speedtest server manually:
speedtest --server-id=25733
Speedtest by Ookla
Server: TaNET West s.r.o. - Tachov (id = 25733)
ISP: Hetzner Online GmbH
[error] Failed to resolve host name. Cancelling test suite.
[error] Host resolve failed: Connection refused
If you run the Speedtest CLI in verbose mode, you can see that it is trying to establish connections with the servers:
speedtest -vvv
...
completed with response code 200
...
[info] Server count: 10
[info] app.version: 1.0.0.2 (5ae238b)
[info] Resolving host in thread.
[info] Resolving host in thread.
[info] Resolving host in thread.
[info] Resolving host in thread.
[info] Resolved address 1: 91.137.110.250
[info] Resolving host in thread.
[info] Opening socket to '91.137.110.250'
[info] Resolving host in thread.
[info] Resolving host in thread.
[info] Resolving host in thread.
[info] Resolved address 1: 109.73.31.177
[info] Opening socket to '109.73.31.177'
[info] Resolving host in thread.
[info] Resolved address 1: 5.61.162.244
[info] Opening socket to '5.61.162.244'
...
At the same time, the Internet on the server worked and the working DNS servers were specified in the /etc/resolv.conf file.
I found the cause of errors in the firewall, which blocked outgoing connections (OUTPUT) and after I allowed the server all outgoing connections, the Speedtest CLI started working.
iptables -P OUTPUT ACCEPT
See also my articles:
How to configure IPTables