You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In figuring out how best to access multiple WSL2 distros from outside the host computer, I hit upon this scheme. For completeness sake: the host is connected to the LAN with WIFI, interface "WLAN 8", with the primary address 192.168.113.25/22
Create an entry for each WSL distro in the LAN's router/nameserver, assigning each distro an IP address within the LAN's network. In my case, 192.168.113.161 - 168.
Assign each of these addresses to the LAN interface of the host computer:
Forward default ports of known services to custom ports on the shared WSL IP address; in each distro, the services are configured with that port number (example is for sshd):
At least in this test phase, Windows firewall has a rule for port 22 which is wide open, and there is no firewall running on the WSL instances.
According to my understanding of things this should work, but it doesn't: "ssh 192.168.113.161" gives "connection refused" even though "ssh -p 221 172.30.162.45" works just fine. The same thing is true of other ports/services.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
In figuring out how best to access multiple WSL2 distros from outside the host computer, I hit upon this scheme. For completeness sake: the host is connected to the LAN with WIFI, interface "WLAN 8", with the primary address 192.168.113.25/22
Create an entry for each WSL distro in the LAN's router/nameserver, assigning each distro an IP address within the LAN's network. In my case, 192.168.113.161 - 168.
Assign each of these addresses to the LAN interface of the host computer:
netsh interface ipv4 add address 'WLAN 8' 192.168.113.161 255.255.252.0
netsh interface ipv4 add address 'WLAN 8' 192.168.113.162 255.255.252.0
...
netsh interface ipv4 add address 'WLAN 8' 192.168.113.168 255.255.252.0
Forward default ports of known services to custom ports on the shared WSL IP address; in each distro, the services are configured with that port number (example is for sshd):
netsh interface portproxy add v4tov4 listenaddress=192.168.113.161 listenport=22 connectaddress=172.30.162.45 connectport=221
netsh interface portproxy add v4tov4 listenaddress=192.168.113.162 listenport=22 connectaddress=172.30.162.45 connectport=222
...
netsh interface portproxy add v4tov4 listenaddress=192.168.113.168 listenport=22 connectaddress=172.30.162.45 connectport=228
At least in this test phase, Windows firewall has a rule for port 22 which is wide open, and there is no firewall running on the WSL instances.
According to my understanding of things this should work, but it doesn't: "ssh 192.168.113.161" gives "connection refused" even though "ssh -p 221 172.30.162.45" works just fine. The same thing is true of other ports/services.
Where is my mistake?
Beta Was this translation helpful? Give feedback.
All reactions