chore: commenting+end status RTR-02

This commit is contained in:
Alexandre S 2021-05-11 10:39:12 +02:00
parent ef25577702
commit b83b2638cd

View File

@ -8,87 +8,95 @@ echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman"
### Change VM name ### Change VM name
echo "Changing computer Name" echo "Changing computer Name as RTR-02"
Rename-computer RTR-02 Rename-computer RTR-02
echo "Done!"
#End #End
### Rename Adapters by parsing the VM device name ### Rename Adapters by parsing the VM device name
echo "Rename adapters"
$adapts = Get-NetAdapter $adapts = Get-NetAdapter
foreach ($adapt in $adapts) { foreach ($adapt in $adapts) {
$HVName = (Get-NetAdapterAdvancedProperty -name $adapt.name -DisplayName "Hyper-v Network Adapter Name").DisplayValue $HVName = (Get-NetAdapterAdvancedProperty -name $adapt.name -DisplayName "Hyper-v Network Adapter Name").DisplayValue
Rename-Netadapter -name $adapt.name -NewName $HVName Rename-Netadapter -name $adapt.name -NewName $HVName
} }
echo "Done!"
# End # End
### Pausing to let things settle ### Pausing to let things settle
echo "Sleeping 10s" echo "Sleeping 10s"
Sleep 10 Sleep 10
echo "Done!"
#End #End
### Général IP configure
echo "IP configuration"
$MaskBits = 24 # This means subnet mask = 255.255.255.0
$IPType = "IPv4"
#Bou-LAN IP conf #Bou-LAN IP conf
echo "IP conf via netsh fort Bou-LAN"
netsh interface ip set address name="Bou-LAN" static 192.168.128.254 255.255.255.0 netsh interface ip set address name="Bou-LAN" static 192.168.128.254 255.255.255.0
echo "Done!"
#WAN #WAN
echo "IP conf via netsh for WAN"
netsh interface ip set address name="WAN" static 192.168.255.128 255.255.255.0 192.168.255.254 netsh interface ip set address name="WAN" static 192.168.255.128 255.255.255.0 192.168.255.254
echo "Done!"
# END # END
### DNS Conf for all InterfaceAlias ### DNS Conf for all InterfaceAlias
echo "Configuring Dns"
echo "Configuring Dns for 9.9.9.9 on all interfaces"
foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('9.9.9.9') } foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('9.9.9.9') }
echo "Done!"
#End #End
### Install VPN (?) ### Install VPN (?)
echo "installing VPN routing role" echo "installing and activating routing role"
Install-windowsFeature -Name Routing -IncludemanagementTools Install-windowsFeature -Name Routing -IncludemanagementTools
Install-remoteAccess -VpnType Routingonly Install-remoteAccess -VpnType Routingonly
set-service RemoteAccess -StartupType Automatic set-service RemoteAccess -StartupType Automatic
Start-Service RemoteAccess Start-Service RemoteAccess
echo "Done!"
#END #END
### Set connection as Private ### Set connection as Private
echo "Set connection as private" echo "Set connection as private on all Interface"
Get-NetAdapter | Set-NetConnectionProfile -NetworkCategory Private Get-NetAdapter | Set-NetConnectionProfile -NetworkCategory Private
echo "Done!"
#END #END
### Change ZoneAlarm rule to accept incoming ICMP ipv4 probes ### ### Change ZoneAlarm rule to accept incoming ICMP ipv4 probes ###
echo "change firewall rules to accept ICMP probes"
Get-NetFirewallRule -name "*ICMP4-ERQ-In*" |Enable-NetFirewallRule Get-NetFirewallRule -name "*ICMP4-ERQ-In*" |Enable-NetFirewallRule
echo "Done!"
#END #END
### Activate routing and DHCP Relay
### Activate NAT and DHCP Relay echo "Activate DHCP Relay via netsh "
echo "Activate NAT and DHCP Relay"
netsh routing ip relay install netsh routing ip relay install
netsh routing ip add interface name="Bou-LAN" state=enable netsh routing ip add interface name="Bou-LAN" state=enable
netsh routing ip add interface name="WAN" state=enable netsh routing ip add interface name="WAN" state=enable
netsh routing ip relay add interface "Bou-LAN" netsh routing ip relay add interface "Bou-LAN"
netsh rout ip rel set int BOU-LAN min=0 netsh rout ip rel set int BOU-LAN min=0
netsh routing ip relay add interface "WAN" netsh routing ip relay add interface "WAN"
netsh rout ip rel set int WAN min=0 netsh rout ip rel set int WAN min=0
netsh routing ip relay add dhcpserver 192.168.8.1 netsh routing ip relay add dhcpserver 192.168.8.1
echo "Done!"
#netsh -f ./WAN.conf
#netsh -f ./Bou-LAN.conf
### Add routes ### Add routes
@ -96,6 +104,7 @@ echo "Adding routes"
route add -p 192.168.8.0/24 192.168.255.8 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.12.0/24 192.168.255.8
route add -p 0.0.0.0/0 192.168.255.254 route add -p 0.0.0.0/0 192.168.255.254
echo "Done!"
Read-Host "Finished???" Read-Host "Press enter to reboot"
Restart-Computer Restart-Computer