Sample Header Ad - 728x90

NetworkManager Default Connection Settings

13 votes
1 answer
4940 views
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](https://www.dnscrypt.org/) 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 looks like this:
-ini
[ipv4]
dns=127.0.0.1;
ignore-auto-dns=true
method=auto
In my research I found this in the NetworkConfig.conf manpage:
-none
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:
-ini
[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.
Asked by marceloneil (403 rep)
Jan 10, 2017, 02:41 AM
Last activity: Feb 12, 2024, 04:01 PM