DHCP not working on Ubuntu 22.04 and above template
To work around this issue, VMware recommends to prepare a VM template running an Ubuntu Guest OS with an empty /etc/machine-id.
Solution 1 - Unset machine-id on template
Section titled “Solution 1 - Unset machine-id on template”- Clone your VM template to a new VM.
- Power on the new VM and run these commands inside the Linux Guest OS:
echo -n > /etc/machine-idrm /var/lib/dbus/machine-idln -s /etc/machine-id /var/lib/dbus/machine-id- Re-clone the new VM to a new VM template.
Solution 2 - Change client indentifier to MAC
Section titled “Solution 2 - Change client indentifier to MAC”Alternatively, prepare a VM template explicitly setting the dhcp client identifier to mac.
Example 1 - dhcp-identifier
Section titled “Example 1 - dhcp-identifier”set the dhcp-identifier: mac in the /etc/netplan/*.yaml file as below:
network: version: 2 renderer: networkd ethernets: default: match: name: e* dhcp4: yes dhcp-identifier: macExample 2 - ClientIdentifier
Section titled “Example 2 - ClientIdentifier”set the ClientIdentifier=mac in the /etc/systemd/network/default.network file.
Reference: link