WSL2 Network Routes

Brass Contributor

Hello!

I've upgraded to 2004, and upgraded my WSL installations to WSL2.  Under WSL1 the linux distros shared the local PC nic.  Under WSL2 they have their own nic, and IP address behind an internal switch (172.25.168.87).  On my local network, I have two distinct networks. 192.168.1.0/24 and 172.16.0.0/24.  I have a virtual machine acting as a router between them, and a static route on the local pc that directs traffic to the router for the 172.16.0.0/24 network.

 

When I attempt to access anything within the WSL2 distro on the 172.16.0.0/24 network communication fails.  I can access anything on the 192.168.1.0/24 network because that's local to the PC, even though the WSL distro is behind another switch.  

 

What route would I add within the WSL2 Distro to access the 172.16.0.0/24 network.  This is all I have on current routes. 

 
ip route show
default via 172.25.160.1 dev eth0
172.25.160.0/20 dev eth0 proto kernel scope link src 172.25.168.87
 
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default ENTDESKTOP 0.0.0.0 UG 0 0 0 eth0
172.25.160.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
 
 
Thanks for the help.
 
 

2 Replies

Hi @John Wildes , 

I have the same behavior since I updated to 2004, on my personal machine that did not have WSL previously installed, but I have another machine that does work and the difference is that I had previously installed the WSL before the 2004 update, I have done everything that I have found myself on the internet, put a dns, modify the nameserver, modify the ips and the routes but it still doesn't work for me, haven't you found any other solution?

 

regards

@Nervill_mcbo 

@John Wildes I managed to repair the problem, first open the installed distribution (ubuntu, fedora, etc.), locate the vEthernet network card in the network connection, in the properties of the card in the IPv4 section, place in the DNS 8.8.8.8, see to the installed distribution and run the following command sudo nano /etc/resolv.conf edit the nameserver and put 8.8.8.8 saves and run a sudo apt update and it should run without problem.

 

Regards,

 

Nervill

nervill@gmail.com