kvm supports nested virtualization, which means that virtual machines can be created within virtual machines. This article focuses on how to turn on kvm nested virtualization in CentOS 7 with Intel processors.

kvm is mainly implemented through the kernel module, so we can check if kvm nested virtualization is enabled on our system by simply executing the following command and know if it is supported based on the output.

1
2
$ cat /sys/module/kvm_intel/parameters/nested
N

If not, we need to create a new kvm-nested.conf in /etc/modprobe.d/.

1
2
3
4
options kvm-intel nested=1
options kvm-intel enable_shadow_vmcs=1
options kvm-intel enable_apicv=1
options kvm-intel ept=1

Next, let’s reload the kvm module.

1
2
modprobe -r kvm_intel
modprobe -a kvm_intel

Finally, check again to see if it was successful.

1
2
$ cat /sys/module/kvm_intel/parameters/nested
Y