Resolving DNS Conflicts with systemd-resolved and Tailscale

Resolving DNS configuration conflicts between NetworkManager, systemd-resolved, and Tailscale.

problem

The DNS configuration was not applied correctly; the system continued using the DNS server provided by DHCP (192.168.1.1).

root cause

NM was taking DNS from DHCP and sending it to systemd-resolved which had the stub resolver symlinked to resolv.conf.

solution

step 1: configure systemd-resolved

File: /etc/systemd/resolved.conf.d/00-custom.conf

[Resolve]
DNS=1.1.1.1
DNSStubListener=no

step 2: configure networkmanager

NetworkManager was also taking DNS from DHCP and forwarding it to systemd-resolved, so the configuration needed to be modified. NM reads all drop-in *.conf files from /etc/NetworkManager/conf.d/.

File: /etc/NetworkManager/conf.d/dns.conf

[main]
dns=none
systemd-resolved=false