What Is Hyper-V Nested Virtualization and How to Enable It

Hyper-V Nested Virtualization is a powerful virtualization technology that enables the creation of multiple layers of virtual machines within virtualized environments. It's crucial for IT professionals and businesses seeking to maximize the potential of their virtual infrastructure.

By @Crystal Last Updated October 25, 2024

What Is Hyper-V Nested Virtualization

Hyper-V Nested Virtualization is a technology that allows you to run virtual machines (VMs) within other virtual machines on Microsoft's Hyper-V virtualization platform. Typically, a hypervisor (like Hyper-V) runs directly on the physical hardware and hosts VMs. With Nested Virtualization, you can run another instance of Hyper-V inside a virtual machine that's already running on the physical host. It essentially means you can have a "virtual machine within a virtual machine."

For example, you can have a physical server, then run a VM (VM1) on it, and inside VM1, you can run additional VMs (VM2, VM3, and so on) using Hyper-V.

When to Use

  • Development and Testing: Software developers and testers can use it to create various virtualized environments for testing applications, operating systems, or network configurations without needing multiple physical machines.
  • Training and Education: Instructors can set up complex virtualization scenarios within VMs, allowing students to learn and experiment with virtualization concepts without access to physical hardware.
  • Isolation: Nested Virtualization can be used to isolate different workloads or services within their own virtualized environments, even if they require different virtualization technologies.

Requirements and Limitations

However, Hyper-V nested virtualization is not supported by all hardware and virtualization platforms. Your physical hardware and hypervisor must both support this feature for it to work correctly. Additionally, setting up Nested Virtualization can be more complex than running VMs directly on the host, so it's important to carefully plan and configure your virtualization environment if you intend to use this feature.

These requirements ensure that your virtualized environment functions properly:

❈ Processor Compatibility: Your physical processor (CPU) must support hardware virtualization extensions. Most modern processors from Intel (VT-x) and AMD (AMD-V) have these extensions.

❈ Host Hyper-V: The physical host must be running a Windows operating system that includes Hyper-V. Windows Server and Windows 10/11 Pro, Enterprise, or Education editions support Hyper-V.

❈ Hyper-V Enabled: Hyper-V must be enabled on the physical host. You can enable it through the "Turn Windows features on or off" settings on Windows.

❈ Sufficient Memory: Ensure that you have enough physical RAM on the host to allocate to both the first-level virtual machines (VMs running directly on the host) and the second-level VMs (nested VMs).

❈ 64-Bit Guest Operating Systems: To run nested VMs, the guest operating systems within the virtual machines must be 64-bit versions. 32-bit guest operating systems are not supported.

There are specific requirements and limitations that you should be aware of:

✲ VM snapshots may not work as expected in nested virtualization scenarios.

✲ Live migration fails for the VM.

✲ Runtime memory resize does not function.

How to Enable Nested Virtualization on Microsoft Hyper-V

Hyper-V Nested Virtualization enables you to create a multi-layered virtualization environment. This part will introduce how to enable Hyper-V nested virtualization in Windows Server 2019. The configuration process is the same for Windows Server 2016 and Windows Server 2022.

Step 1. Check Virtualization Support on the Host

1. Open PowerShell with administrative privileges by right-clicking the Start button, selecting "Windows Terminal (Admin)" or "Command Prompt (Admin)," or searching for "PowerShell" and choosing "Run as administrator."

2. Run the following command to check if nested virtualization is supported on your physical CPU:

Get-VMProcessor -VMName | Select-Object -ExpandProperty ExposeVirtualizationExtensions

Replace with the name of the virtual machine in which you want to enable nested virtualization.

  • If the result is "True," it means nested virtualization is supported on your host.
  • If it's "False," you may need to update your BIOS/UEFI settings to enable virtualization support.

Step 2. Create a Hyper-V Virtual Machine

1. Create a Windows 10 VM in Hyper-V before enabling nested virtualization.

2. Install a guest VM operating system compatible with nested virtualization for Hyper-V, such as Windows 10 Anniversary Update or a later version, or Windows Server 2016 or a more recent release.

Step 3. Enable Nested Virtualization in Hyper-V

To set up Hyper-V nested virtualization, you must first create a network for VM hosted on a host to communicate. To do that, you’ll need to create a NAT-enabled virtual switch that all VMs will use and reach the Internet.

Note: Make sure the virtual machine in which you want to enable nested virtualization is turned off.

1. Run the following PowerShell command to enable nested virtualization for the guest virtual machine:

Set-VMProcessor -VMName -ExposeVirtualizationExtensions $true

2. After enabling nested virtualization, start the virtual machine. Inside the nested virtual machine, you can now install and configure another hypervisor like Hyper-V or VMware, depending on your needs.

To disable Hyper-V Nested Virtualization, enter the command:

Set-VMProcessor -VMName -ExposeVirtualizationExtensions $false

[Important] Hyper-V Data Backup Protects Virtual Environment

Hyper-V nested virtualization offers many advantages, but also has potential risks such as performance overhead, complexity, and security issues.

Despite these risks, with effective Hyper-V backups, it can be a valuable tool for scenarios such as development and training. AOMEI Cyber Backup is a free and centralized backup software for Hyper-V virtual machines. It supports Hyper-V in Windows 8/8.1/10/11, Windows Server/Microsoft Hyper-V Server 2012 R2 and later versions.

✤ Independent image-backup: create complete and image-based backups for VMware ESXi and Hyper-V VMs from a central console. ✤ Support Free ESXi: support both paid and free versions of VMware ESXi. ✤ Multiple Storage Destinations: backup to local drive, NAS or network share. ✤ Automated Execution: create backup schedules to automate backups daily, weekly, monthly. ✤ Role Assignment: allows one administrator to create sub-accounts with limited privileges. ✤ Email Notification: send email notification when the task is completed or abnormal. ✤ Perpetual Free: you can use AOMEI Cyber Backup Free Edition with no time limit.

✍ You can click on the button to enjoy the perpetual free edition:

Download FreewareVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

Easy steps to automate Hyper-V VMs backups

1. Navigate to Source Device > Hyper-V > + Add Hyper-V to add a host, and click > Bind Device.

2. Navigate to Backup Task>+ Create New Task, and specify the Task Name, Backup Type, Device, Target, ArchiveSchedule on a simple page.

  • Device: select the VMs on the host you want to back up.
  • Target: select to back up to a local path, or to a network path.
  • Archive: enable Archiving backup versions to Amazon S3 > Select to choose the added Amazon S3.
  • Scheduleschedule backup flexibly, automatically performing full or incremental backups on a daily, weekly, or monthly basis.

3. Click Start Backup you can select to Add the schedule only, or Add the schedule and start backup now.

✎ While the Free Edition has covered most of VM backup needs, you can also upgrade to enjoy: Batch VM backup: Batch backup large numbers of VMs managed by hosts. Backup cleanup: Specify a retention policy, and the old backups that exceed the limit will be auto deleted. Restore to new location: Create a new VM from the backup to the original or another datastore, host, and reset the RAM and Vital Processor.

Q & A: Frequently Asked Questions About Hyper-V Nested Virtualization

Conclusion

In this article, you could know more about Hyper-V nested virtualization and how to enable it in Windows environment. Hyper-V Nested Virtualization opens up new possibilities in virtualized environments. While it brings the advantages of enhanced resource utilization, versatile testing and development capabilities, and effective training scenarios, it also carries considerations such as performance overhead and compatibility.