Fix: Del on-link routes
This commit is contained in:
parent
4bcc5e96c8
commit
f2f8fdf770
@ -101,9 +101,6 @@ Set-NetFirewallRule @Params
|
||||
|
||||
# Add routes
|
||||
|
||||
route add -p 192.168.8.0/24 192.168.8.254
|
||||
route add -p 192.168.12.0/24 192.168.12.254
|
||||
route add -p 192.168.255.0/24 192.168.255.8
|
||||
route add -p 192.168.128.8/24 192.168.255.128
|
||||
route add -p 0.0.0.0/0 192.168.255.254
|
||||
|
||||
|
64
Guests/RTR-02_OLD.ps1
Normal file
64
Guests/RTR-02_OLD.ps1
Normal file
@ -0,0 +1,64 @@
|
||||
# Alexandre SIMAO
|
||||
# GPLv3
|
||||
|
||||
# Script to install and configure a Fuckdows Server 2016 as a router
|
||||
# RTR-02 Only
|
||||
|
||||
echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman"
|
||||
|
||||
# Change the poor machine name
|
||||
Rename-computer "RTR-02"
|
||||
|
||||
Rename-NetAdapter -Name "Ethernet" -NewName "Bou-LAN"
|
||||
Rename-NetAdapter -Name "Ethernet 2" -NewName "WAN"
|
||||
|
||||
netsh interface ip set address "WAN" static 192.168.255.8 255.255.255.0 192.168.255.254
|
||||
netsh interface ip set address "Bou-LAN" static 192.168.128.254 255.255.255.0
|
||||
netsh interface ip set dns name="WAN" static 9.9.9.9.
|
||||
|
||||
# Install Routing and necessary linked roles
|
||||
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools
|
||||
set-service RemoteAccess -StartupType Automatic
|
||||
Start-Service RemoteAccess
|
||||
|
||||
# Display interfaces and active forwarding for all of thm via Regedit
|
||||
netsh inter show inter
|
||||
|
||||
|
||||
Set-NetConnectionProfile -NetworkCategory Private
|
||||
|
||||
$Params = @{
|
||||
"Name" = 'vm-monitoring-icmpv4'
|
||||
"Action" = 'Allow'
|
||||
}
|
||||
|
||||
Set-NetFirewallRule @Params
|
||||
|
||||
# Activate NAT and DHCP Relay
|
||||
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 "Bou-LAN"
|
||||
netsh rout ip rel set int ARC-SRV min=0
|
||||
|
||||
|
||||
netsh -f ./Bou-LAN.conf
|
||||
|
||||
# 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.255.0/24 192.168.255.128
|
||||
route add -p 192.168.128.0/24 192.168.128.254
|
||||
route add -p 0.0.0.0/0 192.168.255.254
|
@ -10,6 +10,14 @@ echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman"
|
||||
#Rename this piece of garbage
|
||||
Rename-computer "SRV-1"
|
||||
|
||||
# Rename interfaces
|
||||
|
||||
$adapts = Get-NetAdapter
|
||||
foreach ($adapt in $adapts) {
|
||||
$HVName = (Get-NetAdapterAdvancedProperty -name $adapt.name -DisplayName "Hyper-v Network Adapter Name").DisplayValue
|
||||
Rename-Netadapter -name $adapt.name -NewName $HVName
|
||||
}
|
||||
|
||||
# Set IP for pre-defined MAC addresses
|
||||
|
||||
$adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-SRV"}
|
||||
@ -18,7 +26,6 @@ $adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-SRV"}
|
||||
$IP = "192.168.8.1"
|
||||
$MaskBits = 24 # This means subnet mask = 255.255.255.0
|
||||
$Gateway = "192.168.8.254"
|
||||
$Dns = "9.9.9.9"
|
||||
$IPType = "IPv4"
|
||||
|
||||
$adapter | New-NetIPAddress `
|
||||
@ -27,6 +34,9 @@ $adapter | New-NetIPAddress `
|
||||
-PrefixLength $MaskBits `
|
||||
-DefaultGateway $Gateway
|
||||
|
||||
# Set DNS
|
||||
|
||||
foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('9.9.9.9') }
|
||||
|
||||
# Install the DHCP role (Management tools if you love Metrosexual UI)
|
||||
Install-WindowsFeature DHCP -IncludeManagementTools
|
||||
@ -86,9 +96,9 @@ route add -p 0.0.0.0/0 192.168.8.254
|
||||
# Change DHCP server options
|
||||
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -OptionID 3 -Value 192.168.128.254
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -DnsServer 9.9.9.9
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -DnsServer 9.9.9.9
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -OptionID 3 -Value 192.168.12.254
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -DnsServer 9.9.9.9
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -DnsServer 9.9.9.9
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -OptionID 3 -Value 192.168.8.254
|
||||
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -DnsServer 9.9.9.9
|
||||
|
||||
|
@ -7,7 +7,6 @@ echo "CC BY-NC-SA 4.0"
|
||||
|
||||
# Region SRV-01
|
||||
|
||||
|
||||
cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\SRV-01.vhdx
|
||||
|
||||
Mount-VHD d:\VHD\SRV-01.vhdx
|
||||
@ -20,14 +19,12 @@ $vms = @{
|
||||
Generation = '2'
|
||||
MemoryStartupBytes = 1024Mb
|
||||
VHDPath = "d:\VHD\$VMName.vhdx"
|
||||
SwitchName = 'Arc-SRV'
|
||||
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
Set-VMMemory SRV-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
|
||||
$vmadapter = Get-VMNetworkAdapter -VMName "SRV-01"
|
||||
Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -StaticMacAddress 00155D027000
|
||||
Add-VMNetworkAdapter -VMName "SRV-01" -SwitchName "Arc-SRV" -Name "Arc-SRV" -DeviceNaming on
|
||||
|
||||
# RTR-01
|
||||
|
||||
@ -67,16 +64,15 @@ $vms = @{
|
||||
Generation = '2'
|
||||
MemoryStartupBytes = 1024Mb
|
||||
VHDPath = "d:\VHD\$VMName.vhdx"
|
||||
SwitchName = 'Bou-LAN'
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
|
||||
Set-VMMemory RTR-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
|
||||
|
||||
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-01"
|
||||
Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -StaticMacAddress 00155D027004
|
||||
Add-VMNetworkAdapter -VMName RTR-02 -SwitchName "WAN" -StaticMacAddress 00155D027005
|
||||
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-02"
|
||||
Add-VMNetworkAdapter -VMName "RTR-02" -SwitchName "Arc-CLI" -Name "Bou-LAN" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "RTR-02" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
|
||||
|
||||
|
||||
# RTR-03
|
||||
@ -102,9 +98,9 @@ New-VM @vms
|
||||
|
||||
Set-VMMemory RTR-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
|
||||
|
||||
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-01"
|
||||
Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -StaticMacAddress 00155D027006
|
||||
Add-VMNetworkAdapter -VMName RTR-03 -SwitchName "Aston" -StaticMacAddress 00155D027007
|
||||
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-03"
|
||||
Add-VMNetworkAdapter -VMName "RTR-03" -SwitchName "Aston" -Name "Aston" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "RTR-03" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
|
||||
|
||||
|
||||
Start-VM -Name RTR*
|
||||
|
Loading…
Reference in New Issue
Block a user