4

I have a dualstack private network. My router is DHCP and DNS Server.

All client IPv4 addresses are registered and can be queried by DNS as expected as their hostnames are registered with DHCP.

Now some hostname queries return the IPv6 addresses, too. This works for example with Windows 10 clients and a Linux Raspberry Pi (Debian 10), but not for Android devices and a Arch Linux server.

How does this generally work? The IPv6 addresses are auto configured on the clients (SLAAC) as my router manages only DNS records via DHCPv6. So how does the router know about these IPv6 addresses? Do these clients advertise their AAAA record on their own?

1

1 Answer 1

5

It generally doesn't. As far as I know, currently there is no widely accepted mechanism for making this work (aside from DHCPv6, obviously), only manufacturer-specific hacks.


The most likely guess I have (though it still doesn't entirely match up with which operating systems you report working):

Some router DNS/DHCP software, such as dnsmasq, tries to guess the SLAAC-derived address (but specifically just the EUI-64 format address) for each device which obtains a DHCPv4 lease. Since the DHCPv4 server knows the host's MAC address, that's all it needs to derive the EUI-64 SLAAC address.

For example, the dnsmasq documentation for the dhcp-range option (which controls DHCPv4, DHCPv6, and SLAAC at the same time) says:

ra-names enables a mode which gives DNS names to dual-stack hosts which do SLAAC for IPv6. Dnsmasq uses the host's IPv4 lease to derive the name, network segment and MAC address and assumes that the host will also have an IPv6 address calculated using the SLAAC algorithm, on the same network segment. The address is pinged, and if a reply is received, an AAAA record is added to the DNS for this IPv6 address. Note that this is only happens for directly-connected networks, (not one doing DHCP via a relay) and it will not work if a host is using privacy extensions. ra-names can be combined with ra-stateless and slaac.

This obviously can't work with RFC 7217 opaque SLAAC addresses which you'll get from NetworkManager or dhcpcd(it does SLAAC), nor the ones generated by Windows 10, though it should work with Android and the Linux kernel's built-in SLAAC support.

(It is in theory possible that some routers could do something similar based on their neighbour cache – e.g. if they see a particular MAC address speaking as 2001:db8::1234, they might automatically associate it with the corresponding DHCPv4 lease and the hostname... This would be a bit unreliable and wrong and I hope your router doesn't do this, but it still wouldn't be the worst thing I've seen home routers do with their DNS.)


Other guesses:

  • Hosts can indeed advertise DNS records on their own. All Windows clients support performing DNS updates on their own (RFC 2136), which also works without Active Directory as long as the authoritative server accepts updates without any authentication. It is possible, though I've never seen this, that your router actually accepts DNS 'UPDATE' messages from LAN devices and uses them to update its own DNS.

    Linux devices almost never do this automatically. Still, it might be worth trying to run nsupdate against your LAN domain to see if it works.

  • It wouldn't be entirely surprising – though again, I have never actually seen this in practice – if the router's DNS server acted as a proxy for mDNS and/or LLMNR (the two multicast name resolution protocols often found on LANs).


Non-options:

  • I was also expecting there to be a "host name" or "FQDN" option which could be sent by hosts in ICMPv6 Router Solicitations, but there isn't one.

  • ICMPv6 does have "Node Information Request" packets which can be used to query the hostname, but no OS implements responding to them, so it's very unlikely that a router would use them.

5
  • nsupdate returns NOERROR and I get the new (fake) IPv6 address from nslookup, so I guess your second guess is correct. How can I find out if Debian is really doing this?
    – schlamar
    Commented Feb 18, 2021 at 11:54
  • Well, watch tcpdump for DNS packets with the UPDATE operation... On Linux, the only time I've seen this happening automatically is if SSSD was configured for Active Directory, but now that I think of it, it is possible that dhclient and dhcpcd might come with "DHCP lease obtained" hook scripts for that as well. Commented Feb 18, 2021 at 12:32
  • I guess I found it in journalctl avahi-daemon[244]: Registering new address record for fd00::... on wlan0.*.
    – schlamar
    Commented Feb 18, 2021 at 13:39
  • avahi-daemon implements mDNS; it doesn't do DNS updates. Commented Feb 18, 2021 at 14:23
  • 1
    Yes, but my guess is that my router does mDNS requests on certain events, maybe on DHCP requests. I haven't seen DNS traffic in tcpdump during boot. But maybe my tcpdump service starts too late (it is activated after network-online). I have no idea how to start tcpdump after wlan0 is active but DHCP has not run yet.
    – schlamar
    Commented Feb 18, 2021 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .