tailscale: Unable to resolve dns on Android 13

What is the issue?

Unable to resolve any domain without specifying dns server explicitly when tailscale is enabled. Private DNS is not enabled either.

Steps to reproduce

  1. Enable Tailscale
  2. Open Termux
  3. ping google.com: failed
  4. ping 8.8.8.8: works
  5. dig google.com @8.8.8.8: works
  6. Open YouTube app: failed to show anything

Are there any recent changes that introduced the issue?

No response

OS

Android

OS version

Android 13

Tailscale version

1.40.0-t9bdaece3d-ge0ba590be3e

Other software

AdGuard Android (will be automatically disabled when Tailscale is active)

Bug report

BUG-4cc3d4f3fd6b5ea50b2982505d0d6ffaae31e1bb5fcb6181ab4f17b70bd5c599-20230429112917Z-441b5f2258c699b5

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I have this same issue, have to stop and restart Tailscale to resolve. The issue seems to only happen occasionally when moving between networks, but not always. Most commonly I notice it when I’ve left my home wifi and then attempt to connect to the Internet from mobile networks like LTE.

Thanks for replying!

One way to work around the issue would be to set “Override local DNS” in login.tailscale.com/admin/dns

Enabling “Override local DNS” does fix the DNS issue for my Android device, but it would also override the DNS setting for other devices. Is it possible to enable this setting for one specific device instead of a whole tailnet?

The tailnet in its https://login.tailscale.com/admin/dns has “Override local DNS” turned off, which means Tailscale is supposed to find the DNS servers which were already present in the underlying OS and use those.

Android makes this difficult: starting in Android 8, apps are not allowed to retrieve the DNS server properties like net.dns1 or net.dns4. We instead implement a series of mechanisms in https://github.com/tailscale/tailscale-android/blob/main/android/src/main/java/com/tailscale/ipn/DnsConfig.java

Shortly before the bugreport while on mobile data, all of those mechanisms fail to find a DNS server:

2023-04-30 00:49:24.449414758 +0000 UTC: getDnsConfigFromLinkProperties:
2023-04-30 00:49:24.45033053 +0000 UTC: getDnsServersFromSystemProperties:
2023-04-30 00:49:24.4510717 +0000 UTC: getDnsServersFromNetworkInfo:

Earlier, on Wi-fi, it did find the DNS servers in use:

2023-04-29 16:43:19.169134333 +0000 UTC: getDnsConfigFromLinkProperties: 192.168.x.1
2023-04-29 16:43:19.169683731 +0000 UTC: getDnsServersFromSystemProperties:
2023-04-29 16:43:19.171425349 +0000 UTC: getDnsServersFromNetworkInfo: 192.168.x.1

One way to work around the issue would be to set “Override local DNS” in https://login.tailscale.com/admin/dns

I found some new info:

If I switched to wifi before enabling Tailscale, DNS works.

If I use mobile data before enabling Tailscale, DNS is broken.