[CentOS] Unexpected /etc/resolv.conf updates on CentOS 7

Wed Oct 13 18:06:09 UTC 2021
J Martin Rushton <martinrushton56 at btinternet.com>

If you just want to tell NM to clear off and leave your resolv.conf 
alone do the following:

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 

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://lists.centos.org/mailman/listinfo/centos

J Martin Rushton MBCS