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

    Redirecting all DNS to pihole does not work :(

    Scheduled Pinned Locked Moved Firewalling
    10 Posts 4 Posters 739 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.
    • A
      abesh
      last edited by abesh

      SETUP : I have only have a LAN and WAN on pfSense with the Lan being a 192.168.86.0/24. I have a pihole running, pfSense system DNS is set to pihole and DNS Resolver is running in forwarding mode.

      I want to block ANY and ALL external DNS queries and redirect them to the pihole. To this effect I have define the rules as show here : https://labzilla.io/blog/force-dns-pihole

      98c4228b-f63e-4184-b748-460ac937eba3-image.png

      984909d8-2682-45b1-b9f4-0bfc0402157a-image.png

      ISSUE : I test this thus (as mentioned in the article). Add a temporary DNS in the pihole for a random domain, set the host pc DNS to 1.1.1.1 and then issue a nslookup. The problem is when I set my DNS to 1.1.1.1 anywhere, for e.g. my laptop all DNS resolution is blocked and absolutely nothing resolves even internet domains. I understand that the redirection to pihole is working. Why am I not getting a response ? What did I not do right ?

      46e12014-ac19-4969-ab8b-a46d5c2b7cd1-image.png 7d92bfcc-027a-4cc5-8927-43fcc6781692-image.png

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

        @abesh well for starters that port forward on wan isn't going to do anything.. There should be a rule on your lan that allows pihole to forward to where you want.

        lets see your lan firewall rules.

        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

        A 1 Reply Last reply Reply Quote 1
        • A
          abesh @johnpoz
          last edited by

          @johnpoz Awesome catch thank you ! I just changed that to LAN. No dice :( Pihole forwards to unbound running on localhost#5335 and that works since other DNS resolutions are working.
          Firewall rules :
          0fb7b64f-8035-42d2-8d55-1bd0264d5905-image.png

          GertjanG johnpozJ 2 Replies Last reply Reply Quote 0
          • GertjanG
            Gertjan @abesh
            last edited by

            @abesh

            893e1638-09bb-407a-b2f1-b754e1507d29-image.png

            Hint : rules are handled from top to bottom.
            Not 'all at one' or 'randomly'.

            So the very first rule (not counting the Anti-Lockout rule), a catch all IPv4 rule, will match all traffic, and is wide open for everything, TCP, UDP, ICMP etc for all destinations.

            So this rule is used by all the traffic, and you can see it :

            d6c6a6ba-14bb-4846-9441-01bd6f0e8bd6-image.png

            You see the states and packet counters ?

            These two rules

            169bf490-13a4-44a8-8a76-eda9d6a657d2-image.png

            never matched any traffic.
            The first : you have no IPv6.
            The second .... well, you understand by now ^^

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

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

              @abesh said in Redirecting all DNS to pihole does not work :(:

              I just changed that to LAN

              because its not a suppose to be a port foward, and has @Gertjan has gone over already your lan rules are not correct for what your wanting to do.

              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 1
              • A
                abesh @Gertjan
                last edited by abesh

                @Gertjan said in Redirecting all DNS to pihole does not work :(:

                Hint : rules are handled from top to bottom.
                Not 'all at one' or 'randomly'.

                THANK YOU SO MUCH ! This is exactly what I was missing that was not making any sense. Now I understand it much better. Does the rule processing stop once it reaches a matching rule or does it continue post that as well ? That being said, in my scenario, how would I go about achieving what I want to do ?

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

                  @johnpoz @Gertjan Tried with a new set of rules. I can now see them get hit, but still no luck with my use case :(

                  f6750c57-28f3-4862-90cd-ffd9fe837850-image.png

                  4657079e-e016-4c4e-99da-442ea269f195-image.png 197e16b1-edc8-4e32-9ab8-97f0781876ab-image.png

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    MoonKnight @abesh
                    last edited by

                    @abesh

                    One of mine interface rules:
                    63872924-9697-4fd9-9be8-0af4c4130f3f-image.png

                    The NAT rule:

                    fcfb66bc-fa31-44d5-a856-8ec5bb68b3fb-image.png

                    But my upstream DNS is pfsense in the pi-hole settings.

                    --- 24.11 ---
                    Intel(R) Xeon(R) CPU D-1518 @ 2.20GHz
                    Kingston DDR4 2666MHz 16GB ECC
                    2 x HyperX Fury SSD 120GB (ZFS-mirror)
                    2 x Intel i210 (ports)
                    4 x Intel i350 (ports)

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

                      @MoonKnight Thank you ! How would I adopt this to my situation. I have tried a few times and have managed to block DNS traffic from the pihole itself :(
                      This is what I have currently:
                      94380318-6e85-4d24-bfa4-f704c3e0a625-image.png

                      948a67d5-5c86-4e93-ae88-4d3932ab762a-image.png

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        MoonKnight @abesh
                        last edited by

                        @abesh

                        I have pfsense to use external DNS server and i'm running unbound in resolver mode.

                        428aface-b662-46f8-bc5f-b8a84403ce41-image.png

                        DNS Resolver:

                        aebe7f1b-d29b-4b61-96e7-a369f5868321-image.png

                        --- 24.11 ---
                        Intel(R) Xeon(R) CPU D-1518 @ 2.20GHz
                        Kingston DDR4 2666MHz 16GB ECC
                        2 x HyperX Fury SSD 120GB (ZFS-mirror)
                        2 x Intel i210 (ports)
                        4 x Intel i350 (ports)

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