Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tailscale: fix broken DNS on IPv6 only tailnets #1246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions modules/services/tailscale.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ in
1. at least one DNS server is added
2. `Override local DNS` is enabled

As this option sets 100.100.100.100 as your sole DNS server, if the requirements above are not met,
As this option sets 100.100.100.100 and fd7a:115c:a1e0::53 as your sole DNS servers, if the requirements above are not met,
all non-MagicDNS queries WILL fail.
'';
};
};

config = mkIf cfg.enable {
assertions = [{
assertion = !cfg.overrideLocalDns || config.networking.dns == [ "100.100.100.100" ];
assertion = cfg.overrideLocalDns -> (builtins.any (x: x != "100.100.100.100" || x != "fd7a:115c:a1e0::53") config.networking.dns);
message = ''
DNS servers should be configured on the Tailscale control panel when `services.tailscale.overrideLocalDns` is enabled.

Expand All @@ -61,10 +61,13 @@ in
};
};

networking.dns = mkIf cfg.overrideLocalDns [ "100.100.100.100" ];
networking.dns = mkIf cfg.overrideLocalDns [ "100.100.100.100" "fd7a:115c:a1e0::53" ];

# Ensures Tailscale MagicDNS always works even without adding 100.100.100.100 to DNS servers
environment.etc."resolver/ts.net".text = "nameserver 100.100.100.100";
environment.etc."resolver/ts.net".text = ''
nameserver 100.100.100.100
nameserver fd7a:115c:a1e0::53
'';

# This file gets created by tailscaled when `Override local DNS` is turned off
environment.etc."resolver/ts.net".knownSha256Hashes = [
Expand Down