Secondary DNS Server for DHCP

#1

Hi all,

is it possible to add a secondary DNS Server to the DHCP configuration of PiHole as fallback?

Scenario: If Pi-Hole is not reachable, the clients in the network should fallback to the router’s DNS server.

0 Likes

#2

We have had a discussion about “secondary” DHCP servers. You may want to look it up.

In short: Most operating systems implement them as alternatives, not as fallbacks, i.e. they will query any of both servers from time to time, so it is quite likely that you will loose your Pi-hole filtering capabilities (at least partially). That is why we have never implemented this.

1 Like

#3

What do you recommend at the moment?

I have a my Pi set up in a shared network and about to leave for a few weeks. I am afraid the other people on the network don’t know what to do when the pihole fails and will try to reach me on my holiday (which should be as offline as possible :slight_smile: )

Ideally, they would just loose the filtering of the pihole, but not internet when something happens to the pi.

0 Likes

#4

I have it running in different environments (two of them at an enterprise level, one with more than 100 clients). They all run on Raspberry Pi hardware in various revisions. They never failed so far, so I wouldn’t bother too much.

A clever idea might be to set up two independent Pi-hole’s and (two distinct devices in the same network) and set up those two IPs as “primary” and “secondary” servers. All devices should be able to resolve domains, even if one of them fails for some reason. The costs of an extra device (with the excellent NanoPi NEO it is only $8) should perfectly balance with the extra reassurance you have for your holidays.

P.S: This is the post I referred to, just n case you haven’t had found it already

1 Like

Ausnahme für MAC Adressen
Good solution to automatically revert to "normal" if Pi Hole dies?
Can the Pi-Hole DHCP send out a second DNS server address to clients?
#5

Here’s an answer (if you’re still looking):

sudo nano /etc/dnsmasq.d/02-pihole-dhcp.conf

dhcp-option=6,Pi-holeIP,SecondaryDNSIP

sudo /etc/init.d/pihole-FTL restart

You would have to renew release on each host after that to pull the new settings.

Consider running tests with namebench with various combination of DNS servers. Set the fastest one in pi-Hole and a slightly slower one in your secondary DNS resolver (i’m assuming it’s your router). I am only talking milliseconds here based on the namebench results.

4 Likes

#6

I like the idea of using two piholes for redundancy.
Are there any plans to have the two piholes sync config data automatically ? E.g. DHCP, custom black & whitelists… ?

This topic may have been discussed before and I’m not sure how much effort it would take to inplement such functionality.
PiHole HA would definetely be very cool.

0 Likes

#7

We try to implement the most popular feature requests, so you may want to vote for this one:

0 Likes

#8

Most operating systems implement them as alternatives, not as fallbacks, i.e. they will query any of both servers from time to time, so it is quite likely that you will loose your Pi-hole filtering capabilities (at least partially). That is why we have never implemented this.

This is a problem because my router requires a secondary DNS server; its not “optional”, and it cannot be the same IP as the primary DNS server.

2 Likes

How to handle a pi-hole failure / crash?
#9

Can you explain what this is doing? Thanks

0 Likes

#10

Sure.

So the

dhcp-option=6,Pi-holeIP,SecondaryDNSIP

Woyld look like this:
dhcp-option=6,192.168.1.2,8.8.8.8

Assuming pi has 192.168.1.2 ip. Replace with what you have.

8.8.8.8 is the google dns

So if you use your pi as dhcp server, it will push those ips as primary and secondary ips.

1 Like

Pi-hole's DHCP service should announce different DNS to clients
Fresh install of dev branch?
#11

Will this work?
Creating file /etc/dnsmasq.d/05-custom.conf

# DNS
dhcp-option=6,10.0.0.1 10.0.0.2
# NTP Server
dhcp-option=42,10.0.0.1
0 Likes

#12

I have two Pi-holes running here, setup was no problem and putting both in the router’s DHCP was simple.

Clients seem to pick one or the other and change from time to time with no issues, they seem to be roughly split between Pis. If I power one down all clients migrate to the one still up. Plug the other back in and after a couple days the clients are once again roughly split between them.

0 Likes