Ability to set secondary and tertiary DNS servers in PH DHCP

If a secondary or tertiary DNS could be set with PH DHCP you could have a simple PAIR (or triplet) of PHs running with each having part of the DHCP scope to hand out and each pointing to the same upstream DNS server, same gateway and same subnet mask. That would create a simply sort of PH 'fallover' cluster.

With several PHs on the same LAN with each handing out addresses as part of the same DHCP scope like 5-50, then 51-100, any other PH could take over if the other one should go offline.

If only a single PH is on the LAN then the second DNS should automatically default to 0.0.0.0.

This can be done if your router can handle DHCP with internal DNS settings, but a lot of routers can't.

I know it runs the risk of a user setting an external IP as the second DNS and rendering PH useless for anything using that second DNS as resolution. But I think it would be worth it for hundreds of users out there that want a second PH for redundancy.

Is this what you want to do?

No, not exactly, this would add a second DNS setting in the PH
DHCP, but to be honest I don't see how this would accomplish what
that user seeks to do. Since modern OSs no longer head the
primary / secondary DNS designations (if they ever did) with
that idea there wold be nothing preventing them from using the
router as a DNS source and thereby bypassing PH.

  I ask for a second DNS setting the PH's DHCP so that a second

PiHole can be placed on the network. And if it is setup with
identical settings (just a different IP) and were BOTH DHCP
servers and each had part of the the DHCP scope, each can act
independently and hand out valid addresses via DHCP for a single
subnet. Even if one of the PHs goes down, because the DHCP scope
that is split between them, either ones address will still be
valid and any device will still function talking to the remaining
PH server for DNS resoluton. If the PH that's down is not
answering it should not cause any issues as it can never be polled
for DNS resolution, devices should fall over to the functioning
DNS server only. it may be a tad slower, but of the DNS lease time
is kept short the devices should request a new lease - and new IP

  • and be answered by the remaining PH.

    This just seems a super simple way of having 2 PHs on the same
    

network each providing DHCP addresses (on a split scope) and each
pointing to the same upstream DNS. Either can answer a request for
an IP via DHCP and DNS resolution and if one goes own the other
will answer all the requests. Just a poor mans easy redundancy.

Huh?
Second DNS setting is not exactly what you look for, yet you are asking for it?

Anyways, it seems you are aiming for the following configuration:

  • Pi-hole-1
    DHCP enabled, range 192.168.0.5 to .50
    DNS servers: Pi-hole-1 and Pi-hole-2
  • Pi-hole-2
    DHCP enabled, range 192.168.0.51 to .100
    DNS servers: Pi-hole-2 and P-hole-1

This can be achieved by setting up two Pi-hole machines, configuring DHCP ranges accordingly, and by applying the dhcp-option per the instructions as linked by @jfb within a custom configuration file for dnsmasq (don't forget to restart :wink: ).

  • on Pi-hole-1
    dhcp-option=dns-server,<IP of Pi-hole-1>,<IP of Pi-hole-2>
  • on Pi-hole-2
    dhcp-option=dns-server,<IP of Pi-hole-2>,<IP of Pi-hole-1>

The referenced link shows how to use dnsmasq configuration to provide more than one DNS server to each client. Each Pi-Hole provides the IP of itself and the IP of any other Pi-Holes on the network.

There is no guarantee of how the DNS traffic will be distributed among the Pi-Holes in daily use, but if you have two Pi-Holes set up this way and one fails, the other will seamlessly pick up the DNS load.

In your message you user asked for a second DNS entry for the
purpose of setting the homes router as a fall back DNS service. I
don't want to do this - and I don't believe that won't work as the
user asked for it to, that would simply offer the second DNS
server (the router) as an alternative - which will get used
randomly as clients don't seek DNS resolution by order (primary,
secondary , tertiary they simply use whatever answers first. So,
yeah, the same THING but not for the same REASON.

  My request is for the same setting - but for a different use.  To

setup 2 PHs on the same network, and offer them BOTH up via PHs
DHCP services to be valid DNS resolution sources. I can do all
this if I use a router to do DHCP, but not PH itself - at least
not through the web interface.

  I will try your suggestion about the custom file settings. It

will do the trick but it would be a whole lot nicer to have it
available in the web interface.

  I've often suggested doing this on Reddit when a user wants to

have 2 PHs in a simple pair. There are scripts that can be run
and services to use to keep them in sync but this way is pretty
bone simple and does not require any manual entry into files -
BUT as I said - can only be done via a router (or other device)
whos DHCP DNS settings supports 2 internal DNS names / IPS. And a
lot of bone stock routers don't. At least as far as I could find,
you manual entry should do it OK.

To clarify, your feature request is to have the option to offer a second DNS server when Pi-Hole is the DHCP, and you want it in the web interface?

Is this the feature you want?

@DanSchaper Can you comment on whether it is a good idea or not to run two (authoritative!) DHCP servers with non-overlapping address ranges within the same network? I'd assume it's not a good idea, however, the devices should only acknowledge (DHCPACK) one of the two offers and - in theory - this might work as expected.

This is a not-frequent workaround for routers that don't provide the option of disabling DHCP - the DHCP range on the router is changed to a single IP, that of the Pi.

Two DHCP servers in the same broadcast domain? Not a good idea unless you have some method of filtering MAC addresses or the two DHCP servers have some was of sharing MAC tables to know when a lease is in effect.