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:     localhost.localdomain localhost     localhost.localdomain citrix-ls

But instead, after a reboot, it looks like this:     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!



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):     localhost.localdomain localhost     citrix-ls.yourdomain.name citrix-ls

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

  • Ok that's fine, I can fix that when I come to it. For now, any ideas why the hosts file would be clearing out the IP address on each reboot? – slashp Sep 5 '12 at 16:28
  • "localhost.localdomain" is repeated. The file is read top-to-bottom. You may have a dynamic DNS or DHCP arrangement at the location. You may not have the hostname defined in /etc/sysconfig/network... There could be a few reasons. – ewwhite Sep 5 '12 at 16:38
  • Gotcha. I have a static IP set in my /etc/sysconfig/network-scripts/ifcfg-seth0 and my hostname set in /etc/sysconfig/network as well as /etc/sysctl.conf. Tried manually creating an A record on my DNS server but still no dice. – slashp Sep 5 '12 at 16:50
  • Change your /etc/hosts file as I specified in the original answer. That was meant to be the fix. – ewwhite Sep 5 '12 at 17:08
  • I did, the IP still blanks out after every reboot. Quite odd actually. See my ifcfg-seth0 & /etc/hosts file configuration as well if it's helpful: pastebin.com/raw.php?i=UGmEe4ft – slashp Sep 5 '12 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.