Public bug reported:

===== DESCRIPTION =====

The initramfs dhcpcd hook hardcodes the IPv6 prefix length to 128 when
generating /run/net6-*.conf.

$ grep "IPV6NETMASK=" /usr/share/initramfs-tools/dhcpcd-hooks/70-net-conf
IPV6NETMASK='128'

This value is currently hardcoded because dhcpcd does not provide an
IPv6 prefix length in the initramfs hook environment. As a result, the
hook defaults to 128, and downstream initramfs-tools logic consumes this
value.

This 128 value is written into the initramfs-generated network
configuration for IPv6 addresses, regardless of the prefix length
provided by upstream configuration sources. In environments where a
different prefix length is expected (e.g. /64), this can lead to a
mismatch between the configured IPv6 address and the effective network
prefix.

For example, systemd-networkd logs show:

May 26 15:25:47 kajgm-3-00435091 systemd-networkd[5020]: ens300np0:
Ignoring DHCPv6 address xxxx:xxxx:xxxx:xxxx:x:xxxx:xxxx:xxxx/128 (valid
for 1d 59min 59s, preferred for 23h 59min 59s) which conflicts with
xxxx:xxxx:xxxx:xxxx:x:xxxx:xxxx:xxxx/64.

In this scenario, if a prefix conflict occurs, SSH will be lost once the
/64 lease expires and SSH access to the machine will not come back until
dhcp runs again and applies the /128 address.

It is also possible that the issue is not solely the hardcoded value,
but a broader problem in how IPv6 prefix information is propagated
through the initramfs networking stack.

===== EXPECTED BEHAVIOR =====

The IPv6 prefix length written by the initramfs dhcpcd hook should
reflect the value provided by the DHCPv6 configuration source (e.g. /64
where appropriate), and must not be hardcoded.

No prefix length conflicts should occur between initramfs-generated
configuration and systemd-networkd.

===== ACTUAL BEHAVIOR =====

The initramfs dhcpcd hook hardcodes IPv6 prefix length to /128, which
results in conflicting network configuration and causes systemd-networkd
to ignore DHCPv6-provided addresses.

ENVIRONMENT INFORMATION

Reproduced on Oracle Cloud Instances on Noble (24.04) and Questing
(25.10)

===== ADDITIONAL INFORMATION =====

As an experiment, I hardcoded IPV6NETMASK='64' to see what would happen.
It was correctly written to /run/net6-ens300np0.conf as seen below:

sudo cat /run/net6-ens300np0.conf

DEVICE6='ens300np0'
IPV6PROTO='dhcp6'
IPV6ADDR='xxxx:xxxx:xxxx:xxxx:x:xxxx:xxxx:xxxx'
IPV6NETMASK='64'
IPV6DNS0='fd00:c1::a9fe:a9fe'
IPV6DOMAINSEARCH='kajgmipv6only.oraclevcn.com.'

However, I still saw the "Ignoring DHCPv6 address
xxxx:xxxx:xxxx:xxxx:x:xxxx:xxxx:xxxx/128 [...] which conflicts with
xxxx:xxxx:xxxx:xxxx:x:xxxx:xxxx:xxxx/64" error.

This indicates /128 is also coming from somewhere else.

===== ADDITIONAL LINKS =====

Related upstream discussion: https://github.com/canonical/cloud-
init/issues/6867

** Affects: dhcpcd (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2154301

Title:
  dhcpcd initramfs hook hardcodes IPV6NETMASK to 128 for IPv6

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dhcpcd/+bug/2154301/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to