Aston-HyperV-Code/RTR-03.ps1

36 lines
980 B
PowerShell

# Alexandre SIMAO
# GPLv3
# Script to install and configure a Fuckdows Server 2016 as a router
# RTR-03 Only
# Change the poor machine name
$name = Read-host "Nouveau nom d'hôte?"
Rename-computer $name
# Install Routing and necessary linked roles
Install-WindowsFeature RemoteAccess -IncludeManagementTools
set-service RemoteAccess -StartupType Automatic
Start-Service RemoteAccess
# Activate NAT
netsh routing ip nat install
netsh routing ip nat add interface name="WAN" mode=PRIVATE
netsh routing ip nat add interface name="Aston" mode=FULL
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
$Params = @{
"Name" = 'vm-monitoring-icmpv4'
"Action" = 'Allow'
}
Set-NetFirewallRule @Params
# Add routes
route add -p 0.0.0.0/0 10.94.2.137
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.128.0/24 192.168.255.128
route add -p 192.168.255.0/24 192.168.255.254