Prevent Pi-hole from resolving queries from localhost?

#1

Can Pi-hole be setup so that it is not being used as a DNS resolver by localhost itself?
In other words, is it possible to not have Pi-hole take over DNS services for the machine it is running on and have DNS queries from localhost itself be sent to a different DNS server instead?
Or, can FTLDNS bet configured to ignore queries from localhost (and not put ‘nameserver 127.0.0.1’ in /etc/resolv.conf)?

I am asking because, in my case, running Pi-hole apparently interferes with Mono Apps running on the same machine
(and I could not get to the bottom of it, but it seems to be an issue with Mono itself, resulting in all Mono Apps unable to resolve hostnames - queries never even reach Pi-hole and do not show up in the logs - while the same hostnames are resolved just fine on the host itself).
Everything else seems to be working fine, so for some reason Mono does not seem to play along well with Pi-hole.

As a workaround, I’ve tried manually setting the DNS Servers to be used in /etc/network/interfaces and restarted, but as soon as Pi-hole runs it ‘takes over’; as soon as I stop pihole-FTL, the manually set DNS server are used (in in /etc/resolv.conf) and the Mono Apps do resolve hostnames again.
Starting Pi-hole up again and the Mono Apps fail.
Bummer.

Anyone got an idea how to prevent this as a workaround or maybe even solve the issue itself?
I figure I could install unbound to sit between Mono and Pi-hole, but wouldn’t I run into the same issues?

#2

Create a new file in /etc/dnsmasq.d name 99-ipbinding.conf

Content:

dns-loop-detect
except-interface=lo
listen-address=192.168.X.X
bind-interfaces

Replace the 192.168.X.X with your pihole IP address.

Choose in the Pi-hole web interface in Settings - DNS for Listen on all interfaces, permit all origins

Ofcourse you have to restart pihole to activate.

#3
#4

Ah, that was the missing link, thank you!

May I feature-request this as an option for pihole-FTL.conf (the change of resolv.conf)?

#5

Btw. (I tried this as well, thank you) a small glitch I noticed after I did this (no longer necessary) is the status on the admin page is reported as ‘DNS service not running’ as pihole checks for 127.0.0.1#53 but not it’s only running on 192.168.X.X#53.

So I could put my static IPv4 in /usr/local/bin/pihole as well (statusFunc, line 261 right now), but it would be nicer to work with variables here in future versions (I understand all of this is considered a hack right now).

#6

I have inbound running at 127.0.0.1#53 and Pihole is happy with that.

/etc/resolv.conf is for the local apps and changing it is more difficult and is situated in the systemd / startup section.