-1

I am setting up a home server running Debian 10 (Buster), but I have been unable to associate the host's name with its IPv6 addresses.

I have a router running OpenWRT, which is configured with dnsmasq acting as both a DHCP server and a DNS server.

The behavior I'd like to see is the router having both A and AAAA records for the server after it makes successful DHCP request. The server is successfully being assigned both IPv4 and IPv6 addresses by the router (it receives IPv6 addresses for both the ISP-assigned subnet as well as the private subnet). However, while I am able to retrieve the A record, there is no AAAA record created.

I have a desktop running Arch Linux that behaves how I want, so I know it's not an issue with the router. With this host, I am able to lookup both its IPv4 and IPv6 addresses: dig @router -t AAAA desktop returns two answers, and dig @router -t A desktop returns one. Requesting the A record works the same for the server, but not the AAAA.

I have the default values in /etc/dhcp/dhclient.conf. Those settings are:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;

Replacing send host-name with send fqdn.fqdn did not change the behavior (A record is present, AAAA is not). dhcp-options(5) seems to indicate that it is valid to pass something besides a fully-qualified domain name in fqdn.fqdn:

Specifies the domain name that the client wishes to use. This can be a fully-qualified domain name, or a single label. If there is no trailing '.' character in the name, it is not fully-qualified, and the server will generally update that name in some locally-defined domain.

  • Why not compare the non-working configuration to the working configuration? – Michael Hampton Sep 12 '20 at 23:21
  • dhclient uses the same configuration file for both DHCP and DHCPv6 (`/etc/dhcp/dhclient.conf`). DHCPv6-specific options can be passed by adding `dhcp6.` before them, but per `dhcp-options(5)`, but none of the ones I tried helped. – IncongruentModulo1 Sep 13 '20 at 12:31

2 Answers2

2

Replacing send host-name with send fqdn.fqdn actually was the solution, but I think that the existing lease file caused it to not work correctly when I initially tried bringing the interface down and then back up. After rebooting, the below change fixed the problem:

- send host-name = gethostname();
+ send fqdn.fqdn = gethostname();
0

Most people assume that a single instance of dhclient handles both protocols but looking at the man page reveals:

... -4 Use the DHCPv4 protocol to obtain an IPv4 address and configuration parameters. This is the default and cannot be combined with -6.

-6 Use the DHCPv6 protocol to obtain whatever IPv6 addresses are available along with configuration parameters. It cannot be combined with -4. ...

Even NetworkManager doesn't get this straight. As pointed out correctly the FQDN is mandatory and should be sent instead of hostname and gethostname() is not a sufficient FQDN:

send fqdn.fqdn "myhost.at.fully.qualified.domain"
send fqdn.encoded on;
send fqdn.server-update on;

I use this config to get name registering working on both DHCP server implementations (Lin & Win) with an additional instance running: dhclient -6 ...

3ronco
  • 143
  • 7
  • I believe you're conflating two things. The -4 and -6 options control which protocol is used: DHCP or DHCPv6. However, both protocols can assign IPv4 and IPv6 addresses. So you can make a request over DHCPv6 and receive both an IPv4 address and IPv6 address back. – IncongruentModulo1 Mar 30 '22 at 16:13
  • The observed behavior is (in my opinion) a deficiency in the dhclient implementation. I opened an issue here: https://gitlab.isc.org/isc-projects/dhcp/-/issues/186. The summary is that the DHCP spec allows clients to send a short hostname. The server should append the domain name to create the FQDN that is assigned to the client, but dhclient does not format the request to allow that to open. I switched to systemd-networkd, which resolves the issue. – IncongruentModulo1 Mar 30 '22 at 16:16
  • @IncongruentModulo1 That's what it's actually **not** doing although discussed in _RFCs_ _3315_ & _7341_ there's still a wide belief that _DHCPv4_ and _DHCPv6_ is the same thing for different protocols and as such only needs to be implemented that way. That's simply not the case due to the fundamental differences (DUID, IA-NA, ...) By the way i doubt that any _v4_ protocol is able to deliver _v6_ addresses and never found any _DHCP_ client implementation which gets _DHCP4over6_ right. – 3ronco Mar 31 '22 at 16:35