Nat on Windows 2016+ or on Windows 10 – quick config

Sometimes we need to Enable Internal NAT on Windows Especially when we want to share Internet connection from host to Virtual Machine (using Nested Virtualisation in Azure) or using Windows Containers.

Issue commands:

New-VMSwitch –SwitchName “NAT” –SwitchType Internal
New-NetIPAddress –IPAddress 10.0.0.1 -PrefixLength 24 -InterfaceAlias “vEthernet (NAT)”
New-NetNat –Name NATnetwork –InternalIPInterfaceAddressPrefix 10.0.0.4/24