Created
January 3, 2017 21:59
-
-
Save gaelcolas/4dcd3cc78bc7a39f2809ba10a618dd49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$containerPrefix = '10.111.110.0/24' | |
$sharedPrefix = '10.111.0.0/16' | |
$vmprefix = '10.111.111.0/24' | |
$vmPrefixLength = 24 | |
$SharedGw = '10.111.111.1' | |
$vmNatSwitchName = 'NAT' | |
$null = Get-ContainerNetwork | Remove-ContainerNetwork -Force -ErrorAction SilentlyContinue | |
$null = Get-NetNat | Remove-NetNat -Confirm:$false -ErrorAction SilentlyContinue | |
$null = Get-VMSwitch -Name $vmNatSwitchName -ErrorAction SilentlyContinue | Remove-VMSwitch -Force -Confirm:$false -ErrorAction Stop | |
$containerNetwork = New-ContainerNetwork -Name nat -Mode NAT -SubnetPrefix $containerPrefix -GatewayAddress $SharedGw | |
$null = Get-NetNat | Remove-NetNat -Confirm:$false | |
$SharedNat = New-NetNat -Name SharedNAT -InternalIPInterfaceAddressPrefix $sharedPrefix | |
$vswitch = New-VMSwitch -Name $vmNatSwitchName -SwitchType Internal -Notes 'VM NAT SWITCH' -Confirm:$false | |
$nic = Get-NetAdapter | ? Name -Match $vswitch.Name | |
$HostSwitchIP = New-NetIPAddress -IPAddress $SharedGw -InterfaceIndex $nic.ifIndex -DefaultGateway $SharedGw -PrefixLength 24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment