Youtube channel !

Be sure to visit my youtube channel

Wednesday, April 20, 2022

WSL2 - how to make it accessible through outher machines

1) enable wildcard listening address of the app like 0.0.0.0

ss -anpst will show you the on which address/port the app is listening to.

2) use powershell to setup portproxy to forward all the outside requests to the windows machine to land in the WSL2 system:

netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=localhost

listenport and listenaddress are on the Windows side.

connectport and connectaddress are on the WSL2 side.

(for a node app the listening port (connectport) is usually 3000, check you app listening port in 1)

verify with:  netsh interface portproxy show all

3) open port 3000 on the firewall with:

netsh advfirewall firewall add rule name="WSL2 app" dir=in action=allow protocol=TCP localport=3000

verify from the windows defender firewall, advanced settings, inbound rules.

Cheers !

No comments:

Subscribe To My Channel for updates

Modernizing old php project with the help of AI

0. Keep docker running in separate outside of VSCODE terminal 1. The importance of GIT for version control - create modernization branch 2. ...