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 144.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.
    • U
      user747
      last edited by user747

      Sorry, but had to interject here. It seem @johnpoz has a very narrow view of what pfsense is, despite being a forum mod.
      Maybe due to supporting a majority of non-technical users, he only sees the cases where pfsense is used on the bare minimum hardware and only for IP routing.
      The reality of pfsense is that it is also for power users. Maybe they @johnpoz doesn't hear about the advanced use cases as much.

      Using pfsense to perform periodic ISP speed tests is absolutely a fair ask.
      pfsense has packages that make it way more than just a router.

      In addition to "just being a router" it is also a DHCP server of course, but also can be:

      • Web Server
      • Captive Portal
      • DNS Server
      • RADIUS Authentication Server
      • Gateway monitoring Daemon
      • Squid Proxy
      • NG Firewall (pfblocker)
      • Dynamic DNS Client
      • VPN Client and VPN Server
      • and much, much more.

      Yes, all of these services running does require good hardware, but not even a full desktop sucking down 95W. A mini PC like a NUC does work great.

      pfsense IS SUPPOSED to also be a client in many situations. VPN is a good example. It's OpenVPN package allows a user to create a persistent VPN client on the pfsense to a VPN provider on the Internet. That's more resource intensive than a periodic speedtest.

      And the built in "dpinger" Gateway Monitoring Daemon has the sole purpose of keeping an eye on the WAN gateways to see if they go down. It pings the ISP periodically. A periodic speedtest would be a natural extension of this function. DDNS is another client that goes out to a service on the internet to update the Public IP.
      So it is absolutely a proper request that a speedtest client be an available feature.

      Regarding "slow results" from speedtest-cli running on the pfsense, this is due to the sivel package being old/buggy and not using the closest servers compared to the Speedtest.net website and/or the Ookla provided cli client.

      Power users understand that speedtest.net isn't going to be 100% perfect, but it does provide a source of trending data that will help users if they need to show their ISP that they are not getting what they pay for.

      1 Reply Last reply Reply Quote 1
      • bearhntrB bearhntr referenced this topic on
      • stephenw10S stephenw10 referenced this topic on
      • stephenw10S stephenw10 referenced this topic on
      • provelsP provels referenced this topic on
      • E
        Elrick75 @aln
        last edited by Elrick75

        @aln

        Hello to all,

        My need : Evaluate the speed of my ISP directly on my firewall because my machines are behind other network equipments (Switch, ect...).
        My hardware, a DELL R230 server (CPU E3-1260L v5 @ 2.90GHz) with pfSense 2.6.0-RELEASE (amd64) FreeBSD 12.3-STABLE.

        After a quick search on google, I installed the speeptest package by following some tutorials found everywhere from the Diagnostics > Command Prompt menu
        Unfortunately I have a message ERROR: Unable to connect to servers to test latency.
        Is there any specific opening to do for the application to work? Someone can help me to open it properly from pfSense please?
        If not, someone can tell me more ?

        I ran the following commands:

        Translated with www.DeepL.com/Translator (free version)

        # pkg search speedtest
        py38-speedtest-cli-2.1.3 Command line interface for testing internet bandwidth

        # pkg install -y py38-speedtest-cli-2.1.3

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

        # speedtest --version
        speedtest-cli 2.1.3
        Python 3.8.12 (default, Jan 12 2022, 15:22:58) [Clang 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a

        Best Regards.

        J fireodoF 2 Replies Last reply Reply Quote 0
        • J
          Jarhead @Elrick75
          last edited by

          @elrick75
          That package is extremely old and may not still work with current BSD versions. I haven't tried it so I can't say for sure, but this one from Ookla does work.
          https://www.speedtest.net/apps/cli

          1 Reply Last reply Reply Quote 0
          • fireodoF
            fireodo @Elrick75
            last edited by fireodo

            @elrick75 Try

            speedtest --secure
            

            Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
            SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
            pfsense 2.8.0 CE
            Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

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

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

              speedtest --secure

              Same result :

              Retrieving speedtest.net configuration...
              Testing from Free SAS (82.xx.xx.xx)...
              Retrieving speedtest.net server list...
              Selecting best server based on ping...
              ERROR: Unable to connect to servers to test latency.
              
              fireodoF 1 Reply Last reply Reply Quote 0
              • fireodoF
                fireodo @Elrick75
                last edited by

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

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

                speedtest --secure

                Same result :

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

                Can you reach speedtest.net in a browser? Perhaps something in your system is blocking the access to that server.

                Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                pfsense 2.8.0 CE
                Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

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

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

                  speedtest.net

                  I reach it... https://www.speedtest.net/ works fine

                  @jarhead
                  How to install it ?

                  fireodoF 1 Reply Last reply Reply Quote 0
                  • fireodoF
                    fireodo @Elrick75
                    last edited by

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

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

                    speedtest.net

                    I reach it... https://www.speedtest.net/ works fine

                    Hmmm ...

                    Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                    SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                    pfsense 2.8.0 CE
                    Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

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

                      The speedtest pkg in out repo works fine here:

                      [22.05-RELEASE][admin@fw1.stevew.lan]/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.
                      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][admin@fw1.stevew.lan]/root: rehash
                      [22.05-RELEASE][admin@fw1.stevew.lan]/root: speedtest-cli
                      Retrieving speedtest.net configuration...
                      Testing from Plusnet (X.X.X.X)...
                      Retrieving speedtest.net server list...
                      Selecting best server based on ping...
                      Hosted by Jump Networks Ltd (London) [9.58 km]: 9.422 ms
                      Testing download speed................................................................................
                      Download: 61.69 Mbit/s
                      Testing upload speed......................................................................................................
                      Upload: 18.83 Mbit/s
                      

                      Steve

                      E 1 Reply Last reply Reply Quote 0
                      • Sergei_ShablovskyS
                        Sergei_Shablovsky @jimp
                        last edited by Sergei_Shablovsky

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

                        That looks nice, though it's usually better to test bandwidth through the firewall and not from the firewall itself. pfSense has been optimized to work in a routing role, so sometimes you might see reduced numbers when pfSense itself is acting like the client.

                        Dear John!

                        With all my honor and appreciate to You.

                        As we had discuss some time before, there are two points of view on TESTING link parameters:

                        1. From border firewall to outside (in our case pfSense);
                        2. Through border firewall to outside (mean nearest ISP fiber splitter/switch/router)

                        I have a thought that approximately 85-90% of this pfSense users forum mean “WHAT IS EXACTLY MY UPLINK BANDWIDTH” when thinking about link bandwidth testing services like speedtest/fast/librespeed.

                        And only we “squeeze” as much as possible from ISP uplink (this mean cabling, good connectors, may be spending hours on ISP hotline to resolve some issue on ISP hardware You connected up...), we must doing next step to “WHAT IS PING/BANDWIDTH FROM MY PC TO IP/ADDRESS OUTSIDE AND BACK”.

                        This mean we quickly goes to “rabbit hole” for newbies “WHATS GOING ON INSIDE PFSENSE SERVER” (this mean adjustments of Settings, tune limits, etc...).

                        So logically looks like BOTH OF THIS TESTING ARE NEEDED.

                        —
                        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.)

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

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

                          BOTH OF THIS TESTING ARE NEEDED.

                          And that could often confuse them even more.. When they test from their router and do not see the speed they expect..

                          There is a huge difference between a router, and a server/client when it comes to processing power needed and what it is optimized to do.

                          There is big difference in requirements in hardware to move a packet from one interface to another and change its source IP and port, etc. ie nat.. and processing all things needed to test speed..

                          Just because a "router" can process packets and get speed X, doesn't mean that the "router" can do that when acting as the client.. If your internet speed is low, your prob fine - of your router is beefy enough, etc. But when you start talking high speeds like gig, and low resource hardware used in "routers" that can quite easy route/firewall traffic at gig.. Doesn't always mean that it can be a client at those speeds.

                          I get why that might be confusing for the new user - not saying testing from the router can not be of some use in some cases, but I sure would not use a test from router to troubleshoot not seeing speed X from isp, unless you have tested before from that router and seen the speeds, etc.

                          If you had tested from router before and seen speed X, and then test it another day and only see something much lower than X - then sure that is an indication that something is wrong.

                          What I wouldn't assume is isp says I should see 900mbps, and then never seeing 900mbps from some cli running on my router and only seeing 700mbps for example that isp is problem, etc. Or that there is anything wrong or needing adjustment on the router.

                          example:

                          test.jpg

                          I see my speed from client that I pay for 500mbps, but from pfsense I do not - there is nothing wrong.. I wouldn't expect to see full speed from my router. What I expect is my router to be be able to route at my isp speed.

                          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

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

                            @stephenw10 I see but it doesn't explain to me why not on my side. How to troubleshoot it?

                            1 Reply Last reply Reply Quote 0
                            • 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
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.