Updates Bridge-WslPorts.ps1
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user