Step 22 of 82
← Home
πŸ–₯️ Phase: Infrastructure

Step 22 Nested Virtualisation in Hyper-V

Why this step? Run VMs inside VMs for complex lab environments.

Nested Virtualisation in Hyper-V

Guide on how to enable Nested Virtualization, allowing you to run Hyper-V inside a Hyper-V Virtual Machine.

What is Nested Virtualization?

It enables you to install Hyper-V (or Docker/WSL2) inside a VM.

  • Host: Your physical PC (Win 11 / Server 2022)
  • L1 VM: A VM running on Host (e.g., Windows Server 2022)
  • L2 VM: A VM running inside the L1 VM.

Prerequisites

  • Host OS: Windows 10 Anniversary Update or later / Server 2016 or later.
  • CPU: Intel (VT-x) or AMD (Ryzen) with virtualization support.
  • VM Configuration version: 8.0 or higher.
  • VM State: must be OFF.

One-Command Enable (PowerShell)

You must run this command on the HOST system (Physical PC).

  1. Open PowerShell as Administrator.
  2. Run:
Set-VMProcessor -VMName "YourVMName" -ExposeVirtualizationExtensions $true

Optional: Enable MAC Address Spoofing (Required for L2 networking):

Get-VMNetworkAdapter -VMName "YourVMName" | Set-VMNetworkAdapter -MacAddressSpoofing On

Configuring the VM (Guest)

Now boot the VM. Inside the VM, you can now install Hyper-V:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

AMD Processors

Previously, nested virtualization was Intel-only. Since Windows 10 build 19636 (and Server 2022), it works on AMD Ryzen/Epyc too. The command is essentially the same.