Commit ba7bfe9c authored by Christof Schulze's avatar Christof Schulze 😎
Browse files

Firewall ping rule fixes

parent 1b8cca6b
Loading
Loading
Loading
Loading
+15 −19
Original line number Diff line number Diff line
# enable pings from other institute clients

# Networks
$network131 = "131.188.220.192/26"
$network131 = '131.188.220.192/26'
$network192 = "192.168.220.128/25"
$network10  = "10.188.220.0/25"
$network10  = '10.188.220.0/25'

$management_nodes = '131.188.220.208/29','192.168.220.230-192.168.220.231','192.168.220.215','10.188.220.96-10.188.220.107'

# TODO Check and delete old rules first
# Get-NetFirewallRule -DisplayGroup "WW8" | Get-NetFirewallAddressFilter

$management_nodes = "131.188.220.208/29","192.168.220.230-192.168.220.230.231","192.168.220.215","10.188.220.96-10.188.220.107"

Function SetFirewallRule
{
param([string]$network, [bool]$IPv6=$false)

Write-host $i -foregroundcolor cyan
# can be done bye wf.msc
if($IPv6 -eq $false)
  {
  New-NetFirewallRule -DisplayName "Allow inbound ICMPv4" -Group "WW8" -Profile Private,Domain -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress $network -Action Allow


#New-NetFirewallRule -DisplayName "Allow inbound ICMPv6" -Direction Inbound -Protocol ICMPv6 -IcmpType 8 -RemoteAddress <local subnet> -Action Allow

#Write-host $p1 -foregroundcolor cyan
#Write-host $p2 -foregroundcolor Magenta
  }else{
  New-NetFirewallRule -DisplayName "Allow inbound ICMPv6" -Group "WW8" -Profile Private,Domain -Direction Inbound -Protocol ICMPv6 -IcmpType 8 -RemoteAddress $network -Action Allow
  }
}




$hostip = Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex 7 | select IPAddress
@@ -42,13 +43,8 @@ if($hostname -like "*sek*") {
  $networks = $network131,$network192,$network10
}

Foreach ($i in $networks)

Foreach ($i in $networks)
{
 SetFirewallRule $i
 Write-host $i -foregroundcolor cyan

}

# can be done bye wf.msc
#New-NetFirewallRule -DisplayName "Allow inbound ICMPv4" -Group "WW8" -Profile Private,Domain -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress $inst_networks -Action Allow