Not looking for a response. Just sharing tonights experience since having to document it slows me down so I gain a better understanding, and maybe its useful for someone else…
Opened WSL shell.
$ ping google.com
ping: google.com: Temporary failure in name resolution
$ cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
Wow! thats a suprise, that the system removed that file.
Restarted Windows LxssManager service to reboot Linux Subsystem.
Opened new WSL shell
resolv.conf still missing. Ahh… maybe need…
/etc/wsl.conf
[network]
- generateResolvConf = false
+ generateResolvConf = true
Rebooted Linux Subsystem again and opened new shell, and it had created the file
$ cat /etc/resolv.conf
nameserver 172.31.192.1
$ ifconfig
eth0: inet 172.31.201.159 netmask 255.255.240.0 broadcast 172.31.207.255
# linux host IP and nameserver IP are on the same subnet (172.31.192.1 - 172.31.207.254)
# so expected to be on same layer 2 virtual switch, no routing.
$ ping 172.31.192.1 #nameserver
33 packets transmitted, 0 received, 100% packet loss, time 33284ms
$ ping 10.1.1.116 #Win-host
10 packets transmitted, 0 received, 100% packet loss, time 9393ms
$ ping 10.1.1.1 #Wireless gateway
64 bytes from 10.1.1.1: icmp_seq=1 ttl=63 time=6.39 ms
From Windows side vEthernet(WSL) IP matches linux host. good.
C:> ipconfig /all
Wireless LAN adapter Wi-Fi:
Description . . . . . . . . . . . : Qualcomm QCA61x4A 802.11ac Wireless Adapter
DHCP Enabled. . . . . . . . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.1.1.116(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.1.1.1
DHCP Server . . . . . . . . . . . : 10.1.1.1
DNS Servers . . . . . . . . . . . : 10.1.1.1
Ethernet adapter vEthernet (Default Switch):
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
IPv4 Address. . . . . . . . . . . : 172.29.64.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Ethernet adapter vEthernet (WSL):
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
IPv4 Address. . . . . . . . . . . : 172.31.192.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
$ ping 172.31.201.159 #WSL eth0
Reply from 172.31.201.159: bytes=32 time<1ms TTL=64
$ ping 172.31.192.1 #WSL nameserver
Reply from 172.31.192.1: bytes=32 time<1ms TTL=128
So Win11-host can nameserver, but WSL can’t.
Win11-host can ping WSL, but WSL can’t ping Win11-host.
WSL can ping wireless-router.
Firewall had been turned off during this.
Looking in the registery, it seems that 172.31.192.1 (the expected namserver)
is associated with an interface that no longer shows up for ipconfig. Maybe it was picked up when WSL was installed.
Now I just realised something about, my machine that might be different to others with working DNS. I already had a Windows 10 Virtual Machine configured before I installed WSL. And actually that was created after I had deleted a previous one. Anyway…