mirror of
https://github.com/juanfont/headscale.git
synced 2026-01-11 20:00:28 +01:00
Local DNS resolution doeesn't work on macOS with MagicDNS enabled #284
Closed
opened 2025-12-29 01:26:02 +01:00 by adam
·
21 comments
No Branch/Tag Specified
main
update_flake_lock_action
gh-pages
kradalby/release-v0.27.2
dependabot/go_modules/golang.org/x/crypto-0.45.0
dependabot/go_modules/github.com/opencontainers/runc-1.3.3
copilot/investigate-headscale-issue-2788
copilot/investigate-visibility-issue-2788
copilot/investigate-issue-2833
copilot/debug-issue-2846
copilot/fix-issue-2847
dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
dependabot/go_modules/github.com/docker/docker-28.3.3incompatible
kradalby/cli-experiement3
doc/0.26.1
doc/0.25.1
doc/0.25.0
doc/0.24.3
doc/0.24.2
doc/0.24.1
doc/0.24.0
kradalby/build-docker-on-pr
topic/docu-versioning
topic/docker-kos
juanfont/fix-crash-node-id
juanfont/better-disclaimer
update-contributors
topic/prettier
revert-1893-add-test-stage-to-docs
add-test-stage-to-docs
remove-node-check-interval
fix-empty-prefix
fix-ephemeral-reusable
bug_report-debuginfo
autogroups
logs-to-stderr
revert-1414-topic/fix_unix_socket
rename-machine-node
port-embedded-derp-tests-v2
port-derp-tests
duplicate-word-linter
update-tailscale-1.36
warn-against-apache
ko-fi-link
more-acl-tests
fix-typo-standalone
parallel-nolint
tparallel-fix
rerouting
ssh-changelog-docs
oidc-cleanup
web-auth-flow-tests
kradalby-gh-runner
fix-proto-lint
remove-funding-links
go-1.19
enable-1.30-in-tests
0.16.x
cosmetic-changes-integration
tmp-fix-integration-docker
fix-integration-docker
configurable-update-interval
show-nodes-online
hs2021
acl-syntax-fixes
ts2021-implementation
fix-spurious-updates
unstable-integration-tests
mandatory-stun
embedded-derp
prtemplate-fix
v0.28.0-beta.1
v0.27.2-rc.1
v0.27.1
v0.27.0
v0.27.0-beta.2
v0.27.0-beta.1
v0.26.1
v0.26.0
v0.26.0-beta.2
v0.26.0-beta.1
v0.25.1
v0.25.0
v0.25.0-beta.2
v0.24.3
v0.25.0-beta.1
v0.24.2
v0.24.1
v0.24.0
v0.24.0-beta.2
v0.24.0-beta.1
v0.23.0
v0.23.0-rc.1
v0.23.0-beta.5
v0.23.0-beta.4
v0.23.0-beta3
v0.23.0-beta2
v0.23.0-beta1
v0.23.0-alpha12
v0.23.0-alpha11
v0.23.0-alpha10
v0.23.0-alpha9
v0.23.0-alpha8
v0.23.0-alpha7
v0.23.0-alpha6
v0.23.0-alpha5
v0.23.0-alpha4
v0.23.0-alpha4-docker-ko-test9
v0.23.0-alpha4-docker-ko-test8
v0.23.0-alpha4-docker-ko-test7
v0.23.0-alpha4-docker-ko-test6
v0.23.0-alpha4-docker-ko-test5
v0.23.0-alpha-docker-release-test-debug2
v0.23.0-alpha-docker-release-test-debug
v0.23.0-alpha4-docker-ko-test4
v0.23.0-alpha4-docker-ko-test3
v0.23.0-alpha4-docker-ko-test2
v0.23.0-alpha4-docker-ko-test
v0.23.0-alpha3
v0.23.0-alpha2
v0.23.0-alpha1
v0.22.3
v0.22.2
v0.23.0-alpha-docker-release-test
v0.22.1
v0.22.0
v0.22.0-alpha3
v0.22.0-alpha2
v0.22.0-alpha1
v0.22.0-nfpmtest
v0.21.0
v0.20.0
v0.19.0
v0.19.0-beta2
v0.19.0-beta1
v0.18.0
v0.18.0-beta4
v0.18.0-beta3
v0.18.0-beta2
v0.18.0-beta1
v0.17.1
v0.17.0
v0.17.0-beta5
v0.17.0-beta4
v0.17.0-beta3
v0.17.0-beta2
v0.17.0-beta1
v0.17.0-alpha4
v0.17.0-alpha3
v0.17.0-alpha2
v0.17.0-alpha1
v0.16.4
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.16.0-beta7
v0.16.0-beta6
v0.16.0-beta5
v0.16.0-beta4
v0.16.0-beta3
v0.16.0-beta2
v0.16.0-beta1
v0.15.0
v0.15.0-beta6
v0.15.0-beta5
v0.15.0-beta4
v0.15.0-beta3
v0.15.0-beta2
v0.15.0-beta1
v0.14.0
v0.14.0-beta2
v0.14.0-beta1
v0.13.0
v0.13.0-beta3
v0.13.0-beta2
v0.13.0-beta1
upstream/v0.12.4
v0.12.4
v0.12.3
v0.12.2
v0.12.2-beta1
v0.12.1
v0.12.0-beta2
v0.12.0-beta1
v0.11.0
v0.10.8
v0.10.7
v0.10.6
v0.10.5
v0.10.4
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.1
v0.8.0
v0.7.1
v0.7.0
v0.6.1
v0.6.0
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v0.2.0
v0.1.1
v0.1.0
Labels
Clear labels
CLI
DERP
DNS
Nix
OIDC
SSH
bug
database
documentation
duplicate
enhancement
faq
good first issue
grants
help wanted
might-come
needs design doc
needs investigation
no-stale-bot
out of scope
performance
policy 📝
pull-request
question
regression
routes
stale
tags
tailscale-feature-gap
well described ❤️
wontfix
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/headscale#284
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @felixscheinost on GitHub (Jun 23, 2022).
Bug description
When connected to a Headscale server where MagicDNS is enabled, local name resolution doesn't work anymore on macOS.
For example without Tailscale enabled my machine receives DNS configuration via DHCP from my home router.
The home router runs its own DNS server and resolves <router_name> to its own IP address.
Once connected to the Headscale Tailnet, <router_name> can no longer be resolved.
With the official Tailscale coordination server on the other hand there is an explicit option whether local DNS resolution should be overriden or not. If the toggle to override local DNS resolution is turned off, the router name can still be resolved.
So this seems like a bug in how Headscale configures the Tailscale client.
Context info
config.yamlOutput of
scutil --dnsThe output of
scutil --dnslooks different when connected to Tailscale vs Headscale.Tailscale
Headscale
=> So it seems with Tailscale my resolver number 1 stays my router, even for the Tailscale namespaces, while with Headscale resolver number 1 is
100.100.100.100@huskyii commented on GitHub (Jun 26, 2022):
I encountered some dns issue in Linux and OpenBSD machine, have not dive into these issues, but I think it may be same as yours.
@huskyii commented on GitHub (Jun 26, 2022):
After read some code, I think
DefaultResolversshould be set to nil and a Route map item{ '.' : '$resolver_set_in_config'}shoule be added into Routes.I do not have a official tailscale account, maybe someone with official tailscale account could look into the log see how dns config looks like(keyword:
dns: Set:)If anyone confirm my guess is correct, I'm happy to implement the fix :)
@felixscheinost commented on GitHub (Jun 26, 2022):
Oh cool, that you have a hunch so quickly! @huskyii
I just checked on a different Linux machine, that should work as well, right?
In there I have the following line in the log:
Is that what you are looking for?
@huskyii commented on GitHub (Jun 27, 2022):
Hi @felixscheinost which version of tailscale r u using?
The log is different from mine. I'm using tailscale 1.26.1
Here's my log, note: no
router:beforedns: Set:@vquicksilver commented on GitHub (Jul 9, 2022):
Isn't this related to #280 ? My understanding is that an option for deciding if you want to override the DNS servers, or just use "split-dns" as in adding an extra DNS server to your current network configuration is missing on the headscale side vs tailscale.
In some cases you might want to force the DNS servers in the configuration to be the only ones (i.e if you are using another node as an exit node and the node has a DNS server configured and you don't want to leak DNS requests to the outside world), and in other cases you only want to add an extra DNS server to your configuration so that you can resolve the internal tailscale/headscale names.
I am not sure of which mode it is the default right now, for example in one of my Ubuntu systems I see:
This system was joined with the following command:
tailscale up --exit-node=100.64.0.1 --exit-node-allow-lan-access --login-server=https://vpn.my-private.domain
I guess the parameters you use to join the overlay network do also effect the resulting DNS servers in your system, as someone new to tailscale/headscale it would be great to get more details on how this is supposed to work in the documentation.
I also have configured 100.64.0.1 as my default DNS server in the headscale config with:
And I am running my own DNS server on that system. systemd-resolve --status is showing 100.100.100.100 as the default DNS server for ~* , but the queries are still being forwarded to 100.64.0.1 (I see them in the log), and as you see it is still keeping 10.83.0.1 as my local dns server for ".local" for my lan.
@felixscheinost commented on GitHub (Jul 31, 2022):
@huskyii I think I was using
1.24.2at the time.@vquicksilver Yeah, its probably a duplicate of that issue.
I tried working around the issuee right now by using the Go
tailscaledand not the version from the macOS AppStore. But then I need to configure100.100.100.100manually. I couldn't find a way to do this without also overriding the DHCP DNS servers.@felixscheinost commented on GitHub (Jul 31, 2022):
Okay, I just ran
tailscaledmanually on Linux against official Tailscale server.I turned override local DNS on, then off again and watched the log:
@huskyii commented on GitHub (Aug 16, 2022):
I don't think headscale has a override_local_DNS option now, maybe we should add one, what confused me is that offical Tailscale KB for maigic DNS stated that
I think it's basically says that to use magic DNS, you need override local DNS.
@felixscheinost does magic DNS work if you turn off
override local DNS?And could you please also take a look at
/etc/resolv.confand/etc/resolv.pre-tailscale-backup.conf@mlincett commented on GitHub (Sep 15, 2022):
This is incorrect, at least when using
resolved.MagicDNS sets
in-addr.arparecords for all the IP address space used by tailscale.Override local DNS enabled sets
+DefaultRoutefor the tailscale interface (meaning this should be the default DNS unless a more specific is found) and the global DNS domain~.The two settings are independent - however I have no idea how this works in systems pre-resolved.
@kradalby commented on GitHub (Oct 31, 2022):
@mlincett @huskyii @felixscheinost
I think I have added support for this correctly in https://github.com/juanfont/headscale/pull/905, can you please help me test it?
@felixscheinost commented on GitHub (Nov 10, 2022):
Sorry, I just got around to try out the new version.
BTW: Awesome that you have a
flake.nix!@kradalby If I set
dns_config.override_local_dns = falsethen I can again use local resolvers but I can no longer resolve MagicDNS names@felixscheinost commented on GitHub (Nov 10, 2022):
My config looks like this
@felixscheinost commented on GitHub (Nov 10, 2022):
Output of
scutil --dnsSo now it seems as if the Tailscale client isn't configuring any DNS settings at all.
@CNLHC commented on GitHub (Nov 15, 2022):
same problem here
@brian-maloney commented on GitHub (Mar 29, 2023):
I'm trying out headscale this week and just ran into this problem myself. It seems like the only working options using the official macOS Tailscale client are:
I guess maybe most users are intentionally routing DNS through the overlay network for added security so this is an uncommon issue? My long-term plans for this do involve DNS so if there's not a workaround it's probably fine but was wondering if anyone had discovered anything new on this issue?
@hrtkpf commented on GitHub (Sep 10, 2023):
I am currently having the issue that MagicDNS breaks when override_local_dns is set to false (on Linux, Tailscale client v1.48.1). I am not sure if this is exactly the same issue, but at least it seems to be somehow related (and I did not want to open yet another issue for this).
MagicDNS only works with override_local_dns=true, but then all DNS queries are obviously sent through the resolvers configured in Headscale, which might not be what you want.
When override_local_dns=false, all DNS queries are sent through the client's resolver (whichever that is), including queries designated for MagicDNS, making the resolution fail. I verified both observations using tcpdump.
A manual
dig host1.magicdns.example.com @100.100.100.100works.Someone also seems to have the same issue since #905 (https://github.com/juanfont/headscale/pull/905#issuecomment-1377224539).
@letitfly commented on GitHub (Sep 26, 2023):
Same here. Might have to stop using MagicDNS.
@mlincett commented on GitHub (Sep 26, 2023):
I am not currently using
headscalebut I guess it could be helpful if you could say something more about your DNS configuration. In case you are usingsystemd-resolvedyou may want to attach the output ofresolvectl status.@github-actions[bot] commented on GitHub (Dec 26, 2023):
This issue is stale because it has been open for 90 days with no activity.
@github-actions[bot] commented on GitHub (Jan 2, 2024):
This issue was closed because it has been inactive for 14 days since being marked as stale.
@c-p-b commented on GitHub (Jan 27, 2024):
Just tried this and I can also confirm that apparently you really have only two choices with MacOS official tailscale client + headscale currently:
You either run ALL your DNS through there or none of it. override_local_dns doesn't seem to be respected, resolver will always try to route through headscale first if you're connected.