RTR-01,02 and SRV-01 OK, to be tested

This commit is contained in:
Alexandre 2021-04-09 15:28:45 +02:00
parent 1ccbc9a629
commit fbd0492757
5 changed files with 77 additions and 28 deletions

13
Bou-LAN.conf Normal file
View File

@ -0,0 +1,13 @@
pushd routing ip relay
Install
set global loglevel = ERROR
add dhcpserver 192.168.8.1
add interface name = "Bou-LAN"
set interface name = "Bou-LAN" relaymode = enable maxhop = 6 minsecs = 6
popd

View File

@ -9,8 +9,8 @@ $name = Read-host "Nouveau nom d'h
Rename-computer $name
# Install Routing and necessary linked roles
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing
Install-remoteAccess -VpnType Vpn
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools
#Install-remoteAccess -VpnType Vpn
# Display interfaces and active forwarding for all of thm via Regedit
netsh inter show inter
@ -19,12 +19,24 @@ Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet`
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
netsh routing ip relay install
netsh routing ip add interface name="WAN" state=enable
netsh routing ip relay add interface "WAN"
netsh rout ip rel set int ARC-CLI min=0
netsh routing ip relay add interface "Arc-CLI"
netsh rout ip rel set int ARC-SRV min=0
netsh routing ip relay add interface "Arc-SRV"
netsh rout ip rel set int WAN min=0
netsh routing ip relay add dhcpserver 192.168.8.1
set-service RemoteAccess -StartupType Automatic
Start-Service RemoteAccess
netsh -f ./Arc-CLI.conf
netsh -f ./Arc-SRV.conf
netsh -f ./WAN.conf
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
$Params = @{

36
RTR-03.ps1 Normal file
View File

@ -0,0 +1,36 @@
# 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

View File

@ -42,19 +42,20 @@ Set-ItemProperty Path registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft` \Serve
Add-DhcpServerv4Scope -name "Arc-SRV" -StartRange 192.168.8.1 -EndRange 192.168.8.254 -SubnetMask 255.255.255.0 -State Active
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.8.0 -StartRange 192.168.8.1 -EndRange 192.168.8.63
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.8.0 -StartRange 192.168.8.240 -EndRange 192.168.8.254
Set-DhcpServerv4OptionValue -OptionID 3 -Value 192.168.8.254
Set-DhcpServerv4OptionValue -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -OptionID 3 -Value 192.168.8.254
Add-DhcpServerv4Scope -name "Arc-CLI" -StartRange 192.168.12.1 -EndRange 192.168.12.254 -SubnetMask 255.255.255.0 -State Active
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.12.0 -StartRange 192.168.12.1 -EndRange 192.168.12.63
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.12.0 -StartRange 192.168.12.240 -EndRange 192.168.12.254
Set-DhcpServerv4OptionValue -OptionID 3 -Value 192.168.12.254
Set-DhcpServerv4OptionValue -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -OptionID 3 -Value 192.168.12.254
Add-DhcpServerv4Scope -name "Bou-LAN" -StartRange 192.168.128.1 -EndRange 192.168.128.254 -SubnetMask 255.255.255.0 -State Active
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.128.0 -StartRange 192.168.128.1 -EndRange 192.168.128.63
Add-DhcpServerv4ExclusionRange -ScopeID 192.168.128.0 -StartRange 192.168.128.240 -EndRange 192.168.128.254
Set-DhcpServerv4OptionValue -OptionID 3 -Value 192.168.128.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -OptionID 3 -Value 192.168.128.254
# Global DHCP options
Set-DhcpServerv4OptionValue -DnsServer 9.9.9.9
# Change ZoneAlarm rule to accept incoming ICMP ipv4 probes
@ -66,7 +67,8 @@ $Params = @{
Set-NetFirewallRule @Params
# Add routes
# Add routes for RTR-01
route add -p 192.168.12.0/24 192.168.8.254
route add -p 192.168.255.0/24 192.168.8.254
route add -p 192.168.128.0/24 192.168.8.254

View File

@ -1,14 +0,0 @@
# IP address or DnsHostName of your Dhcp Server
$dhcpServer = '192.168.8.1'
# Name of the network adapter to enable DHCP on
$routerNetAdapterName = 'Ethernet1'
$dhcpAddress = [Net.Dns]::GetHostEntry($dhcpServer)
if(!$dhcpAddress){
Write-Warning "Unable to identify IP address of [$dhcpServer]"
break
}else{
$dhcpServerIP = $dhcpAddress.AddressList[0]
}