You are not logged in.

#1 2020-04-04 12:30:16

Okami no seishin
Member
From: Ukraine, Kiev
Registered: 2018-06-29
Posts: 4

Set NetworkManager to ignore DHCP DNS only

I need to achieve the following:

  • use systemd-resolved as local caching DNS resolver;

  • ignore DHCP-provided DNS addresses for all connections, but

  • use connection-specific DNS if it is set in connection properties manually.

I can achieve this without last requirement using following configuration:

/etc/NetworkManager/NetworkManager.conf

[global-dns-domain-*]    
servers=127.0.0.53

/etc/systemd/resolved.conf

[Resolve]
DNS=176.103.130.130 2a00:5a60::ad1:0ff
FallbackDNS=176.103.130.131 2a00:5a60::ad2:0ff
Domains=~.

As expected due to using [global-dns-domain-*], connection-provided DNS does not sent to systemd-resolved (no such per-link DNS in it's terminology; Domains=~. is redundant in this case). But this approach has significant downside: some specific connections such as VPN can not use it's own DNS without reconfiguring NetworkManager.

There are also one related, weird behavior: in case of using following configuration some connections (like mobile hotspot) still using DHCP DNS, while others (home access point) - doesn't. Home AP uses ISP-provided DNS, which is not AdGuard.

/etc/NetworkManager/NetworkManager.conf; systemd-resolved config the same as above

[main]
dns=none

In this case systemd-resolved receives (should not) DHCP DNS from NetworkManager (gateway address in both cases), but due to Domains=~. uses global DNS forcibly. Not for some connections though. Also on both APs systemd-resolved log with debug enabled shows both DHCP and global DNS in Using DNS server <IP> lines. Cache is turned off for testing.

Ideally, NetworkManager should send to systemd-resolved only manually set DNS addresses (is it possible?), and systemd-resolved should work in default mode preferring per-link DNS over global.


Respectfully, Okami no seishin

Offline

Board footer

Powered by FluxBB