Use this to understand L0/L1/L2 layers when running a hypervisor in a VM.
Nested Hypervisor
A nested hypervisor is a hypervisor running inside a VM (L1) that starts its own VMs (L2). It needs exposed virtualization extensions and is mainly used for labs, CI and training rather than production workloads.
1. A nested hypervisor is a hypervisor running in a VM.
2. Needs VT exposed and enough memory.
3. L2 networking requires MAC spoofing or promiscuous on L0.
4. Not supported for production by most vendors.
5. Keep labs isolated.
L0 → L1 nested hypervisor → L2
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Checks Verify boundary
- L0 exposes virtualization extensions to L1.
- L1 sees vmx/svm (
egrep -c '(vmx|svm)' /proc/cpuinfo). - Networking for L2: MAC spoofing/promiscuous or MAC learning enabled.
Step 2 Common mistakes Narrow the fault
- Forgetting MAC learning/promiscuous mode for L2 networking.
- Too little memory for L1, which must host its own VMs.
- Expecting vendor support for production nested setups.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Every VM exit in the nested guest is handled by two hypervisors.
- Vendor support for nested setups is limited.
- It is meant for labs, CI and training.
systemd-detect-virt— in L1: running as VMlsmod | grep kvm— L1 hypervisor loadedvirsh list— L2 VMs
ReferenceWhy it matters1 section · depth on demand
Use cases
- Hypervisor labs and training.
- Testing upgrades.
- CI for infrastructure code.
- WSL2/VBS inside Windows VMs.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Requirements for a nested hypervisor VM:
| Requirement | Why |
|---|---|
Expose VT-x/AMD-V (host CPU or vmx/svm flag) | L1 needs virtualization extensions |
| Static memory, no ballooning | L1 manages its own memory for L2 |
| MAC spoofing / promiscuous or MAC learning | L2 VMs have their own MACs |
| Enough vCPUs and RAM | L2 VMs live inside L1's allocation |
| UEFI where the nested hypervisor requires it | ESXi 8, Hyper-V Gen 2 |
Check inside L1: grep -c vmx /proc/cpuinfo (Linux) or systeminfo → "Virtualization Enabled in Firmware: Yes" (Windows).
Layers
| Layer | Example |
|---|---|
| L0 | Physical host hypervisor (ESXi, KVM, Hyper-V) |
| L1 | VM running a hypervisor (ESXi, Proxmox, Hyper-V) |
| L2 | VMs inside the L1 hypervisor |
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Nested Virtualization → Nested Hypervisor. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/docs.html · confidence 94%