I'm trying to modify NetworkManager's default DNS settings so that whenever I add a new connection it uses instead of the default DNS for that connection. I still would like to be able to modify the DNS for each individual connections afterwards however.

I set up DNSCrypt recently, and it worked great on most networks. However, some networks that I use require that I use their DNS server instead of DNSCrypt, meaning that I cannot simply set the default nameserver on resolv.conf to I found that NetworkManager/nmcli still did a good job of using DNSCrypt when I changed some of the networks to use However, it would be very nice if each new connection had this config by default:

/etc/NetworkManager/system-connections/connection.conf looks like this:


In my research I found this in the NetworkConfig.conf manpage:

Specify default values for connections. […]



However, there are only a few supported properties, and trying this did not work:


I was wondering if there were any know workarounds to this issue, either using NetworkManager or something different.

  • Have you ever found a solution to this? Commented Sep 30, 2017 at 20:48
  • 1
    Unfortunately no, I ended up switching to systemd-networkd, but I have yet to implement dnscrypt Commented Sep 30, 2017 at 20:54
  • 2
    I researched based on your comment and, since NetworkManager now uses systemd-networkd (at least on Ubuntu 17.04), the only thing I had to was create the /etc/systemd/network/ files and restart both services. I continue using NetworkManager and systemd takes care of the DNS (tested with systemd-resolve --status). Commented Sep 30, 2017 at 22:00

1 Answer 1


I am not allowed to comment yet to probe for further information to ensure that I can accurately solve your issue, however, I don't believe that I need too based on what I read in the documentation and from experience using other software packages constructed in this manner. While I don't have the ability to test this out right now to make absolutely sure that it is accurate from what I gleaned, you can put your default values into a file under /usr/lib/NetworkManager/system-connections and they take less weight than the versions in /etc/NetworkManager/system-connections. Then in the etc tree, you can just override what you want changed.

Maybe try putting your initial solution into the /usr/lib tree named the same as the file you have under the etc tree:


Generally speaking, files under /usr/lib/* are meant to be what the package maintainer wants you to use (or a sane default) and /etc/ is for what the sysadmin (you) wants to use, so I don't see why it doesn't apply here as well.

Should this solution not fix the issue, I also propose that you create some sort of transient config for those "other networks" that you have to use from time to time like the VPN configurations do. That way you only need to change your settings when you need them instead of trying to create a happy-medium config that will fit all... Doing so will likely reduce potential issues with routing from attempted traversal of invalid paths.

Lastly, in your question, you stated that you tried to place ipv4.xxxx under [connection]. You have to place those statements in their proper stanza under [ipv4].

You seem to know what's up, so maybe the bit about /usr vs /etc was what is eluding you. (the same is true for files in /var too btw.) Good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .