Hyper-V NAT network setup using the default switch
This was the easiest guide to use the default virtual switch to enable NAT for the VMs to download patches from the internet without adding more IP addresses to your network.
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/setup-nat-network
Basically steps are:
1. Start Powershell as administrator
2. PS C:\WINDOWS\system32> Get-NetAdapter
3. "Extract the ifIndex for the Hyper-V Virtual Ethernet Adapter. In my case it was 28"
4. PS C:\WINDOWS\system32> New-NetIPAddress -IPAddress 172.16.0.1 -PrefixLength 24 -InterfaceIndex 28
5. PS C:\WINDOWS\system32>New-NetNat -Name NAT -InternalIPInterfaceAddressPrefix 172.16.0.0/24
6. After that, go to the VM and assign a static IP address to the VM as 172.16.0.2 with subnet mask as 255.255.255.0 and gateway as 172.16.0.1. DNS settings can be 8.8.8.8
Comments