Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Speedtest CLI. Run speedtest on pfSense box

    Scheduled Pinned Locked Moved pfSense Packages
    167 Posts 52 Posters 142.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • provelsP
      provels
      last edited by

      Wonder if anyone's seeing this. When I run speedtest cli from my Windows box to pull the list of servers,

      C:\Python27\python.exe C:\Python27\Lib\site-packages\speedtest.py --list > serverlist.txt
      

      normally it returns a list including a half dozen that are within 30 miles or so of my location. My scheduled task is hard-coded to the server that returns the best ping (the server that is normally chosen when I run speedtest without choosing a specific server). Recently, though, the closest servers are over 700km away and the nearby servers are missing.

      Retrieving speedtest.net configuration...
      12733) WestPAnet, Inc. (Warren, PA, United States) [758.42 km]
       9276) ColoCrossing (Buffalo, NY, United States) [775.56 km]
      31483) CreeperHost LTD (Buffalo, NY, United States) [775.56 km]
      32993) Crowsnest Broadband LLC (Altoona, PA, United States) [849.74 km]
      14233) Frontier (Rochester, NY, United States) [879.94 km]
      14148) Rochester Institute of Technology (Rochester, NY, United States) [879.94 km]
       1239) Synoptek (Rochester, NY, United States) [879.94 km]
      39474) University of Rochester (Rochester, NY, United States) [879.94 km]
      

      And needless to say, my data is borked. Strange, when Irun the Windows client Ookla speedtest, it finds the servers w/o issue.
      Anyone else see this?
      3992a581-890a-461b-81a5-d051f5fcb40f-image.png

      Peder

      MAIN - pfSense+ 24.11-RELEASE - Adlink MXE-5401, i7, 16 GB RAM, 64 GB SSD. 500 GB HDD for SyslogNG
      BACKUP - pfSense+ 23.01-RELEASE - Hyper-V Virtual Machine, Gen 1, 2 v-CPUs, 3 GB RAM, 8GB VHDX (Dynamic)

      1 Reply Last reply Reply Quote 0
      • A
        alpharulez @provels
        last edited by

        @provels said in Speedtest CLI. Run speedtest on pfSense box:

        @lastb0isct said in Speedtest CLI. Run speedtest on pfSense box:

        Does anyone have the speedtest.py still? I can't seem to find it.

        It comes with the package when you install it. SSH to your box and run:

        pkg search speedtest
        
        [2.4.4-RELEASE][root@fw.workgroup]/root: pkg search speedtest
        py37-speedtest-cli-2.1.1       Command line interface for testing internet bandwidth
        
        

        Then run

        pkg install py37-speedtest-cli-2.1.1
        

        Have fun!

        Anyone seeing this error? I get this when i run any pkg command in this thread. Am on pfsense 2.4.5 on a 3100. Thanks

        Shared object "libarchive.so.7" not found, required by "pkg"

        A 1 Reply Last reply Reply Quote 0
        • D
          daplumber
          last edited by

          The binary package from Ookla is so much better than speedtest-cli which is ancient. But: no-source, deal I Guess.

          See: https://www.speedtest.net/apps/cli
          and:https://bintray.com/ookla/download/download_file?file_path=ookla-speedtest-1.0.0-freebsd.pkg

          Obviously being a binary it's x86_64 only.

          I don't suppose anyone's wrapping a page, or better widget, around speedtest? The above one already can output json.

          –--------
          This user has been carbon dated to the 8-bit era...

          A 1 Reply Last reply Reply Quote 0
          • A
            aln @daplumber
            last edited by

            @daplumber look for my widget on this topic's history

            D 1 Reply Last reply Reply Quote 0
            • D
              daplumber @aln
              last edited by

              @aln I was hoping fir a widget based on the Ookla binary above. It really is that much more accurate. Yes, I’m running an 8-core AMD with 8GB desktop as a router. Waste not, want not. Good for Suricata too.

              –--------
              This user has been carbon dated to the 8-bit era...

              1 Reply Last reply Reply Quote 0
              • A
                alpharulez @alpharulez
                last edited by

                @alpharulez said in Speedtest CLI. Run speedtest on pfSense box:

                @provels said in Speedtest CLI. Run speedtest on pfSense box:

                @lastb0isct said in Speedtest CLI. Run speedtest on pfSense box:

                Does anyone have the speedtest.py still? I can't seem to find it.

                It comes with the package when you install it. SSH to your box and run:

                pkg search speedtest
                

                Then run

                pkg install py37-speedtest-cli-2.1.1
                

                Have fun!

                Anyone seeing this error? I get this when i run any pkg command in this thread. Am on pfsense 2.4.5 on a 3100. Thanks

                Shared object "libarchive.so.7" not found, required by "pkg"

                For anyone facing this issue with pkg... here is what I did to resolve...

                pkg update

                this will fail

                Instead run:
                pkg-static update

                then run:
                pkg bootstrap -f

                then install:
                pkg update
                pkg install -y py37-speedtest-cli

                directories for reference if you would like to install the widget php file:
                /usr/local/bin/speedtest

                create new file with nano, copy paste code from the Github link @aln provided.
                /usr/local/www/widgets/widgets/speedtest.widget.php

                Should be good to go when you go back into the web portal and add widget (+). dont forget to save...

                D 1 Reply Last reply Reply Quote 0
                • D
                  daplumber @alpharulez
                  last edited by

                  @alpharulez I had no issue installing the py37 speedtest. But the Ookla binary is so much better on the command line, I deinstalled the py37 version.

                  A widget fir the binary would be nice to have, but I’m not fussed about it.

                  –--------
                  This user has been carbon dated to the 8-bit era...

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    alpharulez @daplumber
                    last edited by

                    @daplumber Cool. I had 'pkg' issues on the box. So the above steps fixed it.

                    So what was the difference between the py37 and ookla builds?

                    My understanding was Ookla did not have an ARM version of the build so might be an issue with my 3100.

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      daplumber @alpharulez
                      last edited by

                      @alpharulez the py37 build is Open Source, but also ancient, based on the code from when Speedtest was a Flash App! (read the Ookla site). The Ookla binary is closed, only compiled for FreeBSD 11.2, and thus pfSense 2.5.0 (right now). But the binary is based off their current code, is available for MacOS, Linux, and FreeBSD and comes with a plethora of output options, including a nifty text based interactive version. Think htop vs top functionality-wise.

                      –--------
                      This user has been carbon dated to the 8-bit era...

                      C 1 Reply Last reply Reply Quote 0
                      • C
                        carbonejf @daplumber
                        last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • C
                          carbonejf
                          last edited by

                          Hello,
                          I have a little problem with speedtest on my pfsense.
                          I'm using 2 différent widget from this forum.
                          the php one, and for this version I have everytime an error, shell_exec("speedtest --json"); don't work in php (from the latest version of pfsense I think)
                          and the .sh file.
                          I add in a cron the script, if I start manually everything is ok, I have the different time, ...
                          But with cron (as root) I don't receive different time, in the speed.txt I have:
                          Retrieving speedtest.net configuration...
                          Testing from VOO (123.123.123.123)...
                          Retrieving speedtest.net server list...
                          Does anyone has an idee of the reason?

                          C 1 Reply Last reply Reply Quote 0
                          • C
                            carbonejf @carbonejf
                            last edited by

                            I have a solution, I installed the ookla pkg and now I receive data again (with pfsense 2.5.0).
                            First I removed speedtest and after I installed ookla version (cf https://www.speedtest.net/apps/cli pkg add ookla-speedtest-1.0.0-freebsd.pkg).
                            I made some adaptation in script and now I have result :)
                            af92b586-71d0-4b04-b5e0-129428ffdde4-image.png

                            1 Reply Last reply Reply Quote 0
                            • M
                              MarcO42
                              last edited by

                              Hi,
                              since a few day I got this:

                              [2.5.1-RC][admin@router.local]/usr/local/bin: /usr/local/bin/speedtest-cli
                              Retrieving speedtest.net configuration...
                              Traceback (most recent call last):
                                File "/usr/local/bin/speedtest-cli", line 11, in <module>
                                  load_entry_point('speedtest-cli==2.1.2', 'console_scripts', 'speedtest-cli')()
                                File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1986, in main
                                  shell()
                                File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1875, in shell
                                  secure=args.secure
                                File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1091, in __init__
                                  self.get_config()
                                File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1174, in get_config
                                  map(int, server_config['ignoreids'].split(','))
                              ValueError: invalid literal for int() with base 10: ''
                              

                              Any ideas how to fix this?
                              Cheers
                              MarcO

                              johnpozJ 1 Reply Last reply Reply Quote 0
                              • johnpozJ
                                johnpoz LAYER 8 Global Moderator @MarcO42
                                last edited by

                                @marco42

                                see here
                                https://forum.netgate.com/post/976739

                                An intelligent man is sometimes forced to be drunk to spend time with his fools
                                If you get confused: Listen to the Music Play
                                Please don't Chat/PM me for help, unless mod related
                                SG-4860 24.11 | Lab VMs 2.8, 24.11

                                M 1 Reply Last reply Reply Quote 1
                                • M
                                  MarcO42 @johnpoz
                                  last edited by

                                  @johnpoz
                                  Many thx. That fixed my issue. :)

                                  1 Reply Last reply Reply Quote 0
                                  • A
                                    ashima LAYER 8
                                    last edited by

                                    Hello everyone,
                                    Thank you for pointing to Speedtest by Ookla.

                                    Issue facing:

                                    Pfsense Version : 2.4.5

                                    WAN Interface : WAN1 and WAN2 (both 300Mbps line)

                                    Tested : speedtest-cli works fine with either of the Wans. When WAN1 is primary, I can test WAN2 speed using
                                    speedtest-cli --source <interface ip>
                                    I get the right results.

                                    Upgraded to Pfsense version 2.5.2

                                    I can only test the primary line. Speedtest-cli gives < 1 Mbps for secondary line. If I make WAN2 as primary the speedtest-cli result with WAN1 gives < 1 Mbps.

                                    I get similar result with speedtest by OOkla. So I guess the issue is with pfsense blocking the secondary line.

                                    Is there any work around.

                                    Ashima (Pronet Services)

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      Is it actually binding to the WAN2 IP and NATing out of the WAN1 address?

                                      That could imply there is no gateway on the WAN2 interface.

                                      Steve

                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        ashima LAYER 8 @stephenw10
                                        last edited by

                                        Replying late as I got locked out of Netgate forum stating my ip is banned by community. I tried access using my mobile data but still with same error. Anyway it's working now... :)

                                        @stephenw10 Sorry, but not sure whether I could really follow your reply.

                                        When WAN1 is down, WAN2 automatically starts working. So I guess no issue with Natting. Speedtest-cli is then able to give right result for WAN2.

                                        Basically Speedtest-cli is able to give the right result for active gateway (WAN1 or WAN2). Doesn't show right result for other Wan (WAN1 or WAN2).

                                        Also I am able to ping from both the interface with either of Wan active .

                                        This was not the case with pfsense 2.4.5. I still have a machine with older pfsense(2.4.5). Its working fine there.

                                        Ashima(Pronet Services)

                                        1 Reply Last reply Reply Quote 0
                                        • stephenw10S
                                          stephenw10 Netgate Administrator
                                          last edited by

                                          I'm suggesting that Speedtest could be using the correct source IP but that traffic is still using the default route via WAN1. Check the state table when you're testing to see if that traffic is being NAT'd from the WAN2 address to the WAN1 address.
                                          That would not normally be possible though. The auto outbound NAT rules on WAN1 would not include the WAN2 address.

                                          Steve

                                          1 Reply Last reply Reply Quote 0
                                          • J
                                            jpass0222
                                            last edited by

                                            Just set up on Version 2.6.0-DEVELOPMENT (amd64)

                                            d13e6cb7-b724-4aa9-a6ba-3d28af3748a8-image.png

                                            Really nice, thanks


                                            Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
                                            Current: 2100 MHz, Max: 2101 MHz
                                            16 CPUs: 1 package(s) x 8 core(s) x 2 hardware threads
                                            AES-NI CPU Crypto: Yes (active)
                                            QAT Crypto: No

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.