For those that like me use Pi-Hole as the DHCP server there is a quick and quite easy way to add a second DNS to the settings that are sent to network clients.
Pi-Hole is based on dnsmasq and therefore you can tweak your DNS needs on your internal network for specific situations. In my case I have two Pi-Hole machines where the second one acts as a backup to the main one. The second DNS server does not have to be also a Pi-Hole machine necessarily. You can use unbound, blocky, AdGuard or whatever you like.
The Pi-Hole DHCP web gui interface though does not provide a way to add a second or third internal DNS that will be served to the network clients. We need to use cli for this customization.
But before we continue you might ask why would you need this. The answer is simple, if my primary DNS server fails or requires maintenance the second DNS machine continues to serve queries on the network without any disruptions. The second DNS server can also help offload the main one in some cases.
Please run this as root.
sudo -i cd /etc/dnsmasq.d nano 03-pihole-dhcp-DNS.conf
Edit the file with the following parameters:
#PiHole DNS server IP’s dhcp-option=6, 192.168.0.2, 192.168.0.3
Make sure to replace the IP addresses above with the ones that correspond to your DNS servers. In this example 192.168.0.2 is the primary DNS machine and 192.168.0.3 is the secondary DNS machine.
Close the file with CTRL+O and CTRL+X. Finally you have to restart pihole-FTL. I use Debian Buster so the command for me is:
systemctl restart pihole-FTL.service