I am running two instances of pihole on my network. One (PH1) is running as a container on my QNAP NAS and is serving addresses with DHCP, and the other one (PH2) is running as a container on my RaspberryPi 3 running HomeAssitant OS, configured to lookup local addresses on PH1.
My intention is to use PH2 as a backup for PH1, should anything happen to my QNAP NAS (or even while it's rebooting). To achieve this, before upgrading them both to PiHole 6, I had /etc/dnsmasq.d loaded as a volume on PH1, with a custom configuration to set both as the DNS servers served by PiHole's DHCP server:
dhcp-option=6,192.168.10.31,192.168.10.14
(10.31 is PH1, 10.14 is PH2)
Actual Behaviour:
After upgrading to PiHole 6 and the migration of the config, I can see that PH1 no longer serves PH2 as the secondary DNS server. I have read about this and it seems the /etc/dnsmasq.d is disabled by default.
While I know I can enable it (via misc.etc_dnsmasq_d), I was wondering if simply adding
dhcp-option=6,192.168.10.31,192.168.10.14
to misc.dnsmasq_lines would do the trick, and if so, should I then unmount and delete the /etc/dnsmasq.d volume?
Both would work.
I'd probably prefer misc.dnsmasq_lines for just that one line.
If you are not using misc.etc_dnsmasq_d, then there would be no need to mount /etc/dnsmasq.d for your Pi-hole container.
You'll note that Pi-hole's sample configuration also does no longer mount it.
Yes, that was my deviation from the default configuration with PiHole 5, in order to retain the contents of /etc/dnsmasq.d between image upgrades.
That was a lesson learned after migrating from pihole installed on RaspberryPi OS which had no problem with upgrades, vs docker upgrades which reverted my changes /etc/dnsmasq.d.
I wanted to confirm that using dnsmasq_lines is indeed the preferred option rather than mounting /etc/dnsmasq.d
There is no "preferred" way to do it.
It is the user's choice.
We usually recommend using misc.dnsmasq_lines when there are just a few lines because the user can easily handle the changes via web interface, without the need to open text editors and change files on the server.
On the other hand, when the user wants to change many dnsmasq options, using many lines, we recommend to use an external file and enabling misc.etc_dnsmasq_d.