Skip to content

health: dns-forward-failing triggers with one-off query failures #13520

Closed

Description

@agottardo

In v1.70, we added a health check for DNS forwarding failures, which triggers a “DNS unavailable” warning whenever DNS resolution fails:

health(warnable=dns-forward-failing): error: Tailscale can't reach the configured DNS servers. Internet connectivity may be affected.

While this is helpful for advanced users, the logic behind it is fairly straightforward at the moment. Based on code inspection, it seems to trigger a warning whenever a DNS query fails and no other DNS queries succeed within 5 seconds from the last failure. On mobile devices or when the user isn’t actively using the Internet, this can happen easily, resulting in unnecessary warnings due to a transient bad query.

We should adjust the dns-forward-failing Warnable to use a failure rate over time instead of marking it as unhealthy after a single failed query. A few failed queries shouldn’t prompt a warning. Instead, we should adopt a “percentage of failed queries over time” approach. For example, triggering the warning only if “more than 50% of queries failed in the last 60 seconds.”

Activity

  1. self-assigned this
    on Sep 19, 2024
  2. barnstar commented on Sep 23, 2024

    @barnstar
    Member

    There's current a 15 second TimeToVisible on this and the logic is such that any successful query within that 15 second window will remove the warnable.

    I've played a bit with a sliding window, but I'm not convinced it's a better user experience. If the number of queries in the window is low, it's flaky. If the number of failures outweighs the number of successes, but with enough retries, the resolver gets a result, it's flaky.

    The "hold-off-on-warning for 15 seconds" is more in line with typical retry logic. Many queries may fail, but as long as the last one succeeded - the system is probably working - albeit slowly.

  3. tayl commented on Oct 22, 2024

    @tayl

    Seeing this issue in 1.74.1 on Android, multiple devices. "DNS unavailable" warning, with text "Tailscale can't reach the configured DNS servers. Internet connectivity may be affected". However, DNS requests are definitely making it to the configured DNS server both before and after the device is woken up without issue. That doesn't mean some unknown outgoing requests aren't failing, but if they are it's not obvious to the user. I can't get the error to disappear even after waking the device up and making multiple successful DNS requests.

    Maybe add a timestamp to the warning? No idea if it's recent or old. Or if this is a side effect of a device power saving features, the logic will probably need to change because it doesn't seem accurate at the moment.

  4. gemnioo commented on Jan 24, 2025

    @gemnioo

    Any info linked to set Exit node with config "tailscale set --accept-dns=false" trigger the

    ' Tailscale can't reach the configured DNS servers. Internet connectivity may be affected.' ?

    #12244 (comment)

  5. chennin commented on Feb 15, 2025

    @chennin

    Having this issue on Ubuntu 24.04 with systemd-resolved. I can trigger the health warning by looking up anything invalid, such as with tailscale dns query gsdjkghdsjkgds, and apparently, the warning never clears! To be clear, I am not seeing any actual issue, just the tailscale status warning.

    It would be a better experience if the warning cleared when appropriate, and also if the logs had more information, like: what query failed? No upstream resolvers set where (/etc/resolv.conf? in tailscale admin?) and why is that a problem?

    I don't want to override local DNS.

    Information

    Tailscale version 1.80.2

    /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf

    Magic DNS is enabled

    Override Local DNS is not set and no global nameservers are set in Tailscale admin. Even if I set a Global nameserver in admin and restart tailscaled, any single failed DNS query still causes the health check to fail forever. And it doesn't look like tailscaled is getting the globlal nameserver setting at all, because tailscale dns query google.com still fails and causes the permanent healthcheck warning.

    tailscale status says "Tailscale can't reach the configured DNS servers. Internet connectivity may be affected" but, as far as I can tell, everything is working just fine.

    Logs at time of failed query
    Feb 15 09:01:44 HOST.DOMAIN.net tailscaled[104032]: 2025/02/15 09:01:44 dns: resolver: forward: no upstream resolvers set, returning SERVFAIL
    Feb 15 09:01:44 HOST.DOMAIN.net tailscaled[104032]: 2025/02/15 09:01:44 dns: DNS resolution failed due to missing upstream nameservers.  Recompiling DNS configuration.
    Feb 15 09:01:44 HOST.DOMAIN.net tailscaled[104032]: 2025/02/15 09:01:44 dns: Set: {DefaultResolvers:[] Routes:{tailXYZ.ts.net.:[] ts.net.:[199.247.155.53 2620:111:8007::53]}+65arpa SearchDomains:[taiXYZ.ts.net.] Hosts:9}
    Feb 15 09:01:44 HOST.DOMAIN.net tailscaled[104032]: 2025/02/15 09:01:44 dns: Resolvercfg: {Routes:{ts.net.:[199.247.155.53 2620:111:8007::53]} Hosts:9 LocalDomains:[tailXYZ.ts.net.]+65arpa}
    Feb 15 09:01:44 HOST.DOMAIN.net tailscaled[104032]: 2025/02/15 09:01:44 dns: OScfg: {Nameservers:[100.100.100.100] SearchDomains:[tailXYZ.ts.net.] MatchDomains:[tailXYZ.ts.net. ts.net.]+65arpa}
    
    tailscale dns status output: reading the system DNS configuration is not supported on this platform === 'Use Tailscale DNS' status ===

    Tailscale DNS: enabled.

    Tailscale is configured to handle DNS queries on this device.
    Run 'tailscale set --accept-dns=false' to revert to your system default DNS resolver.

    === MagicDNS configuration ===

    This is the DNS configuration provided by the coordination server to this device.

    MagicDNS: enabled tailnet-wide (suffix = tailXYZ.ts.net)

    Other devices in your tailnet can reach this device at HOSTNAME.tailXYZ.ts.net.

    Resolvers (in preference order):
    (no resolvers configured, system default will be used: see 'System DNS configuration' below)

    Split DNS Routes:

    • ts.net. -> 199.247.155.53
    • ts.net. -> 2620:111:8007::53

    Search Domains:

    • tailXYZ.ts.net

    === System DNS configuration ===

    This is the DNS configuration that Tailscale believes your operating system is using.
    Tailscale may use this configuration if 'Override Local DNS' is disabled in the admin console,
    or if no resolvers are provided by the coordination server.

    (reading the system DNS configuration is not supported on this platform)

    [this is a preliminary version of this command; the output format may change in the future]

    resolvectl status
    Global
               Protocols: -LLMNR -mDNS DNSOverTLS=opportunistic DNSSEC=no/unsupported
        resolv.conf mode: stub
      Current DNS Server: 9.9.9.9#dns.quad9.net
             DNS Servers: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
    Fallback DNS Servers: 8.8.8.8#dns.google 1.1.1.1#cloudflare-dns.com
              DNS Domain: DOMAIN.net tailXYZ.ts.net
    
    `grep "^[^#]" /etc/resolv.conf`
    nameserver 127.0.0.53
    options edns0 trust-ad
    search tailXYZ.ts.net DOMAIN.net
    

    BUG-b86054b872f88a8159f615e16d98b4d8dead04fcbd9cc4ce78b9451d181811f5-20250215135955Z-75c40019d0b1bcc9

  6. luckman212 commented on Dec 1, 2025

    @luckman212

    I created a simple POC to repro this bug:

    https://gist.github.com/luckman212/6924d1f2d4ecedd11af62203ae8da37b

    Save, chmod +x and run the script. As long as you have --accept-dns=false, after ~15 seconds, you should get:

    Image

    ref: #15389

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions