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
WSL 2 DNS not working #4855
Comments
Same issue, EDIT: slow ring btw 19041 |
Same issue. /etc/resolv.conf suggestions have no effect. Full Windows reboot seems to fix. I can ping via IP4 addr (ex. for github.com: ping 192.30.253.113 ) |
The 'Network is unreachable' error is different from the DNS error but both related to the same problem. WSL2 is using a NAT adapter - vEthernet (WSL) Internal Network. If you open network connections, right click and click status it probably says 'No Network'. ifconfig in wsl shows eth0 is on a 172 ip address. To get around that I had to set the wsl adapter to 'External Network' in Hyper-V manager, and bridge it to my wifi connection, which gave the WSL2 adapter a 192.168 IP address. Then in WSL2 I had to set the new IP address, and update resolv.conf with the new IP address of the wsl adapter: Everytime I had a incorrect config somewhere I would get the DNS error. After I had all the config working correctly on the network bridge I could ping any hostname or IP address and got a response. I tried this process again, uninstalled / reinstalled Ubuntu 18.04, I've set up the network bridge and IP's and I have the DNS error, despite the wsl2 vEthernet connection status saying 'internet' in ipv4. I must have the wrong config somewhere. The annoying thing was even when I had the config set up correctly, rebooting would always generate a new IP address in WSL and I had to repeat the network bridge setup and IP address assignment. #4285 and #3268 are duplicates of this one, and there are quite a few more related open issues. I've read through at least 10. I set up a bridged network years ago with an external network adapter in my second pc for using VM's in hyper V, somehow it just works and I've never had any DNS or network problems in WSL2 with that PC. Hopefully these errors will go away when #4150 is ready but not sure when that will be. |
The proof for it is in my initial description: The Wireshark capture show that the problem is not with the network adaptor blocking the DNS query. The problem is that the DNS query request was never sent out. This is an internal WSL 2 problem that CAN NOT be solved by making changes in the Network Adaptor. |
If I set my dist ver to WSL 2, then DNS works. If I set it back to WSL2, it fails. I too am unable to get it working in WSL-2. I did not have these issues until recently, and I’m unsure what changes I made to either Windows or WSL.
|
Is anyone from Microsoft listening? If no, where can a defect report be submitted? |
I found the problem in my case: Firewall. If I disable my mcafee End Point Security Firewall, DNS works on my WSL 2.0 box:
|
Adding a Rule in Firewall that allows UDP port 53 (domain port) solves the problem too |
Perhaps related: I just noticed that something has being creating tons and tons of inbound rules at the Windows Firewall configuration relative to port 53 (DNS): They are all of two types: HNS Container Networking - ICS DNS (TCP-In), associated to svchost.exe. I'm at Windows 10 Pro build 19564 with WSL2, using regularly Ubuntu 18.04.4 LTS and Docker CE 19.03.6 (from the Ubuntu packages provided by Docker [1], not the new experimental Docker for Windows that uses WSL2). [1] https://docs.docker.com/install/linux/docker-ce/ubuntu/ If they're inbound rules, my first guess is that these are created by WSL2 for a local DNS server used on things like localhost resolution to the ip address of the WSL2 network interface. It concerns me that so many rules have being created at the firewall, and I'm unsure about removing them, but could it be related that this registration process somehow fails, or it works but the addition of so many rules delays the actual DNS responses? |
It works in my evaluation copy of 2004. Additional info:
|
The only case when it fails is nslookup from inside docker-desktop ddstro: Name: www.google.com |
Doing the following worked for me Windows Features - Disable WSL |
I finally found a solution and I must say I didn't think of it. This came from another thread on Stack Overflow. The hosts file had a bunch of docker crap in it that I did not load however I did load docker desktop on my pc and uninstalled it after it broke a large amount of my build processes. I installed Ubuntu 18.04 AFTER uninstalling docker so it must leave all sorts of turds around for you to try and find - not exactly user friendly I would say! 127.0.0.1 localhost I had to remove that and adding the following in the /etc/hosts solved the problem for me 127.0.0.1 ip-XXX-XX-XX-XXX" answered May 20 '19 at 0:40 Nabin |
This will solve your issue.. |
This was related to my firewall as well. I have simplewall turned on and it was blocking incoming UDP port 53 packets from the 192.168.x.x block. I enabled port 53 inbound and DNS immediately worked in WSL again. |
That also fixed the issue for me. WSL/Ubuntu files still exist too. |
I've got the same issue. On my side it was due to Windows FW. An easy lookup for it is to disable the FW globally or only for the WLS2 vEthernet adapter, then try to make a DNS query from WSL2; if it works the issue is bound to Windows FW configuration. In that case, you can either take the time to analyse your FW rules or if you don't mind (as me), you can globally allow DNS queries by adding a new inbound/outbound rule for it: |
The problem is the VPN Ethernet Adaptor's DNS server settings are not taken by the WSL. |
Open a PowerShell with adminitrative privileges and run: Thats all. You can keep using your windows host as DNS relay instead of modifying DNS servers in |
It doesn't work for me |
I was facing same issue (which has started just after "wsl --update") , that fixed it for me too. |
Windows build number: 10.0.19041.21
I know it sounds like previous DNS problem reports, but this one is a bit different...
If I use IP addresses and not network address names, the network works fine. But network addresses are not resolved into IP addresses.
On a WSL 2 Ubuntu command prompt, i query for an IP address:
I can ping the 15.64.64.53 DNS Server. I can also get ping out to google.com:
I was expecting to get the IP address of google.com, but instead i got the following:
Wireshark capture show that the following took place:
And that's it. Silence. The DNS query did not go on its way.
If I switch the distribution back to wsl 1, I get the proper response:
The wireshark capture in this case looks like this:
Please don't suggest anything related to /etc/resolv.conf. It doesn't help.
The text was updated successfully, but these errors were encountered: