If you don't mind, gents, I took the liberty of digging a bit into these
guts.

I reproduced this on a clean Ubuntu 26.04 (Resolute) environment running
netplan.io 1.2 and systemd 259.5-0ubuntu3.4. The actual issue is this:

1. How systemd 259 handles [DHCP]:
In systemd-networkd, the legacy `[DHCP]` section is not completely ignored. It 
is mapped via a compatibility alias in 
`src/network/networkd-network-gperf.gperf`:
- Line 255: `DHCPv4.ClientIdentifier` -> `Network.dhcp_client_identifier`
- Line 641: `DHCP.ClientIdentifier` -> `Network.dhcp_client_identifier`

When Netplan writes `[DHCP]` with `ClientIdentifier=mac`, systemd-
networkd parses it into `Network.dhcp_client_identifier =
DHCP_CLIENT_ID_MAC`. Checking `networkctl status <iface>` confirms that
`DHCPv4 Client ID:` is set to the MAC address when no conflicting
configuration exists.

2. Why this causes confusion and real breakage:
- `man systemd.network(5)` dropped `[DHCP]` years ago; only `[DHCPv4]` and 
`[DHCPv6]` are documented. Seeing `[DHCP]` in `networkctl cat` leads users to 
believe it is unparsed.
- Global config `/etc/systemd/networkd.conf` only recognizes `[DHCPv4]`, not 
`[DHCP]`.
- If any drop-in in `/etc/systemd/network/` or `/etc/systemd/networkd.conf.d/` 
configures `[DHCPv4]`, systemd's section parser prioritizes `[DHCPv4]` settings 
over the legacy `[DHCP]` alias, which silently overrides or masks Netplan's 
generated values.
- In `netplan/src/networkd.c`, Netplan still carried legacy logic from 2017 
emitting `[DHCP]` for both DHCPv4 and DHCPv6.

3. Resolution:
Netplan should stop emitting the legacy `[DHCP]` block and output canonical 
`[DHCPv4]` and `[DHCPv6]` sections matching modern systemd-networkd standards.

Upstream pull request submitted for review:
https://github.com/canonical/netplan/pull/617

I also attached the patch file for review.


** Patch added: "Emit [DHCPv4] and [DHCPv6] in networkd backend instead of 
legacy [DHCP]"
   
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2167907/+attachment/6002833/+files/lp2167907_networkd_dhcp4_section.patch

** Changed in: netplan
       Status: New => Confirmed

** Changed in: netplan.io (Ubuntu)
       Status: New => Confirmed

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

Title:
  'dhcp-identifier: mac' in netplan .yml config is ignored by systemd

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/2167907/+subscriptions


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

Reply via email to