Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Cloud and hosting

Nested virtualization on a VPS: uses, limits, setup

What nested virtualization on a VPS runs (KVM, Proxmox, Hyper-V, WSL 2, emulators), how to check for it, how inner guests get online and what slows them.

CloudSat teamNovember 18, 20267 min read
A large translucent cube holding a smaller cube, which holds a tiny glowing cube, floating above a dark grid
On this pageThree layers, one processor

A VPS is already a virtual machine. Nested virtualization lets that machine run virtual machines of its own, which turns a rented server into a lab for Proxmox VE, a Hyper-V host, a farm of Android emulators or a place to test operating system installs. It works well for those jobs, but it adds a layer that costs some speed and makes networking less obvious. This guide explains what happens under the hood, which software needs it, how to check for it and how to give inner guests a network.

Three layers, one processor

Virtualization people number the layers:

  • L0 is the provider's physical host and its hypervisor, usually KVM.
  • L1 is your VPS. With nesting enabled, it runs a hypervisor too.
  • L2 are the guests you create inside your VPS.

Nesting works because L0 exposes the processor's virtualization extensions to L1: AMD-V appears as the svm CPU flag, Intel VT-x as vmx. Most instructions an L2 guest runs go straight to the CPU at full speed. The cost appears on VM exits, the moments when a guest needs its hypervisor: disk and network I/O, interrupts, timers and some special instructions. In a nested setup each exit lands in L0 first, which hands it to the hypervisor in L1, so every exit takes extra round trips. Hardware helps with nested paging and, on recent CPUs, features that let L1 handle some exits more directly. The rule of thumb: compute-heavy work in L2 runs close to L1 speed, while I/O-heavy work notices the second layer most.

What needs it, and what does not

Workload Nested virtualization? Why
Docker, Podman, LXC and Incus containers Not needed Containers share the VPS kernel
Proxmox VE running only LXC containers Not needed Only its KVM virtual machines need it
KVM with libvirt, Proxmox VE VMs, VirtualBox Needed They create hardware-accelerated guests
Hyper-V role, Windows Sandbox Needed Both run on the Hyper-V hypervisor
WSL 2, Docker Desktop on Windows 10 or 11 Needed WSL 2 runs a lightweight VM; WSL 1 does not
Android SDK emulator, BlueStacks Needed Both rely on hardware virtualization
Firecracker microVMs, Kata Containers Needed Both require /dev/kvm
Vagrant with libvirt, Packer image builds Needed Each build boots a full VM

If everything on your list sits in the first two rows, skip nesting: containers give you isolation with no second hypervisor in the way.

Check that your VPS has it

On Linux, three quick tests:

grep -cE 'svm|vmx' /proc/cpuinfo    # above 0: the extensions are visible
lscpu | grep -i virtualization       # prints AMD-V or VT-x
ls -l /dev/kvm                       # present once the kvm modules load

On Debian and Ubuntu, sudo apt install cpu-checker followed by kvm-ok answers in plain words. On Windows Server, the test is the install itself: Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart refuses to continue when the processor does not expose virtualization support.

Error messages that mean nesting is off

Software rarely says "nested virtualization" when it fails. These messages usually mean the extensions never reached your server:

  • Android emulator: "x86 emulation currently requires hardware acceleration", together with a hint that KVM is not usable.
  • WSL 2: error 0x80370102, "The virtual machine could not be started because a required feature is not installed."
  • VirtualBox: VERR_VMX_NO_VMX or VERR_SVM_NO_SVM, VirtualBox's way of saying VT-x or AMD-V is missing.
  • libvirt: "could not find capabilities for domaintype=kvm" when you create a guest, or virt-host-validate reporting that /dev/kvm does not exist.

If the checks above pass and an error persists, look at the software's own settings next, such as a Windows feature that is not installed yet or a user who is not in the kvm group.

A first nested guest with KVM

A cloud image boots faster than an installer and needs no console. As root on an Ubuntu or Debian VPS:

apt install qemu-system-x86 qemu-utils libvirt-daemon-system virtinst xorriso
cd /var/lib/libvirt/images
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
qemu-img convert -O qcow2 noble-server-cloudimg-amd64.img lab1.qcow2
qemu-img resize lab1.qcow2 20G
head -n 1 /root/.ssh/authorized_keys > /root/lab-key.pub   # one public key for the guest
virt-install --name lab1 --memory 2048 --vcpus 2 --import \
  --disk /var/lib/libvirt/images/lab1.qcow2,bus=virtio \
  --osinfo detect=on,require=off \
  --cloud-init clouduser-ssh-key=/root/lab-key.pub \
  --network network=default,model=virtio --graphics none --noautoconsole
virsh domifaddr lab1

The last command prints the guest's private address on libvirt's default network, for example 192.168.122.50, once the guest has booted. Ubuntu cloud images log in as the ubuntu user, so from your own computer, jump through the VPS to reach it: ssh -J root@203.0.113.10 ubuntu@192.168.122.50.

Networking: one public address, many guests

A VPS usually has one public IPv4 address, so inner guests share it.

  • NAT is the default. libvirt's default network gives guests private addresses behind the virtual bridge virbr0 and translates their outgoing traffic. Guests can reach the internet at once; nothing from outside can reach them yet.
  • Decide how traffic gets in. For web services, the simplest route is a reverse proxy on the VPS itself (Caddy or Nginx) that passes each hostname to the right guest. For other ports, add a destination NAT rule plus a forward rule, because libvirt's own firewall rules block new inbound connections to NAT guests.
  • Public addresses per guest depend on how your provider routes extra IPs. Ask before you design around them.

Hyper-V has the same pattern. Create an internal switch with NAT, then give each guest a static address in that range with 192.168.50.1 as its gateway:

New-VMSwitch -Name LabNAT -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (LabNAT)'
New-NetNat -Name LabNAT -InternalIPInterfaceAddressPrefix 192.168.50.0/24

Sizing and performance

  • Memory runs out first. Keep 2 GB or more for a lean Linux host, more for Windows Server or Proxmox VE, then add what each guest needs. Do not overcommit: swapping at two levels at once is far slower than either alone.
  • Fewer vCPUs per guest. Give each L2 guest fewer vCPUs than the VPS has, so the host keeps room to handle their exits.
  • Paravirtual devices. Use virtio disks and network cards in every Linux guest, and the VirtIO drivers in Windows guests. Emulated IDE disks and e1000 cards multiply the exit cost.
  • Measure your real workload. Run the same job in L1 and in L2. If the gap is too large for production, the job wants its own VPS rather than a nested guest.

On CloudSat, nested virtualization is a switch in the deploy form for plans with 8 GB of memory or more and adds 11% to the plan price; it is set at deploy time, so decide before you build. The setup guide walks through the same checks on CloudSat's AMD processors.

When nesting is the wrong tool

Nesting is ideal for labs, CI jobs that boot images, training environments, emulators and disposable test machines. It is a poor fit for long-lived production VMs that need consistent disk speed, and for anything that needs many public addresses. In those cases, run each workload on its own server, or put a hypervisor such as Proxmox VE on dedicated hardware where it controls the CPU directly. The Proxmox VE and VMware comparison covers the choices for that route.

FAQ

Does Docker need nested virtualization?

No. Docker and Podman on Linux use containers, which share the server's kernel and run on any VPS. Docker Desktop on Windows is the exception, because it runs its engine inside WSL 2.

Why does my nested guest feel slow on disk?

Every disk request becomes a VM exit that crosses two hypervisors. Use virtio devices, avoid swapping in either layer, keep guest disks on fast storage and prefer raw or preallocated qcow2 images for write-heavy work.

Is a nested guest less isolated?

An L2 guest is isolated from the VPS by your own hypervisor, and the VPS stays isolated from other customers by the provider's. A flaw that lets code escape an L2 guest lands in your L1 server, so patch the hypervisor packages on your VPS like any other software.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.