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

    How to block internet access for client operating system's DNS over HTTPS

    Scheduled Pinned Locked Moved DHCP and DNS
    22 Posts 5 Posters 603 Views 6 Watching
    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.
    • R Offline
      richardsago
      last edited by

      I made these three changes and there were no internet problems:

      • Set Services > DNS Resolver > General Settings > "Python Module" to enabled
      • Return Services > DNS Resolver > General Settings > "DNS Query Forwarding" back to default of disabled
      • Removed all DNS Servers in System > General Setup > DNS Server Settings

      DNS Resolver enable Python Module
      6468b01a-e19d-47e6-b278-e0741b3eb611-image.png

      Remove DNS Servers
      27d3758f-1093-451c-9df7-e8e9a0458aba-image.png

      Dashboard now says only 127.0.0.1 and ::1 as DNS servers
      ca7d7041-3586-42d7-aea4-6c1393c21bdc-image.png

      But when I set Firewall > pfBlockerNG > DNSBL > DNSBL Mode to "Unbound python mode" the web browsing is not successful but viber messaging is still working. Can you please check if there are other DNSBL settings that I have to change? I have reverted to Unbound for now but this was the screenshot when it was at unbound python mode and finished pfBlockerNG Reload DNSBL and firewall restart:
      ff3dc93d-c1d6-4355-8f69-5598f85d0ae9-image.png
      309a013e-ba60-4af0-a366-3e583e99055f-image.png
      283f717a-0a46-4ceb-940f-36b2b2e7b353-image.png
      0385546a-1a0f-43c3-a8d5-5cd4012eab4a-image.png

      This is the last four lines from Status > System > DNS Resolver:
      9fa69f9a-a750-4533-b758-bff46f7be66b-image.png

      I think my pfBlockerNG setting is the cause and not firewall rules because things were working it was on Unbound and only stopped working in "Unbound python mode"

      1 Reply Last reply Reply Quote 0
      • U Offline
        Uglybrian
        last edited by Uglybrian

        Not a solution, but a couple things that may help. The free DNSBL list in PF blocker are only updated once a month at the most. I would go back through and change all of your update settings to weekly. An example is is the UT1 list that you have enabled. A quick check told me the last time that list was updated was eight months ago. Personally, I would not run that list yet. It’s a big list and if you don’t have the CPU horsepower or RAM it’s just going to bog your system down. Plus trying to block porn is like trying to control the weather. I would start with your Steven black list, get things running how you want. Then add just one list at a time and see how the system handles it.

        Screenshot from 2025-10-30 09-05-36.png

        Screenshot from 2025-10-30 09-06-33.png

        I would also disable DNSBL IP, put it back to stock settings. I dont understand what function it preforms exactly. Im just thinking it could be one of the sources of your problems.

        1 Reply Last reply Reply Quote 0
        • S Offline
          SteveITS Galactic Empire @richardsago
          last edited by SteveITS

          @richardsago said in How to block internet access for client operating system's DNS over HTTPS:

          How do I block internet access of users who enabled their operating system's DNS over HTTPS

          Enable DNSBL, and this, and then select all entries in the list:
          6260bde6-6eb6-4c23-99a0-a9401326806b-image.png

          Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
          When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
          Upvote 👍 helpful posts!

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            SteveITS Galactic Empire @SteveITS
            last edited by

            and in general block https://docs.netgate.com/pfsense/en/latest/recipes/dns-block-external.html#dns-over-tls

            Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
            When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
            Upvote 👍 helpful posts!

            1 Reply Last reply Reply Quote 0
            • R Offline
              richardsago
              last edited by

              Thank you @Uglybrian for the suggestion. The UT1 DNSBL update frequency was already once a day but internet browsing is still possible when client's OS uses DNS over HTTPS.

              Thank you @SteveITS for the suggestions. The "DoH/DoT/DoQ Blocking" was already enabled and all its entries were already selected, and the DNS over TLS entry is now added in the firewall rules but internet browsing is still possible when client's OS uses DNS over HTTPS.

              I tried applying the "DNS over HTTPS" topic in the link (https://docs.netgate.com/pfsense/en/latest/recipes/dns-block-external.html#dns-over-tls) you gave and it can successfully block internet browsing if client's OS uses DoH, but it requires manually adding the IP Addresses of the DoH servers. Below are what I did and please let me know if you have other DoH Servers so I can add them to my list. Thank you in advance.

              Added this firewall rule:
              92c7bbc0-b756-4b05-957b-5e08b7dedf2a-image.png

              Created this alias:
              b7dd5af3-d76f-401f-b869-da816b38cf82-image.png

              GertjanG 1 Reply Last reply Reply Quote 0
              • GertjanG Offline
                Gertjan @richardsago
                last edited by Gertjan

                @richardsago said in How to block internet access for client operating system's DNS over HTTPS:

                let me know if you have other DoH Servers

                He showed you all the known DoH/Dot/DoQ server - see the list in pfBlockerng 😊

                Example : when I switch from "Off" to the maximum protection mode in my browser :

                9b957181-e996-4b4f-a306-f77603c0c2f0-image.png

                I couldn't visit nothing anymore : the browser showed :

                835115dc-c91a-4086-a2d5-f563deb460a4-image.png

                (Firefox uses mozilla.cloudflare-dns.com which was blocked)

                That's what pfBlockerng does for me, I enbaled :

                d9a88ba1-d26f-4b71-ac79-386888790f2b-image.png

                and done.
                No need to maintain a list by myself.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • R Offline
                  richardsago
                  last edited by richardsago

                  Thank you @Gertjan for the reply. The problem I wanted to solve was that users can bypass pfBlockerNG by activating DNS over HTTPS in the operating system. These are the steps to activate DoH in Windows 11 that will bypass pfBlockerNG if I will not use the firewall rule and alias in my last post:

                  1. Under Windows Settings go to the network settings and click the "DNS server assignment" button
                    56c55e73-c9ea-4875-9112-49415b655bed-image.png

                  2. Click "Automatic (DHCP)"
                    46a97678-85ec-4b1d-8e0c-af8f7392dedf-image.png

                  3. Choose "Manual"
                    975cc0e4-d6f6-42e0-99d4-92ad2700588b-image.png

                  4. Click the IPv4 button to set it to ON value
                    ab3661be-2efe-4c1a-96db-1bbc99cbeb31-image.png

                  5. Set the "Preferred DNS" to 8.8.8.8, set "DNS over HTTPS" to "On (automatic template)", and the "DNS over HTTPS template" should automatically change to "https://dns.google/dns-query" value. Click the Save button
                    01749c95-5355-4914-8949-e60518224ef6-image.png

                  6. I open a website that's listed in the StevenBlack and it will successfully open and not blocked by pfBlockerNG. Please let me know if this is also the behavior in your system, because maybe there's a misconfiguration in my system. Thank you in advance.

                  GertjanG S 2 Replies Last reply Reply Quote 0
                  • GertjanG Offline
                    Gertjan @richardsago
                    last edited by Gertjan

                    @richardsago

                    @richardsago said in How to block internet access for client operating system's DNS over HTTPS:

                    These are the steps to activate DoH in Windows 11

                    Ok, I see.
                    The thing is, I can't test that right now.
                    Some one (== me, in the past) was using regedit or the policy editor to telle 'Windows' that it shouldn't use DoH or DoT.

                    95fc9f8d-2db4-4e5a-912f-661927904658-image.png

                    I have to undo these setting first ^^
                    That is : find how to undo them.

                    But : whatever happens, my Windows device can not 'bypass' pfSense.
                    So, if it uses an IP that belongs to this list :

                    f77e57df-9385-4e1e-b882-3a7bfeee185b-image.png

                    it will get blocked.
                    Btw : this list shows host names like "use-application-dns.net", so, first, the classic DNS has to be used, like asking pfSense IP (!) or 8.8.8.8 (IP !) or whatever your windows device is using as a 'classic' DNS, so it can / has to resolve "use-application-dns.net" first !
                    Then when it gets the IP of "use-application-dns.net", it will use this IP to do a DoT/DoH.
                    pfBlocker will block requests from your PC to resolve "use-application-dns.net", but if your Windows PC was using 8.8.8.8 (== bypassing the pfSense normal resolver DNS), then pfSense has to block all outgoing port 53 (== DNS requests) first.

                    So requests going to the classic 8.8.8.8, 1.1.1.1 etc etc will have to be blocked also.
                    Makes sense as if you want to block Dot/Doh, start by blocking the normal outgoing (= not to pfSense) DNS requests.
                    This forces the (windows) device to use the pfSense LAN IP as its DNS. And there, requests for "use-application-dns.net" will get blocked, so DoH/DoT isn't possible anymore.

                    No "help me" PM's please. Use the forum, the community will thank you.
                    Edit : and where are the logs ??

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      SteveITS Galactic Empire @richardsago
                      last edited by

                      @richardsago Are you flushing DNS on the Windows PC when testing? If it’s blocked in pfBlocker seems like your task is figuring out how dns.google resolves on it. The PC is only using pfSense for DNS?

                      Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                      When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
                      Upvote 👍 helpful posts!

                      1 Reply Last reply Reply Quote 0
                      • U Offline
                        Uglybrian
                        last edited by

                        I think you are on the right track with your With your DoH list on your firewall.
                        Here are two list i use.

                        https://raw.githubusercontent.com/crypt0rr/public-doh-servers/refs/heads/main/ipv4.list

                        https://raw.githubusercontent.com/crypt0rr/public-doh-servers/refs/heads/main/ipv6.list

                        Here is how i have mine set up. go to firewall/aliases/ URLs click add. In properties change the URL type to tables. Add your list.

                        2025-11-03_07-06.png

                        your update frequency will be stock at 128 days i set mine to 33. Save and then make your firewall rule.

                        2025-11-03_07-12.png

                        There are more DoH list on github that are more aggressive.

                        1 Reply Last reply Reply Quote 0
                        • R Offline
                          richardsago
                          last edited by

                          Thank you @Gertjan for the reply. I will next try to solve the "Unbound python mode" for the next school break.

                          Thank you @SteveITS for the reply. I was not sure about dns flushing and browser cache issues so what I did was to restart the client PC each time I tested a DoH setting change in the operating system, and pressing shift + [refresh] multiple times on the browser when I typed a URL. The client computer is using pfSense for DNS, DHCP, and internet connection. In case I misunderstood the question this is the services status on the pfSense dashboard:
                          80c37773-52df-44ee-a0c9-b32a4dc8f59e-image.png

                          Thank you @Uglybrian for the suggestion. I have replaced my manual list with your auto-populated list.

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