Microsoft Azure Nested Virtualization | Hyper-V VM inside Azure VM
With the new Dv3 and Ev3 VM sizes Microsoft has released the Nested Virtualization, meaning you can simply have a Hyper-V VM inside an Azure VM. I have created a set of posts to explore the Nested Virtualization functionality. Of course nested virtualization is only supported in Windows Server 2016.
Microsoft Azure Nested Virtualization
At the first port, we will create a Hyper-V VM inside an Azure VM and have Network and Internet Connectivity.
Lets get started. First of all we will need a Dv3 or Ev3 VM and for best Nested Virtualization performance make use of SSD Managed Disks. I created a D4s_v3 Standard (4Cores, 16GB Ram, SSD managed disks) and I attached a 1023GB SSD Data Disk for performance.
Now remote desktop to the VM to add the Hyper V Role. From the Server Manager, add Roles and Features and add the Hyper-V role
Since this is an one NIC VM select the NIC to create the Virtual Switch
Change the default Store location to the SSD Data Disk, in this case the E: drive.
Finally wait for the installation to complete and reboot the VM. After the VM reboots, Remote Desktop and open the Hyper-V manager. Now we have Hyper-V inside an Azure VM.
Lets create a VM. You can download a Trial Windows Server 2016 from https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2016 or use your Subscription (MSDN, EA, etc).
I created a VM Called NestedVM01, with 4GB Ram using the Trial Windows Server 2016 ISO
After the VM creation setup the Windows Server 2016 with all defaults and login.
The first thing to notice is that the Network Interface does not have a valid IP address, since Microsoft Azure will not provide one. In order to have the Nested VM to have Network connectivity we need to use NAT.
First change the Virtual Switch to “Internal network”
At the Host’s Network interfaces, open the vEthernet NIC and add a static IP, only IP & Mask
Now we will need PowerShell, since we cannot configure NAT form the GUI.
Open the PowerShell (still at the Host Azure VM) and run
New-NetNat –Name NVMNat –InternalIPInterfaceAddressPrefix 192.168.168.0/24
After that we can provide the Nested VMs with IPs form the 192.168.168.0/24 range. So login to the Nested VM and add an IP fron the Range and for Default Gateway add the Host’s IP.
For DNS add your AD DNS or a Public DNS server just to have internet.
Now from the Nested VM you can ping the Host:
And also browse the Internet:
Stay tuned, on my next post we will see how we can make the Nested VM a Web Server, a hidden Web Server in a VM inside an Azure VM!
Of course this Features opens the door for many more features to test, like Hyper-V Replica, Containers, etc, that we will see in future posts.