On Thu, Oct 8, 2009 at 5:39 PM, Dave tdbtdb+centos@gmail.com wrote:
On Thu, Oct 8, 2009 at 11:27 AM, Meenoo Shivdasani meenoo@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.
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:
My bad -- on the 4.x system I referred to, ifup is where it's called.
On my 5.x system, it's called by ifup-eth.
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.
Are there any interfaces that have BOOTPROTO=dhcp? Perhaps one that's not connected to the network?
grep BOOTPROTO /etc/sysconfig/network-scripts/ifcfg*
How would I find this out on my own?
That's a harder one to answer. I would start with the comment that got added to the resolv.conf file -- and Google resolv.conf dhclient. That brings up hits that describe several ways of avoiding the whole issue (and confirms for you that you're on the right track). man dhclient mentions dhclient-script, then poking around in various etc directories gets you to where it gets called from.
Making the leap to figuring out that PEERDNS is one of the ways that you can control whether or not resolv.conf gets modified would mean looking through the various definitions in ifcfg-eth0 and making sure that you know what each one does. When you hit one that you don't recognize, look it up. In this case:
PEERDNS=<answer>, where <answer> is one of the following: yes — Modify /etc/resolv.conf if the DNS directive is set. If using DCHP, then yes is the default. no — Do not modify /etc/resolv.conf.
M