You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows login, Tailscale is started. When I open Ubuntu 18.04 on WSL2 no DNS is working.
$ dig google.com
; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached
When opening /etc/wsl.conf, I see Tailscale has added the following snippet:
# added by tailscale
[network]
generateResolvConf = false
When I remove this snippet from /etc/wsl.conf and then terminate and start WSL again, the DNS works again.
C:\WINDOWS\system32> wsl --terminate Ubuntu-18.04
C:\WINDOWS\system32> wsl --distribution Ubuntu-18.04
$ dig google.com
; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54109
;; flags: qr rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 0 IN A 142.250.179.206
;; Query time: 21 msec
;; SERVER: 172.29.64.1#53(172.29.64.1)
;; WHEN: Wed Sep 08 09:16:49 CEST 2021
;; MSG SIZE rcvd: 54
On every restart of Windows the snippet is added to /etc/wsl.conf again.
Reacted by Loren Gordon, Woongbin Kang, Marcus Cemes, Joseph Stahl, Thomas Vochten ☕👨💻🏃♂️, Silvio Böhler, Jamie Greeff, Veeti Haapsamo, Dmitri Maximovich, Oleg Martynov and 2 more
The write to /etc/wsl.conf was added in 1147c7f to fix #775.
When first booted with "generateResolvConf = false" present, what is the content of /etc/resolv.conf? I think we'd expect to have written a "nameserver 100.100.100.100" line there.
So we should have written to both /etc/wsl.conf and /etc/resolv.conf, but something went wrong in writing to /etc/resolv.conf and the result is broken DNS.
Could you send the Tailscale IP address of the Windows host to [email protected], and reference this bug? Maybe we can see what went wrong in telemetry or error it reported.
Likewise. I wondered what was causing this, and it turned out to be Tailscale. MagicDNS enabled, and 1.1.1.1 as global nameserver (same as person above me)
Hmm, I wonder if the problem is because in wsl2 /etc/resolv.conf is typically a symlink to ../run/resolvconf/resolv.conf? It being a symlink is why I had to modify my original workaround from:
Also, don't change files that aren't yours without asking me first.
Reacted by Woongbin Kang, Carwyn Nelson, Silvio Böhler, Oliver Spryn, David Anthoff, Jackson Lai, daalekz, roperworks, Mat Dave Jones, FallingLights and 4 more
I'm unsure what version of Tailscale exactly did it, but this bug has broken networking on all of my WSL2 machines at some point. Deleting the /etc/wsl.conf file seems to fix the issue across Tailscale restarts, so maybe the fix/removal has been added to newer versions?
We may make another attempt to better support WSL in the future. I do not believe this bug will be useful in that, we won't do so until we have something better. Closing this bug.
EDIT: Warning the comment below pertains to WSL1. This ticket is titled WSL2. The two stacks are very different.
I just ran into this myself, and I wanted to report what I ran into (and how I fixed it) in-case it helps future work on WSL compatibility or anyone else that finds this thread.
Problem
I had just recently installed Tailscale, and restarted my machine, and then I was running into connectivity (really DNS) issues under WSL (WSL 1, Ubuntu 22.04).
I checked my /etc/resolv.conf file, as that's a common source of DNS issues in WSL (microsoft/WSL#3438), and saw this:
$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
nameserver fec0:0:0:ffff::3
search tail63fee.ts.net Home
... which resulted in DNS failing, but I could still ping
$ dig google.com
;; communications error to fec0:0:0:ffff::1#53: timed out
;; communications error to fec0:0:0:ffff::1#53: timed out
;; communications error to fec0:0:0:ffff::1#53: timed out
;; communications error to fec0:0:0:ffff::2#53: timed out
;; communications error to fec0:0:0:ffff::3#53: timed out
; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> google.com
;; global options: +cmd
;; no servers could be reached
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=3.79 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=3.50 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=3.41 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=3.13 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=118 time=3.28 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=118 time=3.52 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=118 time=3.56 ms
^C
--- 8.8.8.8 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6005ms
rtt min/avg/max/mdev = 3.133/3.455/3.791/0.195 ms
... Exiting the Tailscale app (in the system tray), removing the resolv.conf (sudo rm /etc/resolv.conf in WSL), and then restarting WSL (wsl --shutdown via an admin/elevated cmd) resulted in this /etc/resolv.conf contents:
$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
nameserver fec0:0:0:ffff::3
search Home
... which is close, but notice the search line is missing the tailscale domain?
Fix
I removed the resolv.conf again (sudo rm /etc/resolv.conf in WSL)
I shutdown WSL (wsl --shutdown via an admin/elevated cmd)
I disabled the "Tailscale" (Tailscale Tunnel) network adapter in Network Connections
Started WSL again...
... and now my DNS in WSL is fixed!
$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 192.168.0.1
nameserver 205.171.3.25
nameserver 2001:428::1
search Home
$ dig google.com
$ ping google.com
PING google.com(den08s06-in-x0e.1e100.net (2607:f8b0:400f:803::200e)) 56 data bytes
64 bytes from den08s06-in-x0e.1e100.net (2607:f8b0:400f:803::200e): icmp_seq=1 ttl=116 time=4.23 ms
64 bytes from den08s06-in-x0e.1e100.net (2607:f8b0:400f:803::200e): icmp_seq=2 ttl=116 time=3.54 ms
64 bytes from den08s06-in-x0e.1e100.net (2607:f8b0:400f:803::200e): icmp_seq=3 ttl=116 time=3.78 ms
64 bytes from den08s06-in-x0e.1e100.net (2607:f8b0:400f:803::200e): icmp_seq=4 ttl=116 time=3.86 ms
64 bytes from den08s06-in-x0e.1e100.net (2607:f8b0:400f:803::200e): icmp_seq=5 ttl=116 time=4.00 ms
^C64 bytes from 2607:f8b0:400f:803::200e: icmp_seq=6 ttl=116 time=3.71 ms
--- google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 25043ms
rtt min/avg/max/mdev = 3.538/3.853/4.233/0.220 ms
Adding to this for those that have the same issue as me. The above solution didn't work for me because every time I tried to disable the Tailscale tunnel, it would go away and a new connection would instantly start up and be enabled. Instead, I went to properties and unchecked the IPv6 option and it seems to have fixed the DNS problem inside WSL for me. No deletions or resolv.conf or anything else required. Did not even need a restart of WSL.
Reacted by Jerome, TairanLee, zekesixniner, Zachary Radtka, Richard Hansen and 145a
Activity
DentonGentry commentedon Sep 9, 2021
The write to /etc/wsl.conf was added in 1147c7f to fix #775.
When first booted with "generateResolvConf = false" present, what is the content of /etc/resolv.conf? I think we'd expect to have written a "nameserver 100.100.100.100" line there.
PieterScheffers commentedon Sep 9, 2021
The
/etc/resolv.conffile doesn't exist when the DNS isn't working.DentonGentry commentedon Sep 9, 2021
In https://login.tailscale.com/admin/dns do you have either Magic DNS enabled, or any nameservers added?
PieterScheffers commentedon Sep 9, 2021
I see MagicDNS is enabled and nameserver 100.100.100.100 is the nameserver. The global nameserver is 1.1.1.1.
DentonGentry commentedon Sep 9, 2021
So we should have written to both /etc/wsl.conf and /etc/resolv.conf, but something went wrong in writing to /etc/resolv.conf and the result is broken DNS.
Could you send the Tailscale IP address of the Windows host to [email protected], and reference this bug? Maybe we can see what went wrong in telemetry or error it reported.
lorengordon commentedon Sep 17, 2021
I'm seeing the same thing in my setup.
rdbisme commentedon Sep 23, 2021
Same problem here. MagicDNS enabled, 1.1.1.1 as global nameserver
svercl commentedon Sep 24, 2021
Likewise. I wondered what was causing this, and it turned out to be Tailscale. MagicDNS enabled, and 1.1.1.1 as global nameserver (same as person above me)
Edit: typo ;)
lorengordon commentedon Sep 30, 2021
The upgrade to 1.14.4 re-broke it, by re-adding
generateResolvConf = falseto/etc/wsl.conf.12 remaining items
lorengordon commentedon Dec 16, 2021
Hmm, I wonder if the problem is because in wsl2
/etc/resolv.confis typically a symlink to../run/resolvconf/resolv.conf? It being a symlink is why I had to modify my original workaround from:to:
But once I did that,
/etc/resolv.confwas no longer a symlink. I bet then the tailscale logic was able to work.lorengordon commentedon Dec 16, 2021
Hysterically, now the backup of the file that tailscale makes is invalid, because wsl2 changes its IP every boot. 🤦♂️
voltagex commentedon Dec 26, 2021
Please allow disabling this - you're breaking WSL2 even when Tailscale isn't connected.
ping: tailscale.com: Temporary failure in name resolutionvoltagex commentedon Dec 26, 2021
Also, don't change files that aren't yours without asking me first.
evilpilaf commentedon Jan 3, 2022
I was running into the same issue and after updating to tailscale 1.18.2 I was able to remove
/etc/wsl.confand now my DNS is working as expected.net/dns: make WSL network configuration opt-in for now
net/dns: make WSL network configuration opt-in for now
net/dns: make WSL network configuration opt-in for now
Xalaxis commentedon Jan 23, 2022
I'm unsure what version of Tailscale exactly did it, but this bug has broken networking on all of my WSL2 machines at some point. Deleting the
/etc/wsl.conffile seems to fix the issue across Tailscale restarts, so maybe the fix/removal has been added to newer versions?DentonGentry commentedon Jan 23, 2022
In the 1.20.x release a14d445 means that resolv.conf will only be written if a TS_DEBUG_CONFIGURE_WSL environment variable exists.
arjoh commentedon Feb 14, 2022
This is currently not working for me. Set TS_DEBUG_CONFIGURE_WSL to True in Windows 11 System environment variables. Tailscale version is 1.20.4.
DentonGentry commentedon Mar 27, 2022
Fixed in 1.20 by #3687
We may make another attempt to better support WSL in the future. I do not believe this bug will be useful in that, we won't do so until we have something better. Closing this bug.
Rican7 commentedon Feb 23, 2024
EDIT: Warning the comment below pertains to WSL1. This ticket is titled WSL2. The two stacks are very different.
I just ran into this myself, and I wanted to report what I ran into (and how I fixed it) in-case it helps future work on WSL compatibility or anyone else that finds this thread.
Problem
I had just recently installed Tailscale, and restarted my machine, and then I was running into connectivity (really DNS) issues under WSL (WSL 1, Ubuntu 22.04).
I checked my
/etc/resolv.conffile, as that's a common source of DNS issues in WSL (microsoft/WSL#3438), and saw this:... which resulted in DNS failing, but I could still ping
... Exiting the Tailscale app (in the system tray), removing the resolv.conf (
sudo rm /etc/resolv.confin WSL), and then restarting WSL (wsl --shutdownvia an admin/elevatedcmd) resulted in this/etc/resolv.confcontents:... which is close, but notice the
searchline is missing the tailscale domain?Fix
sudo rm /etc/resolv.confin WSL)wsl --shutdownvia an admin/elevatedcmd)... and now my DNS in WSL is fixed!
I hope someone else finds this useful!
derekyle commentedon Jun 14, 2024
Adding to this for those that have the same issue as me. The above solution didn't work for me because every time I tried to disable the Tailscale tunnel, it would go away and a new connection would instantly start up and be enabled. Instead, I went to properties and unchecked the IPv6 option and it seems to have fixed the DNS problem inside WSL for me. No deletions or resolv.conf or anything else required. Did not even need a restart of WSL.