how can I configure Google Cloud SSH browser to not change the hostname?

Saif asked:

When you create new instance like “my-instance-1”, this mean your instance Host name will be also “my-instance-1” !.

The problem is when you change the host name for example to “”, every time you use the Google SSH browser tool, or upgrade the instance, the host name will be automatically changed to “my-instance-1” !.

Why Google SSH browser tool change instance hostname ?

My answer:

In my CentOS VMs I found that the script /etc/dhcp/dhclient.d/, installed by the google-compute-engine RPM, actually changed the hostname. This happens when the instance gets its IP address during boot.

While it’s not the long-term solution I really want, for now I simply deleted this script. The hostname I set with hostnamectl now persists after a reboot.

The script is likely to be exactly the same place in Debian/Ubuntu VMs, but of course I don’t run any of those.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.