[CentOS] resolv.conf rewritten every reboot. How to figure out who and why?

Fri Oct 9 05:29:37 UTC 2009
Rob Townley <rob.townley at gmail.com>

On Thu, Oct 8, 2009 at 4:39 PM, Dave <tdbtdb+centos at gmail.com> wrote:
> On Thu, Oct 8, 2009 at 11:27 AM, Meenoo Shivdasani <meenoo at gmail.com> wrote:
>> /etc/init.d/network calls /etc/sysconfig/network-scripts/ifup which
>> calls /sbin/dhclient which calls /sbin/dhclient-script which
>> overwrites your resolv.conf with the info it gets from the DHCP server
>> on the network.
>
>
> How would I find this out on my own? And it seems not to be correct.
> At least, if /etc/sysconfig/network-scripts/ifup calls
> /sbin/dhclient, it must use some indirection, as dhclient is not
> mentioned in the script explicitly:
>
> grep -i dhc /etc/sysconfig/network-scripts/ifup
> if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
>
>
> Why does it overwrite /etc/resolv.conf when the machine is not set to
> use DHCP? The IP address etc. is set statically using
> /usr/bin/system-config-network.
>
> Dave
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

i feel the pain as i went through this just last night on a multihomed
CentOS 5.3 box.  It was using old and wrong lease info which helped me
notice it as a problem.

i ended up deleting:

/var/lib/dhcpd/dhclient.leases
/var/lib/dhcpd/dhclient.leases~
/etc/dhclient.conf  (but you should make a backup or at least look at
the dhclient.conf because i think you can tell it what ethX to work on
or not).
rm anything else associated with dhclient

Some guys say to uninstall NetworkManager, not just keep it from running.

Setting a static dhcp lease in our separate dhcpd server you would
think would fix this.  But static lease made things worse because
dhclient broke /etc/sysconfig/network-scripts/ifup-routes calls to
'/sbin/ip/route add" and "/sbin/ip/rule add".  With dhclient, i could
not set a default gw rule for each different network interface card.
After deleting the lease info and maybe changing the
/etc/dhclient.conf and then deleting it, i could have a separate
default gateway for each nic.

Ok, the other BUG is ping.  There is a bug in ping that has sucked up
much of my life for the last 2 or 3 years.  i will post separately on
the ping -I bug.