custom.list is not taken into account

Hi,

I have pihole v5.1.1 and I've added some hosts that I don't want to be pushed to the upstream DNS servers. My pihole should resolve queries for two different local domains: .lan1 and .lan2. When I try to resolve something like comp1.lan1 or comp2.lan2, the queries are pushed to the public DNS servers.

I've made sure that "custom.list" is in the "/etc/dnsmasq.d/01-pihole.conf". When I put the hosts mentioned above in "/etc/hosts", they get resolved normally but they also get pushed to the upstream DNS servers.

What am I missing?

Thanks

It actually worked but I have no idea why.

I just added "no-hosts" to "/etc/dnsmasq.d/01-pihole.conf" and then restarted the Pihole FTL. It started to consult the "custom.list" file. I removed the "no-hosts" and then restarted the FTL again and it kept working. Strange.

About forwarding the local queries to the upstream DNS servers, actually, only the AAAA queries are being pushed. Is there any way to disable the AAAA queries for certain domains or entirely without disabling IPV6 for the client?

Did you check Settings/DNS

Never forward reverse lookups for private IP ranges
Never forward non-FQDNs

Never forward non-FQDNs may not apply here, as comp1.lan1 already contains a dot.

Assuming that you are using your router as DHCP server, you should be able to divert DNS queries for hosts in your local lan1 and lan2 domains by providing a custom configuration file, e.g. /etc/pihole/50-local-domains.conf:

server=/lan1/192.168.0.x
server=/lan2/192.168.0.x

Replace 192.168.0.x with your router's IP address.

If you want to limit resolution strictly to local definitions on your Pi-hole only, use instead:

local=/lan1/
local=/lan2/

Note that you have to supply hostnames manually for any lan1 and lan2 device with this configuration.

1 Like

They're both on by default.

If you want to limit resolution strictly to local definitions on your Pi-hole only, use instead:

local=/lan1/
local=/lan2/
Note that you have to supply hostnames manually for any lan1 and lan2 device with this configuration.

Do you mean that I should add all the domains as local and then put the hostnames in the "custom.list" file?

You might be affected by this issue
https://github.com/pi-hole/pi-hole/issues/3303

Are you using pihole as DHCP server?

No, not really. I'm using my router as the DHCP server.

So I created the /etc/pihole/50-local-domains.conf and in the custom.list file, I put:

172.30.0.10 comp1.lan1
172.31.0.10 comp2.lan2

It worked. If I change the custom.list file and remove "lan1" and "lan2" from the hostnames, I get:

Jul 28 12:31:42 dnsmasq[13213]: query[A] comp1 from 10.200.200.2
Jul 28 12:31:42 dnsmasq[13213]: config comp1.lan1 is NODATA-IPv4

Any idea why? Note that client on which I run the nslookup, it has the following in the resolv.conf file:

search lan1 lan2

So the domain is appended correctly.

Yes, to the client's DNS search.
You still have to provide your desired DNS answer on your DNS server, i.e. Pi-hole (which you had, initially).

Well, since you've removed the hostnames from your local definitions, Pi-hole correctly answers NODATA-IPv4.

Well, since you've removed the hostnames from your local definitions, Pi-hole correctly answers NODATA-IPv4.

I thought since the PCs are in the custom.list file, Pi-hole should find them even if they're without a domain name. It's clear now.

Regarding the AAAA queries, they're still getting pushed to the upstream DNS servers. I tried adding the following:

local=/lan1/
domain=lan1
expand-hosts

Just as mentioned here https://github.com/pi-hole/pi-hole/issues/3303 thanks @yubiuser but it didn't solve it. When I run nslookup, I get the following:

Jul 28 15:39:10 dnsmasq[16926]: query[A] comp1.lan1 from 10.200.200.2
Jul 28 15:39:10 dnsmasq[16926]: /etc/pihole/custom.list comp1.lan1 is 172.30.0.12
Jul 28 15:39:10 dnsmasq[16926]: query[AAAA] comp1.lan1 from 10.200.200.2
Jul 28 15:39:10 dnsmasq[16926]: forwarded comp1.lan1 to 149.112.112.112
Jul 28 15:39:10 dnsmasq[16926]: forwarded comp1.lan1 to 9.9.9.9
Jul 28 15:39:10 dnsmasq[16926]: reply comp1.lan1 is NODATA-IPv6

Any idea how to tackle this issue?

If it is the same issue than it is not relsoved yet upstream in dnsmasq.

Thanks a lot guys for the help and the information.

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