Skip to content

Clients do not promptly observe loss of DERP connectivity in some scenarios #15776

Description

@raggi

What is the issue?

There are some conditions under which a Tailscale client will not correctly identify that a connection a/it's home DERP has been lost. Failing to identify this state results in loss of connectivity with peers if it also coincides with endpoint changes or is behind a hard to traverse NAT as in the reproduction example.

Steps to reproduce

On a macOS node, connect via wifi to a residential internet connection with both IPv4 and IPv6 network access. Assert that Tailscale is operating normally.

Use the wifi connection menu to switch to an iOS device tethering to a cellular connection.

Observe that the client reconnects to control, informs control of new endpoints, but the client has not reconnected to a new home DERP and both control and derptrack observe the old DERP client endpoint still "active" for the node.

Observe that connections to the client fail unless they can directly reach one of the clients new endpoints.

Additional Notes

  • We shouldn't resolve this just by unconditionally severing DERP connectivity as there are many cases of route changes/interface changes where doing so may be unnecessarily disruptive.
  • A core part of this issue stems from having unidirectional keepalives on the DERP connection - they come from the server ticks, and the client is not tracking/enforcing their frequency.
  • After a major network change the client should perform some kind of active assertion on the DERP connection to trigger teardown if it is no longer viable. Something like a ping frame is fine.

Are there any recent changes that introduced the issue?

Not that I know of.

OS

macOS

OS version

15.3.2

Tailscale version

1.83.81

Other software

No response

Bug report

See #10701 for some related reports.

Activity

  1. added
    bug
    L5 All users
    P1 Nuisance
    on Apr 23, 2025
  2. added theissue type on Apr 23, 2025
  3. bradfitz commented on Apr 24, 2025

    @bradfitz
    Member

    After a major network change the client should perform some kind of active assertion on the DERP connection to trigger teardown if it is no longer viable. Something like a ping frame is fine.

    We already do that, though?

  4. wingcomm commented on Apr 26, 2025

    @wingcomm

    After a major network change the client should perform some kind of active assertion on the DERP connection to trigger teardown if it is no longer viable. Something like a ping frame is fine.

    We already do that, though?

    Would this explain why Tailscale continuously needs an On/Off toggle on iOS to restore connectivity as it migrates between cellular/Wi-Fi Networks? This is still a major issue for me...

  5. looseMole commented on Oct 31, 2025

    @looseMole

    We have observed a similar issue:

    On a network with a multi-WAN configured router, with configurations preventing direct connections being established to devices on it's LAN:
    Once the WAN changes from the primary uplink to a secondary, the tailnet resources behind said router becomes inaccessible for approx. 2 minutes.
    This is in spite of the network's general internet connectivity being restored within a couple of seconds.

    While the resources are not responding to requests from outside their LAN, they are still reported as online from tailscale status and the admin console, despite not being able to ping the devices or establish TCP connections to them from any tailscale clients outside this router's LAN.

    Via. a TCP dump, we have observed that once the WAN uplink changes, the tailscale client continues to send out traffic, headed for the DERP server - but it stops receiving any.

    It is as if the DERP server continues to relay traffic to the device's old IP addresses for those 2 minutes, before updating it's destination address for that client.

  6. thesw4rm commented on Mar 14, 2026

    @thesw4rm

    We have observed a similar issue:

    On a network with a multi-WAN configured router, with configurations preventing direct connections being established to devices on it's LAN: Once the WAN changes from the primary uplink to a secondary, the tailnet resources behind said router becomes inaccessible for approx. 2 minutes. This is in spite of the network's general internet connectivity being restored within a couple of seconds.

    While the resources are not responding to requests from outside their LAN, they are still reported as online from tailscale status and the admin console, despite not being able to ping the devices or establish TCP connections to them from any tailscale clients outside this router's LAN.

    Via. a TCP dump, we have observed that once the WAN uplink changes, the tailscale client continues to send out traffic, headed for the DERP server - but it stops receiving any.

    It is as if the DERP server continues to relay traffic to the device's old IP addresses for those 2 minutes, before updating it's destination address for that client.

    Disclaimer: I'm brand new here. Please let me know if I am breaking any rules or going down the wrong path.

    Were you able to/How did you confirm that the DERP server is still routing incoming traffic to your primary WAN after you switched to the secondary? Are you able to capture those network logs?

    For example, after the switch, see what happens if external peers send a noticeably large flood of UDP packets to something behind your router. Do you see a significant increase of tailscale traffic coming in to primary WAN?

  7. thesw4rm commented on Mar 14, 2026

    @thesw4rm

    I also want to say that I just reproduced these steps on a more modern MacOS/iOS and did not see this behavior.

    OS

    macOS Tahoe 26.3.1

    Tailscale

    1.94.2

    In my case, I switched from the same LAN as the peer to a cell connection. There were a few seconds where my traffic went through DERP (which still worked), and then the NAT hole punching did its thing and direct connection was established.

    I did not see any loss of connectivity except when the laptop was switching Wifi networks for just a second or two.

  8. luckman212 commented on Mar 14, 2026

    @luckman212

    related? #18603

  9. dszp commented on Jul 12, 2026

    @dszp

    Another occurrence: macOS 1.101.162 (unstable, standalone), ~13-hour zombie home-DERP registration — logs from both the affected client and a peer

    Hit what looks like exactly this issue on 2026-07-08. Adding it as a data point since I had simultaneous visibility into the affected client and one of its peers.

    Setup: MacBook Pro (M2, Darwin 25.5.0) running 1.101.162 unstable, standalone io.tailscale.ipn.macsys variant, on a home network with easy NAT (netcheck during the incident: MappingVariesByDestIP: false, UPnP/NAT-PMP/PCP all available, nyc DERP reachable at 39ms). The peer is a Linux VM (1.98.4) behind a hard NAT that prevents direct paths between these two nodes, so their traffic rides DERP.

    Symptom: one-way traffic for ~13 hours. Mac → VM packets arrived, but every VM → Mac reply vanished. ICMP from the Mac showed 66–100% loss; SSH sessions died and new connects timed out. A third node on the VM's LAN reached the VM perfectly throughout, and tailscale ping from the Mac got pongs via DERP(iad) — disco worked while the data return path was dead.

    The mismatch: the Mac reported Relay: nyc in tailscale status --json and believed it was homed there, but derp-1 evidently had no session for it. The peer VM logged, every ~5–60 s for the entire window, against the Mac's node key:

    magicsock: derp-1 does not know about peer [2ZXOo], removing route
    

    interleaved with wgengine: sending TSMP disco key advertisement to 100.82.169.123 (the Mac's Tailscale IP) — i.e. the VM was still receiving tunnel traffic from the Mac while the Mac's advertised home DERP denied knowing it. The VM homed on iad, which is why Mac→VM traffic kept working; replies addressed to the Mac's claimed home (derp-1) were dropped.

    Onset, from the peer's journal — the VM connects to derp-1 because the netmap says the Mac lives there, and derp-1 immediately denies the peer:

    Jul 08 10:55:21 peer-vm tailscaled[813]: magicsock: adding connection to derp-1 for [2ZXOo]
    Jul 08 10:55:21 peer-vm tailscaled[813]: magicsock: 2 active derp conns: derp-1=cr0s,wr0s derp-27=cr36h9m0s,wr22h38m0s
    Jul 08 10:55:21 peer-vm tailscaled[813]: derphttp.Client.Send: connecting to derp-1 (nyc)
    Jul 08 10:55:21 peer-vm tailscaled[813]: magicsock: derp-1 connected; connGen=1
    Jul 08 10:55:47 peer-vm tailscaled[813]: magicsock: endpoints changed: <wan-ip>:23575 (stun), <wan-ip>:23747 (stun), <wan-ip>:41641 (stun4localport), 192.168.222.106:41641 (local)
    Jul 08 10:55:50 peer-vm tailscaled[813]: wgengine: sending TSMP disco key advertisement to 100.82.169.123
    Jul 08 10:55:50 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    Jul 08 10:55:51 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    Jul 08 10:55:57 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    

    Steady state ~13 h later (while I was actively debugging; Mac awake and in use the whole time):

    Jul 08 23:39:54 peer-vm tailscaled[813]: wgengine: sending TSMP disco key advertisement to 100.82.169.123
    Jul 08 23:40:14 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    Jul 08 23:40:43 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    Jul 08 23:40:55 peer-vm tailscaled[813]: wgengine: sending TSMP disco key advertisement to 100.82.169.123
    Jul 08 23:40:55 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    Jul 08 23:41:00 peer-vm tailscaled[813]: magicsock: derp-1 does not know about peer [2ZXOo], removing route
    

    ~1,600 occurrences on the incident day; they run continuously from 10:55 to ~01:00 the next morning, ending exactly when the Mac's client was replaced (below).

    Recovery behavior:

    • tailscale ping <peer> from the Mac temporarily restored two-way traffic (fresh disco taught the peer a working path); it broke again within minutes.
    • tailscale down && tailscale up on the Mac restored traffic for ~3 minutes, then the same signature returned.
    • A full client restart (quit + relaunch the macOS app) fixed it durably that evening.
    • Around one recovery attempt, a netcheck run logged portmap: monitor: gateway and self IP changed — consistent with link-change events being involved, per this issue's analysis (server-tick-only keepalives, client never validates its receive path after a network change).

    After downgrading the Mac to 1.98.8 stable (3 days ago): zero awake-time failures since. For completeness: the peer still logs derp-1 does not know about peer [2ZXOo] in overnight bursts, but those correlate precisely with the Mac being asleep (e.g. 01:00–05:50 local, zero occurrences during active-use hours) — the expected offline-peer case, with none of the user-visible breakage. The distinguishing feature of the 1.101.162 incident was that the machine was awake, in use, and sending the entire time.

    Client logs from the affected window are available on request — happy to pull whatever helps.

  10. raggi commented on Jul 15, 2026

    @raggi
    MemberAuthor

    @dszp thank you for your report. I don't want to expose much detail of your logs here, so if you would like more details please reach out to our support team and reference this bug and I can work with them to get you whatever more data that you need.

    At the onset time you mention above, the mac was aggressively reentering sleep. It is ~normal for a sleeping device to enter this state of being last seen at a DERP but unreachable there (or only sometimes incrementally reachable there when it wakes in power nap as this seems to periodically).

    At the steady state time, I also see the machine asleep, specifically the machine reports in at 23:50 saying time jumped 29m, so it was asleep from 23:11 - 23:50.

    The log data you are seeing is almost certainly a side effect of an overlay TCP connection in RTO continually trying to reach the peer. This is normal, it is sometimes tempting to tear these down proactively to reduce peer outreach attempts, however doing so also makes users unhappy as they often want SSH connections to "stay alive" through sleep. The mac wakes frequently enough that TCP RTO in default tuning would generally re-sync and stay up, unless the VM runs out of buffer space (too much output is trying to be sent) at which point the kernel will kill the connection.

  11. dszp commented on Jul 19, 2026

    @dszp

    @raggi Thanks for looking at the logs — and I think I see the disconnect: the journal excerpts in my comment are in the peer VM's local timezone, US Eastern (UTC-4), which I failed to state. Apologies for the confusion that caused. In UTC, the quoted events are:

    • Onset: Jul 08 10:55 EDT → Jul 8 14:55 UTC
    • Steady-state example: Jul 08 23:39–23:41 EDT → Jul 9 03:39–03:41 UTC

    Both sleep windows you found are exactly four hours from the quoted events — they line up with my timestamps read as UTC rather than with the events themselves. And I don't dispute the machine slept at those times: 10:55 UTC is 6:55 AM local, and 23:11–23:50 UTC is 7:11–7:50 PM local, before I'd noticed the outage.

    At the corrected times, local records on the Mac show it awake and in use:

    • Interactive terminal session activity until 14:41 UTC, 14 minutes before onset.
    • At the steady-state example, an interactive session began at 03:43 UTC and shows continuous per-minute activity through ~05:43 UTC — a two-hour awake, in-use window during which the peer kept logging derp-1 does not know about peer and new connections to the Mac kept failing.

    One correction on my side: "awake, in use, and sending the entire time" overstated the 13-hour window — the machine certainly slept during parts of it (evidently including 23:11–23:50 UTC). The defensible claim is narrower: the one-way condition persisted through every awake period, including the two-hour active window above, and only a full client restart cleared it durably.

    On the TCP-RTO interpretation: an existing overlay connection in RTO wouldn't account for what was observed while awake — new SSH connection attempts timing out, 66–100% ICMP loss, tailscale ping succeeding via DERP(iad) while the data return path stayed dead, and tailscale down && tailscale up restoring traffic for only ~3 minutes at a time.

    Would you mind re-checking the client logs at Jul 8 14:55 UTC (onset) and Jul 9 03:39–03:50 UTC (steady state)? Happy to open a support ticket referencing this issue if that's the better channel for the detail.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    L5 All usersP1 Nuisancebugneeds-fix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions