Allow custom DNS servers to be provided to DHCP clients

Please provide the ability to set up to two IPv4 and two IPv6 DNS server addressees to be provided to DHCP clients (on the DHCP settings page).

That way, one wouldn't need to disable the Pi-hole DHCP server because it doesn't allow one to define DNS servers.

In the meantime, you can assign additional DNS servers using a dnsmasq configuration file.

I know that. The problem with that is if they conflict with the Pi-hole DHCP settings, they get ignored, thus you have to disable the DHCP server.

Either way, it would be easier to enter the details via the web interface.

Or, eliminate the conflict.

I tried, but it's not possible, as restarting pihole-FTL overwrites any changes made to /etc/pihole/dnsmasq.conf to eliminate the conflict (duplicate IPv6 DNS settings).

Don't make the changes in that file. As noted in the prominent header of the file:

##################################################################################
#                                                                                #
#                     FILE AUTOMATICALLY POPULATED BY PI-HOLE                    #
#    ANY CHANGES MADE TO THIS FILE WILL BE LOST WHEN THE CONFIGURATION CHANGES   #
#                                                                                #
#            IF YOU WISH TO CHANGE ANY OF THESE VALUES, CHANGE THEM IN           #
#                             /etc/pihole/pihole.toml                            #
#                             and restart pihole-FTL                             #
#                                                                                #
#           ANY OTHER CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE           #
#                       WITHIN /etc/dnsmasq.d/yourname.conf                      #
#    (make sure misc.etc_dnsmasq_d is set to true in /etc/pihole/pihole.toml)    #
#                                                                                #
#                      Last updated: 2025-02-20 21:46:40 CST                     #
#                           by FTL version vDev-22142c0                          #
#                                                                                #
##################################################################################

Make an additional configuration file in the /etc/dnsmasq.d directory and the settings won't be overwritten.

Enable this setting in /etc/pihole/pihole.toml or via the web interface in the settings/all settings/misc panel in expert mode:

misc.etc_dnsmasq_d

Should FTL load additional dnsmasq configuration files from /etc/dnsmasq.d/?

I have, but I needed to disable DHCPv6 to avoid the settings being ignored, due to being a duplicate IPv6 DNS setting.

That why allowing DNS servers to be defined in the web interface would help.

To be clear, I don't need help, I'd just like to avoid all the extra work, by defining the DNS servers in the web interface so Pi-hole didn't create incorrect settings.

Not to belabor the point, but are the Pi-hole settings incorrect or are the dnsmasq settings just in conflict? You told Pi-hole (and thus dnsmasq) to do one thing in the web GUI, and another thing in the dnsmasq file?

Elaborate (so we fully understand the request) on how assigning custom DNS servers in the web interface will avoid this problem.

When you check Enable additional IPv6 support (SLAAC + RA) the following lines are added to /etc/pihole/dnsmasq.conf:

dhcp-option=option6:dns-server,[::]
# Enable IPv6 DHCP variant
dhcp-range=::,constructor:eth0,ra-names,ra-stateless,64

Notice that there are no DNS servers defined.

So I created a file /etc/dnsmasq.d/dns-servers.conf with the following line:
dhcp-option=option6:dns-server,<piholelink-local address>,[2606:4700:4700::1111]

This results in the following:
Warning in dnsmasq core:
Ignoring duplicate dhcp-option 23

Thus my IPv6 DNS setting is being ignored, because of an entry that one cannot override in /etc/pihole/dnsmasq.conf

If we could define DNS servers in the DHCP settings, that are to be passed to DHCP clients and advertised via Router Announcements, I could leave Enable additional IPv6 support (SLAAC + RA) checked and have the correct DNS server settings in /etc/pihole/dnsmasq.conf (for DHCP).

And, I havent found anywhere in /etc/pihole/pihole.toml that one can define DNS servers for use with DHCP and RA.

1 Like

If you'd want all those addresses to point to Pi-hole, then that's what enabling dhcp.multiDNS under Settings | DHCP would do for DHCP:

Advertise DNS server multiple times to clients. Some devices will add their own proprietary DNS servers to the list of DNS servers, which can cause issues with Pi-hole. This option will advertise the Pi-hole DNS server multiple times to clients, which should prevent this from happening.

As we haven't received reports for similar behaviour of DHPCv6 clients, you could be the first to demonstrate such offending client behaviour.

If Enable additional IPv6 support is ticked, pihole-FTL/dnsmasq would default to automatically offer an IPv6 address of the machine its running on as DNS server.

Unticking Enable additional IPv6 support in combination with enabling misc.etc_dnsmasq_d will allow you to provide your own custom IPv6 DNS configuration.

I'd advise against that, though:

This would offer Cloudflare's DNS server's IPv6 besides Pi-hole, allowing IPv6 clients to by-pass Pi-hole at their own discretion.