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
Your Windows build number: (Type ver at 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.
Reacted by Morten Ricki Elmegaard, Ambar, michaelsew, macbury, Jeffrey Clark, Anton Sudak, Yoonseop Kang, Nikos Douvlis, Richard Simpson, Henry Cho and 155 more
Reacted by Jaime Moncayo
Reacted by Trouble
Reacted by Leon Heess and Jaime Moncayo
Reacted by Jeffrey Clark, Nikos Douvlis, Joe Wood, Henry Cho, Aaron Curtis, Janusz, Ahmadali Shafiee, Gonzalo Moreno, IlyaKochnev, Matthew and 9 more
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
Reacted by Manfred Lange, Axel Lells Hjelmqvist, Matthew Sundberg and Andrei Damian-Fekete
$ 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.
Reacted by Adam Hanna, Jason Elie Bou Kheir, Joe Wood, Matt Poole, Gonzalo Moreno, tanghailong1205, Tyler Nielsen, kyori19, Justin Stander, Aman Patel and 7 more
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.
Reacted by Soham Dasgupta, Duarte O.Carmo and Miles Buckton
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.
Reacted by Jim King, Justin Stander and Sabin Kumar Shrestha
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.
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
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.
Reacted by Rubén González, michaelsew, Oleksiy Stetsyuk, Colten Krauter, yangmingzhe, Yoonseop Kang, Vinicius De Antoni, Wayc0de, Dmitry M. Gavrovsky, Diego Borges and 272 more
Reacted by Costi Rgg, Aditya Hoige, mcrapts, Igor Morozov, Steven Williams, Nikhil Attar, J. Scott Elblein, George, Tommy May, Zazzop and 10 more
Reacted by Xudong Shen, 麻酱, natalicot, zero-plusplus and Claudio Pereira
Reacted by Raphael Preston, qhualaupies, Anthony P, Rafael Bernabeu, AG-LC, maperr, Oussama Bouguerne, mendoz-a, Tommy Dougiamas, Yassine Fathi and 31 more
Reacted by Felipe Gustavo and Andrii Lytvynenko
Reacted by Szabó, Zoltán, Beren Gamble, Raphael C, Raphael Preston, vibu, Marvin Knoll, Gaurav Sharma, Rafael Bernabeu, Alexander Spivak, AG-LC and 55 more
Reacted by Raphael Preston, larsgrah, Chris Rogus, Rafael Bernabeu, AG-LC, Oussama Bouguerne, Sergej, mendoz-a, Valter Vicente, Katie Barriere and 23 more
Reacted by Raphael Preston, Janusz, mendoz-a, anguyenkn, Drew Miller, Erdogan, Tifenn, Xudong Shen, John Carlo Roberto, Mateusz Pokora and 3 more
Same thing happened to me. I was building a container and it worked fine, but then my computer ran out of space, so WSL2 crashed. I quit Docker, used wsl --shutdown and compacted the virtual disk. After starting Docker and WSL2 again, I used docker system prune. When I retried building the container, it started failing on build, unable to install Node packages because of the network connection. I tried wsl --shutdown again, and it didn't work. I can't modify resolv.conf.
However, after a few tries, it works. I still don't know what the problem is.
What I experienced is a little different, on wsl2ubuntu 20.04. DNS works fine with the default, generated /etc/resolv.conf, nameserver 172.17.0.1. But DNS stopped working once dockerd starts. I tried to disable the auto-generation using the method described earlier, and explicitly set nameserver to a DNS server, e.g. 8.8.8.8. But it did not work for me. DNS stopped working once dockerd starts, and even if I subsequently stopped dockerd. Noticing that dockerd creates an interface on 172.17.0.1, which may interfere with wsl2 DNS forwarding, I changed the docker config to make dockerd create intf in a different subnet. After that change DNS works when dockerd is running. There is no need to disable the default auto-generation of /etc/resolv.conf. DNS inside a docker container, e.g. minikube pod, needs more configuration. But that seems to be a separate issue.
The docker config change is simple. Just the following in /etc/docker/daemon.json:
{
"bip" : "10.10.0.1/16"
}
Reacted by sirpilan, Lars Jonsson Baker, Mickaël Salmon, Ondřej Machala, chhe, Lucero Alvarado Ruiz (Lu0) and yk
Reacted by Michaël Arnauts, Lars Jonsson Baker, christian-van-rensen-tng and Adam Smith
I had bridge IPs that I think are recreated by the WSL service. I deleted them with some PS commands after screwing them up, then new ones are created when I bring WSL back on line.
This fix worked for me within WSL. I haven't used docker extensively on this new machine to verify the docker dns, but I have updated the docker dns on other machines and it worked inside docker containers.
FYI, Windows 11 still has the extra adaptors, but you only see them in administrator tools from what I've read. I haven't had the need to dig in there, yet. Windows 10 had them in the standard "network adaptors" screen.
which updates my /etc/resolv.conf file with the correct nameserver from my VPN. After executing this I usually have to also run in Powershell Restart-NetAdapter -Name "vEthernet (WSL)" -Confirm:$false to force the adapter to reset, and then my WSL connections are all good.
It's been a while since I've had this problem, but it happened again today. Typical symptoms -- dns timeouts. Targeting other DNS servers directly works fine (local router's dns, google dns, etc). The default WSL2 dns server does not respond.
From further up this thread, lots of reports about firewall issues, so I can report that DNS(1) fails, but then if I disable the Windows Firewall, DNS(1) works again.
(1) "DNS" aka the default wsl2 dns server which on my system is some WSL-internal 172.20.128.1 address -- the same address as the default route.
Using nslookup from the Windows side, I can use the WSL dns server (setting server 172.20.128.1). Inside WSL, however, it times out unless I disable the firewall.
Hope this helps one of us eventually solve this 🤷♂️
I wasn't having this problem until the newest Windows 11 update that recently occurred as of this post. I've tried all of the fixes mention above.
For context, I'm on a VPN using Cisco AnyConnect. I've tried both the Windows 11 version and the Microsoft Store version. I need to access a server on the intranet. (Of which, I do not know the IP of the internal DNS server)
As a hotfix, I created a static host file of the ip of the server I needed to ssh into. Kind of a gross fix, but it works if you already know the ip address of the server you need.
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
"After I removed the 172 address from the interface, DNS resolution returned to normal."
Activity
jordansissel commentedon Jul 8, 2019
Whatever provides the internal WSL2 dns seems busted, but other dns servers are successful:
lkuich commentedon Jul 8, 2019
Jordan Sissel (@jordansissel) This started happening to me yesterday, but it seems my whole network is busted:
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.
develleoper commentedon Jul 9, 2019
I ran into this same issue; resolved for now after removing
etc/resolve.confand resetting the entire dns config via theresolvconfpackage, pointing to cloudflare's1.1.1.1.heamaral commentedon Jul 10, 2019
Maybe it is related to this: #4275
bmpertierra commentedon Jul 11, 2019
Using build: 18932.1000: I ran into this issue on Ubuntu also. Sometimes rebooting windows host and executing
wsl --shutdownworks. Will look into it further as it occurs and check back on solutions.astamos commentedon Jul 23, 2019
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
loop txqueuelen 1000 (Local Loopback)
RX packets 8 bytes 560 (560.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 560 (560.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sit0: flags=128 mtu 1480
sit txqueuelen 1000 (IPv6-in-IPv4)
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
mahsoommoosa42 commentedon Aug 15, 2019
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
mahsoommoosa42 commentedon Aug 15, 2019
Facing the same issue on 18956. Git and Ping does not work.
non-static commentedon Aug 17, 2019
My workaround:
/etc/wsl.conf.cmdwindow, runwsl --shutdown/etc/resolv.conf. If it exists, replace existing one with this new file.gitworking fine now.mahsoommoosa42 commentedon Aug 17, 2019
nonbeing commentedon Sep 11, 2019
klein-hu : tried your workaround, followed your steps, but it doesn't seem to be working for me.
My
/etc/resolv.conffile is getting wiped out every time I relaunch wsl2 :-/mahsoommoosa42 commentedon Sep 11, 2019
nonbeing commentedon Sep 11, 2019
Yes, I did.
mahsoommoosa42 commentedon Sep 11, 2019
onomatopellan commentedon Sep 11, 2019
Ambar (@nonbeing) make sure resolv.conf is a file and not a link
271 remaining items
Mithras commentedon May 28, 2022
If you are in MS corpnet, you can repo it by installing any Docker after 3.5.2.
LUC18fknU7P commentedon May 29, 2022
Yes, this also happened to me while using Docker. No VPNs or that kind of stuff.
carlos-hdzm commentedon Jun 7, 2022
Same thing happened to me. I was building a container and it worked fine, but then my computer ran out of space, so WSL2 crashed. I quit Docker, used
wsl --shutdownand compacted the virtual disk. After starting Docker and WSL2 again, I useddocker system prune. When I retried building the container, it started failing on build, unable to install Node packages because of the network connection. I triedwsl --shutdownagain, and it didn't work. I can't modify resolv.conf.However, after a few tries, it works. I still don't know what the problem is.
eg-fxia commentedon Jul 11, 2022
What I experienced is a little different, on
wsl2ubuntu 20.04. DNS works fine with the default, generated/etc/resolv.conf, nameserver 172.17.0.1. But DNS stopped working oncedockerdstarts. I tried to disable the auto-generation using the method described earlier, and explicitly set nameserver to a DNS server, e.g. 8.8.8.8. But it did not work for me. DNS stopped working oncedockerdstarts, and even if I subsequently stoppeddockerd. Noticing thatdockerdcreates an interface on 172.17.0.1, which may interfere withwsl2DNS forwarding, I changed the docker config to makedockerdcreate intf in a different subnet. After that change DNS works whendockerdis running. There is no need to disable the default auto-generation of/etc/resolv.conf. DNS inside a docker container, e.g.minikubepod, needs more configuration. But that seems to be a separate issue.The docker config change is simple. Just the following in
/etc/docker/daemon.json:jikuja commentedon Jul 13, 2022
Did you report this on the docker repo(s)?
ps2goat commentedon Aug 11, 2022
I had bridge IPs that I think are recreated by the WSL service. I deleted them with some PS commands after screwing them up, then new ones are created when I bring WSL back on line.
This fix worked for me within WSL. I haven't used docker extensively on this new machine to verify the docker dns, but I have updated the docker dns on other machines and it worked inside docker containers.
FYI, Windows 11 still has the extra adaptors, but you only see them in administrator tools from what I've read. I haven't had the need to dig in there, yet. Windows 10 had them in the standard "network adaptors" screen.
petertirrell commentedon Oct 31, 2022
In case it helps anyone, I have a workaround that I use to "fix" DNS after I connect to my VPN, as that's where I see the issue. In WSL I run
which updates my /etc/resolv.conf file with the correct nameserver from my VPN. After executing this I usually have to also run in Powershell
Restart-NetAdapter -Name "vEthernet (WSL)" -Confirm:$falseto force the adapter to reset, and then my WSL connections are all good.jordansissel commentedon Oct 31, 2022
It's been a while since I've had this problem, but it happened again today. Typical symptoms -- dns timeouts. Targeting other DNS servers directly works fine (local router's dns, google dns, etc). The default WSL2 dns server does not respond.
From further up this thread, lots of reports about firewall issues, so I can report that DNS(1) fails, but then if I disable the Windows Firewall, DNS(1) works again.
(1) "DNS" aka the default wsl2 dns server which on my system is some WSL-internal 172.20.128.1 address -- the same address as the default route.
Using
nslookupfrom the Windows side, I can use the WSL dns server (settingserver 172.20.128.1). Inside WSL, however, it times out unless I disable the firewall.Hope this helps one of us eventually solve this 🤷♂️
jordansissel commentedon Oct 31, 2022
From a linked issue, possibly a solution for some of us will be released soon as noted in this comment: #8365 (comment)
rcprior commentedon Nov 1, 2022
The issue seems to be fixed: #8365 (comment)
felipe-gustavo commentedon Nov 8, 2022
I've tried to solve it for a whole week, thank you a lot Christopher Armstrong (@radix), I owe you my soul
NanoWar commentedon Jun 27, 2023
Quick fix that worked for me:
Mithras commentedon Jun 30, 2023
Hot take:
Instead of running Windows with Linux VM in it, you can just run Linux with optional Windows VM in it if necessary. Solved all my problems.
SandysPappy commentedon Sep 20, 2023
I wasn't having this problem until the newest Windows 11 update that recently occurred as of this post. I've tried all of the fixes mention above.
For context, I'm on a VPN using Cisco AnyConnect. I've tried both the Windows 11 version and the Microsoft Store version. I need to access a server on the intranet. (Of which, I do not know the IP of the internal DNS server)
As a hotfix, I created a static host file of the ip of the server I needed to ssh into. Kind of a gross fix, but it works if you already know the ip address of the server you need.
and add
<ip address of server> <domain.of.the.server.com>rwayan commentedon Jul 30, 2024
"After I removed the 172 address from the interface, DNS resolution returned to normal."