Test Internet Speed - Speedtest-cli (Docker & Command Line) - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Friday, March 13, 2020

Test Internet Speed - Speedtest-cli (Docker & Command Line)


Test Internet Speed using Speedtest-cli

Docker Image : Speedtest-cli


You might need more memory when running this docker to test speed. Please add swap size if you are running a low memory VPS. 

Related Post:



root@ubuntu18-04-1:~# docker run --rm moutten/speedtest-cli
Unable to find image 'moutten/speedtest-cli:latest' locally
latest: Pulling from moutten/speedtest-cli
3690ec4760f9: Pull complete 
8cf4eb2be1b3: Pull complete 
b30d63227d13: Pull complete 
6255aad43ec4: Pull complete 
Digest: sha256:feacde601da0c9e06989c900a21e86105c7af327382444b989eeb3a36c06865c
Status: Downloaded newer image for moutten/speedtest-cli:latest
Retrieving speedtest.net configuration...
Testing from Google Cloud (35.225.54.226)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cox - Nova (Fairfax, VA) [21.49 km]: 35.428 ms
Testing download speed................................................................................
Download: 695.30 Mbit/s
Testing upload speedTraceback (most recent call last):
  File "/usr/local/bin/speedtest-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 1400, in main
    shell()
  File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 1376, in shell
    speedtest.upload(callback=callback)
  File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 1086, in upload
    data._create_data()
  File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 497, in _create_data
    (chars * multiplier)[0:int(self.length) - 9]
MemoryError
root@ubuntu18-04-1:~# 


Notes: https://hub.docker.com/r/moutten/speedtest-cl






Run Script Directly from Command Line


Github Project Address:https://github.com/sivel/speedtest-cli

It requires python installed first. 

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
./speedtest-cli

If there is no python installed, you can install python first then run this spedtest-cli.py script. 

Here is an example from Alpine OS.


[node1] (local) [email protected] ~
$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
Connecting to raw.githubusercontent.com (185.199.108.133:443)
saving to 'speedtest-cli'
speedtest-cli        100% |************************************************************************************************************************| 65018  0:00:00 ETA
'speedtest-cli' saved
[node1] (local) [email protected] ~
$ chmod +x speedtest-cli 
[node1] (local) [email protected] ~
$ ./speedtest-cli 
env: can't execute 'python': No such file or directory

[node1] (local) [email protected] ~
$ cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.12.2
PRETTY_NAME="Alpine Linux v3.12"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
[node1] (local) [email protected] ~
$ apk add --no-cache python3 py3-pip
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
OK: 405 MiB in 151 packages


[node1] (local) [email protected] ~
$ python3 speedtest-cli
Retrieving speedtest.net configuration...
Testing from Microsoft Corporation (40.87.120.67)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Wave2Net LLC (Winchester, VA) [52.15 km]: 22.074 ms
Testing download speed................................................................................
Download: 847.06 Mbit/s
Testing upload speed......................................................................................................
Upload: 562.39 Mbit/s
[node1] (local) [email protected] ~






1 comment: