2021-04-09 15:51:30 +02:00
|
|
|
|
# Alexandre SIMAO
|
|
|
|
|
# GPLv3
|
|
|
|
|
|
|
|
|
|
# Script to install and configure a Fuckdows Server 2016 as a router
|
2021-04-19 16:04:47 +02:00
|
|
|
|
# RTR-02 Only
|
2021-04-09 15:51:30 +02:00
|
|
|
|
|
2021-04-20 10:49:35 +02:00
|
|
|
|
echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman"
|
|
|
|
|
|
2021-04-09 15:51:30 +02:00
|
|
|
|
# Change the poor machine name
|
2021-04-20 10:49:35 +02:00
|
|
|
|
Rename-computer "RTR-02"
|
2021-04-09 15:51:30 +02:00
|
|
|
|
|
2021-04-20 10:49:35 +02:00
|
|
|
|
Rename-NetAdapter -Name "Ethernet" -NewName "Bou-LAN"
|
|
|
|
|
Rename-NetAdapter -Name "Ethernet 2" -NewName "WAN"
|
2021-04-19 16:04:47 +02:00
|
|
|
|
|
|
|
|
|
netsh interface ip set address "WAN" static 192.168.255.8 255.255.255.0 192.168.255.254
|
|
|
|
|
netsh interface ip set address "Bou-LAN" static 192.168.128.254 255.255.255.0
|
|
|
|
|
netsh interface ip set dns name="WAN" static 9.9.9.9.
|
|
|
|
|
|
2021-04-09 15:51:30 +02:00
|
|
|
|
# Install Routing and necessary linked roles
|
|
|
|
|
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools
|
|
|
|
|
set-service RemoteAccess -StartupType Automatic
|
|
|
|
|
Start-Service RemoteAccess
|
|
|
|
|
|
|
|
|
|
# Display interfaces and active forwarding for all of thm via Regedit
|
|
|
|
|
netsh inter show inter
|
|
|
|
|
|
|
|
|
|
Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet`
|
|
|
|
|
\Services\Tcpip\Parameters' -Name 'IPEnableRouter' -Value '0x00000001'
|
|
|
|
|
Set-NetConnectionProfile -NetworkCategory Private
|
|
|
|
|
|
|
|
|
|
# Activate NAT and DHCP Relay
|
|
|
|
|
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 "Bou-LAN"
|
|
|
|
|
netsh rout ip rel set int ARC-SRV min=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
netsh -f ./Bou-LAN.conf
|
|
|
|
|
|
|
|
|
|
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
|
|
|
|
|
$Params = @{
|
|
|
|
|
"Name" = 'vm-monitoring-icmpv4'
|
|
|
|
|
"Action" = 'Allow'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Set-NetFirewallRule @Params
|
|
|
|
|
|
|
|
|
|
# Add routes
|
|
|
|
|
|
|
|
|
|
route add -p 192.168.8.0/24 192.168.255.8
|
|
|
|
|
route add -p 192.168.12.0.24 192.168.255.8
|
|
|
|
|
route add -p 192.168.255.0/24 192.168.255.128
|
|
|
|
|
route add -p 192.168.128.0/24 192.168.128.254
|
2021-04-19 16:04:47 +02:00
|
|
|
|
route add -p 0.0.0.0/0 192.168.255.254
|