Symptoms
On Google Cloud Platform, the system hostname is changed either on boot or after some time. This can cause license errors.
Description
The dhclient
script may not preserve the locally-configured hostname, so hosting providers use scripts to work around this issue. For example, Google Cloud Platform Services™ uses the google_set_hostname
script.
The workaround scripts may interfere with WHM's "Change Hostname" feature ("WHM » Home » Networking Setup » Change Hostname"), which causes hostname configuration issues and a locked cPanel & WHM license.
Workaround
To resolve this issue, you must create a dhclient
exit hook script to set the hostname properly.
- Create the /etc/dhcp/dhclient-exit-hooks.d directory.
mkdir -p /etc/dhcp/dhclient-exit-hooks.d/
- Create the zzz-set-hostname.sh file.
touch /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh
- Edit zzz-set-hostname.sh and add the following information, replacing $host.domain.tld with the server's hostname.
#!/bin/sh
hostname $host.domain.tld
/scripts/fixetchosts - Set the executable permission on zzz-set-hostname.sh.
chmod +x /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh