TransWikia.com

How to reset and persist the hostname and FQDN of an WIdows Azure Centos instance?

Server Fault Asked by ddario on December 23, 2021

How does one reset a hostname and domain name (FQDN) to localhost.localdomain on a Centos 6.2 Azure Instance? I’ve tried editing /etc/sysconfig/network, /etc/sysctl.conf, setting the hostname manually, but whatever I do, cannot get FQDN (i.e. the output of hostname -f command to localhost.localdomain.

Is there any specific way of persisting an FQDN such as this one on Centos?

Thanks

2 Answers

I'm not sure how does Azure work, but I can tell you that cloud providers typically ship modified OS images that include at least one of their package as replacements or addition of the vanilla packages provided by your Linux distro. For instance, on GCP there is a DHCPhook in /etc/dhcp/dhclient-exit-hooks that updates the /etc/hosts file. Maybe you can find the culprits in that area as well on Azure.

Answered by Francozen on December 23, 2021

Hostname can be set in CentOS / Redhat / Fedora:

Editing /etc/sysconfig/network

HOSTNAME=localhost.localdomain

OR running:

hostname localhost.localdomain

You most likely will need to restart networking:

service network restart

Side Note: Verify that your /etc/hosts isn't the one playing tricks on you. Shouldn't be the case in your example but a good point to keep in mind.

Answered by user182320 on December 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP