Repository navigation
Description
What is the issue?
I have MagicDNS enabled and my machine accepting it with tailscale set --accept-dns=true.
When my local DNS resolver changes, my system apparently does not use it. While the Tailscale VPN is activated (and no traffic is even being routed through it), my system will only use the locally set DNS resolver in place when Tailscale first started. So when I change my DNS resolver this is ignored. I can only observe this indirectly by using another service that reports my DNS resolver to me. The actual resolver being used doesn't appear in scutil --dns, networksetup -getdnsservers Wi-Fi or cat /etc/resolv.conf
My situation: I run dnscrypt-proxy locally with some aggress DNS ad blocking rules and typically have my DNS resolver set to 127.0.0.1. However, when the DNS blocking is too aggressive I have a shortcut that changes my system's DNS resolver to my LAN's resolver. Normally this works fine, however when Tailscale + MagicDNS is enabled changing my local DNS resolver has no affect.
In a very mysterious way Tailscale somehow makes my system keep using the DNS resolver set when Tailscale was started, ignoring all my local DNS settings.
Steps to reproduce
- Make sure Tailscale is off, MagicDNS is on for your account, and locally has
--accept-dns=true. - Set my system's DNS resolver to Cloudflare with this:
networksetup -setdnsservers Wi-Fi 1.1.1.1 - Start Tailscale connection:
tailscale up - Run
scutil --dnsand observe 1.1.1.1 in my DNS settings. - Use the https://my.nextdns.io/ to observe that Cloudflare is my resolver (screenshot)
- Change my local DNS resolve to be Quad9 with this:
networksetup -setdnsservers Wi-Fi 9.9.9.9 - Go back to https://my.nextdns.io/ and observe that Cloudflare is still the resolver!
- Run
scutil --dnsand observer than Cloudflare's1.1.1.1resolver isn't listed anywhere in my local DNS settings but Tailscale is somehow making my system still use Cloudflare as the resolver. - Turn off Tailscale and check DNS server again to observe that it's now using Quad9 as expected.
Also here's some more screenshots of my tailscale settings:


Are there any recent changes that introduced the issue?
I am a new Tailscale user so I've always observed this behavior.
OS
macOS
OS version
14.3.1
Tailscale version
1.66.4 tailscale commit: 067defc641850791142cc83a44dadae29709344a
Other software
I'm running Little Snitch but all the testing done above was done with Little Snitch off. (however it was still installed on the system, so that might be contributing).
I also ensured that iCloud Private Relay was off (both system wide and the Wi-Fi network specific "Limit IP Address tracking" option).
Bug report
BUG-cafb7d6238f79c6992e84aac8608faa66cc8d12fb844958915c46f6c20dd3592-20240523200412Z-9d50dc0ca9a3f0be
Activity
[-]macOS: With MagicDNS enabled Tailscale does not respect changes to my local DNS resolver. Forced to keep using the resolver set when Tailscale first started[/-][+]Tailscale does not observe changes to local DNS resolver while an interface is up[/+]agottardo commentedon May 24, 2024
I can reproduce on macOS 14.5. The backend reads the DNS configuration for the default route interface every time the default route interface changes. However, it doesn't observe for changes in real-time. If I attempt to modify the DNS servers specified in Settings.app while my Wi-Fi is up, Tailscale won't pick up the change in resolver until I toggle my Wi-Fi off and on again.
varenc commentedon May 24, 2024
If it helps, here's my theory of what's happening:
en0), so the traffic is sent there.And there is the bug I believe.
A bigger question to me is why macOS needs to send all DNS queries to the Tailscale declared resolver when I only care about it for a very narrow set of things. Ideally only DNS queries already matching the search domain/prefix
*.xx-yy.ts.netand*.100.in-addr.arpawould get sent to this resolver. I'm guessing Tailscale has to implement it this way for macOS limitation reasons?agottardo commentedon May 24, 2024
100.100.100.100 is the local DNS forwarder inside the Tailscale client.
As you correctly identified, the issue is that at the moment Tailscale doesn't observe DNS changes. It only reads the DNS server when the VPN goes up and starts using an interface, or when your Mac switches between interfaces (for instance, unplugging your Ethernet cable and switching to Wi-Fi). So we need to build that ability to observe changes and re-configure our DNS forwarder with the new upstream DNS.
Yes, we could do split DNS in the case of your very simple setup. But we do need to handle all DNS on the system for more advanced features, such as app connectors. Handling all queries also allows us to do things that the built-in operating system resolvers don't normally do, such as automatic upgrade to DNS over HTTPS when attempting to connect to the most popular public resolvers.
varenc commentedon May 24, 2024
Thanks for the context! It makes sense given the other features that Tailscale would want to handle DNS exclusively. With this bug fixed I can't think of other drawbacks.
My workaround for this in the mean time is to keep MagicDNS enabled but turn it off locally with
--accept-dns=false. Then I have setup some forwarding rules in my dnscrypt-proxy configuration that forward requests matching my ts.net search domain or .100.in-addr.arpa to the Tailscale 100.^4 resolver. (100.* isn't quite correct, should be 100.64.0.0/10)barnstar commentedon Apr 28, 2025
This issues was resolved in 1.82. DNS configuration changes will now get propagated to Tailscale even while it's running.