Port Forwarding Manager for WSL (Windows Subsystem for Linux)
- Run
.\Install.ps1 -d Ubuntu
on PowerShell with administrator on Windows. (ReplaceUbuntu
to your WSL distro name) - (Option) Set
wsl-pfm set-ip
command to run on the WSL startup
(consider using WSL-RC-Local: https://github.com/masaharu-kato/wsl-rc-local ) - Reboot the host (Windows) machine (NOT shutdown and boot, but Reboot)
- On the WSL, run following commands.
- You can set port forwardings by multiple WSL distributions.
(Run commands on each distribution.) - For more information, try
wsl-pfm --help
.
-
wsl-pfm add from 8080
wsl-pfm add to 8080
wsl-pfm add 8080
Add a new port forwarding: Host:8080
-> WSL:8080
-
wsl-pfm add from 8080 to 80
wsl-pfm add to 80 from 8080
wsl-pfm add 80 from 8080
Add a new port forwarding: Host:8080
-> WSL:80
-
wsl-pfm delete from 8080
wsl-pfm delete 8080
Delete the port forwarding: Host:8080
-> WSL:8080
-
wsl-pfm delete from 8080 to 80
wsl-pfm delete to 80 from 8080
wsl-pfm delete 80 from 8080
Delete the port forwarding: Host:8080
-> WSL:80
wsl-pfm show
Show informations about port forwardings.
- Run
.\Uninstall.ps1 -d Ubuntu
on PowerShell with administrator on Windows. (ReplaceUbuntu
to your WSL distro name) - (Option) Unset
wsl-pfm set-ip
command to run on the WSL startup - Reboot the host (Windows) machine