r/selfhosted•
bachya

Unbound Forwarding and NAT Redirection

DNS Tools

Hi all,

I recently ran into an interesting DNS issue with Unbound and NAT redirection. I've solved it, but I have no clue why the solution works. Posting here in the hopes that somebody can educate me!

Like many, I have NAT redirection rules in place to ensure that all of my VLANs are forced to use a particular IP address for DNS – ostensibly, "If a host attempts to reach port 53 on an IP other than the one I want, redirect that request to the desired IP." Until recently, that IP address had been that of my gateway (a USG 3P); however, I finally took the plunge and implemented an AdguardHome/Unbound stack and updated the NAT rules to point there, instead.

With that preamble, here's the situation I ran into:

  1. The AdguardHome/Unbound stack (running in Docker) is located on a box in VLAN 30.
  2. If I include a NAT redirection rule like the above on VLAN 30, Unbound will only work if I configure a forward zone to some other DNS resolver (CloudFlare, etc.). Key point: without this redirection rule, Unbound will fail to resolve addresses by itself.
  3. If I remove the redirection rule on VLAN 30, Unbound resolves address itself – no need for a forward zone.

I would imagine there's some sort of loop going on, but this is just a little bit outside of my knowledge set. Any insights that can help teach me?

Thanks!

EDIT: cleaned up some horrible verbiage.

Posted Feb 1, 2022, 6:47 PM UTC · edited

20

No comments yet

Nobody commented on this post, or the comments weren't captured.