Conditional 2nd DNS server

If your problem doesn't fall into one of the other categories, report it here.

Moderator: Moderators

Post Reply
Dr.R. Clavan
Posts: 12
Joined: Wed May 25, 2011 9:27 pm

Conditional 2nd DNS server

Post by Dr.R. Clavan »


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 (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").


Posts: 6490
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Conditional 2nd DNS server

Post 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. for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Posts: 168
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Re: Conditional 2nd DNS server

Post by pythonic »

Not necessarily a desirable solution, but you might be able to mitigate Pi-hole's stability problem with regular scheduled reboots?

Post Reply