Page 1 of 1

Conditional 2nd DNS server

Posted: Mon Jan 23, 2023 3:59 pm
by Dr.R. Clavan
Hi,

I run pihole as my DNS server. In the router (running Gargoyle 1.12.0) I have the IP of my pihole server as first DNS.

Because occasionally pihole crashes (once a month, and always when I'm not around to fix things) I have 1.1.1.1 (CloudFlare) listed in the router as my 2nd DNS server.

This 2nd DNS server should however ideally ONLY be used when the first one FAILS, as in: the server is unreachable.

It seems however that the router either randomly distributes DNS queries to either one of the two DNS servers, or it refers to the 2nd one if the 1st one comes back with "I don't know that one". I am not sure which of the two cases is in fact happening.

The annoying thing is that I have, for good reason, a number of blacklisted entries in my pihole server, I don't want those blacklisted addresses to be resolved just because the router decides to give a query to the 2nd DNS server. I would like to ONLY allow the 2nd DNS server to be used when the first one really fails, as the alternative - no DNS server at all - would be worse.

So can somebody please explain to me if/how it is possible to get the desired outcome: ONLY use 2nd listed DNS server if 1st one is actually offline (NOT when it simply reports "I don't know that address").

Thanks!

Re: Conditional 2nd DNS server

Posted: Tue Jan 24, 2023 4:35 am
by Lantis
Unfortunately that’s not something that is supported at all.
You would need to do a script which detected if your PiHole was unavailable and switch to an alternate DNS.

Re: Conditional 2nd DNS server

Posted: Thu Jan 26, 2023 8:28 am
by pythonic
Not necessarily a desirable solution, but you might be able to mitigate Pi-hole's stability problem with regular scheduled reboots?

Re: Conditional 2nd DNS server

Posted: Mon Feb 13, 2023 1:10 am
by pricerc
I loaded AlmaLinux on my Pi4 and switched from PiHole to AdGuard.

I found it a bit more flexible than PiHole.

AlmaLinux comes with Cockpit for web management of the O/S, and AdGuard has its own web management page.