[CentOS] centos 6 - changing resolv.conf by hand gets overwritten by rebooting

Fri Aug 28 08:50:13 UTC 2015
Nicolas Thierry-Mieg <Nicolas.Thierry-Mieg at imag.fr>


On 08/27/2015 09:36 PM, George wrote:
> 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).

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

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