Gadgets
How to Enable Hyper-V Nested Virtualization in Windows 11
[ad_1]
Read this guide to learn about Hyper-V nested virtualization and how to enable and configure it in Windows 11.
What is Nested Virtualization?
Nested virtualization is a feature of Hyper-V that allows installing a Hyper-V role on a VM. If this feature is not enabled on a Hyper-V VM, the VM cannot be used as a Hyper-V host.
In simple terms, nested Virtualization means turning a Hyper-V VM into a hypervisor host that will host other VMs.
Requirements of Hyper-V Nested Virtualization
Nested virtualization supports Intel processors with EPT and VT-x technology. Additionally, you can configure this feature on an AMD EPYC / Ryzen processor or higher.
To configure this Hyper-V feature with a host on an Intel processor
- The Hyper-V host must be running Windows 10 or higher or Windows Server 2016 and above
- The VM configuration version must be 8.0 or higher
On the other hand, if your Hyper-V host is running an AMD processor, these conditions must be met:
- The VM configuration version must be 9.3 and above
- The host must be running Windows Server 2022 or later or Windows 11 or later
Steps to Enable Nested Virtualization
Step 1: Check Hyper-V Host Specs
In the last section, I explained the requirements to enable and use this feature in Hyper-V. The first step is to check if your PC meets the processor requirements.
Specifically, the processor must support Intel VT-x or AMD. To learn how to check if your PC’s processor supports these features, read our guides – How to Enable Virtualization in Windows 11 or How to Enable Virtualization in Windows 10.
Once you’ve enabled the processor virtualization feature on the PC’s BIOS and installed the Hyper-V optional feature, the last step is to check the VM configuration version.
To learn the supported virtual machine configuration version for your Hyper-V Host, run PowerShell as administrator. Then, run the command below:
Get-VMHostSupportedVersion
The command lists all VM config versions your Hyer-V host supports and the default version set on the host. When I ran the above command on my Windows 11 PC with the Hyper-V optional feature enabled, it returned the results in the screenshot below.

Based on the results of the command, my Windows 11 Hyper-V host’s default VM configuration version is 11.0. So, if I create a VM, on this host, its configuration version will be 11.
What this means is that my Windows 11 PC meets the requirements to enable nested virtualization.
Step 2: Create the VM and Install Windows
Use Hyper-V Manager to create a VM. If you need help creating a VM, follow the steps in this guide Create a Generation 2 Hyper-V VM.
Alternatively, you can run a modified version of this command:
New-VM -Name "HyperNVHost1" -MemoryStartupBytes 16GB -NewVHDPath C:Hyper-VVHDHyperNVHost1.vhdx -NewVHDSizeBytes 60GB -Generation 2
Get-VM -Name "HyperNVHost1" | Set-VM -ProcessorCount 5
Get-VM -Name "HyperNVHost1" | Set-VMMemory -DynamicMemoryEnabled $false
The first command creates a new VM while the second modifies the processor count. Meanwhile, the third command disables dynamic Memory.
Change the VM’s name, VHD path, and processor count as required.
Since you will be using this VM as a Hyper-V host, it is recommended to disable Dynamic Memory. I recommend assigning a fixed memory to the VM.
Step 3: Enable Nested Virtualization on the VM
Ensure that the new VM you created in Step 2 is off. Then, to enable nested virtualization, run the following PowerShell command on the Hyper-V host:
Set-VMProcessor -VMName "HyperNVHost1" -ExposeVirtualizationExtensions $true
To confirm that the feature has been enabled, run this command – it should return true:
Get-VMProcessor -VMName "HyperNVHost1" | Select-Object ExposeVirtualizationExtensions


Step 4: Install Hyper-V on the Nested VM
To install the Hyper-V feature on the VM, sign in to the VM, open PowerShell, and run the command below:
I installed Windows Server 2022 on the VM so the command below installs the Hyper-V feature on the Server. Once you install Hyper-V on the VM, it is a Hyper-V host and you can create virtual switches and VMs like you would on a Physical server running Hyper-V!
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
Step 5: Enable MAC Address Spoofing on the VM’s vNIC
For the nested VMs to access the “first” host’s external network, you need to enable MAC address spoofing or configure Network Address Translation (NAT).
Enabling MAC address spoofing is faster. To Enable this feature on the “middle” VM, run the command below.
Run the command on the main (“first”) Hyper-V host. In my case, I’m running this command on my Windows 11 PC. Change the placeholder, “
Get-VMNetworkAdapter -VMName| Set-VMNetworkAdapter -MacAddressSpoofing On
To confirm that MAC address spoofing has been enabled, run the command below. As shown in my screenshot beneath the last command, MacAddressSpoofing should be “On.”
Get-VMNetworkAdapter -VMName| Select-Object MacAddressSpoofing


You can also enable MAC Address spoofing from the VMs vNIC setting on Hyper-V Manager.


Step 6: Link the VM’s pNIC to an External vSwitch
If you haven’t created an External Virtual Switch on the “main” Hyper-V host, create one. Then, link the nested VM’s vNIC to the switch.
To set the VM’s vNIC to the virtual switch, open its properties, and select the click the vNIC. Then, on the details pane, click the Virtual Switch drop-down and select the external switch.
When you finish, remember to click Apply > OK (Not shown on the screenshot below)


Step 7: Install Hyper-V Role on the VM
The whole idea behind Nested Virtualization is to be able to use a Hyper-V VM as a Hyper-V Host. To install Hyper-V on the VM you enabled this feature, log in to the VM, and open PowerShell as administrator.
Then, run the command below:
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
Step 8: Create a VM in the Hyper-V VM
Sign in to the Nested Virtualized VM (now a Hyper-V host) and create a VM.
- Open Hyper-V Manager from Server Manager: Tools > Hyper-V Manager.


- Before you create a VM, create an External Virtual Switch – open Virtual Switch Manager.


- Then, give the Virtual Switch a name, and select “External network” as the Connection type. Since the VM has just one virtual NIC, the vSwitch will use it for external connection.
When you finish, click OK to create the virtual switch. You’ll receive a warning about network interruption, click Yes.




After creating the Virtual Switch, assign an IP to it by opening its TCP/IP properties. If you have DHCP, the switch will be assigned an IP address automatically.
- Next stop, create a VM: right-click the Hyper-V host’s name, point to New, and select Virtual Machine.


Follow these screenshots to create the new VM:
















Step 9: Install Operating System on the New VM
Now we need to install OS on the new VM we created in our Hyper-V VM. But, wait a minute, how do we provide the ISO image?
The easiest way is to copy the ISO image to an external USB drive.
- Then, follow the steps in my guide – How to Access an External USB Drive from a Hyper-V VM – to mount the USB drive on the first VM (the VM you enabled Nested Virtualization).
When you mount the USB drive on the first VM (now acting as a Hyper-V host), bring it online via the VM’s Disk Management.
- Then, open the Settings of the second VM (from Hyer-V Manager), and select SCSI Controller > DVD Drive > Add.


- On the details pane of the DVD drive, select “Image file:” Then, use the Browse button to open the ISO image file on the USB drive. Click Apply (I did not show the Apply button in my screenshot).


- Finally, click Firmware, then on the details pane, use the Move Up button to make DVD Drive the first boot device, and click Apply when you finish.
Then, start the VM and install the OS.




If you’re installing a Windows OS, before you click Start, get ready to press any key to start the installation. Then, follow the wizard to complete the installation.


When the OS is installed, if your network has a DHCP server, it should pick up an IP address.
Conclusion
Nested Virtualization is running Hyper-V on a VM. In my screenshot below, the VM Ilabelled (1) is running on my Windows 11 Hyper-V.


Meanwhile, the second VM (2) is on the first VM.
I hope you were as excited reading this guide as I was writing it!
Nested Virtualization provides a great opportunity to build a Hyper-V cluster using a laptop running Windows 11. Based on this guide, I will be writing a 7-part series of articles titled Migrate VMware to Hyper-V.
Thank you again for reading my article. Let me know your thoughts by responding to the “Was this page helpful?” question below.
[ad_2]
Victor Ashiedu
Source link
