RedHat /etc/hosts problem

Posted by: wfaulk

RedHat /etc/hosts problem - 07/06/2007 14:57

I have about a hundred RedHat machines (RHEL4). I need to change /etc/hosts on each of them. However, I've found that after I change them manually, sometimes they forget the changes and revert to the old file. I'm not sure, but it looks like it's being overwritten on boot by the contents of /etc/sysconfig/networking/profiles/default/hosts, which is apparently normally accessed through the system-config-network programs. But sometimes when I edit /etc/hosts, that file is automatically updated.

What I'd like to know is how to make sure that that file gets updated, and, preferably, how it sometimes gets updated automatically. I'm sure that if I use the system-config-network GUI it'll get updated properly, but I don't really relish the hours that it will take to click through all hundred or so machines, when a script would take me about five minutes to write and five minutes to run, if that. I might be able to use the system-config-network-cmd app to export, modify, then import the, for lack of a better word, registry, but I've done that before with other things and I find that it often causes RedHat to think that its hardware has changed on reboot, which is irritating at the least, so I'd rather avoid that, if possible.

Also, just to let you know: I really f'n hate RedHat.
Posted by: matthew_k

Re: RedHat /etc/hosts problem - 07/06/2007 16:33

Any reason to not have your script modify /etc/sysconfig/networking/profiles/default/hosts and /etc/hosts?

Matthew
Posted by: wfaulk

Re: RedHat /etc/hosts problem - 07/06/2007 16:35

I have no idea if modifying /etc/sysconfig/.../hosts will break anything.
Posted by: JBjorgen

Re: RedHat /etc/hosts problem - 07/06/2007 16:54

run

# redhat-config-network-cmd --help
then
# redhat-config-network-cmd -o -e | more
to view the current profile.

You should be able to figure out how to import a new profile from there. I don't have a box I can play with at present.
Posted by: wfaulk

Re: RedHat /etc/hosts problem - 07/06/2007 17:15

Yeah, I know how to do that, but, like I said, it seems that when I do that, RedHat decides I have new hardware on reboot and tries to go through their stupid "you've got new hardware" wizard thing. I'd like to avoid that if possible.
Posted by: tman

Re: RedHat /etc/hosts problem - 07/06/2007 19:18

Quote:
Yeah, I know how to do that, but, like I said, it seems that when I do that, RedHat decides I have new hardware on reboot and tries to go through their stupid "you've got new hardware" wizard thing. I'd like to avoid that if possible.

I disable Kudzu after its done the initial install.