Running Virtual Machines Inside Hyper‑V: How to Enable and Evaluate Nested Virtualization
Nested virtualization lets a Hyper‑V guest host its own VMs, enabling test labs or CI pipelines on a single server. This post covers enabling the feature on Windows Server 2019+, configuration steps, performance caveats, and a practical example. Test it before production.
02 Aug 2025, 21:40 UTC

Why Run VMs Inside Hyper‑V?
In many labs and continuous‑integration (CI) pipelines you need a clean, isolated environment that can be spun up and torn down quickly. Traditionally that means provisioning a fresh physical host or a dedicated virtual machine (VM) that acts as a host for other VMs. With nested virtualization you can accomplish the same on a single physical server: spin up a Hyper‑V guest, enable it to expose the processor’s virtualization extensions, and then run additional VMs inside that guest. The result is a single‑host, multi‑level VM stack that saves hardware, simplifies networking, and keeps your test environments reproducible.
Prerequisites: What the Host Must Provide
- The physical CPU must support Intel VT‑x or AMD‑SVM and expose those extensions to the Hyper‑V host. On Intel machines this is usually enabled by default; on AMD you may need to enable SVM in the BIOS.
- The Hyper‑V host must run Windows Server 2019 or newer (or Windows 10/11 Pro/Enterprise with the latest Hyper‑V update). Older hosts ignore the nested‑virtualization flag.
- The VM you want to turn into a nested host must have at least one virtual processor. The default of one vCPU is sufficient for a proof‑of‑concept.
Enabling Nested Virtualization
There are two ways to expose the virtualization extensions to a guest: the Hyper‑V Manager GUI or PowerShell. The GUI is convenient for a quick test, but PowerShell gives you a repeatable script that you can version‑control.
Using Hyper‑V Manager
- Open Hyper‑V Manager on the host.
- Right‑click the VM you want to enable nested virtualization for, choose Settings.
- Under Processors, check Expose virtualization extensions to the guest.
- Apply the changes and start the VM.
Using PowerShell
Run the following command on the host with administrative privileges. Replace <vm-name> with the name of your VM.
Set-VMProcessor -VMName <vm-name> -ExposeVirtualizationExtensions $true
After running the command you must restart the VM for the setting to take effect.
Configuring the Nested Guest
Inside the nested VM you need to install a hypervisor that can manage its own VMs. The simplest approach is to install Hyper‑V again (Windows Server or Windows 10/11). For Linux guests you can install KVM or Xen, but the example below sticks with Windows for clarity.
- Boot the nested VM and install the Hyper‑V role via Server Manager or PowerShell:
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools - Restart the nested VM.
- Open Hyper‑V Manager inside the nested guest, create a new VM as you would on a physical host.
- When you create the child VM, give it at least one virtual CPU and any amount of RAM you need.
Verifying That Nested Virtualization Works
Once the child VM is running, confirm that it sees virtualization enabled in the firmware. Inside the child VM run:
systeminfo | findstr /C:\"Virtualization\"
You should see something like Virtualization Enabled In Firmware: Yes. If it reports No, the nested extensions were not exposed correctly.
Another quick test is to open Hyper‑V Manager inside the nested VM and create a second VM. If the UI is responsive and the new VM starts, the nested environment is functional.
Performance Considerations
Nested virtualization adds an extra layer of abstraction. CPU‑bound workloads typically see a 10–30% slowdown, while I/O performance can be affected by double translation layers (guest → nested host → physical host). Memory latency may also increase because address translation occurs twice.
To quantify the impact:
- Run a CPU benchmark such as
Prime95orGeekbenchon a native VM and record the time. - Run the same benchmark on the child VM inside the nested host.
- Calculate the percentage difference:
(nested - native) / native * 100.
Keep in mind that the overhead is highly workload‑dependent. For workloads that are mostly I/O or network‑bound, the penalty may be negligible.
Security Implications
Enabling nested virtualization opens a new attack surface. If a malicious actor compromises the nested guest, they could potentially escape to the host level, especially if the nested guest runs with high privileges. Mitigate this risk by:
- Using hardened base images for both the nested host and its child VMs.
- Isolating the nested environment with a dedicated virtual switch that does not connect to external networks.
- Regularly applying security updates to all layers.
Trade‑Offs and When Not to Use It
Nested virtualization is ideal for isolated labs, CI/CD pipelines, or when you need to test multi‑tier deployments without additional hardware. However:
- If you require maximum performance, especially for CPU‑intensive workloads, a dedicated physical host or a first‑level VM is preferable.
- Some guest operating systems, particularly older Linux kernels, may not support second‑level address translation (SLAT) and could become unstable.
- The extra configuration overhead and potential for mis‑configuration mean you should only enable this feature in environments where you can monitor and manage the nested stack.
Actionable Next Steps
1. Pick a test VM on your Windows Server 2019+ host and enable nested virtualization as shown.
2. Inside that VM, install Hyper‑V and create a child VM.
3. Run a simple benchmark on both the native and nested child VMs to see the overhead.
4. If the performance is acceptable for your use case, add the nested environment to your CI pipeline or lab setup.
5. Document the configuration in your infrastructure‑as‑code repository so that the setup can be reproduced.
By following these steps you can quickly determine whether nested virtualization fits your workload requirements and integrate it into your development or testing workflows.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.