Problem
OCI VMs on DHCP networks (e.g., dhcp-noipam with no CNI IPAM) get their DHCP lease persisted as a static systemd-networkd config file on first boot. This creates a behavioral inconsistency between source VMs and cloned VMs:
- Source VM (cold boot): initramfs
IP=dhcp → configure_networking runs DHCP in initramfs → writes /run/net-eth0.conf → systemd-network-generator converts it to /etc/systemd/network/10-<mac>.network with static Address=/Gateway=/DNS= → subsequent reboots use static IP
- Clone VM (snapshot restore): skips initramfs entirely → post-clone hint writes
DHCP=ipv4 config → reboots use DHCP
Same network, same image, different behavior after reboot.
Root Cause
/etc/initramfs-tools/initramfs.conf has IP=dhcp (set in the OCI image Dockerfile). This is intended for kernel ip= parameter bootstrapping, but when no ip= is present, configure_networking falls back to DHCP. The systemd-network-generator service then reads /run/net-*.conf and generates a 10- priority static .network file that overrides the image's 20-wired.network (DHCP=yes).
Observed Behavior
# Source VM (first boot, dhcp-noipam network)
$ cat /etc/systemd/network/10-8639ccd45f70.network
[Match]
MACAddress=86:39:cc:d4:5f:70
[Network]
Address=10.99.0.180/24 # static!
Gateway=10.99.0.1
DNS=10.99.0.1 8.8.8.8
# Clone of same VM (after post-clone hint)
$ cat /etc/systemd/network/10-327dc895e9ae.network
[Match]
MACAddress=32:7d:c8:95:e9:ae
[Network]
DHCP=ipv4 # dynamic!
Proposed Fix
Remove IP=dhcp from /etc/initramfs-tools/initramfs.conf in the OCI image Dockerfile. The kernel ip= parameter (when present) still triggers configure_networking regardless of the IP= setting — static network configuration for bridge+host-local CNI is unaffected. DHCP networks should be handled entirely by systemd-networkd via the existing 20-wired.network (DHCP=yes).
This ensures both source VMs and cloned VMs have consistent DHCP behavior on DHCP networks.
Problem
OCI VMs on DHCP networks (e.g.,
dhcp-noipamwith no CNI IPAM) get their DHCP lease persisted as a static systemd-networkd config file on first boot. This creates a behavioral inconsistency between source VMs and cloned VMs:IP=dhcp→configure_networkingruns DHCP in initramfs → writes/run/net-eth0.conf→systemd-network-generatorconverts it to/etc/systemd/network/10-<mac>.networkwith staticAddress=/Gateway=/DNS=→ subsequent reboots use static IPDHCP=ipv4config → reboots use DHCPSame network, same image, different behavior after reboot.
Root Cause
/etc/initramfs-tools/initramfs.confhasIP=dhcp(set in the OCI image Dockerfile). This is intended for kernelip=parameter bootstrapping, but when noip=is present,configure_networkingfalls back to DHCP. Thesystemd-network-generatorservice then reads/run/net-*.confand generates a10-priority static.networkfile that overrides the image's20-wired.network(DHCP=yes).Observed Behavior
Proposed Fix
Remove
IP=dhcpfrom/etc/initramfs-tools/initramfs.confin the OCI image Dockerfile. The kernelip=parameter (when present) still triggersconfigure_networkingregardless of theIP=setting — static network configuration for bridge+host-local CNI is unaffected. DHCP networks should be handled entirely by systemd-networkd via the existing20-wired.network(DHCP=yes).This ensures both source VMs and cloned VMs have consistent DHCP behavior on DHCP networks.