Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    Rule for forcing DNS to firewall/router

    Scheduled Pinned Locked Moved DHCP and DNS
    10 Posts 3 Posters 356 Views 4 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.
    • P Offline
      pharceface
      last edited by

      Hi, I am trying to create a rule to force DNS to firewall instead of whatever the endpoint has configured. This is the rule I've made so far:
      Screenshot from 2026-07-25 15-10-03.png

      The way I understand this is that if a DNS request comes from the famlan subnets for anyother destination other than the interface IP it is rerouted to the there. The DHCP config for this VLAN does use a different public DNS than the what is in general config. However, this doesn't work. When I set my DNS from the endpoint and reboot I can get to reddit and other places I shouldn't. What am I doing wrong?

      Here is the DHCP config I have for the interface

      Screenshot from 2026-07-25 15-28-10.png

      And lastly here is what I have for DNS in general settings:

      Screenshot from 2026-07-25 15-31-25.png

      I appreciate any help that anyone is willing to provide.

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

        @pharceface one thing that jumps out is you are only set for tcp, dns normally uses udp. While it sometimes use tcp, your rule should be for both udp and tcp.

        And you would normally redirect to the loopback address. Its spelled out here.

        https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html

        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 26.03.1 | Lab VMs 2.8.1, 26.07

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          pharceface @johnpoz
          last edited by

          @johnpoz Thank you. Things are working as intended. Is it possible to consildate the external DNS allow/block rule(s) to one rule by inverting the destination? If not, I'll keep what what the documentation has, just curious.

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

            @pharceface Bang or inverse rules - smart man here corrected me on their use - I no longer use them myself.

            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 26.03.1 | Lab VMs 2.8.1, 26.07

            1 Reply Last reply Reply Quote 0
            • P Offline
              pharceface
              last edited by

              So I am potentially very dumb. I cannot get this to work. By this I mean my DNS filtering. I have two subnets that I want to use a different DNS than what is configured under general settings.

              I have followed the guides to redirect DNS and it was initally working. Now that I've deployed things its not working. If I alter the rules to have the block rule first, of course DNS doesn't work. If they're in any other order sites like Reddit, X are accessible despite the DNS in use explicitly blocking these sites.
              If it means anything I was testing this from my phone using DuckDuckGo and the built-in LinageOS browser. I would re-order rules, connect and try to hit sites I'm attempting to block and get there. Curse and then try again.

              Here is the order they're currently in:

              famwlan-rules.png

              This interface pictured is a VLAN, I'll be going through and checking to ensure its tagged/untagged on appropiate interfaces and devices. But, what else could I be overlooking?

              Here are the DHCP configs for that interface. I did enable the DNS registration thinking this is neccessary because I want this interface using a different DNS.

              famwlan-DHCP.png

              fam-wlan-dhcpii.png

              I appreciate any help anyone can provide.

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

                @pharceface redirection of dot, (853) should never work. Not if your client is sane and actually checking ssl cert.

                One of the aspects of dot and doh is validation you are talking to who you want to talk to by validation of ssl cert handed out by the IP your talking to, ie googledns, or cloudflare etc.. If the cert doesn't match then your client - if sane would not use this dns.

                that you have any hits on your dot rule is surprising to be honest, dot is rarely used by a client unless you specifically set it up to do so. Common is doh (443).. and much harder to block because it hides in your normal 443 traffic.. You have to specifically block where it is trying to talk to. And again it should be validating the cert so difficult to redirect.

                Not sure what your actual goal is here. What is the point of handing out a NS that is not pfsense, if you are redirecting?

                Keep in mind in testing dns filtering - clients cache, also many browsers love to use doh unless you specifically tell them not too.

                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 26.03.1 | Lab VMs 2.8.1, 26.07

                P 1 Reply Last reply Reply Quote 0
                • P Offline
                  pharceface @johnpoz
                  last edited by

                  @johnpoz Thanks again for responding. The end goal of all of this is too try to keep my kids off of the bad parts of the web using DNS filtering. I was attempting to use these rules to ensure that just wouldn't learn to switch the DNS on the desktop they share. Granted, they don't have admin on it. But, I still try not to underestimate them. Some the sites blocked include reddit, x, instagram, etc. I sometimes go to reddit myself and the other adults use some of these sites so I had created other subnets that used the DNS (Quad9) configured in general settings. Would it just be easer to have the filtered DNS as the "main" DNS for the firewall and the subnets inteneded for the adults be the exception with a different DNS assgined via DHCP? Also, thank you again for all the help you've provided so far.

                  johnpozJ SteveITSS 2 Replies Last reply Reply Quote 0
                  • johnpozJ Offline
                    johnpoz LAYER 8 Global Moderator @pharceface
                    last edited by

                    @pharceface if the goal is dns filter your going to need to make sure you block doh, and or make sure their browsers are set not use it - and they can't change that.

                    Browsers these days default to doh - and would circumvent any normal 53 dns redirection you were doing anyway.

                    your devices are on a different vlan sure set them to use an unfiltered dns.

                    You might have better luck with filtering for different users using something like pihole.

                    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 26.03.1 | Lab VMs 2.8.1, 26.07

                    1 Reply Last reply Reply Quote 0
                    • SteveITSS Offline
                      SteveITS Rebel Alliance @pharceface
                      last edited by

                      For reference there's a recipe for DoT that mentions DoH:

                      https://docs.netgate.com/pfsense/en/latest/recipes/dns-block-external.html

                      For DoH, an easy way is to use the pfBlocker package, set this and select all the DNS servers in the list:
                      e05b2f18-0b1b-43c7-ae45-8cd745d9f57d-image.png

                      In my experience one must also set at least one DNSBL list a.k.a. Group, or the package will ignore the setting above. This is sufficient:

                      name: Placeholder
                      DNSBL Source Definitions state: off
                      DNSBL Source Definitions Source: (leave blank)
                      Update Frequency: never
                      DNSBL Custom_List: bogus.example.com

                      The last one forces the update.

                      To upgrade, 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.
                      Only install packages for your version of pfSense.
                      Upvote 👍 helpful posts!

                      P 1 Reply Last reply Reply Quote 0
                      • P Offline
                        pharceface @SteveITS
                        last edited by

                        @SteveITS Thank you, I will implement this! I actually have pfBlocker installed for some ad blocking.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
                        Privacy Policy · Cookie Policy