How To Enable Nested Virtualization (VT-x) On Hyper-V, VMWare, VirtualBox VMs In Windows

A Windows computer needs to support virtualization technology in order to run guest operating systems (virtual machines), Windows Subsystem for Linux (WSL), and Windows Subsystem for Android (WSA).

If your computer supports virtualization, then it can be enabled from the UEFI/BIOS settings. However, in the case of a Virtual Machine (VM), you cannot access its BIOS settings. However, one can need to run a VM, an Android application, or a Linux distro inside a VM. So what do you do then?

In such an instance, you must enable nested virtualization on a guest operating system. This is our topic for today, and this post gives you a step-by-step guide on how to enable nested virtualization on VMs configured on Microsoft Hyper-V, Oracle VirtualBox, and VMware Workstation on a Windows computer.

Note: Enabling nested virtualization for VMWare Workstation and Oracle VirtualBox on operating systems other than Windows is different. In this post, we have only discussed how to enable it if your host computer is running a Windows operating system.

What is Nested Virtualization

Nested virtualization, often referred to as “nested VT-x,” is running a virtualized environment inside a device that is already virtualized. In other words, running a VM inside of another VM.

When enabling a nested virtualization environment, you are nesting a hypervisor. A hypervisor is software that runs and manages virtual machines on top of the host computer.

The hypervisor running the main virtual machine is considered a “Level 0 (L0)” hypervisor. The hypervisor running inside the VM is referred to as a “Level 1 (L1)” hypervisor. Further nested virtualization would result in a Level 2 (L2) hypervisor, and so on.

At this point, most users come to think “How many nested virtualization environments can you run simultaneously?” There is no definitive answer to this at the moment. However, it all depends on your system’s resources. If you have the CPU and the RAM, as well as the storage for it, you can run as many nested hypervisors as you want.

Prerequisites for Nested Virtualization

To enable nested virtualization, the hypervisor needs to support it. Hyper-V first supported nested virtualization in Windows 10/Windows Server 2016. Before that, this technology was not available in the Hyper-V hypervisor.

If you are using Oracle VirtualBox, versions 6.1 and above support nested virtualization.

Moreover, to be able to run nested virtualization, your processor must be an Intel processor with VT-x and EPT technology, or an AMD EPYC or Ryzen processor. You can verify this information by checking on the OEM website or checking hardware virtualization compatibility from Command Prompt.

Once it is confirmed that both your hardware and software are compatible, let us move on to enabling nested virtualization.

How To Enable Nested Virtualization (VT-x) On Hyper-V

Learn how to make a Windows 11 VM on Hyper-V, VirtualBox, and Workstation.

If you try installing and running a Hyper-V VM inside a VM, you will encounter an error such as the one in this image:

VM ran wiothout nested virtualization
VM ran without nested virtualization

To enable nested VT-x on a Hyper-V VM (or any other supported hypervisor), the VM must already be created and must be turned off before performing the steps below.

The Hyper-V hypervisor does not give you the option to enable nested virtualization on a VM through the settings menu. Therefore, this needs to be done using the Command Line Interface (CLI).

  1. Make sure that the VM is shut down/powered off and note down the VM’s exact name.

  2. On the host computer, open Windows PowerShell with elevated privileges.

  3. Now run the following cmdlet to enable nested virtualization on the VM while replacing [NameOfVM] with the complete name of the virtual machine.

    Set-VMProcessor -VMName "[NameOfVM]" -ExposeVirtualizationExtensions $true
    Enable nested virtualization on Hyper V VM using PowerShell
    Enable nested virtualization on Hyper V VM using PowerShell

Nested virtualization on that particular VM will now be enabled. You can now confirm this by running a guest OS on top of that VM.

Nested virtualization enabled
VM within VM – nested virtualization enabled

In the case you wish to disable nested virtualization, use this cmdlet in PowerShell while the VM is disabled:

Set-VMProcessor -VMName "[NameOfVM]" -ExposeVirtualizationExtensions $false

How To Enable Nested Virtualization (VT-x) On VMWare WorkStation

Similar to Hyper-V, the WorkStation VM must be already created and powered off to enable nested virtualization. Then, follow these steps to enable nested VT-x:

  1. From VMWare WorkStation, open the VM’s settings.

    VMWare Open VM settings
    Open VM settings
  2. Under the Hardware tab, select Processors, and then check the box next to “Virtualize Intel VT-x/EPT or AMD-V/RVI,” and then click Ok.

    Enable nested virtualization on VMWare VM
    Enable nested virtualization on VMWare Workstation VM

Nested virtualization will now be enabled on the VM. You may now run another guest OS on top of that VM.

To disable nested VT-x on the VM, simply shut down the VM, return to the Processor settings page, and uncheck the box.

How To Enable Nested Virtualization (VT-x) On Oracle VirtualBox

According to Oracle, VirtualBox now supports nested virtualization for the supported Intel and AMD processors. We also found the option to enable it from the VirtualBox VMs’ setting page. However, the option was greyed out.

Nested virtualization option disaled grayed out in VirtualBox
Nested virtualization option disabled/grayed out in VirtualBox

Upon researching, we came to know that many people ran into this option because apparently, VirtualBox has not yet enabled it for Intel processors (we do not know why).

However, there is a workaround for this and you can enable nested virtualization on VMs created in VirtualBox as well. Here is how:

  1. Using File Explorer, navigate to the path where VirtualBox is installed. By default, it has the following path:

    C:\Program Files\Oracle\VirtualBox
  2. Copy this path and then open an elevated Command Prompt. Use the “cd” cmdlet to change your directory to the VirtualBox folder. Use the copied path from File Explorer.

    cd /d [PathToVirtualBoxFolder]
    Change directory 2
    Change directory 2
  3. Now, run the following cmdlet while replacing [NameOfVM] with the name of the virtual machine on which you want to enable nested virtualization.

    VBoxManage modifyvm <YourVirtualMachineName> --nested-hw-virt on
    Enable nested virtualization on VirtualBox VM
    Enable nested virtualization on VirtualBox VM

Nested VT-x will now be enabled on the selected VM. You can confirm this by opening the VM’s settings again, clicking System, and then clicking the Processor tab, where you shall now be able to check and uncheck the box next to “Enable nested VT-x/AMD-V” to enable or disable nested virtualization.

Confirm that nested virtualization on VirtualBox VM is enabled
Confirm that nested virtualization on VirtualBox VM is enabled

Note that, like Hyper-V, this cmdlet will need to be run for each individual VM that you want to enable nested VT-x on.

After running the cmdlet in the steps above, nested virtualization is enabled by default. If you wish to disable it, simply uncheck the box next to “Enable Nest VT-x/AMD-V” on the Processor settings page.

Final Analysis

Virtual machines can be used for different purposes, like performing isolated tests, running special services and tasks, etc. However, if you want to perform virtualization-related tests, then we suggest you perform it on a VM inside another VM. This way, you won’t be putting the parent host computer in harm’s way.

Nested virtualization is another great way to use limited resources while achieving more. You can use the same VM, on a physical computer or on the cloud, create multiple VMs on it, and then distribute those VMs to your students/subordinates; all while only using one level 1 VM.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Leave the first comment

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information