DEV Community

Daniel Holth
Daniel Holth

Posted on • Updated on

Working local ipv6 DNS on dd-wrt

If you'd like to be able to ping6 name on your local network based on the names requested by your hosts,

  • Disable radvd; dnsmasq will do it.
  • Disable dhcp6s; dnsmasq will do it.
  • Remove static leases. These are ipv4-only; we will define ipv6-compatible leases in configuration.
  • Set 'Additional Dnsmasq Options:
no-negcache
expand-hosts
domain-needed
enable-ra
no-resolv
server=8.8.8.8
server=8.8.4.4
dhcp-range=::1,::400,constructor:br0,ra-names
dhcp-host=00:24:8C:26:8C:67,cardamom,192.168.1.100,[::1]
dhcp-host=38:f9:d3:cf:ee:86,laptop,192.168.1.104,[::18f]
Enter fullscreen mode Exit fullscreen mode
  • no-negcache: Don't cache negative lookups.
  • expand-hosts: Add our network name to lookups.
  • domain-needed: Don't pass hostname-only lookups to upstream DNS.
  • enable-ra: Dnsmasq provides radvd
  • no-resolv: Stay far away from the ISP domain name servers
  • server: Use Google's
  • dhcp-range=::1,::400,constructor:br0,ra-names: Our LAN is on br0; dhcpv6 assigns addresses based on the delegated prefix, this range, and the device id. ra-names assigns DNS names to dual-stack hosts that advertise a name.
  • Our hosts. The MAC address, the desired hostname, the ipv4 address, and a portion of the ipv6 address appended to the delegated prefix from our ISP.

The ipv4 static leases were the sticking point. These need to be configured only in the dnsmasq configuration; the ipv4 dd-wrt configuration will write a hosts file and prevent dnsmasq from doing what we want.

SLAAC + ra-names doesn't seem to work for me when dhcp-host specifies a hostname and an ipv4 address only. Instead, I specify the mac address, the desired hostname, the ipv4 address, and the suffix of the ipv6 address. The suffix can be either constructed-within-range style [::18f] or whatever you want [::1], [::2].

The host will continue to use its autoconfigured address for outgoing connections and will gain an additional DHCP-assigned address that can be used for incoming connections. My Android phone ignores the assigned suffix, but gets a working assigned ipv6 name anyway.

I am using DHCPv6 with prefix delegation on the WAN side, and my Dhcp6c config is:

interface vlan2 {
 send ia-pd 0;
 send rapid-commit;
# request domain-name-servers;
 script "/sbin/dhcp6c-state";
};
id-assoc pd 0 {
 prefix ::/56 infinity;
 prefix-interface br0 {
  sla-id 0;
  sla-len 8;
 };
};
id-assoc na 0 { };
Enter fullscreen mode Exit fullscreen mode

dnsmasq is enabled and is providing local dns.

The dd-wrt "Used Domain" is set to "LAN & WLAN", adding a line domain=<what you typed in the LAN Domain field> to dnsmasq.conf.

Top comments (0)