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

Wed Oct 13 17:24:26 UTC 2021
Toralf Lund <toralf.lund at pgs.com>

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