Softpanorama

Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Skepticism and critical thinking is not panacea, but can help to understand the world better

Network Manager overwrites resolv.conf

News

Linux Networking

Recommended Books

Recommended Links

NetworkManager

Disabling RHEL 6 Network Manager
Ethernet Protocol Linux ifconfig How to change IP address in RHEL ethtool Autonegotiation Traceroute
Network Utilities Configuring the Services Horror Stories  Unix History Humor Etc

RHEL 6  configured to use Network Manager, even if we install server. Network Manager is a desktop component, which is semi-useless for rack mounted servers with static IP and cable connection (it can be useful for initial installation, when your switch is not yet configured; you can use instead wireless card  to configure server via wireless network or USB to Ethernet adapter which you can connect to desktop DHCP segment). 

Moreover Network Manager is essentially a DHCP beast and it overwrites /etc/resolv.conf if you configure static IP parameters (see Network Manager overwrites resolv.conf for details) on reboot.  That comes to very unpleasant surprise as servers are not rebooted often and at this point you do not expect this Trojan horse inside your environment ;-)

Functionally Network Manager replaces old /etc/init.d/network script, but its useful functionality is limited mainly to wireless networks and desktops/laptops which use DHCP. It typically causes allergy for sysadmins who get used to static IP stack assignments.  And overwriting /etc/resolv.conf is just one of several side effects.

One on the solutions to this problem is top disable Network Manager completly. The second is to exemt particular interface from Network manager control

See Disabling RHEL 6 Network Manager


Top updates

Bulletin Latest Past week Past month
Google Search


NEWS CONTENTS

Old News ;-)

Network Manager overwrites resolv.conf - FedoraForum.org

--------------------------------------------------------------------------------

heey,
I have a problem with NetworkManager.... becouse every time it overwrites resolv.conf
I've searched around and i found a solution to set your dns servers in dhclient.conf, but that file not exist.
I use the DNS servers from my isp becouse if it go's thru my router my internet is verry slow......

thanks
Leon
-----------------
Linux Newb..


leonloopik
View Public Profile
Find all posts by leonloopik

#2 25th January 2008, 11:12 PM
marko Offline
Registered User Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 5,845


Are you implying it should not do that?

NetworkManager is supposed to overwrite the resolv.conf, that's
how it's designed to work. You don't have to use network manager,
just turn it off and then configure your network as you want it.

Mark


marko
View Public Profile
Find all posts by marko

#3 26th January 2008, 12:33 AM
Iron_Mike Offline
Registered User Join Date: Jul 2005
Location: Ft Huachuca, AZ
Posts: 3,772


Or you could go to system ->administration ->network, highlight your device, click edit and uncheck the box for "obtain dns information"

RHEL 6 discussion ()

Collins, Kevin [BEELINE] | 18 Nov 16:54 2010

/etc/resolv.conf getting replaced?
Collins, Kevin [BEELINE] <KCollins@...>
2010-11-18 15:54:59 GMT


I have been playing with RHEL6 for a couple of days now and I have found that my /etc/resolv.conf is being re-created by NetworkManager on reboot!

I end up with this:

# Generated by NetworkManager

nameserver xxx.xxx.xxx.xxx

nameserver xxx.xxx.xxx.xxx

Any other items I have added (such as domain and search) are lost... what gives? Anyone know how I can prevent this?

Thanks,

Kevin

_______________________________________________
rhelv6-list mailing list
rhelv6-list@...
https://www.redhat.com/mailman/listinfo/rhelv6-list

Permalink | Reply |
headersGlaser, David | 18 Nov 17:07 2010

Re: /etc/resolv.conf getting replaced?
Glaser, David <dsglaser@...>
2010-11-18 16:07:36 GMT


Are you getting nameserver information from DHCP?

If you are running DHCP, I'd try using NetworkManager and editing your connections, changing your type from Automatic (DHCP) to Automatic (DHCP) addresses only. Then you can set what you want your DNS servers and search domains to.

Dave

From: rhelv6-list-bounces-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org [mailto:rhelv6-list-bounces-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org] On Behalf Of Collins, Kevin [BEELINE]
Sent: Thursday, November 18, 2010 10:55 AM
To: rhelv6-list-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [rhelv6-list] /etc/resolv.conf getting replaced?

I have been playing with RHEL6 for a couple of days now and I have found that my /etc/resolv.conf is being re-created by NetworkManager on reboot!

I end up with this:

# Generated by NetworkManager

nameserver xxx.xxx.xxx.xxx

nameserver xxx.xxx.xxx.xxx

Any other items I have added (such as domain and search) are lost... what gives? Anyone know how I can prevent this?

Thanks,

Kevin

_______________________________________________
rhelv6-list mailing list
rhelv6-list@...
https://www.redhat.com/mailman/listinfo/rhelv6-list

Permalink | Reply |
headersCollins, Kevin [BEELINE] | 18 Nov 17:12 2010

Re: /etc/resolv.conf getting replaced?
Collins, Kevin [BEELINE] <KCollins@...>
2010-11-18 16:12:45 GMT


Thanks - I should have mentioned that I am using completely static networking information.

[root <at> cpafisxc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"

BOOTPROTO="static"

DNS1="xxx.xxx.xxx.xxx"

DNS2=" xxx.xxx.xxx.xxx "

GATEWAY=" xxx.xxx.xxx.xxx "

HWADDR="00:1C:C4:DD:24:08"

IPADDR=" xxx.xxx.xxx.xxx "

NETMASK="255.255.254.0"

NM_CONTROLLED="yes"

ONBOOT="yes"

Thanks,

Kevin

From: Glaser, David [mailto:dsglaser-63aXycvo3TyHXe+LvDLADg@public.gmane.org]
Sent: Thursday, November 18, 2010 8:08 AM
To: Collins, Kevin [BEELINE]; rhelv6-list-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: RE: /etc/resolv.conf getting replaced?

Are you getting nameserver information from DHCP?

If you are running DHCP, I'd try using NetworkManager and editing your connections, changing your type from Automatic (DHCP) to Automatic (DHCP) addresses only. Then you can set what you want your DNS servers and search domains to.

Dave

From: rhelv6-list-bounces-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org [mailto:rhelv6-list-bounces-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org] On Behalf Of Collins, Kevin [BEELINE]
Sent: Thursday, November 18, 2010 10:55 AM
To: rhelv6-list-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [rhelv6-list] /etc/resolv.conf getting replaced?

I have been playing with RHEL6 for a couple of days now and I have found that my /etc/resolv.conf is being re-created by NetworkManager on reboot!

I end up with this:

# Generated by NetworkManager

nameserver xxx.xxx.xxx.xxx

nameserver xxx.xxx.xxx.xxx

Any other items I have added (such as domain and search) are lost... what gives? Anyone know how I can prevent this?

Thanks,

Kevin

_______________________________________________
rhelv6-list mailing list
rhelv6-list@...
https://www.redhat.com/mailman/listinfo/rhelv6-list

Permalink | Reply |
headersAkemi Yagi | 18 Nov 17:26 2010


Re: /etc/resolv.conf getting replaced?
Akemi Yagi <amyagi@...>
2010-11-18 16:26:19 GMT

On Thu, Nov 18, 2010 at 8:12 AM, Collins, Kevin [BEELINE]
<KCollins@...> wrote:
> Thanks - I should have mentioned that I am using completely static
> networking information.

I confirm the behavior. Changes made in resolv.conf (for example by
system-config-network) do not survive a reboot.

Akemi

Permalink | Reply |
headersAkemi Yagi | 18 Nov 18:55 2010


Re: /etc/resolv.conf getting replaced?
Akemi Yagi <amyagi@...>
2010-11-18 17:55:30 GMT

On Thu, Nov 18, 2010 at 8:26 AM, Akemi Yagi <amyagi@...> wrote:
> On Thu, Nov 18, 2010 at 8:12 AM, Collins, Kevin [BEELINE]
> <KCollins@...> wrote:
>> Thanks - I should have mentioned that I am using completely static
>> networking information.
>
> I confirm the behavior. Changes made in resolv.conf (for example by
> system-config-network) do not survive a reboot.

To add a bit of more info on this ... If you edit the DNS info using
GUI ( nm-connection-editor ), then that will be preserved. Is this (to
use GUI) the only way ?

Akemi

Permalink | Reply |
headersBill Nottingham | 18 Nov 19:32 2010

Re: /etc/resolv.conf getting replaced?
Bill Nottingham <notting@...>
2010-11-18 18:32:33 GMT

Akemi Yagi (amyagi@...) said:
> >> Thanks - I should have mentioned that I am using completely static
> >> networking information.
> >
> > I confirm the behavior. Changes made in resolv.conf (for example by
> > system-config-network) do not survive a reboot.
>
> To add a bit of more info on this ... If you edit the DNS info using
> GUI ( nm-connection-editor ), then that will be preserved. Is this (to
> use GUI) the only way ?

NetworkManager should honor information in the ifcfg file.

Bill

Permalink | Reply |
headersAkemi Yagi | 18 Nov 19:47 2010


Re: /etc/resolv.conf getting replaced?
Akemi Yagi <amyagi@...>
2010-11-18 18:47:39 GMT

On Thu, Nov 18, 2010 at 10:32 AM, Bill Nottingham <notting@...> wrote:
> Akemi Yagi (amyagi@...) said:
>> >> Thanks - I should have mentioned that I am using completely static
>> >> networking information.
>> >
>> > I confirm the behavior. Changes made in resolv.conf (for example by
>> > system-config-network) do not survive a reboot.
>>
>> To add a bit of more info on this ... If you edit the DNS info using
>> GUI ( nm-connection-editor ), then that will be preserved. Is this (to
>> use GUI) the only way ?
>
> NetworkManager should honor information in the ifcfg file.
>
> Bill

Ah, yes, it does. Thanks for the note.

Akemi

Permalink | Reply |
headersFlorian La Roche | 19 Nov 07:24 2010


Re: /etc/resolv.conf getting replaced?
Florian La Roche <Florian.LaRoche@...>
2010-11-19 06:24:47 GMT

On Thu, Nov 18, 2010 at 01:32:33PM -0500, Bill Nottingham wrote:
> Akemi Yagi (amyagi@...) said:
> > >> Thanks - I should have mentioned that I am using completely static
> > >> networking information.
> > >
> > > I confirm the behavior. Changes made in resolv.conf (for example by
> > > system-config-network) do not survive a reboot.
> >
> > To add a bit of more info on this ... If you edit the DNS info using
> > GUI ( nm-connection-editor ), then that will be preserved. Is this (to
> > use GUI) the only way ?
>
> NetworkManager should honor information in the ifcfg file.

Hello Bill,

it does not if no MAC address is given in the ifcfg-* file, even
if NM_CONTROLLED=no is requested. But then disabling NetworkManager
is still a good cure...

regards,

Florian La Roche

Permalink | Reply |
headersJustin Clift | 18 Nov 19:48 2010

Re: /etc/resolv.conf getting replaced?
Justin Clift <jclift@...>
2010-11-18 18:48:31 GMT

If it helps, one of the first things I do on systems is disable NetworkManager, then re-enable the "known
good", older "network" service.

You need to change the physical network devices to no longer be under NetworkManager control:

/etc/sysconfig/network-scripts/ifcfg-eth0
NM_CONTROLLED="yes"

to

NM_CONTROLLED="no"

Then:

$ sudo chkconfig NetworkManager off
$ sudo chkconfig network on

This will cause the server style, non-dynamic non-NetworkManager configuration to be used from the next
boot onwards.

So, if you actually want NetworkManager running, don't do this. :)

Regards and best wishes,

Justin Clift

On 19/11/2010, at 3:12 AM, Collins, Kevin [BEELINE] wrote:

> Thanks - I should have mentioned that I am using completely static networking information.
>
> [root <at> cpafisxc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
> DEVICE="eth0"
> BOOTPROTO="static"
> DNS1="xxx.xxx.xxx.xxx"
> DNS2=" xxx.xxx.xxx.xxx "
> GATEWAY=" xxx.xxx.xxx.xxx "
> HWADDR="00:1C:C4:DD:24:08"
> IPADDR=" xxx.xxx.xxx.xxx "
> NETMASK="255.255.254.0"
> NM_CONTROLLED="yes"
> ONBOOT="yes"

Permalink | Reply |
headersAkemi Yagi | 18 Nov 20:03 2010


Re: /etc/resolv.conf getting replaced?
Akemi Yagi <amyagi@...>
2010-11-18 19:03:57 GMT

On Thu, Nov 18, 2010 at 10:48 AM, Justin Clift <jclift@...> wrote:
> If it helps, one of the first things I do on systems is disable NetworkManager, then re-enable the "known
good", older "network" service.

Right. I used to disable NM in RHEL5 (except for laptops). RHEL6 is
new, however, and I'd like to know how far I can go with NM on. So
far, the only situation where NM had be disabled is with KVM hosts
using bridged networking as documented here:

http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html-single/Virtualization/index.html#sect-Virtualization-Network_Configuration-Bridged_networking_with_libvirt

Akemi

Permalink | Reply |
headersCollins, Kevin [BEELINE] | 18 Nov 21:03 2010

Re: /etc/resolv.conf getting replaced?
Collins, Kevin [BEELINE] <KCollins@...>
2010-11-18 20:03:05 GMT

Thanks, Justin!

The Migration Guide has this to say:

NetworkManager
Red Hat Enterprise Linux 6 uses NetworkManager by default when
configuring network interfaces.

Not much help... :(

I was under the impression that NetworkManager was replacing network -
did not even look for anything else. This sounds like the right way to
go.

Thanks,

Kevin

-----Original Message-----
From: Justin Clift [mailto:jclift@...]
Sent: Thursday, November 18, 2010 10:49 AM
To: Collins, Kevin [BEELINE]
Cc: Glaser, David; rhelv6-list@...
Subject: Re: [rhelv6-list] /etc/resolv.conf getting replaced?

If it helps, one of the first things I do on systems is disable
NetworkManager, then re-enable the "known good", older "network"
service.

You need to change the physical network devices to no longer be under
NetworkManager control:

/etc/sysconfig/network-scripts/ifcfg-eth0
NM_CONTROLLED="yes"

to

NM_CONTROLLED="no"

Then:

$ sudo chkconfig NetworkManager off
$ sudo chkconfig network on

This will cause the server style, non-dynamic non-NetworkManager
configuration to be used from the next boot onwards.

So, if you actually want NetworkManager running, don't do this. :)

Regards and best wishes,

Justin Clift

On 19/11/2010, at 3:12 AM, Collins, Kevin [BEELINE] wrote:

> Thanks - I should have mentioned that I am using completely static
networking information.
>
> [root <at> cpafisxc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
> DEVICE="eth0"
> BOOTPROTO="static"
> DNS1="xxx.xxx.xxx.xxx"
> DNS2=" xxx.xxx.xxx.xxx "
> GATEWAY=" xxx.xxx.xxx.xxx "
> HWADDR="00:1C:C4:DD:24:08"
> IPADDR=" xxx.xxx.xxx.xxx "
> NETMASK="255.255.254.0"
> NM_CONTROLLED="yes"
> ONBOOT="yes"

Permalink | Reply |
headersBill Nottingham | 22 Nov 04:36 2010

Re: /etc/resolv.conf getting replaced?
Bill Nottingham <notting@...>
2010-11-22 03:36:33 GMT

Collins, Kevin [BEELINE] (KCollins@...) said:
> The Migration Guide has this to say:
>
> NetworkManager
> Red Hat Enterprise Linux 6 uses NetworkManager by default when
> configuring network interfaces.
>
> Not much help... :(
>
> I was under the impression that NetworkManager was replacing network -
> did not even look for anything else. This sounds like the right way to
> go.

NetworkManager is enabled if it's installed; however, it is only
installed by default in Desktop/Workstation installations.

Bill

Permalink | Reply |
headersCollins, Kevin [BEELINE] | 22 Nov 22:32 2010

Re: /etc/resolv.conf getting replaced?
Collins, Kevin [BEELINE] <KCollins@...>
2010-11-22 21:32:24 GMT

Hmmm... I am installing a server and my kickstart is not selecting
anything that is Desktop/Workstation oriented. But thanks for the
additional info!

Kevin

-----Original Message-----
From: Bill Nottingham [mailto:notting@...]
Sent: Sunday, November 21, 2010 7:37 PM
To: Collins, Kevin [BEELINE]
Cc: Justin Clift; rhelv6-list@...
Subject: Re: [rhelv6-list] /etc/resolv.conf getting replaced?

Collins, Kevin [BEELINE] (KCollins@...) said:
> The Migration Guide has this to say:
>
> NetworkManager
> Red Hat Enterprise Linux 6 uses NetworkManager by default when
> configuring network interfaces.
>
> Not much help... :(
>
> I was under the impression that NetworkManager was replacing network -
> did not even look for anything else. This sounds like the right way to
> go.

NetworkManager is enabled if it's installed; however, it is only
installed by default in Desktop/Workstation installations.

Bill


Recommended Links

Top Visited

Bulletin Latest Past week Past month
Google Search



How To Make Sure -etc-resolv.conf Never Get Updated By DHCP Client



Etc

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright 1996-2018 by Dr. Nikolai Bezroukov. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019