4

I'm trying to modify NetworkManager's default DNS settings so that whenever I add a new connection it uses 127.0.0.1 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 127.0.0.1. I found that NetworkManager/nmcli still did a good job of using DNSCrypt when I changed some of the networks to use 127.0.0.1. However, it would be very nice if each new connection had this config by default:

/etc/NetworkManager/system-connections/connection.conf

[ipv4]
dns=127.0.0.1;
ignore-auto-dns=true
method=auto

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

Specify default values for connections.

Example:

    [connection]
    ipv6.ip6-privacy=0

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

[connection]
ipv4.method=auto
ipv4.dns=127.0.0.1;
ipv4.ignore-auto-dns=true

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? – Teresa e Junior Sep 30 '17 at 20:48
  • 1
    Unfortunately no, I ended up switching to systemd-networkd, but I have yet to implement dnscrypt – marceloneil Sep 30 '17 at 20:54
  • 1
    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). – Teresa e Junior Sep 30 '17 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.