December 14, 2022

Enable kvm nested virtualization function on Linux

kvm supports nested virtualization, that is, virtual machines can be created within virtual machines. This article mainly introduces how to enable the nested virtualization function of KVM in CentOS7 using Intel processors.

Kvm is mainly implemented through the kernel module, so we check whether the system has enabled kvm nested virtualization, only need:


You can know whether it is supported or not according to the output result.

cat /sys/module/kvm_intel/parameters/nested

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


Then we reload the kvm module:

options kvm-intel nested=1
options kvm-intel enable_shadow_vmcs=1
options kvm-intel enable_apicv=1
options kvm-intel ept=1

modprobe -r kvm_intel
modprobe -a kvm_intel


Finally, check whether it is successful:

cat /sys/module/kvm_intel/parameters/nested

Leave a Reply

Your email address will not be published. Required fields are marked *