Possible to forward only local-domain requests to specific upstream server?

My router (UniFi UDM Pro) is running it's own DNS server but it's extremely limited. However, it does allow for single-record static DNS entries which I use:

For example, my linux server is set with a static DHCP address and a DNS hostname of [server.home.mydomain.com].

However, I'd like to Pi-Hole to add extra A/CNAME (?) records for additional sub-domains (ie. [myservice.server.home.mydomain.com]).

If a client requests *.home.mydomain.com then I'd like Pi-Hole to forward to my upstream UDM Pro router. However, all other requests should go to the main upstream servers (8.8.8.8, etc).

Is this possible?

Thiose two statements are mutually exclusive for a given domain :
You either define Local DNS records within Pi-hole, to have Pi-hole provide the respective replies as defined.
Or you configure Pi-hole to conditionally forward DNS requests to another local DNS server (commonly the one on your router) and have Pi-hole supply its answers as received.

From your description, it seems that Condtiional Forwarding is what you look for.
Please follow the respective link and give that a try.

Thanks so much for the reply. I've also read your other post on conditional forwarding but I'm a bit confused on how it works.

How does Pi-Hole determine if a request is for a local machine versus a remote machine?

I'm running Pi-Hole in a podman (docker?) container on my UDM Pro with a static ip address. How does it know that "myserver.home.mydomain.com" is a local request versus "www.google.com" ?

I see that Pi-Hole asks for the local network in the conditional forwarding setup but I still don't see how that helps Pi-Hole understand if a request is for a local network machine.

EDIT: It looks like on my setup I need to specify the "Local domain name" otherwise all requests are going to the public/primary DNS servers.

Thanks so much for the help!

That is correct. :wink:

By checking DNS requests against the values you are to provide for Conditional Forwarding, i.e.

  • reverse lookups (PTR requests) against the IP range from Local network in CIDR notation
  • regular lookups (like A or AAAA requests) against Local domain name

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.