Skip to content

net/dns, ipn/local: skip health warnings in dns forwarder when accept-dns is false - #18572

Merged
barnstar merged 1 commit into
mainfrom
jonathan/dns-warnable
Feb 10, 2026
Merged

barnstar merged 1 commit into
mainfrom
jonathan/dns-warnable

Conversation

@barnstar

@barnstar barnstar commented Jan 30, 2026 •

Copy link
Copy Markdown
Member

fixes #18436

Queries can still make their way to the forwarder when accept-dns is disabled.
Since we have not configured the forwarder if --accept-dns is false, this errors out
(correctly) but it also generates a persistent health warning. This forwards the
Pref setting all the way through the stack to the forwarder so that we can be more
judicious about health warnings when the forward dns path is missing, vs intentionally
not configured.

Testing:
tailscale set --accept-dns=false. (or from the GUI)
dig @100.100.100.100 example.com
tailscale status

No dns related health warnings should be surfaced.

@barnstar
barnstar requested review from fserb and willh-ts January 30, 2026 20:08
@barnstar
barnstar force-pushed the jonathan/dns-warnable branch 2 times, most recently from 94db30d to 030b26c Compare February 2, 2026 15:26
…-dns is false

fixes #18436

Queries can still make their way to the forwarder when accept-dns is disabled.
Since we have not configured the forwarder if --accept-dns is false, this errors out
(correctly) but it also generates a persistent health warning.   This forwards the
Pref setting all the way through the stack to the forwarder so that we can be more
judicious about when we decide that the forward path is unintentionally missing, vs
simply not configured.

Testing:
tailscale set --accept-dns=false. (or from the GUI)
dig @100.100.100.100 example.com
tailscale status

No dns related health warnings should be surfaced.

Signed-off-by: Jonathan Nobels <[email protected]>
@barnstar
barnstar force-pushed the jonathan/dns-warnable branch from 030b26c to bcad3bb Compare February 2, 2026 16:18
@luckman212

Copy link
Copy Markdown

Not sure if this has made its way into the unstable build yet, but, here's 1.95.65

tsbug_1.95.65_m.mp4

@barnstar
barnstar requested a review from cmol February 9, 2026 22:05

@cmol cmol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is really just skipping the health warning when someone uses the resolver, even though DNS has been disabled, right?

I think I agree with the comment that it is not a health warning per say, but what is this then?

My gut reaction if this was green field would be to not resolve at all, perhaps not respond at all (to avoid returning NX domain poisoning the OS resolver/cache), but I'm assuming that we have clients that are relying on this perhaps fault?

Perhaps this is just me being "we should own the DNS or not", and the fact that the original issue has MagicDNS disabled, to then still get magicDNS is kind of strange, but I do see the utility.

Maybe what I really think we need is an --accept-dns flag that is only valid when --set-dns=false. Then it becomes more detailed:

  • Set the DNS (normal state)
  • Don't set the DNS, and don't accept DNS (drop queries)
  • Don't set the DNS, but accept queries

IDK, there might be reasons why we have the resolver on constantly even when we don't need to, but the above would make more sense for me from a "you're doing something funky, you have to set the flags for it so you're more aware".

This is just my thoughts of the overall idea. The PR looks good.

@barnstar
barnstar merged commit 086968c into main Feb 10, 2026
58 checks passed
@barnstar
barnstar deleted the jonathan/dns-warnable branch February 10, 2026 14:29
@luckman212

Copy link
Copy Markdown

@cmol do you disagree with the general logic outlined in the flowchart I sketched in #18436 ?

image

@cmol

cmol commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

@cmol do you disagree with the general logic outlined in the flowchart I sketched in #18436 ?

@luckman212 I find parts of it somewhat strange, particularly the "tailnet magicDNS enabled" and "client side MagicDNS enabled" part. If the system resolver does not have any tailscale DNS awareness (points to your local CPE resolver or some public one), I don't see how you'd get a requests over to 100.100.100.100 since the system does not know about it? I might be misunderstanding your point here, or perhaps this is where your hand configured DNS comes into play?

Perhaps what I really would like now that I have looked at it a bit more is for the toggle not only to be what we do with --accept-dns, but also if MagicDNS is enabled for the tailnet. This still leads us to a very simple story to tell about how we manage DNS based on this one (https://tailscale.com/docs/features/client/manage-preferences#use-tailscale-dns-settings), but also lets people manage their DNS as they want for those cases.

Also, let me be clear that I know much more about how DNS is handled on Linux than on MacOS, so there might be nuances that I am not getting right here.

@luckman212

Copy link
Copy Markdown

@cmol

  1. I have more detail about this in

But, to quickly sum: on macOS, you can set domain-specific overrides by creating files at /etc/resolver/{foo} - e.g. here is my /etc/resolver/yak-stargazer.ts.net file:

nameserver 100.100.100.100

This instructs the system resolver to forward any *.yak-stargazer.ts.net requests to 100.100.100.100 (all other queries are routed to the default resolver which is my case is my LAN router running Unbound)

I choose to do this because I do NOT want Tailscale to take over control of my DNS resolution chain, however I DO still want to be able to use *.ts.net hostname resolution generally. I'm not aware of any other solution to this.

On Linux there are similar ways to configure scoped aka split-DNS resolution, e.g. using BIND or systemd-resolved.

So I think the flow in my chart is valid and correct.

@cmol

cmol commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

@cmol

1. I have more detail about this in


* [DNS health check logic is invalid when client is not set to "Use Tailscale DNS" #18436](https://github.com/tailscale/tailscale/issues/18436)

* [dns-forward-failing health warning appears even when performing valid DNS queries #18146](https://github.com/tailscale/tailscale/issues/18146)

* [frequent `dns-forward-failing` error with warning in menubar icon (macOS, FreeBSD) #15389](https://github.com/tailscale/tailscale/issues/15389)

But, to quickly sum: on macOS, you can set domain-specific overrides by creating files at /etc/resolver/{foo} - e.g. here is my /etc/resolver/yak-stargazer.ts.net file:

nameserver 100.100.100.100

This instructs the system resolver to forward any *.yak-stargazer.ts.net requests to 100.100.100.100 (all other queries are routed to the default resolver which is my case is my LAN router running Unbound)

I choose to do this because I do NOT want Tailscale to take over control of my DNS resolution chain, however I DO still want to be able to use *.ts.net hostname resolution generally. I'm not aware of any other solution to this.

On Linux there are similar ways to configure scoped aka split-DNS resolution, e.g. using BIND or systemd-resolved.

So I think the flow in my chart is valid and correct.

@luckman212 I think I misunderstood your flowchart then. Your system resolver is indeed set for quad-100, but only for a specific domain.

I think it's fine. I don't think we'll build for the health warning if you disable DNS, though you are welcome to submit a patch for that!

defer f.mu.Unlock()
f.acceptDNS = acceptDNS
f.routes = routes
f.cloudHostFallback = cloudHostFallback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add a:

 if !acceptDNS {
      f.health.SetHealthy(dnsForwarderFailing)
  }

here, in case acceptDNS becomes false and there's a failed dnsForwardedFailing already set?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DNS health check logic is invalid when client is not set to "Use Tailscale DNS"

5 participants