Windows desktop and servers come with a built-in hypervisor role – Hyper-V. This feature is provided free of cost and is used to run Virtual Machines (VM) on the top of Windows server or desktop. The multi-platform application development process on Visual Studio is also dependent on virtualisation to run device emulators for executing codes compiled for different OS planforms, e.g. Android OS, etc.
Support for nested virtualization in Windows Server was first introduced in Microsoft Windows Server 2016. Nested virtualization allows enabling the Hyper-V virtualisation role inside a VM guest running over a Hyper-V host, or even running another virtualization product like virtualbox or vmware inside it. So, it is a VM running inside a VM.
Prerequisites for enabling Nested Virtualization
- The Hyper-V VM configuration must be version 8.0 or higher
- Nested virtualization is only supported on CPUs with VT-x and Extended Page Tables (EPT) enabled.
- All newer Intel and AMD CPUs support the above requirements
Nested virtualization on Windows Server is not enabled by default in Hyper-V. It has to be enabled on a per VM basis. The first step towards nested virtualization is to create at least one VM on a Hyper-V host. It is not required to install any operating system inside the VM to enable nested virtualization.
There are two ways you can enable nested virtualisation on Hyper-V.
- If you are managing the infrastructure through System Center Virtual Machine Manager (SCVMM) we will be discussing that process below.
- And if your Hyper-V is managed standalone, then a different approach is needed, which we will discuss later in this article.
Enabling Nested Virtualization from SCVMM
1. Shutdown the VM from SCVMM.
2. Once shutdown, right-click on that VM and click Properties.
3. In VM properties, on the General tab select the checkbox Enable Nested Virtualization and click the OK button.
4. Next turn on the VM.
5. You can now install the Hyper-V role inside the VM. Also you can run any other virtualization software like VMWARE or VirtualBox inside it.
Enable Nested Virtualization Windows Server from Hyper-V Host
Tip: Follow our Hyper-V Installation blog post to enable Hyper-V on your Windows Server
- Log in or connect to Windows Server 2019 where you installed Hyper-V role
- Open Hyper-V Manager.
- Navigate to the VM where you want to enable nested virtualization. In our example, it is VM named “Windows2019” as shown in the screenshot
- Shutdown the VM
- Right click on the Start Menu and then click on Windows Powershell (Admin)
- TypeSet-VMProcessor -VMName Windows2019 -ExposeVirtualizationExtensions $true
- In the above example, Windows2019 is the VM name. You would need to type the name of your VM hosted on your Hyper-V Manager.
- The next step is to configure networking with the nested virtual machine. This can be done by using MAC Spoofing or Network Address Translation (NAT). In our case we will enable MAC Spoofing by typing command
Get-VMNetworkAdapter -VMName Windows2019 | Set-VMNetworkAdapter -MacAddressSpoofing
- On into the Powershell. Please replace Windows2019 with the name of your virtual machine
- Turn on the VM and login into Windows Server 2019
- Wait until Windows finishes installation of Hyper-V role. It will automatically install the virtual machine.
- Log in to the Windows Server 2019 and create your nested VM from within the VM itself.
Tip: To create a new VM from within the Hyper-V management console – follow our virtual machine creation with hyper-v manager guide.
Hyper-V nested virtualization FAQs
What is Nested Virtualization?
Nested virtualization is a feature that allows users to run multiple VPS server windows inside of other virtual machines. This enables the use of multiple layers of virtualized computing, which can be beneficial in many cases.
What version of Windows Server supports nested virtualization?
Nested Virtualization supports Windows Server 2016 and later versions
What are the benefits of Nested Virtualization?
Windows Server offers businesses a range of advantages. It allows for the running of multiple virtual machines inside an existing VM, providing organizations with increased flexibility and scalability. This technology helps keep costs down by allowing for the use of less hardware and reducing the need for physical space.
Additionally, it increases functionality as it allows businesses to run applications on multiple operating systems simultaneously.
What are the disadvantages of using nested virtualization in Windows Server with Hyper-V?
There are several potential downsides to its use in Hyper-V. First, performance can be significantly reduced due to the complexity of the setup and the extra layer of isolation between the host operating system and virtual machines.
Also, there may be compatibility issues with some hardware and software applications as they may not operate correctly in a nested environment.
Additionally, implementing nested virtualization requires a substantial amount of memory and processor resources which can increase costs.
Finally, older versions of Hyper-V do not support nested virtualization at all so businesses must ensure their chosen version is compatible before attempting this technology.
How is the nested virtualization performance in comparison to a VM which runs directly on a hypervisor?
The performance of nested virtualization in comparison to running a virtual machine directly on a hypervisor can be affected by a number of factors.
Generally, performance is decreased due to the additional layer of isolation between the host operating system and VMs, as well as due to the complexity of the setup. However, this largely depends on the type of applications being run – if only low-resource workloads are used such as web servers, then the impact may be minimal.
Additionally, newer versions of Hyper-V include built-in optimizations which can reduce this overhead to some degree.
Nested Virtualization – Wrapping Up
You can use it on Hyper-V if you follow the right steps and have the proper prerequisites in place. Also it offers many benefits, such as increased security and portability compared to other virtualization options. However, nested virtualization also has some disadvantages, such as lower performance levels.
If you’re interested in using nested virtualization on Windows Server with Hyper-V, we can provide you with a dedicated server hosting in India for experimentation. Contact us today to learn more about our services.