netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=$(wsl.exe hostname -I)Purpose: forwards all incoming network traffic (0.0.0.0) on port 4000 to $(wsl.exe hostname -I) at the same port
- view
netsh interface portproxy show all- delete
netsh interface portproxy resetnetsh advfirewall firewall add rule name=”wsl-jekyll” dir=in action=allow protocol=TCP localport=4000 Purpose: adds firewall rule ('wsl-jekyll') to allow incoming traffic to TCP port 4000
- view (specific)
netsh advfirewall firewall show rule name="wsl-jekyll"- view (all)
netsh advfirewall firewall show rule name=all | findstr "Rule Name:" | findstr /V "Microsoft"- toggle
netsh advfirewall firewall set rule name="wsl-jekyll" new enable=<yes/no>- delete
netsh advfirewall firewall delete rule name='wsl-jekyll'Note: access system via <your Windows PC's IP>:<4000>, which can be obtained with:
(netsh interface ip show address "Wi-Fi" | Select-String -Pattern "IP Address") -replace ".+:\s+",""