From a8139fd987591aafbd6dbc52c87ce6ceae75c41b Mon Sep 17 00:00:00 2001 From: "Matheus A." Date: Fri, 16 May 2025 00:20:24 -0300 Subject: [PATCH] Updates Bridge-WslPorts.ps1 --- scripts/pshell/Bridge-WslPorts.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/pshell/Bridge-WslPorts.ps1 b/scripts/pshell/Bridge-WslPorts.ps1 index 15ca00c..a640366 100755 --- a/scripts/pshell/Bridge-WslPorts.ps1 +++ b/scripts/pshell/Bridge-WslPorts.ps1 @@ -1,6 +1,6 @@ # https://jwstanly.com/blog/article/Port+Forwarding+WSL+2+to+Your+LAN/ -$ports = @(80, 443, 25565); +$ports = @(8080, 25565); $wslAddress = bash.exe -c "ifconfig eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'" @@ -20,9 +20,9 @@ foreach ($port in $ports) { Invoke-Expression "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$listenAddress connectport=$port connectaddress=$wslAddress"; } -# $fireWallDisplayName = 'WSL Port Forwarding'; -# $portsStr = $ports -join ","; +$fireWallDisplayName = 'WSL Port Forwarding'; +$portsStr = $ports -join ","; -# Invoke-Expression "Remove-NetFireWallRule -DisplayName $fireWallDisplayName"; -# Invoke-Expression "New-NetFireWallRule -DisplayName $fireWallDisplayName -Direction Outbound -LocalPort $portsStr -Action Allow -Protocol TCP"; -# Invoke-Expression "New-NetFireWallRule -DisplayName $fireWallDisplayName -Direction Inbound -LocalPort $portsStr -Action Allow -Protocol TCP"; +Invoke-Expression "Remove-NetFireWallRule -DisplayName '$fireWallDisplayName'"; +Invoke-Expression "New-NetFireWallRule -DisplayName '$fireWallDisplayName' -Direction Outbound -LocalPort $portsStr -Action Allow -Protocol TCP"; +Invoke-Expression "New-NetFireWallRule -DisplayName '$fireWallDisplayName' -Direction Inbound -LocalPort $portsStr -Action Allow -Protocol TCP";