How to enable local domains lookup?

The issue I am facing:
I cannot lookup hostnames on my local network when I use Pi-Hole as my DNS. I can reach them via their IPs, but hostnames with local domain names (like .home, .lab etc) does not work anymore.

Details about my system:
I am running Pi-Hole on RPi. Versions are:

  • Pi-hole [v5.14.2]
  • FTL [v5.20]
  • Web Interface[v5.18]

I have a router that supports multiple VLANs and my network is segmented into 4 VLANs. Pi-Hole lives within one VLAN and is accessible to other VLANs via proper routing rules in place. Pi-Hole is also setup with DoH with Cloudflare and DNSSEC.

Router is the DHCP server and I'd like to keep it that way as it allocates IPs for various subnets across multiple VLANs. Router also maintains its own DNS list for local network.

What I have changed since installing Pi-hole:
Before introducing Pi-Hole, the router was the DNS. It resolved local network domains and hostnames via its own local DNS list that it maintains (its dynamic and keeps track of which hosts are connected at any given time). It also forwarded DNS requests to external DNS that I configured.

Now that Pi-Hole is the default DNS across all VLANs, I can see the traffic, the dashboard, who is doing what. But I cannot use local hostnames with local domain names anymore. I'd like to be able to use my local network names again.

How can I tell Pi-Hole to forward DNS requests for specific domain names to my router, instead of Cloudflare?

Thanks in advance!

These will need to be known to Pi-hole. You can map domain names to IP's in your /etc/hosts file on the Pi, or using Local DNS records from the web admin GUI. The latter uses a hosts file at /etc/pihole/custom.list.

1 Like

Did you try to enable Conditional Forwarding at the bottom of Settings | DNS yet?

I was thinking about it too. Like create some DNS records in Pi-Hole for local domains and forward their lookup to my router. What is the specific syntax for that and where do I have to make the changes?

Conditional Forwarding only has one entry. I tried it but it does not have the entire subnet as IP. Wont work with multiple local domains for me.

Use the following command in a new dnsmasq configuration file in directory /etc/dnsmasq.d.

-S, --local, --server=[/[]/[domain/]][[#]][@][@[#]]

https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

If I add the DNS records in the Local DNS section, is that the same thing as you mentioned?

No.

Pi-hole's Conditional Forwarding should have three entry fields:
Local network in CIDR notation, IP address of your DHCP server (router), Local domain name (optional).

It should work straight away, provided your separate VLANs subnets can be aggregated into a common top level network (like a 10.10.0.0/23 would cover 0.10.0.0/24 and 10.10.1.0/24).
And of course, your router must be able to answer DNS requests for local hosts - not all routers do so. Check with nslookup <local-name> <router.ip> before you experiment with CF.

If your VLANs are on different ranges (like 192.168.0.0 and 10.10.10.0 subnets) and/or do have different local/search domains, you'd have to follow jfb's suggestion and create a custom dnsmasq configuration file.
Though it's in German, you may refer to my recent Conditional Forwarding mit mehreren DHCP Servern? - #2 by Bucking_Horn for some suggestions. Searching our forum may quite possibly yield English samples as well. :wink:

Thanks! This solved my issue.

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