Following an earlier announcement, Microsoft has added a preview of nested virtualization in Windows 10 Build 10565, which was pushed few days back to Windows Insiders.
Nested virtualization means a host machine which running a virtual machine, which in turn is running its own guest virtual machine.
The new feature virtualizes certain hardware capabilities that are needed to run hypervisor in a virtual machine, but it’s still in the development stage and has some known issues.
The native Hypervisor or Hyper-V depends on hardware virtualization support to run virtual machines. Once it is installed, it hides its capabilities from guest virtual machines, preventing them from installing Hyper-V.
However, the new feature of Nested virtualization exposes hardware virtualization support to guest virtual machines, and allows the user to install Hyper-V in a guest virtual machine. As a result, more virtual machines are created inside the underlying virtual machine.
In a nutshell, the user can have a host machine running a virtual machine, which is also running its own virtual machine inside.
How to enable Nested Virtualization in Windows 10 Build 10565:
- Create a Virtual Machine
- Run the enablement script
Users can use the following Powershell script which will change configuration by correcting errors. It will enable nested virtualization for Virtual machine.
Invoke-WebRequest //raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/hyperv-tools/Nested/Enable-NestedVm.ps1 -OutFile ~/Enable-NestedVm.ps1
~/Enable-NestedVm.ps1 -VmName <VmName>
- Install Hyper-V in the guest machine
- Enable networking
Although it’s optional, but once, Nested Virtualization is enabled MAC spoofing must enabled to enable networking in guest virtual machines. To do this, run the following powershell as administrator on the host-
Set-VMNetworkAdapter -VMName <VMName> -MacAddressSpoofing on
- Create Nested Virtual Machines.