What causing resolv.conf overwritten ?

Issues related to configuring your network
Locked
khapare77
Posts: 11
Joined: 2013/05/29 13:39:08

What causing resolv.conf overwritten ?

Post by khapare77 » 2013/05/29 13:59:29

Hello all,

I search for this issue quite a lot, there are numerous suggestion but cause is still not clear. I just installed the new CentOS release 6.4 (Final) and kernel 2.6.32-358.2.1.el6.x86_64 x86_64 x86_64. Some strange reason or even every now and then my /etc/resolv.conf is overwritten which is causing problem in name resolution. Let me tell you this - I have not installed the network manger on this machine (because many people always pointing to network manger) and not running at all. The interface is not configured to get IP address from DHCP. So there are the configuration :


There are total 6 interface on this machine
eth0
eth1
eth2
eth3
lo
usb0

eth2 is the only up and running

DEVICE=eth2
HWADDR=44:40:b5:b2:73:66
TYPE=Ethernet
UUID=07eec0f5-2936-4151-a1cf-dce0489cabfc
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.1.1
NETMASK=255.255.255.0
IPV6INIT=no
USERCTL=no
DNS1=192.168.1.5
GATEWAY=192.168.1.3

I read this thread but not real answer for the cause
http://lists.centos.org/pipermail/centos/2009-October/083346.html

So what is causing this resolve.conf overwritten ? anybody has clue or this is just a bug in some script ?

K

simon_matthews
Posts: 315
Joined: 2012/09/15 21:06:54

Re: What causing resolv.conf overwritten ?

Post by simon_matthews » 2013/05/29 15:18:20

I would first double check that none of the other interfaces is actually up and getting an IP address from a DHCP server, which then overwrites /etc/resolv.conf

khapare77
Posts: 11
Joined: 2013/05/29 13:39:08

Re: What causing resolv.conf overwritten ?

Post by khapare77 » 2013/05/29 16:10:42

No, I have checked all the interfaces, only one interface is up is eth2 which has a static IP.

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

What causing resolv.conf overwritten ?

Post by toracat » 2013/05/29 16:25:16

Have you tried adding "PEERDNS=no"?

khapare77
Posts: 11
Joined: 2013/05/29 13:39:08

Re: What causing resolv.conf overwritten ?

Post by khapare77 » 2013/05/29 17:51:04

well PEERDNS option is if you interface is set to get IP from dhcp server, isn't it ?

some guys were saying maybe this is related with annaconda ?

###############
From: rhelv6-list-bounces redhat com [mailto:rhelv6-list-bounces redhat com] On Behalf Of Brian Long (brilong)
Sent: Friday, March 16, 2012 4:07 PM
To: Red Hat Enterprise Linux 6 (Santiago) discussion mailing-list
Subject: Re: [rhelv6-list] resolv.conf being overwritten by NetworkManager

Are you certain the comment in /etc/resolv.conf about NetworkManager was not the one written by Anaconda during installation? Even when NetworkManager is not installed on the local disk, this comment will exist because Anaconda has it's own version of NetworkManager.

####################

well, after the installation NM_CONTROLLED was set to yes and I changed to no, But again NM_CONTROLLED is only applies if NetworkManager is installed and started however in my case I have no NetworkManger installed

Regards,
K

simon_matthews
Posts: 315
Joined: 2012/09/15 21:06:54

Re: What causing resolv.conf overwritten ?

Post by simon_matthews » 2013/05/31 15:54:05

Let me suggest again that the symptom is entirely consistent with one of the interfaces being configured with dhcp.

Look for an active dhcp client process by running:

[code]
ps -Af | grep dhc
[/code]
This should find either dhclient or dhcpcd if either is running.

numericullustration
Posts: 1
Joined: 2014/02/07 16:08:08

Re: What causing resolv.conf overwritten ?

Post by numericullustration » 2014/02/07 17:00:40

I had the same problem. Though its been a while since you posted and have no doubt moved on, I will post my answer in case its useful to someone else.

I'll quote from this doc a few times: https://access.redhat.com/site/document ... faces.html

I didn't even have NetworkManager installed, and all of my interfaces were set to be static. But, my interface files were set to use NetworkManager with this directive
" NM_CONTROLLED=answer
where answer is one of the following:

yes — NetworkManager is permitted to configure this device. This is the default behavior and can be omitted.
no — NetworkManager is not permitted to configure this device. "


Setting it to no didn't change things. But I noticed that like the file contents you pasted in with:
DNS1=192.168.1.5

I also had this DNS directive set to the IP of my DNS server and while the doc says:

"DNS{1,2}=address
where address is a name server address to be placed in /etc/resolv.conf if the PEERDNS directive is set to yes. "

It apparently rewrites /etc/resolv.conf whether PEERDNS is set or not if you have DNS

Also, at boot time the system will overwrite /etc/resolv.conf if you have SEARCH set to anything as well.


Other people also had issues with this:
https://www.redhat.com/archives/rhelv6- ... 00010.html

It looks like its related to these bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=824622
https://bugzilla.redhat.com/show_bug.cgi?id=744177
http://bugs.centos.org/view.php?id=6537

jareeda
Posts: 5
Joined: 2010/03/11 14:50:12
Location: Los Angeles

Re: What causing resolv.conf overwritten ?

Post by jareeda » 2014/11/26 11:26:13

I had this problem and resolved it by adding NM_CONTROLLED=NO to /etc/sysconfig/network-scripts/ifcfg-lo

All the other interfaces had that parameter, didn't dawn n me lo needed it too.

Joe

rwhirn
Posts: 1
Joined: 2015/09/20 01:04:23

Re: What causing resolv.conf overwritten ?

Post by rwhirn » 2015/10/10 01:19:33

I also found the following:
If you really want to set /etc/resolv.conf directly and you want to make sure NetworkManager won't overwrite it, you can set it up in /etc/NetworkManager/NetworkManager.conf.

Code: Select all

[main]
dns=none

Locked