Last active
January 6, 2024 10:28
-
-
Save pancudaniel7/c6a6131f292f3a2f4454eb58ee7509df to your computer and use it in GitHub Desktop.
WSL2 port forwarding example script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if "%~1"=="" ( | |
set "WSL_IP=172.20.16.1" | |
) else ( | |
set "WSL_IP=%~1" | |
) | |
netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=3001 listenaddress=0.0.0.0 connectport=3001 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=10000 listenaddress=0.0.0.0 connectport=10000 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=10100 listenaddress=0.0.0.0 connectport=10100 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=10200 listenaddress=0.0.0.0 connectport=10200 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=11300 listenaddress=0.0.0.0 connectport=11300 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=11100 listenaddress=0.0.0.0 connectport=11100 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=11200 listenaddress=0.0.0.0 connectport=11200 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=11000 listenaddress=0.0.0.0 connectport=11000 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=10300 listenaddress=0.0.0.0 connectport=10300 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=5005 listenaddress=0.0.0.0 connectport=5005 connectaddress=%WSL_IP% | |
netsh interface portproxy add v4tov4 listenport=3306 listenaddress=0.0.0.0 connectport=3306 connectaddress=%WSL_IP% | |
netsh interface portproxy show all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment