tailscale: DNS breaks on NixOS system after resume
What is the issue?
If tailscale is enabled before I suspend my laptop, resolving domains hangs until I do sudo tailscale down. If I then do sudo tailscale up, everything works again.
/etc/resolv.conf looks as follows:
# Generated by resolvconf
search niedzejkob.github.beta.tailscale.net
nameserver 100.100.100.100
options edns0
Steps to reproduce
- Configure NixOS with settings similar to:
networking.wireless.enable = true;
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.wlp3s0.useDHCP = true;
services.tailscale.enable = true;
(full config available here, probably mostly irrelevant)
2. Set up Tailscale with sudo tailscale up
3. Verify that host github.com resolves properly
4. Suspend the machine, and then wake it up. I’ve found the issue to reproduce regardless of how long the laptop is left suspended.
5. Attempt running host github.com and see that it hangs.
6. Observe that, nevertheless, domains under niedzejkob.github.beta.tailscale.net resolve properly.
7. Run sudo tailscale down and sudo tailscale up.
8. host github.com works again.
Are there any recent changes that introduced the issue?
I installed Tailscale 😉
OS
Linux
OS version
NixOS unstable
Tailscale version
1.22.2
Bug report
BUG-691539f77b145a26bac1296772c1d69e36cb2e33f8ea3596aceb3ddeb2ac1e6c-20220322151817Z-124dbfbbe0e4b57b
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 16
- Comments: 26 (6 by maintainers)
Commits related to this issue
- net/dns: make "direct" mode on Linux warn on resolv.conf fights Run an inotify goroutine and watch if another program takes over /etc/inotify.conf. Log if so. For now this only logs. In the future I... — committed to tailscale/tailscale by bradfitz 4 years ago
- net/dns: make "direct" mode on Linux warn on resolv.conf fights Run an inotify goroutine and watch if another program takes over /etc/inotify.conf. Log if so. For now this only logs. In the future I... — committed to tailscale/tailscale by bradfitz 4 years ago
- net/dns: make "direct" mode on Linux warn on resolv.conf fights Run an inotify goroutine and watch if another program takes over /etc/inotify.conf. Log if so. For now this only logs. In the future I... — committed to tailscale/tailscale by bradfitz 4 years ago
- net/dns: make "direct" mode on Linux warn on resolv.conf fights Run an inotify goroutine and watch if another program takes over /etc/inotify.conf. Log if so. For now this only logs. In the future I... — committed to tailscale/tailscale by bradfitz 4 years ago
- net/dns: make "direct" mode on Linux warn on resolv.conf fights Run an inotify goroutine and watch if another program takes over /etc/inotify.conf. Log if so. For now this only logs. In the future I... — committed to tailscale/tailscale by bradfitz 4 years ago
- net/dns: make "direct" mode on Linux warn on resolv.conf fights Run an inotify goroutine and watch if another program takes over /etc/inotify.conf. Log if so. For now this only logs. In the future I... — committed to coder/tailscale by bradfitz 4 years ago
- tailscale: use systemd-resolved for DNS See: https://github.com/tailscale/tailscale/issues/4254 If this option is not enabled, then I lose DNS resolution every time my laptop goes to sleep and wakes... — committed to ericswpark/nixos-config by ericswpark a year ago
Thanks for the hint. I’ve enabled resolved, and now the DNS breaks the moment I run
sudo tailscale up.I’m experiencing this when
Override local DNSis enabled in the Tailscale admin (I have it pointed to NextDNS).When I disable this, everything works after system resume.
Brads solution above,
services.resolved.enable = trueworked for me. I am now able to directly reach hosts not using tailscale and tailscale hosts.Has there been made any progress towards fixing this issue?
I’ve been trying to reliably solve this on my server today rather than just restarting tailscaled every time I reboot. 😆
I’ve also had issues with ipv6 not working when using it as an exit node.
I believe the DNS issue was solved by switching to resolved and networkd and maybe disabling DHCP by default.
I also have the following configuration but I don’t think it has anything to do with fixing this particular bug:
also having this issue. it seems to be intermittent for me, with nothing networking-related changing. Disabling Magic DNS fixes it (I just point subdomains of xmppwocky.net to tailscale IPs now).
https://github.com/XMPPwocky/nixos-config/ over the past few months I’ve seen it come and go, but tailscale config hasn’t changed since 2021: https://github.com/XMPPwocky/nixos-config/blob/3ce3bea58d86a2697cc3d8c6b465db8008b606db/modules/tailscale.nix
https://github.com/XMPPwocky/nixos-config/blob/bdce31bdacab918aa6c61e84f2dad417719914ed/modules/systemd-resolved.nix in nov. 2021, I initially tried the systemd.resolved stuff, with no luck.
Restarting tailscaled itself seems to generally fix the issue.
I think you’ll want to use
services.resolved.enable = true. In general that’s the most complete DNS implementation for Linux and well supported with Tailscale./cc @danderson @Xe for NixOS stuff