בלוגים – Howto: Set FQDN of a Redhat Linux cloud instance

Views: 555

Hostnames and FQDN are often far from what you desire.

Very often in the cloud, be it Openstack, Amazon, Azure or GC, The default hostname is not what you need. When you change the name, it often reverts after reboot. This is due to Cloud Init run at every boot.

Change a Red Hat Openstack instance  FQDN hostname in a few simple commands

First update the instance name, since otherwise when you reboot cloud init with change the name back. (this can be disabled in /etc/cloud/cloud.cfg)
$ openstack server set PRESENT-INSTANCE-NAME-OR-UUID   --name  NEW-host-NAME (not fqdn)
Now ssh into the Server instance
Edit the /etc/hosts file
$ sudo vi /etc/hosts
At the end of the file put
YOUR_IP_ADDRESS   YOUR-FQDN-HOSTNAME_WITHDOMAIN_NAME    YOUR-HOSTNAME
Then run
$ sudo hostnamectl set-hostname YOUR-FQDN-HOSTNAME_WITHDOMAIN_NAME

Howto: Set FQDN of a Redhat Linux cloud instance

Read More at the OctopusCS website:

Source: בלוגים – Howto: Set FQDN of a Redhat Linux cloud instance

Leave a Reply