/etc/resolve.conf overwritten by NetworkManager

Did check this morning my /etc/resolve.conf and was surprised what I found in it:

# Generated by NetworkManager
search kpn lan
nameserver 192.168.2.254

In the past I had installed dnscrypt-proxy and that is still running. It needs nameserver 127.0.0.1 in resolve.conf and I know I had to do something to make sure resolve.conf was not overwritten. I checked my notes and see I had then to add NETCONFIG_DNS_POLICY="" to /etc/sysconfig/network/config. At that time I checked and things worked.

So it looks meanwhile things changed and NetworkManager took over resolve.conf

Searched the Internet and found you could prevent NetworkManager managing DNS by editing /etc/NetworkManager/NetworkManager.conf but I do not have that file, I have the /etc/NetworkManager/conf.d directory but that is empty. Reading “man NetworkManager.conf” it seems that is no problem and configuration can be done using files in conf.d

# cat /etc/NetworkManager/conf.d/do_not_touch_dns
[main]
dns=none
rc-manager=unmanaged

Restarted the network using sudo systemctl restart network but resolv.conf is still overwritten.

Could not find it in the documentation but renamed the file so it has a .conf extension and changed the access rights to 600

$ sudo mv /etc/NetworkManager/conf.d/do_not_touch_dns /etc/NetworkManager/conf.d/do_not_touch_dns.conf
$ sudo chmod 600 /etc/NetworkManager/conf.d/do_not_touch_dns.conf
$ ls -l /etc/NetworkManager/conf.d/do_not_touch_dns.conf
-rw------- 1 root root 37 May  8 10:20 /etc/NetworkManager/conf.d/do_not_touch_dns.conf

And now resolve.conf is no longer touched again.
Problem solved.

1 Like

Is package sysconfig-netconfig installed?

I checked but no it is not and that likely explains why the method of editing /etc/sysconfig/network/config did not work. I am 99% sure I did not install it in the past myself so is that maybe a package that did go fro default included to default not included?

It was required by wicked and now Tumbleweed defaults to NetworkManager.

1 Like