WSL2 DNS stops working
Please fill out the below information:
- Your Windows build number: (Type
verat a Windows Command Prompt)
Microsoft Windows [Version 10.0.18932.1000]
- What you're doing and what's happening:
> bash
% host google.com
;; connection timed out; no servers could be reached
- What's wrong / what should be happening instead: DNS resolution should work
/etc/resolv.conf:
% 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 172.19.224.1
To my knowledge, I didn't change anything. This has happened a few times, and rebooting fixes it. Sometimes just doing wsl --shutdown is sufficient to fix it. It correlates with my workstation going to sleep and resuming later with DNS in WSL2 not working.
Whatever provides the internal WSL2 dns seems busted, but other dns servers are successful:
% 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 172.19.224.1
% host google.com 172.19.224.1
;; connection timed out; no servers could be reached
% host -t A google.com 1.1.1.1
Using domain server:
Name: 1.1.1.1
Address: 1.1.1.1#53
Aliases:
google.com has address 216.58.194.174
@jordansissel This started happening to me yesterday, but it seems my whole network is busted:
$ host -t A google.com 1.1.1.1
;; connection timed out; no servers could be reached
$ ping 8.8.8.8
connect: Network is unreachable
Running with AV and Firewall disabled.
EDIT: I disabled, restarted, and re-enabled the WSL and Virtual Machine Windows Features and it looks to work now.
I ran into this same issue; resolved for now after removing etc/resolve.conf and resetting the entire dns config via the resolvconf package, pointing to cloudflare's 1.1.1.1.
Maybe it is related to this: #4275
Using build: 18932.1000: I ran into this issue on Ubuntu also. Sometimes rebooting windows host and executing wsl --shutdown works. Will look into it further as it occurs and check back on solutions.
I am seeing this same DNS behavior on Build 18941. The local DNS server is not responding but I can route out to the internet and everything works fine once I set a manual resolv.conf. Using both the official Kali and Ubuntu distros in the store, converted to WSL 2. I have no other Hyper-V VMs.
Ifconfig:
bond0: flags=5122<BROADCAST,MASTER,MULTICAST> mtu 1500 ether 0a:b1:11:d2:aa:66 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.18.201.80 netmask 255.255.0.0 broadcast 172.18.255.255 inet6 fe80::215:5dff:fe9a:1fe3 prefixlen 64 scopeid 0x20 ether 00:15:5d:9a:1f:e3 txqueuelen 1000 (Ethernet) RX packets 11 bytes 1507 (1.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16 bytes 1232 (1.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
sit0: flags=128
Facing the same issue on 18956. manually setting resolv.conf is a temporary solution. adding generateResolvConf to false did not affect anything. What's with that ip address (one starting with 172) though? have never seen it before
Facing the same issue on 18956. Git and Ping does not work.
My workaround:
- Create a file:
/etc/wsl.conf. - Put the following lines in the file
[network]
generateResolvConf = false
- In a
cmdwindow, runwsl --shutdown - Restart WSL2
- Create a file:
/etc/resolv.conf. If it exists, replace existing one with this new file. - Put the following lines in the file
nameserver 8.8.8.8
- Repeat step 3 and 4. You will see
gitworking fine now.
Yeah. I did the same. I suppose it's occuring due to the modifications to network settings with the last fast ring update.
Get Outlook for Androidhttps://aka.ms/ghei36
From: NonStatic [email protected] Sent: Saturday, August 17, 2019 9:09:55 AM To: microsoft/WSL [email protected] Cc: mahsoommoosa42 [email protected]; Comment [email protected] Subject: Re: [microsoft/WSL] WSL2 DNS stops working (#4285)
My workaround:
- Create a file: /etc/wsl.conf.
- Put the following lines in the file
[network] generateResolvConf = false
- In a cmd window, run wsl --shutdown
- Restart WSL2
- Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file.
- Put the following lines in the file
nameserver 8.8.8.8
- Repeat step 3 and 4. You will see git working fine now.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FWSL%2Fissues%2F4285%3Femail_source%3Dnotifications%26email_token%3DAFA4ITLUCJ7RBWMFDIP3MHLQE5XIXA5CNFSM4H65IQMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QCPPI%23issuecomment-522201021&data=02%7C01%7C%7C73660638a70d4dbc6c4f08d722c49219%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637016099969731395&sdata=6rg9%2FiwAZkJoOhwhu6sHElqoJptYoS19AbuYTY5flPw%3D&reserved=0, or mute the threadhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFA4ITMQRWJZKXU26K6BC33QE5XIXANCNFSM4H65IQMA&data=02%7C01%7C%7C73660638a70d4dbc6c4f08d722c49219%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637016099969741400&sdata=ufzaqjmQaVAOOmGeoirghbUOw9ZddYre3JAnJcprh5k%3D&reserved=0.
@Klein-Hu : tried your workaround, followed your steps, but it doesn't seem to be working for me.
My /etc/resolv.conf file is getting wiped out every time I relaunch wsl2 :-/
Did you enter 'wsl --shutdown' into the cmd?
From: ambar [email protected] Sent: Wednesday, September 11, 2019 2:36 PM To: microsoft/WSL [email protected] Cc: mahsoommoosa42 [email protected]; Comment [email protected] Subject: Re: [microsoft/WSL] WSL2 DNS stops working (#4285)
@Klein-Huhttps://github.com/Klein-Hu : tried your workaround, followed your steps, but it doesn't seem to be working for me.
My /etc/resolv.conf file is getting wiped out every time I relaunch wsl2 :-/
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WSL/issues/4285?email_source=notifications&email_token=AFA4ITKHNAZWNB7F7W6376LQJCYK7A5CNFSM4H65IQMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6NZ27Y#issuecomment-530292095, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFA4ITLPNO6V63C5UXARNC3QJCYK7ANCNFSM4H65IQMA.
Yes, I did.
I'm not on Insiders anymore. So, I'm not sure if anything has changed in between.
From: ambar [email protected] Sent: Wednesday, September 11, 2019 11:01 PM To: microsoft/WSL [email protected] Cc: mahsoommoosa42 [email protected]; Comment [email protected] Subject: Re: [microsoft/WSL] WSL2 DNS stops working (#4285)
Yes, I did.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WSL/issues/4285?email_source=notifications&email_token=AFA4ITIBLVEDLIBFTQUXDVLQJETQ3A5CNFSM4H65IQMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6PIQ6A#issuecomment-530483320, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFA4ITOQIJFP2RJ6C5KJ6TTQJETQ3ANCNFSM4H65IQMA.
@nonbeing make sure resolv.conf is a file and not a link
ls -la /etc/resolv.conf
-rw-r--r-- 1 root root 185 Sep 11 16:32 /etc/resolv.conf
My workaround:
- Create a file:
/etc/wsl.conf.- Put the following lines in the file
[network] generateResolvConf = false
- In a
cmdwindow, runwsl --shutdown- Restart WSL2
- Create a file:
/etc/resolv.conf. If it exists, replace existing one with this new file.- Put the following lines in the file
nameserver 8.8.8.8
- Repeat step 3 and 4. You will see
gitworking fine now.
wsl --shutdown doesn't seem to work for me
wslconfig.exe /terminate Ubuntu does
Running insider 10.0.18980.1, kernel 4.19..67 Seems as if the dns resolver running on 172 is single threaded? Request that timeout seem to block.
Just started seeing this today after an update as well
Microsoft Windows [Version 10.0.18980.1]
I made a gist with @Klein-Hu 's instructions. They worked like a charm for me.
For anyone seeing this, the "fixes" proposed are merely a workaround to the problem. In situations where internal/private DNS servers (eg. corporate or home network), DNS will not resolve as expected.
I consider this a critical bug.