Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 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?

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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