Search This Blog

Tuesday, October 13, 2015

Enable Nested Virtualization on Hyper-V

[27 Feb 2016]
A lot of people ask us about possibility of Hyper-V support nested virtualization? Well, we used to say “No” but with Windows Server 2016 (RTM), but starting from Windows Server 2016 TP4,we can say “Yes”.

What is nested virtualization? For those who do not know, it mean
  • Installing Hyper-V hypervisor on physical host
  • Then setting up guest virtual machine on that host, install with Hyper-V roles and run few VMs.
In simple word – “run Hyper-V roles inside VM and create virtual machine”
One of the common scenario we love to do this is for lab testing. At this moment, Refer to below on how  to setup nested virtualization (on Hyper-V):-

[Using Windows Server 2016 TP4 as Host]
1. Install Host with Windows Server 2016 TP4
2. Create a base image of Windows Server 2016 TP4. Refer to below link:- http://www.ms4u.info/2016/02/create-windows-server-2016-base-image_27.html
Make sure the virtual machine has configure the following settings:-
  • Disable Dynamic Memory
  • Set vCPU more than 1
  • Enable MAC Address spoofing
  • Enable virtualization extension on the vCPU by using Powershell
Check Virtualization Extension on target VM:
get-vmprocessor -vmname <target virtual machine> | fl *


Enable Virtualization Extension on target VM:
Set-VMProcessor -VMName <target virtual machine> -ExposeVirtualizationExtension $true




Lastly, boot up target virtual machine, enable Hyper-V roles and create guest virtual machine.

[Using Windows 10 as Host]
Your host should at least running Windows 10 Build 10565. For more detail, you can refer to Windows Insider Preview:- Nested Virtualization
Prior version of Windows 10 Build 10565 cannot setup nested virtualization.

Guest virtual machine:-
  • create a VM running Windows 10 Build 10565
  • Run Enable-NestedVm.ps1 while the VM is turn off. This script will check your configuration and change anything which is incorrect.
1
  • Install Hyper-V Roles
  • Create nested VM
Here is our test result:
result

2 comments: