5

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

Greg Askew
  • 35,880
  • 5
  • 54
  • 82
ddario
  • 511
  • 1
  • 3
  • 12

2 Answers2

0

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.

Overmind
  • 3,076
  • 2
  • 16
  • 25
Francozen
  • 163
  • 5
0

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.

  • http://www.windowsazure.com/en-us/manage/linux/how-to-guides/linux-agent-guide/ Provisioning.MonitorHostName looks like a property to keep in mind as well. In case the above doesn't work you may want to try enabling that boolean to verify that it isn't overriding your hostname updates with its dhcp setup if applicable. –  Sep 06 '13 at 02:40