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

    pfSense - DNS redirect to local DNS server

    Scheduled Pinned Locked Moved NAT
    natdnsmasqueradepihole
    32 Posts 7 Posters 9.6k 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.
    • P
      P.J @AndyRH
      last edited by

      @AndyRH Oh I understand what you wanted to do. You are anonymizing your piehole so your client's think their reply comes from the legitimate DNS they wanted to use. That's clever!

      1 Reply Last reply Reply Quote 0
      • P
        pneuma2021
        last edited by

        I know this post is pretty old, but I just want to thank you for providing an elegant solution of forwarding all DNS queries to the Pihole. I am running Pfsense 2.5.2 and this solution is working for me.

        1 Reply Last reply Reply Quote 0
        • Y
          yay
          last edited by

          Excellent, tyvm! ;)

          F 1 Reply Last reply Reply Quote 0
          • AndyRHA AndyRH referenced this topic on
          • AndyRHA AndyRH referenced this topic on
          • AndyRHA AndyRH referenced this topic on
          • johnpozJ johnpoz referenced this topic on
          • AndyRHA AndyRH referenced this topic on
          • AndyRHA AndyRH referenced this topic on
          • F
            fjmp24 @yay
            last edited by

            @AndyRH Thank you for this post ! I have a question, with this solution pi-hole see only one IP "VLAN42 address" and not client IP ? It's correct ?

            AndyRHA 1 Reply Last reply Reply Quote 0
            • AndyRHA
              AndyRH @fjmp24
              last edited by

              @fjmp24 No, a client on VLAN100 will be seen with its correct address. Any redirected (rouge) queries come from pfSense (42.1). I know it works because VLAN100 does not have ad filtering because 192.168.100.0/24 is in a group on PiHole to not do ad filtering.

              o||||o
              7100-1u

              P F 2 Replies Last reply Reply Quote 0
              • P
                P.J @AndyRH
                last edited by P.J

                Even though I have experimented a lot with PiHole a few years ago, and add filtering from many top firewall brands, the best thing to remove ads is Ad Blocker Ultimate plugin for Chrome.
                Nothing passes through and free YouTube is possible. So it is worth to get and pay a little to help development as I did because it is simply outstanding.

                johnpozJ 1 Reply Last reply Reply Quote 0
                • F
                  fjmp24 @AndyRH
                  last edited by

                  @AndyRH VLAN100 ?

                  AndyRHA 1 Reply Last reply Reply Quote 0
                  • AndyRHA
                    AndyRH @fjmp24
                    last edited by

                    @fjmp24 An example, one of my VLANs is VLAN100. VLAN42 (the meaning of Life, the Universe and Everything) is my primary VLAN and where the PiHoles reside.

                    o||||o
                    7100-1u

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

                      @P-J said in pfSense - DNS redirect to local DNS server:

                      is Ad Blocker Ultimate plugin for Chrome.

                      And those browser plugs are a bit hard to run on say your roku stick.. Or some app your playing on your phone.. I use a browser plug for sure in my browser but dns filtering can be very helpful on stuff your network is doing that is not browser based, or even on browsers that do not allow for addons, etc..

                      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

                      F 1 Reply Last reply Reply Quote 0
                      • F
                        fjmp24 @johnpoz
                        last edited by

                        @AndyRH Sorry but it doesn't work with me :-(

                        When I use the command :

                        • dig @1.2.3.4 google.fr, adguard display firewall address
                        • dig @adguard google.fr, adguard display client address

                        What is wrong ?

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

                          @fjmp24 no idea what your trying to do.. Have you setup redirection? @1.2.3.4 is not going to answer anything unless your redirecting or your dns is being redirected

                          And @aguard sure an the hell would never work.. Its not an IP address or a fqdn that could be resolved by anything.

                          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

                          F 1 Reply Last reply Reply Quote 0
                          • F
                            fjmp24 @johnpoz
                            last edited by

                            @johnpoz Sorry I wrote my message quickly

                            I want to redirect all DNS requests to my internal DNS server Adguard Home.

                            I configured Adguard Home as DNS server in my DHCP servers so by default my devices use Adguard Home as DNS server.

                            Now I want to redirect DNS request that do not have Adguard Home as destination to Adguard Home.
                            I followed the procedure of @AndyRH but I have a name revolving problem. Adguard Home does not display names all the time. When I executes theses commands from a client device I have:

                            • dig @1.2.3.4 google.fr, adguard displays firewall address
                            • dig @<Adguard home ip> google.fr, adguard displays client address

                            I think the problem is with the mappings rules but I don't know how to fix it. Ideas ? Thanks

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

                              @fjmp24 said in pfSense - DNS redirect to local DNS server:

                              adguard displays firewall address

                              What does this mean? You are seeing this error?

                              unexpected.jpg

                              Would be helpful if you showed how you setup redirection, and the actual output of your dig command.

                              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

                              F 1 Reply Last reply Reply Quote 0
                              • F
                                fjmp24 @johnpoz
                                last edited by fjmp24

                                @johnpoz No I have not an error.

                                Dig response:
                                e6014a1d-6023-428d-aa5f-be943297345b-image.png

                                Adguard home log:
                                792dc93e-6f3e-4879-bd45-988ba9ecc4bc-image.png

                                IP is my pfsense address.

                                My configuration:

                                d59edbba-4755-46de-a92a-22bfc5c4f3d5-image.png

                                ad2e93af-c4e3-41cb-9e09-ac85601f804d-image.png

                                d44ac2b9-ef1e-42e5-b5a6-3e99062b928a-image.png

                                The alias MAIN_Host_Shepheherd represents Adgaurd Home host.

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

                                  @fjmp24 what do you think it would show? your doing an outbound nat that nats it to your main address..

                                  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

                                  F 1 Reply Last reply Reply Quote 0
                                  • F
                                    fjmp24 @johnpoz
                                    last edited by fjmp24

                                    @johnpoz Client IP

                                    6f96892b-c97a-4740-af60-670f2f7df600-image.png

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

                                      @fjmp24 not sure what that has to do with you... Your doing you have a outbound nat on man, that says any traffic to that main host, on dns ports to nat it to your main address..

                                      Here I setup a quick port forward to my pihole... You can see it lists my client as who asked for it.

                                      redirect.jpg

                                      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

                                      F 1 Reply Last reply Reply Quote 1
                                      • F
                                        fjmp24 @johnpoz
                                        last edited by

                                        @johnpoz I created the same rules and I have not the same result

                                        62acdc61-1697-4663-87e7-afd24b03ce22-image.png

                                        I disabled my outbound rule. Your DNS server is in LAN network ?

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

                                          @fjmp24 well what are your firewall rules what order.

                                          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

                                          F 1 Reply Last reply Reply Quote 0
                                          • F
                                            fjmp24 @johnpoz
                                            last edited by fjmp24

                                            @johnpoz

                                            33e1b916-2a52-4c52-90f0-0aa1978c0dd9-image.png

                                            a9f99445-2b43-4d2f-9e20-08985698d6dc-image.png

                                            462c771b-f529-4436-8c03-e219ce9bb389-image.png

                                            Adguard receives the request and resolves the hostname.
                                            But client receives a bad response !?

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