Modif route. Add static ip via netsh

This commit is contained in:
Winston Smith 2021-04-19 16:04:47 +02:00
parent 4a9196a7dc
commit c192a160b4
3 changed files with 20 additions and 5 deletions

View File

@ -12,6 +12,14 @@ Rename-computer $name
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools
#Install-remoteAccess -VpnType Vpn #Install-remoteAccess -VpnType Vpn
# Change IP and DNS
#
netsh interface ip set address "WAN" static 192.168.255.8 255.255.255.0 192.168.255.254
netsh interface ip set address "Arc-CLI" static 192.168.12.254 255.255.255.0
netsh interface ip set address "Arc-SRV" static 192.168.8.254 255.255.255.0
netsh interface ip set dns name="WAN" static 9.9.9.9
# Display interfaces and active forwarding for all of thm via Regedit # Display interfaces and active forwarding for all of thm via Regedit
netsh inter show inter netsh inter show inter
Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet` Set-ItemProperty -path 'HKLM:\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet`
@ -52,4 +60,4 @@ 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.12.0.24 192.168.12.254
route add -p 192.168.255.0/24 192.168.255.8 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 192.168.128.8/24 192.168.255.128
route add -p 0.0.0.0/0 192.168.255.0 route add -p 0.0.0.0/0 192.168.255.254

View File

@ -2,12 +2,17 @@
# GPLv3 # GPLv3
# Script to install and configure a Fuckdows Server 2016 as a router # Script to install and configure a Fuckdows Server 2016 as a router
# RTR-03 Only # RTR-02 Only
# Change the poor machine name # Change the poor machine name
$name = Read-host "Nouveau nom d'hôte?" $name = Read-host "Nouveau nom d'hôte?"
Rename-computer $name Rename-computer $name
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 Routing and necessary linked roles
Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools
set-service RemoteAccess -StartupType Automatic set-service RemoteAccess -StartupType Automatic
@ -47,4 +52,4 @@ 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 192.168.255.0/24 192.168.255.128 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 192.168.128.0/24 192.168.128.254
route add -p 0.0.0.0/0 192.168.255.0 route add -p 0.0.0.0/0 192.168.255.254

View File

@ -13,6 +13,9 @@ Install-WindowsFeature RemoteAccess -IncludeManagementTools
set-service RemoteAccess -StartupType Automatic set-service RemoteAccess -StartupType Automatic
Start-Service RemoteAccess 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
# Activate NAT # Activate NAT
netsh routing ip nat install netsh routing ip nat install
@ -29,7 +32,6 @@ Set-NetFirewallRule @Params
# Add routes # 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.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 192.168.128.0/24 192.168.255.128 route add -p 192.168.128.0/24 192.168.255.128