Browse Source

Cleanup wsl2 firewall script

Bryan Roessler 4 years ago
parent
commit
3a9e0b12af
1 changed files with 4 additions and 5 deletions
  1. 4 5
      powershell/wsl2-firewall-rules.ps1

+ 4 - 5
powershell/wsl2-firewall-rules.ps1

@@ -1,12 +1,11 @@
 // Copyright (c) 2021 Bryan C. Roessler
 // 
+// This script will probe the WSL2 instance for its randomly assigned IP
+// and open the requisite Windows Firewall ports
+//
 // This software is released under the MIT License.
 // https://opensource.org/licenses/MIT
 
-
-
-
-
 # Get the WSL2 IP address (randomized on init)
 $remoteport = bash.exe -c "ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1"
 
@@ -28,4 +27,4 @@ for( $i = 0; $i -lt $ports.length; $i++ ){
   $port = $ports[$i];
   iex "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr";
   iex "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport";
-}
+}