Aston-HyperV-Code/RTR-03.ps1

39 lines
1.0 KiB
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
netsh interface ip set address "WAN" static 192.168.255.254 255.255.255.0
netsh interface ip set dns name="WAN" static
# 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 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