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 151.7k 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

      FWIW, my server that runs the Python CL version of Speedtest started failing to provide data. After some searching I found I needed to add the ' --secure ' switch to my batch file. YMMV.

      This is the line I use to retrieve the list of servers:

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

      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
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        Yes I would try --list and see if that fails with or without --secure.

        I assume you can ping other targets?

        Steve

        E 1 Reply Last reply Reply Quote 0
        • E
          Elrick75 @stephenw10
          last edited by

          @stephenw10

          # speedtest --secure
          Retrieving speedtest.net configuration...
          Testing from Free SAS (82.XXX.XXX.XXX)...
          Retrieving speedtest.net server list...
          Selecting best server based on ping...
          ERROR: Unable to connect to servers to test latency.
          
          # speedtest --list
          Retrieving speedtest.net configuration...
          

          From my computer :

          c:\>ping speedtest.net
          
          Envoi d’une requête 'ping' sur speedtest.net [151.101.2.219] avec 32 octets de données :
          Réponse de 151.101.2.219 : octets=32 temps=3 ms TTL=59
          Réponse de 151.101.2.219 : octets=32 temps=3 ms TTL=59
          Réponse de 151.101.2.219 : octets=32 temps=3 ms TTL=59
          Réponse de 151.101.2.219 : octets=32 temps=3 ms TTL=59
          
          Statistiques Ping pour 151.101.2.219:
              Paquets : envoyés = 4, reçus = 4, perdus = 0 (perte 0%),
          Durée approximative des boucles en millisecondes :
              Minimum = 3ms, Maximum = 3ms, Moyenne = 3ms
          
          1 Reply Last reply Reply Quote 0
          • provelsP
            provels
            last edited by

            That version seems to work fine for me from the FW even w/o --secure. Maybe check out your FW logs. Maybe you're blocking yourself.

            [22.05-RELEASE][root@fw.workgroup]/root: pkg-static install py38-speedtest-cli
            Updating pfSense-core repository catalogue...
            pfSense-core repository is up to date.
            Updating pfSense repository catalogue...
            pfSense repository is up to date.
            All repositories are up to date.
            pkg-static: warning: database version 36 is newer than libpkg(3) version 35, but still compatible
            The following 1 package(s) will be affected (of 0 checked):
            
            New packages to be INSTALLED:
                    py38-speedtest-cli: 2.1.3 [pfSense]
            
            Number of packages to be installed: 1
            
            38 KiB to be downloaded.
            
            Proceed with this action? [y/N]: y
            [1/1] Fetching py38-speedtest-cli-2.1.3.pkg: 100%   38 KiB  39.0kB/s    00:01
            Checking integrity... done (0 conflicting)
            [1/1] Installing py38-speedtest-cli-2.1.3...
            [1/1] Extracting py38-speedtest-cli-2.1.3: 100%
            [22.05-RELEASE][root@fw.workgroup]/root: rehash
            [22.05-RELEASE][root@fw.workgroup]/root: speedtest
            Retrieving speedtest.net configuration...
            Testing from Comcast Cable (73.111.129.66)...
            Retrieving speedtest.net server list...
            Selecting best server based on ping...
            Hosted by Windstream (Chicago, IL) [69.50 km]: 14.881 ms
            Testing download speed...............................................................................
            .Download: 81.45 Mbit/s
            Testing upload speed......................................................................................................
            Upload: 12.02 Mbit/s
            [22.05-RELEASE][root@fw.workgroup]/root:
            
            

            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
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              But can you ping things from pfSense where the script is running?

              However if it fails to pull a list of servers it's probably not a ping problem.

              E 1 Reply Last reply Reply Quote 0
              • E
                Elrick75 @stephenw10
                last edited by

                @stephenw10

                Ping result from pfSense :

                PING speedtest.net (151.101.194.219): 56 data bytes
                64 bytes from 151.101.194.219: icmp_seq=0 ttl=60 time=3.154 ms
                64 bytes from 151.101.194.219: icmp_seq=1 ttl=60 time=3.471 ms
                64 bytes from 151.101.194.219: icmp_seq=2 ttl=60 time=2.920 ms
                
                --- speedtest.net ping statistics ---
                3 packets transmitted, 3 packets received, 0.0% packet loss
                round-trip min/avg/max/stddev = 2.920/3.182/3.471/0.226 ms
                
                1 Reply Last reply Reply Quote 0
                • Sergei_ShablovskyS
                  Sergei_Shablovsky
                  last edited by Sergei_Shablovsky

                  I still STRONGLY NOT RECOMMEND testing uplink speed by speedtest - nowadays MOST ISP creating special ACLs and ruleset for speedtest servers BOTH on aggregate level and on core level to “looks better than counterpart that You compare to”.

                  By other words, all speedtest results would be looks really great (hi speed, low latency, low jitter..) BUT all Your REAL traffic would be not so good. ;)

                  And another one important factor: most ISP make a little shaping (frequently on aggregate level than on core) to pay a little less for traffic ;) Depend on state and ISP this may be -7-15% of total uplink bandwidth. As a result You have 85-93% of bandwidth You pay for.

                  But NO ONE of sysadmins told You this truth... No any conspiracy, just business.

                  And I RECOMMEND TO CONFIGURE FREEBSD TCP/IP STACK TO USING QUICK ALGORITHM, because most of nowadays ISPs use QUICK on both aggregate and core level.
                  (Please read posts about QUIC on this forum)

                  —
                  CLOSE SKY FOR UKRAINE https://youtu.be/_tU1i8VAdCo !
                  Help Ukraine to resist, save civilians people’s lives !
                  (Take an active part in public protests, push on Your country’s politics, congressmans, mass media, leaders of opinion.)

                  1 Reply Last reply Reply Quote 0
                  • P
                    patrick.pesegodinski @MarcO42
                    last edited by

                    @marco42

                    Can You send-me the tutorial to create the speedtest_cli.js?

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      MarcO42 @patrick.pesegodinski
                      last edited by MarcO42

                      @patrick-pesegodinski
                      Hi,
                      that files will be created and is only a property bag that is loaded when the widget is called.
                      Cheers

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        patrick.pesegodinski @MarcO42
                        last edited by

                        @marco42 I don't understand your respost.

                        In the .zip no is included the speedtest-cli.js

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

                          speettest_cli.js is a temporary file that is created by speedtest.sh. It's not supposed to be in the file.

                          1 Reply Last reply Reply Quote 2
                          • C
                            carbonejf
                            last edited by

                            Hi,
                            Great script, il works well for me, but I ghave a little problem with speedtest.
                            I don't check every day the speed, and sometime it "stop" to work.
                            The reason is that speedtest don't send result because it s waiting that I accept the licence.
                            So i must connect with putty on my pfsence, start speedtest and validate licence:

                            speedtest
                            ==============================================================================
                            
                            Ookla collects certain data through Speedtest that may be considered
                            personally identifiable, such as your IP address, unique device
                            identifiers or location. Ookla believes it has a legitimate interest
                            to share this data with internet providers, hardware manufacturers and
                            industry regulators to help them understand and create a better and
                            faster internet. For further information including how the data may be
                            shared, where the data may be transferred and Ookla's contact details,
                            please see our Privacy Policy at:
                            
                                   http://www.speedtest.net/privacy
                            
                            ==============================================================================
                            
                            Do you accept the license? [type YES to accept]: YES
                            License acceptance recorded. Continuing.
                            
                            

                            Do you now a solution to stop to ask me to accept licence every month (or something like this)?

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

                              @carbonejf did you install it?
                              Like:

                              pkg install py37-speedtest-cli-2.1.3
                              
                              C 1 Reply Last reply Reply Quote 0
                              • C
                                carbonejf @MarcO42
                                last edited by carbonejf

                                @marco42 Sorry I did it a long time ago and I don't rememberhow I install it :(
                                I installed a package yes, but maybe not this one

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

                                  @carbonejf Maybe you update or uninstall/reinstall to get the latest version? That could help.

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

                                    @marco42 I don't use this version, my speedtest is: Speedtest by Ookla 1.0.0.2 (5ae238b) FreeBSD 12.3-STABLE amd64

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

                                      @carbonejf Ok, that one I don't know, sorry.

                                      1 Reply Last reply Reply Quote 0
                                      • P
                                        patrick.pesegodinski @icewraithuk
                                        last edited by

                                        @icewraithuk how you import the "urllib2" in the pfsense?

                                        I don't search for install.

                                        GertjanG 1 Reply Last reply Reply Quote 0
                                        • P
                                          patrick.pesegodinski
                                          last edited by

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

                                          myAPI="<your api="" key="" goes="" here,="" in="" the="" quotes="">"
                                          baseURL = 'https://api.thingspeak.com/update?api_key=%s' % myAPI
                                          print baseURL</your>

                                          The command "your' doens't work

                                          provelsP 1 Reply Last reply Reply Quote 0
                                          • provelsP
                                            provels @patrick.pesegodinski
                                            last edited by

                                            @patrick-pesegodinski said in Speedtest CLI. Run speedtest on pfSense box:

                                            myAPI="<your api="" key="" goes="" here,="" in="" the="" quotes="">"

                                            myAPI="put_key_here"

                                            PS - That post was the only one that user ever made, and besides it was about 6 years ago.

                                            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)

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