Closed jasonpolites closed 7 months ago
My Windows PC is on a
192.168.x.x
address, with a completely different subnet
That's IP is probably for your LAN or WAN interface. WSL creates a virtual network interface in Windows also. See the output of ipconfig
command.
This is my Windows LAN interface. My WAN address would be whatever my ISP gives me (I presume).
My primary ethernet (physical) adapter on the PC looks like this:
IPv4 Address. . . . . . . . . . . : 192.168.1.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
The WSL ethernet adapter (virtual) looks like this:
IPv4 Address. . . . . . . . . . . : 172.27.160.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Now I'm no networking expert, but I don't see these things talking to each other. I tried manually changing the IP on the WSL adapter (via Windows) to be on the same address range and subnet, but didn't work.
@jasonpolites we've improved this area by updating the docs to make it clearer, as well as adding mirrored mode which should simplify your networking experience. Thank you for filing this feedback!
Documentation Issue
In this page, the guidance suggests that connecting to a process in WSL from Windows is as simple as determining the IP address of the WSL container. This is unlikely to be uniformly true. Indeed, in my own environment, the
cat /etc/resolv.conf
command (as suggested in the documentation), reveals that the WSL container is located at172.27.160.1
. My Windows PC is on a192.168.x.x
address, with a completely different subnet. There's no way these two things can see each other.Please provide guidance on how to configure the virtual network adapter in WSL 2 to allow for packets to travel FROM Windows TO WSL (on a given port)
Link to documentation page
https://learn.microsoft.com/en-us/windows/wsl/networking#accessing-windows-networking-apps-from-linux-host-ip
Suggested Improvements
No response