Speedtest CLI On a FreeBSD To Check Internet Speed

Speedtest CLI allows FreeBSD users to test internet speed using the Command line interface (CLI) command line. This CLI command can be used by software developers, system administrators, and computer enthusiasts to measure bandwidth speed. Speedtest CLI will measure internet connection performance metrics such as downloads, uploads, latency, and packet loss natively without relying on a web browser.

Generally, most people measure bandwidth speed using a web browser, in this way the accuracy of the measurement sometimes does not match the internet subscription package. Speedtest CLI brings the trusted technology and global server network behind the Speedtest server with a command line command line interface. Built for software developers, system administrators, and computer enthusiasts, Speedtest CLI is the first official Linux native Speedtest application powered by Ookla.
Benefits of Using Speedtest CLI:
  1. Measure internet connection performance metrics such as downloads, uploads, latency, and packet loss natively without relying on a web browser.
  2. Test the internet connection of your Linux desktop, windows, remote server, or even a low-power device like a Raspberry Pi with Speedtest Server Network.
  3. Set up automated scripts to collect connection performance data, including trends over time.
  4. Use Speedtest in your programs by wrapping them in the programming language of your choice.
  5. View test results via CSV, JSONL or JSON.
Let's now practice how to install and use the peedtest CLI on FreeBSD.
If you use a FreeBSD system, you can install Speedtest CLI with the pkg package or FreeBSD ports. Speedtest CLI runs on the python application, so before installing Speedtest CLI, install python first.

root@router2:~ # pkg update
root@router2:~ # pkg upgrade -y
After updating and upgrading pkg, continue by installing pyhon and Speedtest.

root@router2:~ # pkg install -g libidn2 ca_root_nss
root@router2:~ # pkg install python39
root@router2:~ # pkg install py-speedtest-cli
If using system ports, follow the following script.

root@router2:~ # cd /usr/ports/lang/python39
root@router2:/usr/ports/lang/python39 # make install clean

root@router2:~ # cd /usr/ports/net/py-speedtest-cli
root@router2:/usr/ports/net/py-speedtest-cli # make install clean
If you have installed the Speedtest CLI, now is the time for us to use the application to test the internet speed that we are using. Use the "speedtest-cli" script.

root@router2:~ # speedtest-cli
Retrieving speedtest.net configuration...
Testing from PT Telkom Indonesia (36.90.9.6)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by PT. Telekomunikasi Indonesia (Bandung) [118.58 km]: 4.875 ms
Testing download speed............................................
Download: 14.82 Mbit/s
Testing upload speed..............................................
Upload: 6.19 Mbit/s
root@router2:~ #
Now we use the script "speedtest-cli --secure", notice the difference.

root@router2:~ # speedtest-cli --secure
Retrieving speedtest.net configuration...
Testing from PT Telkom Indonesia (36.90.9.6)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by JSN Jaringanku (Ponorogo) [545.49 km]: 75.286 ms
Testing download speed.................................................................
Download: 35.15 Mbit/s
Testing upload speed..............................................
Upload: 5.63 Mbit/s
root@router2:~ #
With the script "speedtest --single".

root@router2:~ # speedtest --single
Retrieving speedtest.net configuration...
Testing from PT Telkom Indonesia (36.90.9.6)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by PT. Telekomunikasi Indonesia (Bandung) [118.58 km]: 5.736 ms
Testing download speed............................................
Download: 16.02 Mbit/s
Testing upload speed..............................................
Upload: 5.01 Mbit/s
root@router2:~ #
In JSON or CSV format

root@router2:~ # speedtest --secure --csv
45311,Pemerintah Kota Surabaya,Surabaya,2023-06-19T06:35:09.977058Z,663.1603865242897,12.454,21602493.377905495,6490160.553338757,,36.90.9.6
root@router2:~ #

root@router2:~ # speedtest --secure --json
{"download": 20362205.216706, "upload": 6426336.491038609, "ping": 12.445, "server": {"url": "http://speedtest.surabaya.go.id:8080/speedtest/upload.php", "lat": "-7.2667", "lon": "112.7333", "name": "Surabaya", "country": "Indonesia", "cc": "ID", "sponsor": "Pemerintah Kota Surabaya", "id": "45311", "host": "speedtest.surabaya.go.id:8080", "d": 663.1603865242897, "latency": 12.445}, "timestamp": "2023-06-19T06:36:59.906721Z", "bytes_sent": 8208384, "bytes_received": 31958486, "share": null, "client": {"ip": "36.90.9.6", "lat": "-6.1741", "lon": "106.8296", "isp": "PT Telkom Indonesia", "isprating": "3.7", "rating": "0", "ispdlavg": "0", "ispulavg": "0", "loggedin": "0", "country": "ID"}}
root@router2:~ #

In this short tutorial, we learn how to install speedtest-cli to test internet bandwidth using speedtest.net from Ookla on a FreeBSD Unix server or desktop system. Ookla's Speedtest service is also available in a web browser that you can try and compare the results with the Speedtest CLI.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post