Your Hypervisor Is Stealing Your Guests' IP Addresses
5 min read
A container that had run for months stopped getting an address after its host's bridge was moved from the onboard 1G NIC to a 10G port. The container's DHCP client looped forever:
dhcpcd: eth0: offered 192.168.1.50 from 192.168.1.1
dhcpcd: eth0: probing address 192.168.1.50/24
dhcpcd: eth0: 1c:xx:xx:xx:xx:41 claims 192.168.1.50
dhcpcd: eth0: DAD detected 192.168.1.50
The server was offering the right lease. Something else on the wire was already answering for it. Worse, as we worked the problem the claiming MAC changed three times, which made it look like we were chasing a moving target on the LAN.
The claimant was never on the LAN. It was the hypervisor itself.
What DAD is actually telling you
Before accepting an offered address, a DHCP client does duplicate address detection: it ARPs for the address it was just offered and waits to see whether anyone replies. A reply means somebody already has it, so the client declines the lease and asks again. That is correct behaviour, and it is why the loop never terminates on its own: the server keeps offering, the phantom keeps replying, the client keeps declining.
So DAD detected is not a bug in the guest. It is the guest correctly reporting that a second machine holds its address. The whole job is finding which one.
Failure mode one: an unscoped DHCP client on the host
dhcpcd with no interface restrictions configures every interface it can see. On a bare server that is what you want. On a virtualization host it is a trap, because the interfaces it can see include the physical NICs, the bridge, and, depending on version and configuration, the tap* and veth* interfaces the hypervisor creates for guests.
If the host's guests get addresses from the same LAN DHCP server the host uses, the host will cheerfully lease guest addresses onto its own ports and then answer ARP for them. That is exactly what had happened here. The host was holding two container addresses: one on the now-disconnected onboard NIC, and one on the physical port enslaved to the bridge.
The first command to run is on the host, not the guest:
ip -4 -br addr
A bridged hypervisor should show exactly two lines: loopback, and one address on the bridge. Anything else is a candidate:
lo UNKNOWN 127.0.0.1/8
enp3s0 UP 192.168.1.50/24
br0 UP 192.168.1.10/24
enp1s0f0 UP 192.168.1.63/24
Two of those addresses belong to containers. The host took them because nothing told it not to.
Failure mode two: orphan taps and a bridge that changes identity
When a guest restarts, or the bridge is reconfigured under it, the old tap* or veth* interface can survive as a DOWN / NO-CARRIER leftover still enslaved to the bridge, sometimes with a permanent forwarding-database entry attached to it:
ip -br link | grep -E 'tap|veth'
bridge fdb show br br0 | grep 1c:xx:xx:xx:xx:41
LOWERLAYERDOWN or NO-CARRIER on an interface whose guest is running is the orphan tell. In the fdb output, permanent means the entry was programmed rather than learned, so it will not age out on its own.
The moving-MAC symptom comes from a second Linux behaviour: a bridge with no explicitly configured MAC adopts one of its members' addresses, and re-picks when membership changes. Delete an orphan tap and the bridge's own MAC can change. The phantom ARP replier appears to have moved to a new machine when in fact it never moved at all.
Confirming who actually replies
Before changing anything, watch the wire from the host:
tcpdump -ni br0 -e arp and host 192.168.1.50
The source MAC on the ARP reply is the answer. Match it against bridge fdb show br br0 to find which bridge port it sits behind. If the fdb points at the uplink rather than at a local tap, the claimant is off-host and you need the switch's table. On RouterOS:
/interface bridge host print where mac-address=1C:XX:XX:XX:XX:41
That step earned its place here for an unrelated reason: it showed the uplink was on sfp-sfpplus4, not the port we had assumed. Verify the cabling from the switch's own table rather than from memory or a diagram.
The fixes
Scope the host's DHCP client so it only ever touches the bridge. In /etc/dhcpcd.conf:
denyinterfaces enp* ens* tap* veth* br0
That is the correct form when the host's address is static on the bridge, which is the arrangement to prefer. If the host takes its address by DHCP, invert it and name the one interface that may be configured:
allowinterfaces br0
Both keywords are in dhcpcd.conf(5), and denyinterfaces wins where a pattern matches both. Tested against dhcpcd 10.5.
Pin the bridge's MAC so it never inherits a member's address and never changes identity under you. In netifrc that is mac_br0= in /etc/conf.d/net; under systemd-networkd it is MACAddress= in the bridge's .netdev; on Debian's ifupdown it is bridge_hw. Check the exact syntax for your version before committing it, but the point is the same in all three: the bridge gets its own stable address.
Delete the orphans:
ip link del tap0a1b2c3d
A host reboot is the blunt equivalent and clears every leftover at once.
For hosts not running dhcpcd, the equivalent scoping is Unmanaged=yes in a systemd-networkd .network file whose [Match] selects the virtual interfaces, or nmcli device set <dev> managed no under NetworkManager.
Why the guest looked innocent
Throughout the incident the container's own ip addr was clean: no address, no conflict, nothing suspicious in its logs beyond the DAD loop. That is the diagnostic trap. The guest is the victim of the conflict, so its own state tells you nothing about the cause. When a guest cannot take a lease, the next command belongs on the host.
Checklist for any bridged host
- One address, on the bridge.
ip -4 -br addron the host shows exactly one non-loopback line. - DHCP client scoped to the bridge, by
denyinterfacesorallowinterfaces. - Bridge MAC pinned, so identity does not shift mid-debug.
- Guest addresses reserved on the DHCP server by the guest's MAC, never by a host interface's.
- No
tap*orveth*inip -br linkwithout a running guest behind it.