Snapshot Restore Breaks Static IP on Ubuntu 22.04
Restoring a VM snapshot resets network config to DHCP on Ubuntu 22.04. Netplan's fallback behavior overrides your static IP after a revert.
When This Happens
You’re running Ubuntu 22.04 LTS on a VM — maybe Proxmox, VMware, or KVM. You set a static IP in /etc/netplan/00-installer-config.yaml back when you built the box. Months later, you roll back to an earlier snapshot (maybe to test a patch, maybe you broke something and need a clean state). After the revert, the VM boots, but you can’t SSH in. You console in and ip a shows a DHCP lease on a different subnet, or worse, no IP at all. Your static config file is still there. But the system ignored it.
What’s actually happening here is a silent fight between Netplan and the cloud-init or systemd-networkd fallback that gets triggered during the revert. The snapshot keeps the files, but the boot order re-evaluates the renderer — and it picks the wrong one.
Why It Breaks
Netplan on Ubuntu 22.04 uses a renderer — either NetworkManager or systemd-networkd. The default for server installs is systemd-networkd. But here’s the trap: when you take a snapshot, the renderer setting is stored in /etc/netplan/*.yaml. The restore keeps that file. But the actual systemd-networkd or NetworkManager service state (enabled/disabled, cached config) gets reset to whatever the snapshot’s boot state had.
If your snapshot was taken before the first boot completed (like a template snapshot), the renderer might have defaulted to NetworkManager during that first boot, or the netplan apply never ran cleanly. After revert, systemd-networkd might not be running, or it loads a stale fallback config. The fix is to force the renderer explicitly and regenerate the netplan config so it sticks.
The Fix – Step by Step
- Check the current renderer. Run
netplan get renderer. If it saysNetworkManagerand you’re on a server, that’s the problem. Server images should usesystemd-networkd. - Kill any leftover NetworkManager.
sudo systemctl stop NetworkManager; sudo systemctl disable NetworkManager. This stops it from grabbing interfaces back. - Force the renderer in your YAML file. Edit
/etc/netplan/00-installer-config.yaml. At the top, addrenderer: networkdunder thenetwork:line. Your file should look like:
network: version: 2 renderer: networkd ethernets: ens18: dhcp4: no addresses: - 192.168.1.100/24 gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8, 8.8.4.4] - Remove any other YAML files. Check
/etc/netplan/for extra files like01-netcfg.yamlor99-custom.yaml. Delete them or move them to a backup folder. Netplan merges all YAML files alphabetically, and a stray file can override your static config. - Apply the config.
sudo netplan apply. Then runsudo netplan tryand wait 120 seconds. If you lose SSH, the try will revert. You’ll confirm manually. - Enable systemd-networkd.
sudo systemctl enable systemd-networkd; sudo systemctl restart systemd-networkd. Then checkip a— your static IP should be back.
Still Fails? Check This
If the IP still doesn’t come up after step 6, the problem is likely a cloud-init override. Cloud-init runs on first boot and can rewrite netplan configs. Snapshots that were taken before cloud-init finished will get hit. Fix it by disabling cloud-init network config: create /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the line network: {config: disabled}. Then reboot. Cloud-init will stop touching your netplan files entirely.
Another edge case: if you’re using network-manager intentionally (like on a desktop install), reverse the renderer to NetworkManager and enable that service instead. But for servers: stick with systemd-networkd. It’s simpler and doesn’t fight snapshots.
Pro tip: Before taking production snapshots, run
sudo netplan getand save the output. After restore, compare. Saves you 20 minutes of head-scratching.
Was this solution helpful?