8

Ok, we all know (or should know) that Microsoft's answer is a plain "NO!".

But we also know that recent hypervisors can support nested/recursive virtualization, provided the underlying CPU offers hardware virtualization; VMware's recent products (ESXi 5, Workstation 8) even support this natively, without the need for ugly hacks.

So, my question is: can Hyper-V run succesfully (i.e. allowing to actually run virtual machines) inside other hypervisors?

If yes, which ones? And how?


This is only intended for testing, of course.

Massimo
  • 68,714
  • 56
  • 196
  • 319

3 Answers3

6

Yes, it can, if the underlying CPUs support the latest virtualization extensions (Intel VT-X/EPT) and if you're using the latest VMware products (Workstation 8, ESXi 5).

The relevant settings in your VM should be as follows:

monitor.virtual_mmu = "hardware"
monitor.virtual_exec = "hardware"
vhv.enable = "TRUE"
hypervisor.cpuid.v0 = "FALSE"

The first three settings can be enabled via GUI (where exactly varies slightly between Workstation and ESXi), the last one needs to be manually added to the VM's .vmx file.

Additionally, on ESXi 5, you need to add the following line to /etc/vmware/config:

vhv.allow = "TRUE"
Massimo
  • 68,714
  • 56
  • 196
  • 319
  • Was this found by trial and error or can you point us to the source, which might have more information of interest to those considering doing the same? – John Gardeniers Oct 19 '11 at 09:58
  • There are various sources on the web, all confirming the same steps and settings; nothing official, though, neither from VMware nor from Microsoft (which still says this is not possible at all). – Massimo Oct 19 '11 at 10:39
3

There are different answers to this question.

Before WS2016/W10, the correct answer was: Yes, you can enable the Hyper-V role in a Hyper-V VM, but the hypervisor would not start. Therefore, you could create VMs in the vHost, but those VMs could not start.

However, in Windows 10 and WS2016 (TP4 and later) we can use nested Hyper-V. If you're mad enough to try, you can create a host, in a host, in a host, in a host, on a host ...

Aidan Finn
  • 211
  • 1
  • 3
  • Wow, that's actually true, Microsoft finally managed to support nested virtualization: https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/user_guide/nesting. Wonder if it allows hosting ESX/i inside Hyper-V, too... – Massimo Feb 01 '16 at 20:56
  • @Massimo from your link - *"Both hypervisors need to be the latest Windows Insider build (10565 or greater). Other hypervisors will not work."* (Aside: One reason Microsoft had to make nested Hyper-V work is for Server 2016's container support to be usable in VMs; one of the container types is a Hyper-V based container. Another reason might be the Virtual Secure Mode in Windows 10 Enterprise which keeps passwords in a Hyper-V VM, and runs the main OS in another). – TessellatingHeckler Feb 02 '16 at 00:20
  • @TessellatingHeckler Aside from what Microsoft might say, Hyper-V had been happily able to run inside VMware products for a while (although of course nobody officially supported it ever); this Hyper-V nesting is based on the same underlying principles, thus I'd guess it would make Hyper-V able to run *other* nested hypervisors too (although, again, without any kind of official support). – Massimo Feb 02 '16 at 00:30
0

To complete the previous answer. According to this question and Michael H. comments, ESXi is currently the only option to run Hyper-V within a VM.

Aloene
  • 101
  • 2