diff --git a/WSL_Port_Removal_Script.ps1 b/WSL_Port_Removal_Script.ps1 new file mode 100644 index 0000000..a8146cc --- /dev/null +++ b/WSL_Port_Removal_Script.ps1 @@ -0,0 +1,14 @@ +######################################################################## + # Copyright (c) Intel Corporation 2023 + # SPDX-License-Identifier: BSD-3-Clause +######################################################################## + +## NOTE: Run with Admin Powershell Terminal! + +# WSL Port Forwarding Removal of Port 22 and 2223 +netsh interface portproxy delete v4tov4 listenport=22 listenaddress=0.0.0.0 +netsh interface portproxy delete v4tov4 listenport=2223 listenaddress=0.0.0.0 + +# WSL Remove firewall rules +netsh advfirewall firewall delete rule name="Open SSH port 22 for WSL2" +netsh advfirewall firewall delete rule name="Open SSH Tunnel port 2223 for WSL2" \ No newline at end of file diff --git a/WSL_Port_Script.ps1 b/WSL_Port_Setup_Script.ps1 similarity index 100% rename from WSL_Port_Script.ps1 rename to WSL_Port_Setup_Script.ps1 index 074b0a6..5b71a83 100644 --- a/WSL_Port_Script.ps1 +++ b/WSL_Port_Setup_Script.ps1 @@ -11,7 +11,7 @@ echo "Ubuntu IP: $wsl_ip" netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=22 connectport=22 connectaddress=$wsl_ip netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=2223 connectport=2223 connectaddress=$wsl_ip netsh interface portproxy show all -# WSL Add firewall rules +# WSL Add firewall rules netsh advfirewall firewall add rule name="Open SSH Tunnel port 2223 for WSL2" dir=in action=allow protocol=TCP localport=2223 netsh advfirewall firewall add rule name="Open SSH port 22 for WSL2" dir=in action=allow protocol=TCP localport=22