Add firewall rules for ICMP and Comments
This commit is contained in:
parent
c29a122d10
commit
575bcf10ca
13
Arc-CLI.conf
Normal file
13
Arc-CLI.conf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
pushd routing ip relay
|
||||||
|
|
||||||
|
Install
|
||||||
|
|
||||||
|
set global loglevel = ERROR
|
||||||
|
|
||||||
|
add dhcpserver 192.168.8.1
|
||||||
|
|
||||||
|
add interface name = "Arc-CLI"
|
||||||
|
|
||||||
|
set interface name = "Arc-CLI" relaymode = enable maxhop = 6 minsecs = 6
|
||||||
|
|
||||||
|
popd
|
13
Arc-SRV.conf
Normal file
13
Arc-SRV.conf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
pushd routing ip relay
|
||||||
|
|
||||||
|
Install
|
||||||
|
|
||||||
|
set global loglevel = ERROR
|
||||||
|
|
||||||
|
add dhcpserver 192.168.8.1
|
||||||
|
|
||||||
|
add interface name = "Arc-SRV"
|
||||||
|
|
||||||
|
set interface name = "Arc-SRV" relaymode = enable maxhop = 6 minsecs = 6
|
||||||
|
|
||||||
|
popd
|
9
DHCP.ps1
9
DHCP.ps1
@ -56,3 +56,12 @@ Add-DhcpServerv4ExclusionRange -ScopeID 192.168.128.0 -StartRange 192.168.128.1
|
|||||||
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.128.0 -StartRange 192.168.128.240 -EndRange 192.168.128.254
|
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.128.0 -StartRange 192.168.128.240 -EndRange 192.168.128.254
|
||||||
Set-DhcpServerv4OptionValue -OptionID 3 -Value 192.168.128.254
|
Set-DhcpServerv4OptionValue -OptionID 3 -Value 192.168.128.254
|
||||||
Set-DhcpServerv4OptionValue -DnsServer 9.9.9.9
|
Set-DhcpServerv4OptionValue -DnsServer 9.9.9.9
|
||||||
|
|
||||||
|
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
|
||||||
|
|
||||||
|
$Params = @{
|
||||||
|
"Name" = 'vm-monitoring-icmpv4'
|
||||||
|
"Action" = 'Allow'
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-NetFirewallRule @Params
|
69
Routeur.ps1
69
Routeur.ps1
@ -1,53 +1,34 @@
|
|||||||
|
# Alexandre SIMAO
|
||||||
|
# GPLv3
|
||||||
|
|
||||||
|
# Script to install and configure a Fuckdows Server 2016 as a router
|
||||||
|
|
||||||
|
# Change the poor machine name
|
||||||
$name = Read-host "Nouveau nom d'hôte?"
|
$name = Read-host "Nouveau nom d'hôte?"
|
||||||
Rename-computer $name
|
Rename-computer $name
|
||||||
Install-WindowsFeature Routing
|
|
||||||
|
# Install Routing and necessary linked roles
|
||||||
|
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing
|
||||||
|
Install-remoteAccess -VpnType Vpn
|
||||||
|
|
||||||
|
# Display interfaces and active forwarding for all of thm via Regedit
|
||||||
netsh inter show inter
|
netsh inter show inter
|
||||||
Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet`
|
Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet`
|
||||||
\Services\Tcpip\Parameters' -Name 'IPEnableRouter' -Value '0x00000001'
|
\Services\Tcpip\Parameters' -Name 'IPEnableRouter' -Value '0x00000001'
|
||||||
Set-NetConnectionProfile -NetworkCategory Private
|
Set-NetConnectionProfile -NetworkCategory Private
|
||||||
|
|
||||||
# IP address or DnsHostName of your Dhcp Server
|
# Activate NAT and DHCP Relay
|
||||||
$dhcpServer = '192.168.8.1'
|
netsh routing ip nat install
|
||||||
|
netsh routing ip nat add interface "WAN"
|
||||||
|
netsh routing ip nat set interface "WAN" mode = full
|
||||||
|
netsh routing ip nat add interface "Arc-CLI"
|
||||||
|
netsh routing ip nat add interface "Arc-SRV"
|
||||||
|
ntsh -f ./*.conf
|
||||||
|
|
||||||
# Name of the network adapter to enable DHCP on
|
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
|
||||||
$Inter1 = Read-Host "First interface name"
|
$Params = @{
|
||||||
$Inter2 = Read-Host "Second interface name"
|
"Name" = 'vm-monitoring-icmpv4'
|
||||||
|
"Action" = 'Allow'
|
||||||
|
}
|
||||||
|
|
||||||
$routerNetAdapterName1 = '$Inter1'
|
Set-NetFirewallRule @Params
|
||||||
$routerNetAdapterName1 = '$Inter2'
|
|
||||||
|
|
||||||
|
|
||||||
$dhcpAddress = [Net.Dns]::GetHostEntry($dhcpServer)
|
|
||||||
if(!$dhcpAddress){
|
|
||||||
Write-Warning "Unable to identify IP address of [$dhcpServer]"
|
|
||||||
break
|
|
||||||
}else{
|
|
||||||
$dhcpServerIP = $dhcpAddress.AddressList[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
$netshDhcpRelay=@"
|
|
||||||
pushd routing ip relay
|
|
||||||
install
|
|
||||||
set global loglevel=ERROR
|
|
||||||
add dhcpserver $($dhcpServerIP.IPAddressToString)
|
|
||||||
add interface name="$routerNetAdapterName1"
|
|
||||||
set interface name="$routerNetAdapterName1" relaymode=enable maxhop=6 minsecs=6
|
|
||||||
add interface name="$routerNetAdapterName2"
|
|
||||||
set interface name="$routerNetAdapterName2" relaymode=enable maxhop=6 minsecs=6
|
|
||||||
popd
|
|
||||||
"@
|
|
||||||
|
|
||||||
$netshDhcpRelayPath="$ENV:TEMP\netshDhcpRelay"
|
|
||||||
|
|
||||||
# Create netsh script file
|
|
||||||
New-Item -Path $netshDhcpRelayPath `
|
|
||||||
-Type File `
|
|
||||||
-ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
# Populate contents of the script
|
|
||||||
Set-Content -Path $netshDhcpRelayPath `
|
|
||||||
-Value $netshDhcpRelay.Split("`r`n") `
|
|
||||||
-Encoding ASCII
|
|
||||||
|
|
||||||
# run it
|
|
||||||
netsh -f $netshDhcpRelayPath
|
|
Loading…
Reference in New Issue
Block a user