Forum Discussion
Hyper-v Ubuntu 26.04LTS Multiple DHCP entries
Hi, I think I know what could be happening. The Windows DHCP server does not identify clients only by the MAC, it uses the client identifier that the client sends in the request. Ubuntu with netplan and systemd-networkd sends by default an identifier based on a DUID and not the MAC, so if something else asks for an IP using the MAC the server thinks they are two different clients and gives two leases.
In your case I would check two things.
First open the DHCP console, go to Address Leases and compare the Unique ID column of the .20 and the .21. If one of them is just the MAC of the VM and the other one is a long string, that's the problem.
Second, if it's a Generation 2 VM check the Firmware section in the VM settings. If the Network Adapter is above the Hard Drive in the boot order, the UEFI firmware tries a network boot first and asks for an IP with the MAC before Ubuntu starts. That would explain why the .20 never answers to ping and why it doesn't disappear when you shut down the VM, because only Ubuntu releases its lease and the firmware never does. Just move the hard drive to the top or remove the network adapter from the boot order.
You can also make Ubuntu use the MAC as identifier. Edit the yaml file in /etc/netplan and under your interface add dhcp-identifier with the value mac next to dhcp4 true, then run sudo netplan apply. After that delete the old lease in the DHCP console and restart the VM, you should only see one lease.
Hope it helps!