I tried the two following options, but I do continue to see Network Manager overwrite the /etc/resolv.conf file:
(1) chattr +i /etc/resolv.conf
(2) Putting the preferred dns of 127.0.0.1 in the /etc/systemd/resolved.conf file but I notice the /etc/resolv.conf file continues to be over written by Network Manager. Maybe this is expected?
That being said, I found the following solution. I’d like to get some feedback on whether this is the best option for someone using Manjaro:
By default, NetworkManager Linux dynamically updates the /etc/resolv.conf file with the DNS settings from active NetworkManager connection profiles. This section describes different options on how to disable this feature to manually configure DNS settings in /etc/resolv.conf .
(1) Create the 90-dns-none.conf configuration file.
Otherwise your stuff looks like it might be alright. I think maybe some of your confusion might have come from systemd-resolved ? In any case, a lot of what you wrote above depends on your resolve method.
(openresolv vs systemd-resolved , systemd-resolvconf)
Try using systemd-resolved - ArchWiki .
It is recommended to do: sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
And afterwards: systemctl enable --now systemd-resolved
After this you can check your resolver settings using: resolvectl status
Technically my goal is to choose the the best method to support Unbound setup with DNSSEC setup. I’m doing some more reading here to see I can figure out what works best with openresolv\Unbound:
Then run resolvconf -u to generate /etc/resolv.conf .
So this is why originally I had thought I did not have to do anything to prevent Network Manager from overwriting the file. Then when the file changed I ended up finding the Redhat solution.
I followed the Great Arch Wiki’s suggestions (and also, meticulously verified to suite my needs), to avoid the overwhelming of /etc/resolv.conf by NetworkManager, Independently from specifical needs.
As the title of your topic states, you asked how to prevent/stop NetworkManager from touching /etc/resolv.conf.
Furthermore, doing a chattr on a system file, is discouraged.
Anyway, despite your specific needs, keep in mind that, when any modification of the system is done, other than keeping track of editings, is a good practice take a back up of every involved file and command.
Thanks D Dave. When you work in the IT industry well check-ins and backups are our thing. The big picture for me here is making sure at the end of this discussion that other end users can have 1 complete solution.
That being said I think the group of us can agree a number of factors can cause the /etc/resolv.conf to be modified. I re-implemented the “/conf.d/90-dns-none.conf” file and noticed Network Manager blew away my resolv.conf too.
So i decided to re-do my suggested solution from the very beginning and that did not blow away resolv.conf. The missing step was “systemctl reload NetworkManager”. It makes me wonder whether we use your or my solution with this additional step whether this would make all the difference? How does a regular end user would figure this one out, could one of our solutions be deprecated? Seems to be proof of how results between systems and end uses can be inconsistent.
Assume your system is using openresolv to manage your /etc/resolv.conf file.
By default, NetworkManager Linux dynamically updates the /etc/resolv.conf file with the DNS settings from active NetworkManager connection profiles. This section describes different options on how to disable this feature to manually configure DNS settings in /etc/resolv.conf .
(1) Create the 90-dns-none.conf configuration file.