Windows Server 2016 and Windows 10, are bringing a new Hyper-V feature which is very welcome for those who love and need, do clustering tests, like me, and does not have access to a physical infrastructure (servers, storages, etc.) that makes it possible. Why nested virtualization, which is the new Hyper-V feature, can help a lot!
Being straight forward, nested virtualization is run a VM with Hyper-V host, inside a VM with Hyper-V host. You got confused? Come on, I'm going to show you!
First, you can use a physical computer (or notebook) with Windows Server 2016 RTM or Windows 10 (version 1607). In my case, I used my notebook with Windows 10 to make the lab section of this article. I'm with Hyper-V installed and the VM, that I'm going to enable the nested virtualization, it's called W2K16. See images below:
Another important point, are the requirements for using this feature:
• The VM must be switched off, before making the settings to enable the resource;
• All Save State should be deleted;
• Dynamic memory must be disabled and the VM must have enough RAM memory to run the VM and the host, without sacrificing much performance;
• MAC address spoofing is needed, if the VM that is running within the VM, need to use the network;
• The most important, and the cause of many mistakes, virtualization extensions must be enabled in the VM that will run inside the VM.
Enabling Nested Virtualization
On the host with Hyper-V, you create a Windows Server 2016 VM, as the image below:
When finish the installation, make the basic settings on the VM, such as renaming the server, put IP, etc. See image below:
Now, shutdown the VM.
I will show the error that occurs when you try to install the Hyper-V role on a VM without the nested virtualization feature enabled:
With the VM off, we execute the command to enable virtualization extensions, in the VM that will run the Hyper-V, inside the VM host. The command must be run in Windows PowerShell with administrative privileges:
• Set-VMProcessor -VMname <VMname> VM-ExposeVirtualizationExtensions $true
Now, let's enable the MAC address spoofing, with the following command:
• Get-VMNetworkAdapter -VMname <VMName> | Set-VMNetworkAdapter -MacAddressSpoofing On
At this point, the VM is enabled to run Hyper-V.
The Hyper-V role can be installed via Server Manager or through two PowerShell commands as below:
• Add-WindowsFeature Hyper-V
• Add-WindowsFeature RSAT-Hyper-V-Tools
Once installed, restart the VM to apply the changes.
So, did it work? If it didn't, repeat the above operations, may have escaped some detail!
The image below shows the VM, called NanoServer, running inside of VM, called W2K16, who is running inside the Hyper-V of Windows 10, in my notebook Eddie! Cool, huh!
Thank you and I hope you enjoy!!
Jorge Barata (IT Pro | MVP Reconnect)