Aston-HyperV-Code/Routeur.ps1

34 lines
1.0 KiB
PowerShell
Raw Normal View History

# Alexandre SIMAO
# GPLv3
# Script to install and configure a Fuckdows Server 2016 as a router
# Change the poor machine name
2021-04-09 11:02:54 +02:00
$name = Read-host "Nouveau nom d'h<>te?"
Rename-computer $name
# Install Routing and necessary linked roles
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing
Install-remoteAccess -VpnType Vpn
# Display interfaces and active forwarding for all of thm via Regedit
2021-04-09 11:02:54 +02:00
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 nat install
netsh routing ip nat add interface "WAN"
netsh routing ip nat set interface "WAN" mode = full
netsh routing ip nat add interface "Arc-CLI"
netsh routing ip nat add interface "Arc-SRV"
ntsh -f ./*.conf
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
$Params = @{
"Name" = 'vm-monitoring-icmpv4'
"Action" = 'Allow'
}
Set-NetFirewallRule @Params