CentOS 6 – Changing Resolv.conf By Hand Gets Overwritten By Rebooting

Home » CentOS » CentOS 6 – Changing Resolv.conf By Hand Gets Overwritten By Rebooting
CentOS 2 Comments

given machine with C6 x86_64 (seen on C 6.6 but also before and probably still present on C6.7) only 1 interface, there is dhcp on this network
(for kickstarting) but the machines have static ip’s, and NO
networkmanager installed

contents of resolv.conf search some.domain.here nameserver x.x.x.x #dns1
nameserver y.y.y.y #dns2

change resolv.conf to:
search some.newdomain.here nameserver z.z.z.z #dns3
nameserver a.a.a.a #dns4

reboot machine and the contents of resolv.conf is again:
search some.domain.here nameserver x.x.x.x #dns1
nameserver y.y.y.y #dns2

change it again to:
search some.newdomain.here nameserver z.z.z.z #dns3
nameserver a.a.a.a #dns4
reboot again now it stick to the last update.

Already tried to set /etc/sysconfig/network-scripts/ifcfg-eth0
NM_controlled=no with no result other suggestions around the internet suggest also to set in
/etc/sysconfig/network-scripts/ifcfg-eth0
usepeerdns=no have not tried this but should check if this fixes stuff.

Question: can someone explain me WHY this would help if it does and if this a valid entry in /etc/sysconfig/network ?
since I don’t want to go over all my machines (a couple thousand)
figuring out how many interfaces they have and what their names are to reconfigure that for each interface (some even suggest this should be done for lo too).

See also dozens of questions like that using google:
https://www.google.com/search?q

2 thoughts on - CentOS 6 – Changing Resolv.conf By Hand Gets Overwritten By Rebooting

  • I think that you want to create /etc/dhclient-enter-hooks with this, for more info do a search on dhclient-enter-hooks

    # vi /etc/dhclient-enter-hooks make_resolv_conf(){
    :
    }

    Pete

  • you should read:
    /usr/share/doc/initscripts-*/sysconfig.txt

    I would put DNS1 and DNS2 in the ifcfg-* file .