WSL: WSL 2 DNS not working
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:
$ nslookup google.com 15.64.64.53`
I can ping the 15.64.64.53 DNS Server. I can also get ping out to google.com:
$ ping -c 1 15.17.198.85
PING 15.17.198.85 (15.17.198.85) 56(84) bytes of data.
64 bytes from 15.17.198.85: icmp_seq=1 ttl=123 time=1.06 ms
I was expecting to get the IP address of google.com, but instead i got the following:
;; connection timed out; no servers could be reached
Wireshark capture show that the following took place:
1. 00:15:5d:50:51:ac -> 00:15:5d:50:57:89 : ARP : Who has 172.27.128.1? Tell 172.27.141.152
2. 00:15:5d:50:57:89 -> 00:15:5d:50:51:ac : ARP : 172.27.128.1 is at 00:15:5d:50:57:89
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:
$ nslookup google.com 15.64.64.53
Server: 15.64.64.53
Address: 15.64.64.53#53
Non-authoritative answer:
Name: google.com
Address: 172.217.20.78
Name: google.com
Address: 2a00:1450:400e:80a::200e
The wireshark capture in this case looks like this:
1. 15.18.71.122 -> 15.64.64.53 : DNS : Standard query 0x4a95 A google.com
2. 15.64.64.53 -> 15.18.71.122 : DNS : Standard query response 0x4a95 A google.com A 172.217.20.78
3. 15.18.71.122 -> 15.64.64.53 : DNS : Standard query 0x3a5 AAAA google.com
4. 15.64.64.53 -> 15.18.71.122 : DNS : Standard query response 0x3a5 AAAA google.com 2a00:1450:400e:80a::200e
Please don’t suggest anything related to /etc/resolv.conf. It doesn’t help.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 22
Doing the following worked for me
Windows Features - Disable WSL Reboot Windows Feature - Enable WSL Reboot
This will solve your issue… https://gist.github.com/sivinnguyen/8bc0125b274250683a97e149cf270040
Open a PowerShell with adminitrative privileges and run:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action AllowThats all. You can keep using your windows host as DNS relay instead of modifying DNS servers in
/etc/resolv.confMore info
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. HNS Container Networking - DNS (UDP-In), for any program.
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?
Adding a Rule in Firewall that allows UDP port 53 (domain port) solves the problem too
Same issue. /etc/resolv.conf suggestions have no effect. Full Windows reboot seems to fix. 10.0.19041.1 Ubuntu-18.04-LTS running as version 2.
I can ping via IP4 addr (ex. for github.com: ping 192.30.253.113 ) But ping github.com does not resolve.
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: