WSL 2 Network configuration
I have 2 computers, both with WSL 2 installed, on the same version at the time (Novemeber 2019). WSL 2 networking only works on 1 of them, and I don't understand why. I am aware of many network open issues, but nothing explains why the networking works on my one PC and not the other.
I have tried turning off firewall, editing resolv.conf, reset networking, uninstalling / installing WSL 2 & virtual machine platform and various other prosposed solutions but nothing has worked yet. If I can find the difference between the 2 PC's, I could find the fix on the broken PC which I'm sure will help microsoft as well.
I don't know if this is a problem on WSL2 side or not. If it works on 1 PC, there must be something on the other PC that prevents the network from working in WSL 2, however, when I convert back to WSL1 the newtorking works.
PC 1: Working WSL 2 (Slow ring, latest version) Work laptop PC 2: Broken WSL 2 (Fast ring, currently build 19569) Home laptop
Both have windows defender firewall turned on. I have tested both PC's on the same wifi network, PC 1 still works. No VPN used on either PC's.
The error I get on PC 2 when I try run $ sudo apt update:
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1560:8001::11). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1560:8001::14). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::21). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::17). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.173), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.31), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.174), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.24), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.149), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.162), connection timed out
Networking information for both laptops looks like it is set up the same way (This is all default):
PC 1 vEthernet:
Ethernet adapter vEthernet (WSL):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3
Physical Address. . . . . . . . . : 00-15-5D-0A-A2-CC
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::cdd8:6d9c:39e4:eff1%67(Preferred)
IPv4 Address. . . . . . . . . . . : 172.30.208.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 1124078941
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-69-87-3A-9C-EB-E8-45-62-3E
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.30.212.63 netmask 255.255.240.0 broadcast 172.30.223.255
inet6 fe80::215:5dff:fe7b:4a98 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:7b:4a:98 txqueuelen 1000 (Ethernet)
RX packets 1180920 bytes 1165675162 (1.1 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 401318 bytes 153760624 (153.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
PC 2 (Broken WSL 2) vEthernet:
Ethernet adapter vEthernet (WSL):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : 00-15-5D-CA-45-0A
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::4c1b:8b21:242a:c9bb%32(Preferred)
IPv4 Address. . . . . . . . . . . : 172.30.160.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 536876381
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-20-5E-3C-C9-3C-52-82-11-6C-DA
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.30.168.189 netmask 255.255.240.0 broadcast 172.30.175.255
inet6 fe80::215:5dff:fe14:20f6 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:14:20:f6 txqueuelen 1000 (Ethernet)
RX packets 124 bytes 11948 (11.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15 bytes 1146 (1.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
PC 2 resolve.conf
This is the default, and changing that breaks DNS resolving.
nameserver 172.30.160.1
What other information can I provide to get any clues as to why this doesn't work in PC 2? Thanks in advance.
Finally, I have solved my problem.
In powershell I ran the cmd Get-NetNat to list NAT networks. I found that I had 3 NAT networks set up (probably from previous VM's). I ran the Remove-NetNat cmd which has fixed my WSL2 network connectivity and connection timed out errors.