Enable NESTED virtualization in VMware ESXi 6

My professor asked my for a project about Nested virtualization to emulate some process.

First I should say what is Nested virtualization? If you have a Hypervisor for virtualization and you wanted to have another hypervisor on it. this is Wikipedia’s definition for it :

“Nested virtualization refers to the ability of running a virtual machine within another, having this general concept extendable to an arbitrary depth. In other words, nested virtualization refers to running one or more hypervisors inside another hypervisor. Nature of a nested guest virtual machine does not need not be homogeneous with its host virtual machine; for example, application virtualization can be deployed within a virtual machine created by using hardware virtualization.”


Nested Virtualization

Nested Virtualization

Nested Virtualization

Nested Virtualization













If you want to read more about it :


Nested Virtualization in Xen

Microsoft definition for Nested virtualization


Now in my lab I have ESXi 6 and I want to install an Ubuntu server 16.04 on it and install KVM base machine on Ubuntu server with libvirt. ( I should mention that this is not a good idea but for testing the solution it can help). First I should enable Nested virtualization on ESXi trough :

1- ssh to ESXi host :

1-1 : you should enable SSH service on ESXi by : Configuration -> Security Profile -> Properties -> SSH -> start

Nested Virtualization

Nested Virtualization

then SSH to ESXi host with user “root”  and your password , then edit “/etc/vmware/config” with a text editor and add this line to the end of file

vhv.enable = “TRUE”

2- Turn of the virtual machine and edit CPU configuration to “Use Intel VT-X/AMD-V for instruction set virtualization and Intel EPT/AMD RVI for MMU virtualization.” trough : Edit the VM settings and go to VM settings > Options > CPU/MMU Virtualization . Select the Intel EPT option, like :

cpu info

CPU info


3- Go to Options->CPUID mask> Advanced-> Level 1, add the following CPU mask level

ECX  —- —- —- —- —- —- –H- —-


CPU Configuration

CPU Configuration


4- Open the vmx file of the Ubuntu VM and add the following setting

monitor.virtual_exec = “hardware”
hypervisor.cpuid.v0 = “FALSE”


That’s it, Now you can use Nested virtialization.

Once the above configurations are done in ESXi and the VM, hardware virtualization would be supported in the VM. Inorder to confirm that, run the following command in the Ubuntu VM.

cat /sys/module/kvm_intel/parameters/nested

egrep -c ‘(vmx|svm)’ /proc/cpuinfo

Check Nested Virtualization in ubuntu Server

Check Nested Virtualization in ubuntu Server

You should get output as 1, which means hardware  virtualization is supported. Also you should see hvm flags in the output when you run the following command

cat /sys/hypervisor/properties/capabilities

Or else you could also run the following command


The output should be as follows:

INFO: /dev/kvm exists


KVM acceleration can be used



Hello world!

Hey, my name is Maziar Sojoudian you can read about me here.

Here I’m writing about my experiences and daily routine and ….