Windows Server 2022: Setting Up Nested Virtualization

11-09-2024 - 1 minute, 7 seconds -
documentation virtualization windows server hyper-v

Setting Up Nested Virtualization on Windows Server 2022 Datacenter

Introduction

This guide walks through setting up nested virtualization on Windows Server 2022 Datacenter. The goal is to enable the 2k22-Host → 2k22-Virtualization → Test VMs architecture, where a host VM can also run virtual machines.


Steps

Step 1: Installing Hyper-V on the Host (2k22-Host)

  1. Install Hyper-V using PowerShell:

    Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
  2. Verify Installation:

    Get-WindowsFeature -Name Hyper-V

Step 2: Create and Configure the Intermediate VM (2k22-Virtualization)

  1. Create the Intermediate VM on the host (2k22-Host) using Hyper-V Manager.

  2. Expose Virtualization Extensions: Enable nested virtualization so that the intermediate VM can host other VMs:

    Set-VMProcessor -VMName "2k22-virtualization" -ExposeVirtualizationExtensions $true
  3. Enable MAC Address Spoofing for network connectivity:

    Get-VMNetworkAdapter -VMName "2k22-virtualization" | Set-VMNetworkAdapter -MacAddressSpoofing On
  4. Activate Windows on the intermediate VM using KMS client keys:

    slmgr /ipk W3GNR-8DDXR-2TFRP-H8P33-DV9BG

    If required, refer to Microsoft KMS Documentation for more details.

Step 3: Installing Hyper-V on the Intermediate VM

  1. Install Hyper-V on 2k22-Virtualization using PowerShell:

    Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
  2. Create Nested VMs (such as Windows 10 testbox) within the intermediate VM using Hyper-V Manager.


Additional Considerations

  1. GPU Pass-Through (Optional): If GPU pass-through is needed, follow the Easy-GPU-PV Guide.

  2. Networking: MAC address spoofing is enabled using:

    Get-VMNetworkAdapter -VMName "2k22-virtualization" | Set-VMNetworkAdapter -MacAddressSpoofing On

References