Aston-HyperV-Code/RTR-03.ps1

39 lines
1.0 KiB
PowerShell
Raw Normal View History

2021-04-09 15:51:30 +02:00
# 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
2021-04-19 16:04:47 +02:00
netsh interface ip set address "WAN" static 192.168.255.254 255.255.255.0
netsh interface ip set dns name="WAN" static
2021-04-09 15:51:30 +02:00
# 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
2021-04-19 16:04:47 +02:00
route add -p 192.168.255.0/24 192.168.255.254