I am using netplan to configure my wired interface via DHCP:
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: yes
dhcp6: no
I uninstalled dhclient and installed dhcpcd and even after running netplan apply, I cannot get the hostname (now via dhcpcd -U eno1).
If I manually do dhcpcd eno1 (before requesting the lease information), I can see the hostname.
Does networkd support using dhcpcd as the backend for dhcp leases? I presume that networkd must be using its internal DHCP client?
All I really want is to get the hostname for auditing purposes.
The hostname can be retrieved via netplan ip leases . It appears that it outputs the contents of a file residing in /run/systemd/netif/leases/<#>.
There is a field, HOSTNAME, that can be consumed. It appears systemd / netplan are indicating this may change in the future, but once the hostname is retrieved, it can be set in the normal means.