Aston-HyperV-Code/OLD/RTR-03_Old.ps1
Alexandre-Simao 9b6510871a Ultra commenting + echoing
Now only need testing...
2021-04-23 12:54:01 +02:00

48 lines
1.3 KiB
PowerShell

# Alexandre SIMAO
# GPLv3
### TODO ?
# Script to install and configure a Fuckdows Server 2016 as a router
# RTR-03 Only
echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman"
# Change the poor machine name
Rename-computer "RTR-03"
Rename-NetAdapter -Name "Ethernet" -NewName "WAN"
Rename-NetAdapter -Name "Ethernet 2" -NewName "Aston"
# Install Routing and necessary linked roles
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -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 9.9.9.9
# 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
Set-NetConnectionProfile -networkcategory private
# 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