Header Ads

Microsoft has revealed latest Windows 10 build 10565 supports Nested Virtualization Step by Step How to Enable it

Microsoft has revealed that the latest Windows 10 Insider Preview supports nested virtualization, which lets you launch a virtual machine within another virtual machine -- yes, you can run Windows inside of Windows inside of Windows. The trick is a new feature that supports hardware-based virtualization within a primary virtual machine, providing for that one extra layer. There are limits, of course.

Features like dynamic memory won't work, and nesting currently requires an Intel processor with VT-x support (most chips from the past several years will do). So long as everything lines up, though, you too can create a hall of mirrors effect on your PC -- even if it doesn't serve much of a practical purpose for most people.

Build 10565 -- It is a very early preview

Insider Hub announced the release of build 10565 to Windows Insiders on the Fast ring.  This build contains an early preview of nested virtualization.

When I say it is an “early” preview, I mean it – there are plenty of known issues, and there is functionality which we still need to build. We wanted to share this feature with Insiders as soon as possible though, even if that meant things are still rough around the edges.

This post will give a quick overview of what nested virtualization is, and briefly cover how it works. The end of this post will explain how to enable it, so you can try it out. Please read the “known issues” section before trying this feature.

In the image below, you can see a host machine running a virtual machine, which in turn is running its own guest virtual machine. This is made possible by nested virtualization. Behold, three levels of Cortana!

What is nested virtualization? 

In essence, this feature virtualizes certain hardware features that are required to run a hypervisor in a virtual machine.

Hyper-V relies on hardware virtualization support (e.g. Intel VT-x and AMD-V) to run virtual machines. Typically, once Hyper-V is installed, the hypervisor hides this capability from guest virtual machines, preventing guests virtual machines from installing Hyper-V (and many other hypervisors, for that matter).

Nested virtualization exposes hardware virtualization support to guest virtual machines. This allows you to install Hyper-V in a guest virtual machine, and create more virtual machines “within” that underlying virtual machine.


Known issues: important!

Like I said earlier – this is still just a “preview” of this feature. Obviously, this feature should not be used in production environments.  Below is a list of known issues:

  • Both hypervisors need to be the latest versions of Hyper-V. Other hypervisors will not work. Windows Server 2012R2, or even builds prior to 10565 will not work.
  • Once nested virtualization is enabled in a VM, the following features are no longer compatible with that VM. These actions will either fail, or cause the virtual machine not to start if it is hosting other virtual machines:
  • Dynamic memory must be OFF. This will prevent the VM from booting.
  • Runtime memory resize will fail.
  • Applying checkpoints to a running VM will fail.
  • Live migration will fail -- in other words, a VM which hosts other VMs cannot be live migrated.
  • Save/restore will fail.

Note: these features still work in the “innermost” guest VM. The restrictions only apply to the first layer VM.

  • Once nested virtualization is enabled in a VM, MAC spoofing must be enabled for networking to work in its guests.
  • Hosts with Device Guard enabled cannot expose virtualization extensions to guests. You must first disable VBS in order to preview nested virtualization.
  • Hosts with Virtualization Based Security (VBS) enabled cannot expose virtualization extensions to guests. You must first disable VBS in order to preview nested virtualization.
  • This feature is currently Intel-only. Intel VT-x is required.
  • Beware: nested virtualization requires a good amount of memory. I managed to run a VM in a VM with 4 GB of host RAM, but things were tight.

How to Turn on Hyper V

1. Go to Control Panel  and click Programs

2. Click Turn windows features on or off and select that item

3. Select and enable Hyper-V check all box.

4. Restart  your PC to install updates.

Creating and Running A Windows 10 VM

1. Go to Start  find Windows Administrative Tools
2 Open Hyper V as Administrator

3. To begin creating the VM click Action > New > Virtual Machine

  • To begin creating the VM click ActiOn the Before You Begin screen click Next.
  • On the Specify Name and Location screen, enter the desired name for the VM and click Next.n > New > Virtual Machine
  • On the Specify Generation screen, select Generation 1 and click Next.
  • On the Assign Memory screen, enter a memory size of 2048 MB or higher and click Next.
  • On the Configure Networking screen, select the connection that connects to an external resource for internet connectivity and click Next.
  • On the Connect Virtual Hard Disk screen, select Create a virtual hard disk, enter 20GB or higher for storage size and click Next.
  • On the Installation Options screen, select Install an operating System from a bootable CD/DVD-Rom

    Select Image file (.iso), browse your computer to find the Windows 10 Technical Preview .iso file downloaded in Step 1 and click Next.
  • On the Completing the New Virtual Machine Wizard screen, review the selected options and click Finish.
  • The Windows 10 Technical Preview VM is now created.
  • Back in Hyper-V Manager, right-click on the newly created VM and click Start.
  • Right-click again on the newly created VM and click Connect. 
  • Once connected, commence the installation of Windows 10 Technical Preview on the newly created virtual instance.

How to enable nested virtualization

Step 1: Create a VM

Step 2: Run the enablement script

Given the configuration requirements (e.g. dynamic memory must be off), we’ve tried to make things easier by providing a PowerShell script.

This script will check your configuration, change anything which is incorrect (with permission), and enable nested virtualization for a VM. Note that the VM must be off.

Invoke-WebRequest https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/hyperv-tools/Nested/Enable-NestedVm.ps1 -OutFile ~/Enable-NestedVm.ps1
~/Enable-NestedVm.ps1 -VmName <VmName>

Step 3: Install Hyper-V in the guest

From here, you can install Hyper-V in the guest VM.

Invoke-Command -VMName "myVM" -ScriptBlock { Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V -Online; Restart-Computer }

Step 4: Enable networking (optional)

Once nested virtualization is enabled in a VM, MAC spoofing must be enabled for networking to work in its guests. Run the following PowerShell (as administrator) on the host machine:

Set-VMNetworkAdapter -VMName <VMName> -MacAddressSpoofing on

Step 5: Create nested VMs

FAQ and troubleshooting

My VM won’t start, what should I do?

First, make sure dynamic memory is OFF. If this was not the issue, run this PowerShell script on your host machine from an elevated prompt. This script reports whether your host and VMs are configured properly for nested.

Invoke-WebRequest https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/hyperv-tools/Nested/Get-NestedVirtStatus.ps1 -OutFile ~/Get-NestedVirtStatus.ps1

My Virtual Machine Connection keeps being lost.

This is a known issue. If you are using a blank password, please change your password and the issue should be resolved.

Go build VMs in VMs!

Cheers, Theo Thompson

Updated: Added clarification for points of confusion in the comments and added a PowerShell snippet for enabling Hyper-V in the guest OS.


No comments

blogmytuts. Powered by Blogger.