4

I run Ubuntu 20.04 based from the cloudimage... so netplan has its 50-cloud-init.yaml which just says .. use dhcp

In the background it uses systemd-networkd as backoffice

But how can I advise ubuntu to set the hostname based on option 12? In the past we used dhclient exit hooks but with netplan and systemd this doesn't work anymore. So how can I do this ?

The UseHostname Option in Section DHCP in /etc/systemd/networkd.conf is not accepted (unknown option)

6
  • What is "option 12"? Have you looked at /etc/hostname and man hostname?
    – heynnema
    Oct 19, 2020 at 22:36
  • I also have been unable to force my own hostname (option 12) or override a shorter lease time for testiing purposes as was trivial with dhclient. Doesn't your option request belong in /etc/systemd/network/10-wan.network (your 10-wan.network will be whatever for your network) instead of /etc/systemd/networkd.conf. Oct 19, 2020 at 23:41
  • option 12 is a dhcp option to inform the client about the hostname to be assigned from dhcp server point of view cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr_dhcp/configuration/…
    – stackelk
    Oct 20, 2020 at 5:35
  • the different networkd conf doesnt help. Obviously ubuntu 20.04 doesnt know anything about UseHostname or SendHostname 'Oct 19 21:02:39 sql-new systemd-networkd[1926]: /etc/systemd/networkd.conf:21: Unknown key name 'UseHostname' in section 'DHCP', ignoring. Oct 19 21:02:39 sql-new systemd-networkd[1926]: /etc/systemd/networkd.conf:22: Unknown key name 'SendHostname' in section 'DHCP', ignoring.'
    – stackelk
    Oct 20, 2020 at 5:37
  • According to systemd.network(5), the UseHostname option is supposed to be set in a DHCPV4 section, not a DHCP section. However, this manpage also specifies that it describes the syntax of .network files - not of /etc/systemd/networkd.conf. It does not appear to be possible to set UseHostname globally for networkd., you need to be able to modify a .network file to accomplish this.
    – slangasek
    Oct 21, 2020 at 20:06

1 Answer 1

0

As documented in netplan(5), you can specify use-hostname: true as part of the dhcp4-overrides for an interface.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .