Custom dns for IPV6 dhcp clients

I know how to configure custom setting for specific dhcp clients with the “set” tag in the dnsmasq.d/ custom dhcp.conf file.

How do (if possible) customize dns for ipv6 dhcp clients?

ex. ipv4 = dhcp-host=mac address,“dhcp reservation ip”,set:kids



what is the equivalent for ipv6?

As you may already be aware of, Pi-hole embeds a tailored dnsmasq version that handles DNS and DHCP.

As such, dnsmasq’s documentation is always worth a closer look when dealing with configuration files living in /etc/dnsmasq.d/.

Quoted from that source:


(…) IPv6 options are specified using the option6: keyword, followed by the option number or option name. The IPv6 option name space is disjoint from the IPv4 option name space. IPv6 addresses in options must be bracketed with square brackets, eg. –dhcp-option=option6:ntp-server,[1234::56] (…)

There’s more, so make sure you read the whole lot at the source.
Also verify you’ve enabled IPv6 in Pi-hole’s DHCP settings.

However, this might not work as you intended:

As IPv6 is strong on auto-configuration, your IPv6 clients may decide autonomously whether they use those settings (click for details).

It is completely at a device’s (or rather, its OS’s) discretion whether it would use Stateful DHCPv6 (about equivalent to IPv4 DHCP), Stateless DHCPv6 or SLAAC to integrate itself into your IPv6 network.

Windows clients (up to Win10, which supports SLAAC as well) will use or at least prefer DHCPv6, while Android devices employ SLAAC.

(As a side note: This is also a common reason for smartphones bypassing Pi-hole when IPv6 is enabled in your network, preferring your router’s (or ISP’s) RA over Pi-hole’s).

dhcp-host=mac address,[IPv6 here],set:kids

And that is a literal representation. If you are using an IPv6 address then you must use [ and ] since IPv6 addresses use :s and that character has meaning as a field delimiter. Braces are required.

Thank you all, I’ll try and let you know…

Providing an IPv6 address with a dhcp-host option by itself will not offer a DNS server via IPv6. It will just prompt dnsmasq to offer assignment of that address to a client that uses Stateful DHCPv6.
Clients using SLAAC or Stateless DHCPv6 will just ignore this option or may prefer another router’s RA instead (if present).
In addition, it might fail to assign an address via Stateful DHCPv6 if an IPv6 client tries to register by DUID instead of MAC.

As IPv6 addresses differ from IPv4 ones, and DHCPv6 (port 546, 547) is different from DHCP (port 67,68), I assume that dnsmasq will only offer DNS servers configured via dhcp-option=option6:dns-server to its IPv6 clients.