2017-12-14 04:07:48 +00:00
= Enabling nested virtualization in KVM
[[enabling-nested-virtualization-in-kvm]]
Nested virtualization allows you to run a virtual machine (VM) inside
another VM while still using hardware acceleration from the host.
== Checking if nested virtualization is supported
2017-12-14 04:18:58 +00:00
For Intel processors, check the `/sys/module/kvm_intel/parameters/nested` file. +
For AMD processors, check the `/sys/module/kvm_amd/parameters/nested` file. +
2017-12-14 04:07:48 +00:00
If you see `1` or `Y`,nested virtualization is supported; if you see `0` or `N`, nested virtualization is not supported.
For example:
....
$ cat /sys/module/kvm_intel/parameters/nested
Y
....
== Enabling nested virtualization
To enable nested virtualization for Intel processors:
2017-12-14 04:19:59 +00:00
2017-12-14 04:18:58 +00:00
. Shut down all running VMs and unload the `kvm_probe` module:
+
2017-12-14 04:07:48 +00:00
----
# modprobe -r kvm_intel
----
2017-12-14 04:18:58 +00:00
. Activate the nesting feature:
+
2017-12-14 04:07:48 +00:00
----
# modprobe kvm_intel nested=1
----
2017-12-14 04:18:58 +00:00
. Nested virtualization is enabled until the host is rebooted. To enable it permanently, add the following line to the `/etc/modprobe.d/kvm.conf` file:
+
2017-12-14 04:07:48 +00:00
----
options kvm_intel nested=1
----
To enable nested virtualization for AMD processors:
2017-12-14 04:19:59 +00:00
2017-12-14 04:18:58 +00:00
. Shut down all running VMs and unload the `kvm_amd` module:
+
2017-12-14 04:07:48 +00:00
----
# modprobe -r kvm_amd
----
2017-12-14 04:18:58 +00:00
. Activate the nesting feature:
+
2017-12-14 04:07:48 +00:00
----
# modprobe kvm_amd nested=1
----
2017-12-14 04:18:58 +00:00
. Nested virtualization is enabled until the host is rebooted. To enable it permanently, add the following line to the `/etc/modprobe.d/kvm.conf` file:
+
2017-12-14 04:07:48 +00:00
----
options kvm_amd nested=1
----