2021-04-09 11:34:47 +02:00
|
|
|
|
# Alexandre SIMAO
|
|
|
|
|
# GPLv3
|
|
|
|
|
|
|
|
|
|
# Script to install and configure a Fuckdows Server 2016 as a router
|
2021-04-09 11:43:46 +02:00
|
|
|
|
# RTR-01 Only
|
2021-04-09 11:34:47 +02:00
|
|
|
|
|
|
|
|
|
# Change the poor machine name
|
2021-04-09 11:02:54 +02:00
|
|
|
|
$name = Read-host "Nouveau nom d'h<>te?"
|
|
|
|
|
Rename-computer $name
|
2021-04-09 11:34:47 +02:00
|
|
|
|
|
|
|
|
|
# Install Routing and necessary linked roles
|
2021-04-09 15:28:45 +02:00
|
|
|
|
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools
|
|
|
|
|
#Install-remoteAccess -VpnType Vpn
|
2021-04-09 11:34:47 +02:00
|
|
|
|
|
|
|
|
|
# Display interfaces and active forwarding for all of thm via Regedit
|
2021-04-09 11:02:54 +02:00
|
|
|
|
netsh inter show inter
|
|
|
|
|
Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet`
|
|
|
|
|
\Services\Tcpip\Parameters' -Name 'IPEnableRouter' -Value '0x00000001'
|
|
|
|
|
Set-NetConnectionProfile -NetworkCategory Private
|
|
|
|
|
|
2021-04-09 11:34:47 +02:00
|
|
|
|
# Activate NAT and DHCP Relay
|
2021-04-09 15:28:45 +02:00
|
|
|
|
netsh routing ip relay install
|
|
|
|
|
|
|
|
|
|
netsh routing ip add interface name="WAN" state=enable
|
|
|
|
|
|
|
|
|
|
netsh routing ip relay add interface "WAN"
|
|
|
|
|
netsh rout ip rel set int ARC-CLI min=0
|
|
|
|
|
netsh routing ip relay add interface "Arc-CLI"
|
|
|
|
|
netsh rout ip rel set int ARC-SRV min=0
|
|
|
|
|
netsh routing ip relay add interface "Arc-SRV"
|
|
|
|
|
netsh rout ip rel set int WAN min=0
|
|
|
|
|
netsh routing ip relay add dhcpserver 192.168.8.1
|
|
|
|
|
|
|
|
|
|
set-service RemoteAccess -StartupType Automatic
|
|
|
|
|
Start-Service RemoteAccess
|
|
|
|
|
|
|
|
|
|
netsh -f ./Arc-CLI.conf
|
|
|
|
|
netsh -f ./Arc-SRV.conf
|
|
|
|
|
netsh -f ./WAN.conf
|
2021-04-09 11:34:47 +02:00
|
|
|
|
|
|
|
|
|
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
|
|
|
|
|
$Params = @{
|
|
|
|
|
"Name" = 'vm-monitoring-icmpv4'
|
|
|
|
|
"Action" = 'Allow'
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 11:43:46 +02:00
|
|
|
|
Set-NetFirewallRule @Params
|
|
|
|
|
|
|
|
|
|
# Add routes
|
|
|
|
|
|
|
|
|
|
route add -p 192.168.8.0/24 192.168.8.254
|
|
|
|
|
route add -p 192.168.12.0.24 192.168.12.254
|
|
|
|
|
route add -p 192.168.255.0/24 192.168.255.8
|
|
|
|
|
route add -p 192.168.128.8/24 192.168.255.128
|
|
|
|
|
route add -p 0.0.0.0/0 192.168.255.0
|