WSL2 Network
How to access server which is hosted on WSL2 ?
- Use proxy to forward connection from win10 to wsl2.
-
[powershell] > netsh interface portproxy show all # listen address/port -> windows 10 ip/port # connect address/port -> wsl2 ip/port [powershell] > netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=12345 connectaddress=172.26.68.222 connectport=12345 # If you regret. [powershell] > netsh interface portproxy delete v4tov4 listenport=12345 listenaddress=0.0.0.0
-
- Add related ports to inband rule in firewall.
- Settings
- Update & Security
- Windows Security
- Firewall & netowrk protection
- Advanced settings
- Inband Rules
- New Rule
- Port
- Enter the port you want
- Allow the connection
- Check all
- Enter name, e.g., WSL2 network.
- Finish