I'm trying to figure out how to configure my DHCP client on Ubuntu server 18.04.
I have the following netplan configuration, coming from cloud-init:
network:
version: 2
ethernets:
ens160:
dhcp4: true
match:
macaddress: 02:dc:01:00:38:4c
set-name: ens160
This seems to properly configure my network interface with an ip address, dns, default gateway and search domain. However, I'm wondering how to obtain a hostname from DHCP. I've been looking into dhclient which provides some convenient hooks that I can use, however it doesn't appear that dhclient hooks are being called. I've noticed that cloud-init calls dhclient as per the logs, but as some sort of sandboxed version, which seems to ignore the hooks.
I've also noticed that systemd-networkd reports some DHCP activity regarding to DHCP leases.
Could someone shed some light into the process?