View Full Version : resolv.conf being overwritten

24th July 2007, 09:11 AM
Is there any way to prevent /etc/resolv.conf being overwritten?

I've got a bunch of RHEL3 machines that have a custom /etc/resolv.conf that stays in place despite using DHCP to get IP details. My understanding is that this is due to the PEERDNS=no entry in /etc/sysconfig/network.

I'm trying to implement exactly the same network config on some FC6, F7 and RHEL5 boxes, but am running into the same problem every time.

As soon as networking is started, the DHCP process overwrites the /etc/resolv.conf

Has the functionallity changed since RHEL3?



24th July 2007, 12:57 PM
not sure what the issue is - I'm pretty swamped right now and can't offer much help.
quick fix = /usr/bin/chattr +i /etc/resolv.conf

24th July 2007, 12:58 PM
also, the peerdns=no might have to go into the adapter specific config. just a guess.

24th July 2007, 04:07 PM
I've just added the PEERDNS=no to the ifcfg-eth0 script. Seems to work perfectly now - I'll do some more testing though.



24th July 2007, 04:19 PM
It could be NetworkManager thats overwriting the file.
#service NetworkManager stop
then edit your /etc/resolve.conf file manually
This solved this same issue for me.

24th July 2007, 05:47 PM
If NetworkManager seems to be overwriting your /etc/resolv.conf, it's using dhclient. You can modify the behavior of dhclient using /etc/dhclient.conf. I append a couple of dns domaines to my search path. There's a man page for it.