1

I have tried setting my hostname to d-myserver1 via editing the /etc/hostname file and via 'sudo hostnamectl set-hostname d-myserver1'. If I run hostnamectl, the hostname is reflected properly. If I release and renew the IP, the correct hostname is reflected in my DHCP server.

The moment I reboot however, the d- is removed and my server reverts to a hostname of simply 'myserver1'.

What am I missing?

Matt
  • 21
  • Do you have a static hostname definition (in /etc/hosts)? Or perhaps the hostname myserver1 is being pushed via DHCP? – steeldriver Jun 14 '19 at 01:39
  • The issue was that /etc/cloud/cloud.cfg had preserve_hostname: false and needed to be changed to preserve_hostname: true. – Matt Jun 14 '19 at 14:03

1 Answers1

1

The issue was that /etc/cloud/cloud.cfg had preserve_hostname: false and needed to be changed to preserve_hostname: true.

Matt
  • 21