Linux – CentOS 5.8 why does the /etc/hosts file mess up after a reboot

centoscentos5hostshosts-filelinux

I'm running CentOS 5.8 (it's the Citrix XVA appliance provided on the website) but having an issue where every time I restart the server, the /etc/hosts file loses the IP address of the server…for instance, the way the host file should looks is like so:

127.0.0.1     localhost.localdomain localhost
10.0.0.50     localhost.localdomain citrix-ls

But instead, after a reboot, it looks like this:

127.0.0.1     localhost.localdomain localhost
              localhost.localdomain citrix-ls

Anyone have any idea why this would be happening? I'm thinking of just writing a script to replace the /etc/hosts file at each boot.

Any assistance would be appreciated–thanks!

-slashp

Best Answer

Just so you know, this is an incorrect setup. You should consider making your hosts file reflect the following, where "youdomain.name" is your local network's fully-qualified domain name (FQDN):

127.0.0.1     localhost.localdomain localhost
10.0.0.50     citrix-ls.yourdomain.name citrix-ls

Also see: Setting the hostname: FQDN or short name?