Linux DNS Search Server Required. What is the search domain for pihole?

On my windows machines they are not having an issue with the dns names I am creating in pihole.

When it comes to my Linux boxes they require a DNS search domain. I have my local unifi domains in there now, but I'm unable to resolve the hosts I've created on pihole.

Details about my system:
I have 2 piholes on the latest 5.25.1
UDM Dream Machine

I just wanted to know if there was a way to obtain a DNS search name from the piholes without out turning on DHCP?

The search domains (for IPv4) would normally be handed out to clients, along with all the other networking info, by a DHCP server. If Pi-hole is not the DHCP server then check whatever is (the UDM?) to confiirm these are configured and correct.

You can manually configure the correct values in Linux in /etc/resolv.conf using the search parameter:

search example.com

or using Network Manager, if that is in use:

sudo nmtui
  Edit a connection > select interface >
    IPv4 CONFIGURATION > Show > Search domains

There are probably other ways in use too depending on the distributions on the Linux machines, so check the relevent distro docs.

The UDM is made by Unifi. The question I have is that the piholes DNS records are some how resolving on non Linux nodes provided I use the fqdn. I think it is because there is no DNS search suffix. Unfortunately my Linux node requires a search domain so I added all the domains within my router. Is there not a way for the piholes to produce a search domain?

It's your router's job to provide a search domain to its clients.
Quite a few routers may also conveniently insert the respectice DNS records into their own DNS resolver, but there is no specification requirement to do so.

If yours does, you should be able to use Pi-hole's Conditional Forwarding to have Pi-hole request local names from your router.

However, Ubiquity equipment is known to not enlist with DNS by default, and only some may allow to be configured for it.
You could query your router for a known local domain to verify.

Are you saying conditional forwarding would allow for DNS searches to the piholes?

Meaning I create a DNS record on the piholes.
192.168.1.51 foo.bar.com

On my Linux node my DNS server IP is set to the gateway and search domain is set to my gateway's domain: home.localdomain

My gateway uses the pihole as it's DNS servers.

So when I nslookup foo.bar.com it should return 192.168.1.51?

Actually I think I solved my issue. My Linux nodes were only querying the first DNS name server, which was my gateway. Unfortunately the DHCP gateway can't resolve the DNS entries in pihole, but the pihole can resolve the entries from the DHCP server. Which is odd because the DHCP gateway uses the pihole for DNS servers. Anyways added the 2 piholes to the top of the list of named servers and was able to resolve both the DHCP and pihole DNS entries. Wild!

Note that if you provide multiple DNS servers, a client may use any of them at its own discretion, i.e you can expect your Pi-hole(s) to be by-passed.

No, its the other way round:
Pi-hole's Conditional Forwarding will send queries for local domain names to another DNS server (usually your router's).

Success depends on your router: As explained, your router's DNS server may not know about local domains if its DHCP server would not register a client's hostname (as presented during DHCP negotiation) with its DNS server.

A router may offer two distinctly different DNS configuration options (note that routers may offer none, one, or both of those options):
a. An upstream DNS server where it forwards its clients' DNS requests to, commonly a WAN/Internet kind of setting, pointing to your ISP's DNS servers by default.
b. A local DNS resolver that its telling its clients to use, commonly a LAN/DHCP kind of setting, pointing to itself by default. If available, this would be preferred over a.

Your above description makes me doubt that your router would use Pi-hole as its upstream DNS server, but rather would distribute it as a local DNS server to its clients via DHCP.

So your clients would forward to one of: {router|Pi-hole}.
When a client was using your router, your DNS requests likely went:
client -> router -> public DNS
And when a client was using Pi-hole:
client -> Pi-hole -> Pi-hole's upstream

Yes, as long as the machine that lookup was run from is using Pi-hole for DNS, either directly or indirectly.

That sounds exactly what I have.
What I guess I am missing is the way to configure:
client -> router -> pihole

I have the pihole as my DNS upstream, but I think there is an issue with my pihole config for upstream servers.

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