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

    Redirecting DNS to local Adguard Home DNS server

    DHCP and DNS
    4
    14
    2.9k
    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.
    • Bob.DigB
      Bob.Dig LAYER 8 @kevindd992002
      last edited by

      @kevindd992002 I think the dns-redirect rule should work with AGH for dns without a problem, but not for local DoT or Doh. You should not use those and block them.

      K 1 Reply Last reply Reply Quote 0
      • K
        kevindd992002 @Bob.Dig
        last edited by kevindd992002

        @Bob-Dig said in Redirecting DNS to local Adguard Home DNS server:

        @kevindd992002 I think the dns-redirect rule should work with AGH for dns without a problem, but not for local DoT or Doh. You should not use those and block them.

        It doesn't though, for the reasons I stated above. Picture this:

        1. Client (192.168.10.x:{random source port}) tries to use 8.8.8.8:53 as a DNS server.
        2. The forward packet gets sent to the default gateway, which is pfsense.
        3. The forward packet (with destination socket of 8.8.8.8:53) gets DNAT'ted to 192.168.10.10:53 (my AGH server).
        4. The forward packet is received by the AGH server.
        5. AGH replies with a reply packet with these addresses:
          • source: 192.168.10.10:53
          • destination: 192.168.10.x:{the same random source port in #1)
        6. This reply packet is now all layer 2 since the source and destination are now on the same subnet, so it won't route back through pfsense.
        7. The client rejects this reply packet because the source IP IS DIFFERENT from the destination IP in the original forward packet that came from it.

        This is somewhat similar to asymmetrical routing. The forward packets got DNAT'ted by pfsense but the reply packet did not route back to pfsense so there is no way for the source IP of the reply packet to be translated by pfsense to 8.8.8.8:53 so that the client won't reject the packet. I'm 100% sure this is what's causing the timeouts because I've already tested it. Creating an SNAT rule so the source IP of the forward packet (after being DNAT'ted) gets translated by pfsense to the interface IP fixes this problem but with the downside of having all forward packets having the same source IP (pfsense interface IP) as seen by AGH.

        @NollipfSense I hope this explains my original post better.

        Bob.DigB NollipfSenseN 2 Replies Last reply Reply Quote 0
        • Bob.DigB
          Bob.Dig LAYER 8 @kevindd992002
          last edited by

          @kevindd992002 What happens if you put your AGH in a different (V)LAN?

          K 1 Reply Last reply Reply Quote 0
          • K
            kevindd992002 @Bob.Dig
            last edited by

            @Bob-Dig it works without any issues, as expected. I have clients in other VLANs that access the AGH server in VLAN 10 (192.168.10.0/24). Since these clients are on another VLAN, the reply packets from AGH go back the correct route (pfsense) and the translation happens properly.

            1 Reply Last reply Reply Quote 0
            • NollipfSenseN
              NollipfSense @kevindd992002
              last edited by

              @kevindd992002 said in Redirecting DNS to local Adguard Home DNS server:

              I hope this explains my original post better.

              Yes, I understand your objective and seems you found a solution using vLAN...

              pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
              pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

              K 1 Reply Last reply Reply Quote 0
              • K
                kevindd992002 @NollipfSense
                last edited by

                @NollipfSense nope, I haven't really found a solution yet. I did not create a new VLAN just for my AGH server. I have multiple VLANs and the clients in all those VLANs are pointed to the AGH server in VLAN 10 as their DNS server. The clients that are affected are the VLAN 10 clients. The clients in other VLANs work fine.

                M Bob.DigB 2 Replies Last reply Reply Quote 0
                • M
                  MoonKnight @kevindd992002
                  last edited by

                  @kevindd992002 Maybe you can find some useful information here:
                  https://forum.netgate.com/topic/182369/pi-hole/20?page=1

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

                  K 1 Reply Last reply Reply Quote 0
                  • K
                    kevindd992002 @MoonKnight
                    last edited by

                    @MoonKnight perfect! The discussion there is exactly what I needed. I'll reply there.

                    1 Reply Last reply Reply Quote 0
                    • Bob.DigB
                      Bob.Dig LAYER 8 @kevindd992002
                      last edited by Bob.Dig

                      @kevindd992002 said in Redirecting DNS to local Adguard Home DNS server:

                      I did not create a new VLAN just for my AGH server.

                      Why not, where is the problem? If you want dns-redirect everywhere, you have to.

                      K 1 Reply Last reply Reply Quote 0
                      • K
                        kevindd992002 @Bob.Dig
                        last edited by

                        @Bob-Dig right, what I mean is I didn't really create a new VLAN now. I just happen to have other VLANs when you had me test that idea earlier. But yes, I will be revamping my home lab setup pretty soon anyway. I will create a separate server and client VLANs and put the AGH server in the server VLAN. I won't need to create a redirect for the server VLAN anyway since servers don't really use "any other DNS" and respect what's configured in their settings. I guess this is the best solution overall.

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