0

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

cjones26
  • 276
  • 1
  • 6
  • 18

1 Answers1

1

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?

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • 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? – cjones26 Sep 05 '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 05 '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. – cjones26 Sep 05 '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 05 '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: http://pastebin.com/raw.php?i=UGmEe4ft – cjones26 Sep 05 '12 at 17:13
  • Figured it out..turns out a Citrix script was writing to the /etc/hosts file and not able to pick up on the proper IP..instead of trying to figure out why, I just commented out the line. Thanks anyway for the help :)! – cjones26 Sep 05 '12 at 17:31
  • Well, damn... that works. – ewwhite Sep 05 '12 at 17:34