$ cat proxmox-lxc-containers-can-t-reach-the-network-after-restore.md
Proxmox LXC Containers Can't Reach the Network After Restore: The Duplicate MAC Address Trap
You restore a container from backup to test it. The original is still running. Within a minute, both start dropping packets, SSH sessions freeze, and your DHCP server hands out leases that seem to belong to the wrong machine. Nothing in the logs says “duplicate.” It just feels haunted.
The cause is usually a repeated MAC address on the same bridge.
How it happens
A container’s NIC definition lives in its config file, including the hwaddr value:
net0: name=eth0,bridge=vmbr0,hwaddr=BC:24:11:AA:BB:CC,ip=dhcp,type=veth
Backups store that line as is. When you restore a backup to a new VMID, Proxmox normally generates fresh MAC addresses, but only if you leave the “unique” option on. From the CLI:
pct restore 201 /path/to/backup.tar.zst --unique 1
Without --unique, the restored guest keeps the original’s MAC. The same applies if you copy a config file by hand, or if you restore with the old VMID on a second node that shares the same bridge segment. Clones made with pct clone get new addresses, so those are rarely the problem.
Two devices on one layer 2 segment with the same MAC confuse the switch. It keeps a table of which port owns which address, and it now sees that address arriving from two places. Traffic goes to whichever port spoke last. Hence the flapping.
Symptoms worth recognizing
- Pings succeed for a few seconds, then time out, then recover.
- An established SSH session hangs while a new one works.
- The router’s DHCP lease table shows one MAC with an IP that changes.
- Both containers get the same DHCP-assigned address, because DHCP keys on MAC (or client ID).
- Stopping either guest makes the other one perfectly healthy.
That last one is the quickest test. If the problem vanishes when you shut down a suspect, you have a collision.
Finding the duplicate
Dump every MAC defined across guests on a node:
grep -H -o -i 'hwaddr=[0-9a-f:]*' /etc/pve/lxc/*.conf
grep -H -o -i 'macaddr=\|virtio=[0-9a-f:]*' /etc/pve/qemu-server/*.conf
Then sort and look for repeats:
grep -h -o -i '[0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}' /etc/pve/lxc/*.conf /etc/pve/qemu-server/*.conf | tr 'a-f' 'A-F' | sort | uniq -d
Anything printed is a duplicate. In a cluster, /etc/pve is shared, so this covers all nodes. Be aware that it does not cover physical devices or guests on other hypervisors, so also check your router’s client list for anything odd.
To confirm from the network side, run arping -D -I vmbr0 192.168.1.x against the affected address, or look at the bridge forwarding table with bridge fdb show br vmbr0 | grep -i <mac>. If the same MAC keeps moving between ports, that’s your answer.
The fix
Stop the container you want to change. Never edit the MAC of a running guest and expect it to take effect cleanly.
pct stop 201
pct set 201 -net0 name=eth0,bridge=vmbr0,hwaddr=BC:24:11:12:34:56,ip=dhcp,type=veth
pct start 201
Note that pct set -net0 replaces the whole line. Copy the existing options first (pct config 201 | grep net0) so you don’t lose the VLAN tag, firewall flag, or static IP. If you omit hwaddr entirely in the set command, Proxmox generates a fresh one, which is often the easiest path.
Then handle the consequences:
- If the guest used a DHCP reservation, update the reservation to the new MAC or the container will get a random address.
- If the firewall at your router filters by MAC, update that too.
- Inside the container, some distros cache the old interface identity. Renewing the lease (
dhclient -r && dhclient, or restartsystemd-networkd) clears it. - Flush stale neighbor entries on the machines that talked to it:
ip neigh flush dev eth0.
Preventing it
When restoring for a test, always add --unique 1 or tick “Unique” in the GUI restore dialog. Unless you intend to replace the original, this should be habit.
For true disaster recovery, where the original is dead, keeping the MAC is a feature. Your DHCP reservations and firewall rules keep working with no edits. Just make sure the old host really is off before you start the restored one. I once spent an evening chasing a “network problem” on a container that turned out to be a forgotten test restore running on a second node, quietly fighting its twin since the previous weekend.
A quick duplicate check in a monthly cron script that emails you any output from the uniq -d command above costs almost nothing, and catches the forgotten restore before it costs you an evening.