-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 DNS issues #5256
Comments
I am having the same issue. |
editing the /etc/resolv.conf file, add |
This didn't work for me. |
That doesn't work for me because i need to use my routers dns because i use that instead of using IPs |
I made DNS work by disabling Windows firewall |
tried this too, but didn't work, that's not the problem |
Yet another important issue with WSL 2 and no word from the team. I guess the best and most stable approach right now is to just use a full Linux distribution. |
+1 |
1 similar comment
+1 |
I'm having the same issue (not using a proxy, or vpn btw). After endless searching, none of the suggested workarounds (turning off firewall, manually overwriting the configuration files) found in other threads resolved the issue, so I had to revert do WSL 1.. It baffles me that an issue that impairs functionality to this degree has not been acknowledged, let alone fixed 2-3 months after "release". |
Then this is not your issue, you likely have a firewall issue or some other weird networking scenario like VPN clients mucking it up. The auto populated IP in the resolv.conf should point to the virtual host adapter IP. On a fresh WSL install you should always be able to ping say 8.8.8.8 - if you can't ping you don't have a DNS issue you have a networking issue to track down. |
Sounds like you have an networking issue not a DNS issue - could you ping external IPs? |
The behaviour as follows. In WSL 1 I can do the following:
In WSL 2 the results are as follows:
|
Incredibly unhelpful. It is the issue for many people, it is the same in issue trackers/forums/etc across the internet. The WSL instance cannot resolve domain names. Editing resolv.conf to point to a functioning nameserver "works" for the duration of the session, but as soon as the distro is rebooted resolv.conf is regenerated using WSL's original template. Because etc/resolv.conf is actually a symlink to run/resolvconf/resolv.conf Steps that have worked for me:
At this point, thanks to wsl.conf, run/resolvconf should no longer exist and will never be created again.
|
This worked for me. Thank you so much! I still don't know why nobody is tackling this issue. insane... |
As I said many folks don’t have a dns issue for example you had a networking issue by your own admission (100% packet loss). Tip for folks on GitHub learn to identify what your issue is (networking) not what you think it is (dns). |
I recently upgraded to 2004 and got access to WSL2. I installed a fresh version of Ubuntu 20.04 and experienced the same DNS issue reported by several others there. I am able to ping an external ip address (8.8.8.8), but not able to resolve a domain (github.com). This problem does not occur on WSL1. As mentioned above, the workaround with changing the nameserver in resolv.conf is the only thing that resolves the issue. |
@shoan you are totally correct. It seems WSL2 is assuming there is a dns resolver listening on the hosts internal network and there isn’t one listening (or isn’t accessible?). Makes me wonder if this is actually a hyper-v networking bug rather than a WSL2 bug, aka hyper-v NAT should have a dns resolver listening. I have tried tweaking the WSL adapter to no avail. Next up more research on how and when the hyper-v does and doesn’t do dns resolution for guest VMs. |
@shoan ok I think i know what might be causing the issue - it is some interaction of Hyper-V or Hyper-V plus docker desktop. re-Install procedure i used after cleaning out hyper-v and wsl and docker.
Started debian, sudo ping 8.8.8.8 worked and apt-get upgrade worked perfectly I will do more testing if i can now create a repro, without a reliable repro MS are not going to be able to troubleshoot this. Whatever the issue is it isn't WSL per-se - it is one of the other subsystems and its interaction with WSL. This is what my WSL and Hyper-V looks like in add remove. Note Hyper-V appears as unistalled, next up seeing if checking things in the hyper-v component install breaks a working sceanrio. this is what my network looks like - only one vswitch - and all is now working (i have had same issues as rest of you for months and months and months too - now i don't.... though today my PC also updated to 20180 so small chance that fixed it too!) |
This worked perfectly for me. had to create the wsl.conf file to stop the generation of the resolv.conf Thanks! It's a pity I need to find a work around, But I guess it is beta 🤷♂️ |
If you have DNS over HTTPS enabled and working on the windows machine, the Ubuntu DNS resolution will stop working. My DNS resolution dropped out as soon as I enabled this on the windows machine. |
This worked like a charm! thank you. |
Tried this. But still doesn't work for me😞 |
I converted WSL 2 back to 1 and Internet works now in Ubuntu 20.04. |
@jenishngl you are confusing symptom, root cause (issue) and fix vs workaround. There is one symptom - DNS doesn't work. I assure you on a fresh system WSL 2 DNS works just like it should aka there is no general purpose issue that DNS inside WSL is broken or not operating as designed. There are multiple issues (these are just the ones I am aware of):
The steps you posted (why on earth you posted them again when they already in the issue thread is beyond me) is not a fix, it is a workaround that doesn't fix the underlying cause, yes it may solve the symptom and that's great in short tun but not the long run. If the firewall fix and the reset of hyper-v networking doesn't work then it is indeed an different issue and rather than reposting the workaround that has been posted several time what would be actually helpful of you is to try and root cause your issue, even better create a repro and then submit bug with right details. I am trying to do the same on the hyper-v networking, i am stuck at a repro; this isn't about what happens inside WSL2 - it is about the is some combination of hyper-v networking configuration state that either a) is broke or b) the developers of WSL have not accounted for. We are supposed to use these threads to provide meaningful feedback to get the issue fixed, github issues are not intended to be a general support forum. So yes i think i am being helpful as i posted new workaround that adds context and new insight to the issue (underlying root cause) and did not repeated what has been posted multiple times. Sorry if you tried every step in my workaround that it didn't work - that means you have a different root issue. Or if everyone thinks the fix is to mess with resolv.conf then the bug can be closed. Personally i don't. |
This is happening quite FREQUENTLY, and still, NO WORDS from the WSL team. 😒 |
@iamWing If it's about DNS this should do the trick: #5336 (comment) |
@Elektronenvolt Thanks mate. Unfortunately it doesn't work either. Might be because the firewall is controlled by McAfee rather then Windows. I have no right to change anything in McAfee tho so I've gave up using WSL2 on my work laptop for now. |
According to the logs of my local dns server, it received the dns query from dig and successfully sent a response, but dig failed to receive the response. |
same issues tried everything.
|
give this man a medal! Thanks! |
The past two days I've been having issues with connections to my company's LAN and VPN setup. I use docker on WSL2, and the issue seems to stem from a situation where docker's bridge networks could overlap with the hyper-v switch that provides networking to WSL. This knocks out networking via the VPN. I'm not an expert on IP nor DNS, but I would stress the need to check your company's VPN, your WSL2 vEthernet adapter and docker's bridge interfaces are not colliding on the 172.22.xxx.xxx ranges. It does not seem like my current workaround config is possible with |
DNS NETWORK on WSL2 STILL JUST BREAKS: CLOSING THOUSANDS OF BUG REPORTS ON THIS 10 YEAR OLD BUG (WHICH IS NOT FIXED) IS WEIRD!I have implemented that hard coded DNS solution (above) and protected /etc/resolv.conf with chattr etc done swap=0 and all sorts and it is a lot better, but WSL2 still looses it's DNS even if you disconnect briefly and reconnect your IPsec VPN. Once that happens still have to reboot. (I am running WSL2 on top end Dell laptop with up-to-date bios and Windows 10.) When running ordinary applications under Windows or on a Linux PC, any disconnection of the network and reconnection allows all applications to reconnect to the network no problem; not so with WSL2 it's still got a fragile DNS! When running WSL, DNS resolution is lost even with a brief disconnection or the lease time on the network driver laps and reconnects (which is normal), after that you can’t connect or even ping devices unless you reboot! This is specifically and a WSL Linux bug coded brilliantly by Windows network programmers and they have closed THOUSANDS of the same reports, that is WEIRD! Even with millions of complaints, and thousands of bug reports, this bug has been persistent for almost a decade and NOT FEXED IN JULY 2023! This is so serious many developers avoid all Docker development under WSL and Windows. WSL team members even close bug reports rather than combine the data from thousands of similar reports. When reports are closed so that others can’t comment the geniuses have magically fixed the major bug right? NOT! The use of Docker Desktop makes it 100 times worse, but fortunately Docker Desktop is NOT Docker and many people run WSL2 without Docker Desktop. |
@KonanTheLibrarian - We had that WSL DNS issue on multiple machines and didn't find a root cause for a long time. Finally figured out that for an unknown reason incoming DNS was blocked on the public network profile on some machines. See: We fixed it by setting an inbound firewall rule for the WSL network adapter with Powershell: Needs to be done again after reboots, but it's a fast workaround. Was not a WSL issue in our case. |
Hi folks, we have put out a new update that aims to address networking issues in WSL. In your More info on this release and the changes can be found here in the blog post. Please note: You need to be on a Windows Insiders version to use the new networking settings (Any channel of Windows Insiders will do, including release preview). If you see the "These are not supported" messages it means that your current Windows version doesn't have support, and you will need to upgrade. These features will eventually be coming to Windows 11 22H2. |
Or WSL 1, which does networking right. |
Hi. Can you try enabling the new experimental "dnsTunneling" feature and let us know if the issue still reproduces? You can find more details at https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/ Thanks! |
There is no way to provide a downloadable update package? I could test on
my work laptop where most of the issues with networking are, VPN, etc. But
our security team locks down the Preview channel. -Matt
…On Tue, Sep 26, 2023, 6:18 PM Cătălin Emil Fetoiu ***@***.***> wrote:
Hi. Can you try enabling the new experimental "dnsTunneling" feature and
let us know if the issue still reproduces?
You can find more details at
https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/
Thanks!
—
Reply to this email directly, view it on GitHub
<#5256 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AECPVRTU6FP7VHO7ENB32T3X4NPD7ANCNFSM4NIMR5SQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
These new networking features are now available on the latest version of Win11 22H2! Please make sure you're on the latest build to get these features, you can do that by clicking "Check for Updates" in Windows settings. You can check you have the right build by either ensuring you have KB5031354 installed, or run |
@craigloewen-msft I have the latest Win11 23H2 stable (10.0.22631.2428) and I get error Key experimental.networkingMode unknown and same with DNS tunneling. |
I download lates prerelease 2.0.7 from here https://github.com/microsoft/WSL/releases, install it and it's works for me. |
Sorry for the DNS issues. We have updated our troubleshooting with some configuration conflicts that can break DNS name resolution from the WSL container, as well as a work-around for an OS bug. Please see https://github.com/MicrosoftDocs/WSL/blob/main/WSL/troubleshooting.md#troubleshooting-dns-in-wsl Thanks. |
In my case I was unable to ping anything. Not google.com, not github.com and that was causing git clone to timeout. This was the default generated
So I tried My working theory about what happened is that my laptop while in sleep mode got pinned on my home router. My laptop was at my place in sleep mode (connected to my home router). Then I took my laptop to a different place while it was still in sleep mode. And I suddenly could not connect to anything at all in wsl2. Everything is working fine now after the restart. Hope this helps someone - these kinds of things that should "just work" can be maddening to deal with... |
What caused the issue for me was another firewall (Portmaster) blocking traffic. I just turned it off and it immediately started working again. I recommend all to check their firewalls (pc-side, router-side, etc.) I hope it helps! |
https://github.com/vxiaov/vClash?tab=readme-ov-file It works for me. [dog] |
Looks like dns tunneling is now enabled by default, hopefully that will help with some of the (likely) multiple causes of these DNS issues. |
I just installed WSL2 pre-released, and this is still a issue!! |
https://learn.microsoft.com/en-us/windows/wsl/networking#dns-tunneling This should fixed by enabling dns tunnelling, which now no longer experimental. |
Your Windows build number:
Microsoft Windows [Version 10.0.19041.264] (desktop)
Microsoft Windows [Version 10.0.19041.264] (laptop)
What you're doing and what's happening:
on wsl2 on my desktop PC, name resolution seems to always fail (i've had it working in the past)
on my laptop, wsl2 name resolution works fine
on my desktop:
sudo apt-get update
ping -c 4 google.com
ping -c 4 172.217.23.174
(the ip i get fromping google.com
in cmd)What's wrong / what should be happening instead:
on my laptop:
sudo apt-get update
ping -c 4 google.com
ping -c 4 172.217.23.174
(the ip i get fromping google.com
in cmd)The text was updated successfully, but these errors were encountered: