I'm new to the systemd world (and Ubuntu in general), but I tried to dig as deep as I could to try to answer this question myself, but not really getting anywhere.

I'm setting up VMs for both Ubuntu 18.04 and 20.04, and trying to have the hostname automatically set via DHCP. I can't seem to get it to work.

I guess one issue is that I'm not sure my DHCPd (Infoblox) is actually sending the hostname field in the DHCPv4 request. This is due to the fact that if I check on the /run/systemd/netif/leases/* file, there is no HOST* field. The netplan documentation seems to suggest that if the lease includes HOSTNAME, then by default the hostname should be set (use-hostname is true by default). I've also tried removing the /etc/hostname file which didn't do anything.

Has anyone successfully gotten their bionic or focal Ubuntu server's hostname set via DHCP? Anything special that needs to be done?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.