Learn this information to study Hyper-V nested virtualization and allow and configure it in Home windows 11.
What’s Nested Virtualization?
Nested virtualization is a characteristic of Hyper-V that permits putting in a Hyper-V position on a VM. If this characteristic just isn’t enabled on a Hyper-V VM, the VM can’t be used as a Hyper-V host.
In easy phrases, nested Virtualization means turning a Hyper-V VM right into a hypervisor host that may host different VMs.
Necessities of Hyper-V Nested Virtualization
Nested virtualization helps Intel processors with EPT and VT-x expertise. Moreover, you possibly can configure this characteristic on an AMD EPYC / Ryzen processor or larger.
To configure this Hyper-V characteristic with a number on an Intel processor
- The Hyper-V host should be operating Home windows 10 or larger or Home windows Server 2016 and above
- The VM configuration model should be 8.0 or larger
Alternatively, in case your Hyper-V host is operating an AMD processor, these situations should be met:
- The VM configuration model should be 9.3 and above
- The host should be operating Home windows Server 2022 or later or Home windows 11 or later
Steps to Allow Nested Virtualization
Step 1: Test Hyper-V Host Specs
Within the final part, I defined the necessities to allow and use this characteristic in Hyper-V. Step one is to verify in case your PC meets the processor necessities.
Particularly, the processor should help Intel VT-x or AMD. To learn to verify in case your PC’s processor helps these options, learn our guides – Tips on how to Allow Virtualization in Home windows 11 or Tips on how to Allow Virtualization in Home windows 10.
When you’ve enabled the processor virtualization characteristic on the PC’s BIOS and put in the Hyper-V non-compulsory characteristic, the final step is to verify the VM configuration model.
To be taught the supported digital machine configuration model in your Hyper-V Host, run PowerShell as administrator. Then, run the command under:
Get-VMHostSupportedVersion
The command lists all VM config variations your Hyer-V host helps and the default model set on the host. After I ran the above command on my Home windows 11 PC with the Hyper-V non-compulsory characteristic enabled, it returned the leads to the screenshot under.
Based mostly on the outcomes of the command, my Home windows 11 Hyper-V host’s default VM configuration model is 11.0. So, if I create a VM, on this host, its configuration model might be 11.
What this implies is that my Home windows 11 PC meets the necessities to allow nested virtualization.
Step 2: Create the VM and Set up Home windows
Use Hyper-V Supervisor to create a VM. In the event you need assistance making a VM, comply with the steps on this information Create a Era 2 Hyper-V VM.
Alternatively, you possibly can run a modified model of this command:
New-VM -Title "HyperNVHost1" -MemoryStartupBytes 16GB -NewVHDPath C:Hyper-VVHDHyperNVHost1.vhdx -NewVHDSizeBytes 60GB -Era 2
Get-VM -Title "HyperNVHost1" | Set-VM -ProcessorCount 5
Get-VM -Title "HyperNVHost1" | Set-VMMemory -DynamicMemoryEnabled $false
The primary command creates a brand new VM whereas the second modifies the processor depend. In the meantime, the third command disables dynamic Reminiscence.
Change the VM’s identify, VHD path, and processor depend as required.
Since you’ll be utilizing this VM as a Hyper-V host, it’s endorsed to disable Dynamic Reminiscence. I like to recommend assigning a hard and fast reminiscence to the VM.
Step 3: Allow Nested Virtualization on the VM
Make sure that the brand new VM you created in Step 2 is off. Then, to allow nested virtualization, run the next PowerShell command on the Hyper-V host:
Set-VMProcessor -VMName "HyperNVHost1" -ExposeVirtualizationExtensions $true
To verify that the characteristic has been enabled, run this command – it ought to return true:
Get-VMProcessor -VMName "HyperNVHost1" | Choose-Object ExposeVirtualizationExtensions
Step 4: Set up Hyper-V on the Nested VM
To put in the Hyper-V characteristic on the VM, check in to the VM, open PowerShell, and run the command under:
I put in Home windows Server 2022 on the VM so the command under installs the Hyper-V characteristic on the Server. As soon as you put in Hyper-V on the VM, it’s a Hyper-V host and you’ll create digital switches and VMs such as you would on a Bodily server operating Hyper-V!
Set up-WindowsFeature -Title Hyper-V -IncludeManagementTools -Restart
Step 5: Allow MAC Deal with Spoofing on the VM’s vNIC
For the nested VMs to entry the “first” host’s exterior community, you might want to allow MAC tackle spoofing or configure Community Deal with Translation (NAT).
Enabling MAC tackle spoofing is quicker. To Allow this characteristic on the “center” VM, run the command under.
Run the command on the principle (“first”) Hyper-V host. In my case, I’m operating this command on my Home windows 11 PC. Change the placeholder, “<VMName>” to the identify of the VM.
Get-VMNetworkAdapter -VMName <VMName> | Set-VMNetworkAdapter -MacAddressSpoofing On
To verify that MAC tackle spoofing has been enabled, run the command under. As proven in my screenshot beneath the final command, MacAddressSpoofing needs to be “On.”
Get-VMNetworkAdapter -VMName <VMName> | Choose-Object MacAddressSpoofing
You can too allow MAC Deal with spoofing from the VMs vNIC setting on Hyper-V Supervisor.
Step 6: Hyperlink the VM’s pNIC to an Exterior vSwitch
In the event you haven’t created an Exterior Digital Change on the “important” Hyper-V host, create one. Then, hyperlink the nested VM’s vNIC to the swap.
To set the VM’s vNIC to the digital swap, open its properties, and choose the press the vNIC. Then, on the small print pane, click on the Digital Change drop-down and choose the exterior swap.
If you end, keep in mind to click on Apply > OK (Not proven on the screenshot under)
Step 7: Set up Hyper-V Function on the VM
The entire thought behind Nested Virtualization is to have the ability to use a Hyper-V VM as a Hyper-V Host. To put in Hyper-V on the VM you enabled this characteristic, log in to the VM, and open PowerShell as administrator.
Then, run the command under:
Set up-WindowsFeature -Title Hyper-V -IncludeManagementTools -Restart
Step 8: Create a VM within the Hyper-V VM
Check in to the Nested Virtualized VM (now a Hyper-V host) and create a VM.
- Open Hyper-V Supervisor from Server Supervisor: Instruments > Hyper-V Supervisor.
- Earlier than you create a VM, create an Exterior Digital Change – open Digital Change Supervisor.
- Then, give the Digital Change a reputation, and choose “Exterior community” because the Connection sort. For the reason that VM has only one digital NIC, the vSwitch will use it for exterior connection.
If you end, click on OK to create the digital swap. You’ll obtain a warning about community interruption, click on Sure.
After creating the Digital Change, assign an IP to it by opening its TCP/IP properties. If in case you have DHCP, the swap might be assigned an IP tackle mechanically.
- Subsequent cease, create a VM: right-click the Hyper-V host’s identify, level to New, and choose Digital Machine.
Comply with these screenshots to create the brand new VM:
Step 9: Set up Working System on the New VM
Now we have to set up OS on the brand new VM we created in our Hyper-V VM. However, wait a minute, how do we offer the ISO picture?
The simplest approach is to repeat the ISO picture to an exterior USB drive.
- Then, comply with the steps in my information – Tips on how to Entry an Exterior USB Drive from a Hyper-V VM – to mount the USB drive on the primary VM (the VM you enabled Nested Virtualization).
If you mount the USB drive on the primary VM (now performing as a Hyper-V host), deliver it on-line through the VM’s Disk Administration.
- Then, open the Settings of the second VM (from Hyer-V Supervisor), and choose SCSI Controller > DVD Drive > Add.
- On the small print pane of the DVD drive, choose “Picture file:” Then, use the Browse button to open the ISO picture file on the USB drive. Click on Apply (I didn’t present the Apply button in my screenshot).
- Lastly, click on Firmware, then on the small print pane, use the Transfer Up button to make DVD Drive the primary boot system, and click on Apply whenever you end.
Then, begin the VM and set up the OS.
In the event you’re putting in a Home windows OS, earlier than you click on Begin, get able to press any key to start out the set up. Then, comply with the wizard to finish the set up.
When the OS is put in, in case your community has a DHCP server, it ought to decide up an IP tackle.
Conclusion
Nested Virtualization is operating Hyper-V on a VM. In my screenshot under, the VM Ilabelled (1) is operating on my Home windows 11 Hyper-V.
In the meantime, the second VM (2) is on the primary VM.
I hope you have been as excited studying this information as I used to be writing it!
Nested Virtualization gives a fantastic alternative to construct a Hyper-V cluster utilizing a laptop computer operating Home windows 11. Based mostly on this information, I might be writing a 7-part sequence of articles titled Migrate VMware to Hyper-V.
Thanks once more for studying my article. Let me know your ideas by responding to the “Was this web page useful?” query under.