Running KVM Nested in Microsoft Hyper-V
The other day I was doing some training for my Linux Foundation Certified System Administrator Exam and I needed to practice configuring KVM VM’s and networking so I decided I would give it a shot. In the past I’ve worked with VMWare ESXI and a few other Level-1 Hyper-visors there were able to run other hyper-visors within them, this is a term referred to as nesting, so I just assumed that Microsoft Hyper-V would let me do this by default… I was wrong. So after messing with it a bit I eventually did get it working so I figured I would do a quick write-up because I couldn’t see the information posted anywhere else, so here we go.
- Windows 10
- Microsoft Hyper-V Feature Enabled
- An installed copy of Linux in Hyper-V
- Powershell (Enabled by default in Windows 10)
- Download this powershell script from Github (It’s written by Microsoft don’t worry)
- Copy the script to your desktop
- Open up your Windows Powershell (Run it as admin)
- Browse to the location of your Powershell Script
- Run the following command to allow for script execution in Powershell
- Set-ExecutionPolicy Bypass
- Now just go ahead and type .\nameofyourscript.ps1 NAMEOFYOURLINUXVMINHYPERV
- If all goes well it should prompt you asking if you want to expose Virtualization Extensions this is a yes, you can enable any of the other additions if you so wish as well.
- After the script completes just go ahead and boot back up your VM in Hyper-V and you should now have access to the virtualization extensions required for KVM/XEN
The process is fairly simply but I couldn’t find any simple outline on how to get this all working, Microsoft suggests this is only so you can nest other Hyper-V instances however I wanted to do this with KVM/XEN turns out their script works great for this, thanks Microsoft! If you have any questions feel free to leave a comment and I’ll get back to you as soon as possible.