Nested Virtualization allows us to run a hypervisor (Hyper-V) inside of a virtual machine. In other words, with nested virtualization, a Hyper-V host itself can be virtualized. Before Windows Server 2016 if we wanted to run the hyper-v role and run virtual machines we would have to run it on a physical host. We could not have virtual machine and on that VM install Windows Server 2016 as a guest OS and Install hyper-v on that virtual machine and run VMs on that VM.

Before we enable Nested Virtualization we need to talk about prerequisites and limitations.

Hyper-V Physical Host Prerequisites

  • Hyper-V Host must run Windows Server 2016
  • Intel processor with VT-x and EPT technology. AMD CPU is not supported
  • Device Guard needs to be disabled
  • Virtualization Based Security needs to be disabled

VM Virtual Hyper-V Host Prerequisites

  • VM must run Windows Server 2016
  • Dynamic Memory must be disabled
  • MAC spoofing needs to be enabled
  • Minimum 4 GB RAM for VM Hyper-V Host (I would recommend at least 8 GB RAM)

Nested Virtualization Limitations

  • Checkpoints will not work if you try to apply it on a running VM
  • Memory resize is not working
  • Live Migration is not working on virtualized hyper-v host
  • Save and restore is not working

Servers:

  • Hyper-V Physical Host = HVTEST01
  • Hyper-V Virtual Host = NestedHV (8 vCPU, 10 GB RAM)

Let’s configure nested virtualization.

Before we begin be sure to turn off the VM which will be configured as Virtual Hyper-V.

Right-Click on VM and select Settings

screenshot-2

Memory – Dynamic Memory needs to be disabled

(Powershell: Set-VMMemory -VMName “NestedHV” -DynamicMemoryEnabled $false)

screenshot-3

Next, expand Network Adapter –> Advanced Features and enable MAC Address Spoofing

(Powershell: Get-VMNetworkAdapter -VMName “NestedHV” | Set-VMNetworkAdapter -MacAddressSpoofing On)

screenshot-4

Last thing we need to do is to enable nested virtualization by running

Set-VMProcessor -VMName NestedHV -ExposeVirtualizationExtensions $true

screenshot-5

Now that the VM is configured to support nested virtualization, we need to install the Hyper-V role in the VM.

Start the VM and run Powershell as Admin

Install-WindowsFeature –Name Hyper-V -IncludeManagementTools – Restart

screenshot-6

When it is done, login and start Hyper-V Manager. I will create new VM (NestedVM).

screenshot-7

That’s it.

Cheers,

Nedim