Toralf Lund
2021-Oct-14 06:25 UTC
[CentOS] [External] Re: Unexpected /etc/resolv.conf updates on CentOS 7
On 13/10/2021 20:06, J Martin Rushton via CentOS wrote:> If you just want to tell NM to clear off and leave your resolv.conf > alone do the following:I might possibly be able to set up a workaround based on that, but it's not what I really want. Ideally I want NetworkManager to update resolv.conf, but only if it actually set up a new connection and/or got new information. Which is what it seemed to do in the past, but then something changed... - Toralf> > If you don't want it to touch the contents of the file then remove all > DNSx= parameters from all ifcfg files and add PEERDNS=?no? instead. > Now you are solely responsible for setting the content of > /etc/resolv.conf yourself. > > You may also have to edit /etc/NetworkManager/NetworkManager.conf and > add dns=none to the [main] section. > > On 13/10/2021 18:24, Toralf Lund wrote: >> Hi >> >> Does here anyone know exactly when NetworkManager creates or is >> supposed to create /etc/resolv.conf for a network connection? Is >> there a way I can control it, or alternatively, is there a good way >> to debug the functionality? >> >> I thought that there would simply be an update whenever a connection >> was established, and an addresses/network info was received (if using >> DHCP), and that the information would pretty much be left alone after >> that. However, I've lately found that a new file gets written every >> few hours even though there is no connection change (that I can >> detect), i.e. the same link is up all along. Does anyone have any >> ideas why that might happen? I thought at first that the updates >> could be linked to DHCP lease renewal, but on closer inspection, that >> does not seem to be the case. I don't see anything in the system log >> related to networking at the points where a new file gets written. >> >> I get the above behaviour for my home Wifi net. It seemed to start >> after I switched to a new router, but that might be coincidental. >> It's a problem for me because I'm also using "commercial" VPN >> software (not integrated with NetworkManager) that will create it's >> own resolv.conf file; it replaces data e.g. from Network Manager when >> VPN is enabled, and restores it on disable. If NetworkManager >> "refreshes" the information in the mean time, the DNS config for VPN >> is lost, and the link doesn't work as expected... >> >> This is on a CentOS 7 system with all the latest updates. >> >> - Toralf >> >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.centos.org%2Fmailman%2Flistinfo%2Fcentos&data=04%7C01%7Ctoralf.lund%40pgs.com%7C8d1517edd2f44e2b991f08d98e743008%7C51d05d6147e9480b93b298dc84f1ed06%7C0%7C0%7C637697452053567265%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HH613vBZFHsnsTuJJi52I1%2FSM8Z22U1gVe%2BSsAqOPrg%3D&reserved=0 >> >
Simon Matter
2021-Oct-14 06:44 UTC
[CentOS] [External] Re: Unexpected /etc/resolv.conf updates on CentOS 7
> On 13/10/2021 20:06, J Martin Rushton via CentOS wrote: >> If you just want to tell NM to clear off and leave your resolv.conf >> alone do the following: > > I might possibly be able to set up a workaround based on that, but it's > not what I really want. Ideally I want NetworkManager to update > resolv.conf, but only if it actually set up a new connection and/or got > new information. Which is what it seemed to do in the past, but then > something changed...I'm not running CentOS 7 with NetworkManager so I could be wrong but, isn't it possible to run DHCP internally in NM or use dhclient? If so, did you really check that nothing has happened there like renewing of the lease? And did you also check on the ethernet link level that it never went down for a short period of time? Such things can happen in certain configurations. Or, could it be that you have some software which interacts with NetworkManager via dbus and therefore the problem happens? Regards, Simon