Recently Microsoft released Windows 10 Build 10565, with many new features and known issues.
Gabriel Aul, head of Windows Insiders program, today announced that build 10565 supports Nested Virtualization, which allows you to run Hyper V containers in a Hyper-V virtual machines.
Earlier in the year, we announced that we will be building nested virtualization so that people could run Hyper-V Containers in Hyper-V virtual machines.
In preparation for the first public preview of Hyper-V Containers, we are releasing a preview of nested virtualization. This feature allows you to run Hyper-V in a virtual machine (note that this is Hyper-V on Hyper-V only… other hypervisors will fail).
Although Hyper-V Containers have not been released yet, for now you can try out this feature with Hyper-V virtual machines.
However, Virtualization on Windows 10 build 10565 is in very early stage, so there are some known issues.
What is nested virtualization?
In essence, this feature virtualizes certain hardware features that are required to run a hypervisor in a virtual machine.
Hyper-V relies on hardware virtualization support (e.g. Intel VT-x and AMD-V) to run virtual machines. Typically, once Hyper-V is installed, the hypervisor hides this capability from guest virtual machines, preventing guests virtual machines from installing Hyper-V (and many other hypervisors, for that matter).
Nested virtualization exposes hardware virtualization support to guest virtual machines. This allows you to install Hyper-V in a guest virtual machine, and create more virtual machines “within” that underlying virtual machine.
In the image below, you can see a host machine running a virtual machine, which in turn is running its own guest virtual machine. This is made possible by nested virtualization. Behold, three levels of Cortana!
How to enable nested virtualization
Step 1: Create a VM
Step 2: Run the enablement script
Given the configuration requirements (e.g. dynamic memory must be off), we’ve tried to make things easier by providing a PowerShell script.
This script will check your configuration, change anything which is incorrect (with permission), and enable nested virtualization for a VM. Note that the VM must be off.
Invoke-WebRequest https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/hyperv-tools/Nested/Enable-NestedVm.ps1 -OutFile ~/Enable-NestedVm.ps1
~/Enable-NestedVm.ps1 -VmName <VmName>
Step 3: Install Hyper-V in the guest
From here, you can install Hyper-V in the guest VM.
Step 4: Enable networking (optional)
Once nested virtualization is enabled in a VM, MAC spoofing must be enabled for networking to work in its guests. Run the following PowerShell (as administrator) on the host machine:
Set-VMNetworkAdapter -VMName -MacAddressSpoofing on
Step 5: Create nested VMs
Known issues:
- Both hypervisors need to be the latest versions of Hyper-V. Other hypervisors will not work. Windows Server 2012R2, or even builds prior to 10565 will not work.
- Once nested virtualization is enabled in a VM, the following features are no longer compatible with that VM. These actions will either fail, or cause the VM not to start:
- Dynamic memory must be OFF. This will prevent the VM from booting.
- Runtime memory resize will fail.
- Applying checkpoints to a running VM will fail.
- Live migration will fail.
- Save/restore will fail.
- Once nested virtualization is enabled in a VM, MAC spoofing must be enabled for networking to work in its guests.
- Hosts with Virtualization Based Security (VBS) enabled cannot expose virtualization extensions to guests. You must first disable VBS in order to preview nested virtualization.
- This feature is currently Intel-only. Intel VT-x is required.
- Beware: nested virtualization requires a good amount of memory. I managed to run a VM in a VM with 4 GB of host RAM, but things were tight.
For more detailed information on Hyper V Virtual Machine, Visit Blogs Technet