WSL2 Network Routes

%3CLINGO-SUB%20id%3D%22lingo-sub-1402469%22%20slang%3D%22en-US%22%3EWSL2%20Network%20Routes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1402469%22%20slang%3D%22en-US%22%3E%3CP%3EHello!%3C%2FP%3E%3CP%3EI've%20upgraded%20to%202004%2C%20and%20upgraded%20my%20WSL%20installations%20to%20WSL2.%26nbsp%3B%20Under%20WSL1%20the%20linux%20distros%20shared%20the%20local%20PC%20nic.%26nbsp%3B%20Under%20WSL2%20they%20have%20their%20own%20nic%2C%20and%20IP%20address%20behind%20an%20internal%20switch%20(%3C!--%20StartFragment%20%20--%3E%3CSPAN%3E172.25.168.87%3C%2FSPAN%3E%3C!--%20EndFragment%20%20--%3E).%26nbsp%3B%20On%20my%20local%20network%2C%20I%20have%20two%20distinct%20networks.%20192.168.1.0%2F24%20and%20172.16.0.0%2F24.%26nbsp%3B%20I%20have%20a%20virtual%20machine%20acting%20as%20a%20router%20between%20them%2C%20and%20a%20static%20route%20on%20the%20local%20pc%20that%20directs%20traffic%20to%20the%20router%20for%20the%20172.16.0.0%2F24%20network.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20attempt%20to%20access%20anything%20within%20the%20WSL2%20distro%20on%20the%20172.16.0.0%2F24%20network%20communication%20fails.%26nbsp%3B%20I%20can%20access%20anything%20on%20the%20192.168.1.0%2F24%20network%20because%20that's%20local%20to%20the%20PC%2C%20even%20though%20the%20WSL%20distro%20is%20behind%20another%20switch.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20route%20would%20I%20add%20within%20the%20WSL2%20Distro%20to%20access%20the%20172.16.0.0%2F24%20network.%26nbsp%3B%20This%20is%20all%20I%20have%20on%20current%20routes.%26nbsp%3B%3CBR%20%2F%3E%3C!--%20StartFragment%20%20--%3E%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eip%20route%20show%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Edefault%20via%20172.25.160.1%20dev%20eth0%3CBR%20%2F%3E172.25.160.0%2F20%20dev%20eth0%20proto%20kernel%20scope%20link%20src%20172.25.168.87%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eroute%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%3CSPAN%3E%3C!--%20StartFragment%20%20--%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CDIV%3E%3CSPAN%3EKernel%20IP%20routing%20table%3CBR%20%2F%3EDestination%20Gateway%20Genmask%20Flags%20Metric%20Ref%20Use%20Iface%3CBR%20%2F%3Edefault%20ENTDESKTOP%200.0.0.0%20UG%200%200%200%20eth0%3CBR%20%2F%3E172.25.160.0%200.0.0.0%20255.255.240.0%20U%200%200%200%20eth0%3C%2FSPAN%3E%3C%2FDIV%3E%3CSPAN%3E%3C!--%20EndFragment%20%20--%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThanks%20for%20the%20help.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3C!--%20EndFragment%20%20--%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1742927%22%20slang%3D%22en-US%22%3ERe%3A%20WSL2%20Network%20Routes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1742927%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F32035%22%20target%3D%22_blank%22%3E%40John%20Wildes%3C%2FA%3E%26nbsp%3B%2C%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20the%20same%20behavior%20since%20I%20updated%20to%202004%2C%20on%20my%20personal%20machine%20that%20did%20not%20have%20WSL%20previously%20installed%2C%20but%20I%20have%20another%20machine%20that%20does%20work%20and%20the%20difference%20is%20that%20I%20had%20previously%20installed%20the%20WSL%20before%20the%202004%20update%2C%20I%20have%20done%20everything%20that%20I%20have%20found%20myself%20on%20the%20internet%2C%20put%20a%20dns%2C%20modify%20the%20nameserver%2C%20modify%20the%20ips%20and%20the%20routes%20but%20it%20still%20doesn't%20work%20for%20me%2C%20haven't%20you%20found%20any%20other%20solution%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eregards%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F554353%22%20target%3D%22_blank%22%3E%40Nervill_mcbo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1778072%22%20slang%3D%22en-US%22%3ERe%3A%20WSL2%20Network%20Routes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1778072%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F32035%22%20target%3D%22_blank%22%3E%40John%20Wildes%3C%2FA%3E%26nbsp%3BI%20managed%20to%20repair%20the%20problem%2C%20first%20open%20the%20installed%20distribution%20(ubuntu%2C%20fedora%2C%20etc.)%2C%20locate%20the%20vEthernet%20network%20card%20in%20the%20network%20connection%2C%20in%20the%20properties%20of%20the%20card%20in%20the%20IPv4%20section%2C%20place%20in%20the%20DNS%208.8.8.8%2C%20see%20to%20the%20installed%20distribution%20and%20run%20the%20following%20command%20sudo%20nano%20%2Fetc%2Fresolv.conf%20edit%20the%20nameserver%20and%20put%208.8.8.8%20saves%20and%20run%20a%20sudo%20apt%20update%20and%20it%20should%20run%20without%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENervill%3C%2FP%3E%3CP%3E%3CA%20href%3D%22mailto%3Anervill%40gmail.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Enervill%40gmail.com%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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
Highlighted

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 

Highlighted

@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