** Description changed:
[ Impact ]
On Ubuntu 26.04 (Resolute) and any system running systemd >= 259, setting
'dhcp-identifier: mac' in netplan YAML configuration is ignored by
systemd-networkd.
The Netplan networkd backend (src/networkd.c) writes DHCP client
configuration under the legacy '[DHCP]' section header dating back to
2017. While older systemd versions aliased '[DHCP]' to '[DHCPv4]', in
systemd-networkd >= 259 configuration parser precedence and modern drop-
ins strictly prioritize '[DHCPv4]'. Consequently, settings written under
'[DHCP]' (such as ClientIdentifier=mac, RouteMetric=, UseMTU=,
UseRoutes=) are ignored or overridden by the default networkd
configuration. The DHCPv4 client falls back to DUID, breaking MAC-based
DHCP reservations and static lease assignments in enterprise networks.
[ Fix ]
Update Netplan's networkd generator in src/networkd.c to emit canonical
'[DHCPv4]' section headers for IPv4 DHCP settings and '[DHCPv6]' section
headers for IPv6 DHCP settings instead of the obsolete combined '[DHCP]'
section.
[ Test Plan ]
1. Create a netplan configuration with dhcp4 and dhcp-identifier set to mac:
network:
version: 2
ethernets:
eth0:
dhcp4: true
dhcp-identifier: mac
2. Run `netplan generate`.
3. Inspect the generated systemd-networkd file in
`/run/systemd/network/10-netplan-eth0.network`.
- Verify that `[DHCPv4]` is emitted instead of `[DHCP]`.
- Verify that `ClientIdentifier=mac` is correctly placed under `[DHCPv4]`.
4. Apply network configuration (`netplan apply`) and verify via `networkctl
status eth0` that systemd-networkd initiates DHCPv4 negotiation using the
hardware MAC address instead of DUID.
5. Verify test suite passes:
`pytest-3 tests/generator/test_dhcp_overrides.py`
All 185 networkd generator test cases pass with 0 regressions.
[ Where problems could occur ]
The change only modernizes section headers in generated systemd-networkd
`.network` files from `[DHCP]` to `[DHCPv4]` and `[DHCPv6]`. Both sections have
been supported in systemd since v244 (Ubuntu 20.04 LTS Focal). Therefore,
backwards compatibility across all supported Ubuntu releases is fully
preserved. Potential regression risk is minimal.
[ Other Info ]
- Upstream Pull Request: https://github.com/canonical/netplan/pull/617
- Target development release: Ubuntu 26.04 (Resolute)
- - Patch attached: lp2167907_networkd_dhcp4_section.patch
+ - debdiff attached: netplan.io_1.2-1ubuntu5.1_to_1.2-1ubuntu5.2.debdiff
+ - Upstream CI status: all 17 checks green on PR #617
--- [ Original Report ]
Version:
--------
Ubuntu 26.04 Server using netplan and systemd v259'
Summary:
--------
'dhcp-identifier: mac' is stored in the netplan YAML and shows up in netplan
get, but it does not change the live DHCPv4 client ID on Ubuntu 26.04
Root Cause:
-----------
Netplan 1.2 writes 'ClientIdentifier=mac' under the old [DHCP] section
systemd 259 only reads that setting from [DHCPv4], so it keeps the default
(use DUID)
networkctl cat @IFACE shows an empty [DHCPv4] section and MAC-based DHCP
reservations fail after reboot
Local Workaround:
-----------------
I put 'ClientIdentifier=mac' in /etc/systemd/networkd.conf.d/ under [DHCPv4]
and everything worked again
--
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