Configure KVM for Nested Virtualization

Posted on

This article discuss on configuring a Host Machine installed with KVM as its Virtualization Technology used can can perform ‘Nested Virtualization’.

KVM (Kernel-based Virtualization Machine) is a hypervisor which is responsible for orchestrating the Guest Machines available and runs in a Host Machine.

An amazing things to do when using KVM as the virtualization technology used in a physical server as a Host Machine is the Guest Machine created can be nested.

A Guest Machine can be created and runs inside another Guest Machine and the feature for implementing it is known as the term of ‘Nested Virtualization’. This is the image of the scenario which is going to be achieved :

configure-kvm-for-nested-virtualization
Configure KVM for Nested Virtualization

To be able to achieve it, a kvm package installed in a physical server is absolutely needed since it is the hypervisor which is going to be used to implement the ‘Nested Virtualization’.

Another thing which is necessary needed is Virtual Machine Manager running in the physical server. Using Virtual Machine Manager, it can be used to run a Guest Machine.

If in that Guest Machine which is running with the help of Virtual Machine Manager in certain condition is needed to be configured further so that it also can run another Guest Machine inside, there will be some tasks which is need to be performed.

In the Host Machine, in the image is shown with a PC running Linux with KVM installed, type the following command running as a root or super user :

[root@host-machine ~]# rmmod kvm-intel

The above command is used to remove the currently installed kvm-intel module from the kernel.

[root@host-machine ~]# sh -c "echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf"

After removing the previous kvm-intel module, in order that a nested virtualization can be achieved, re-add kvm-intel module with nested option. It can be seen with the ‘nested=y’ parameter above.

[root@host-machine ~]# modprobe kvm-intel

In the last step, execute the above command to add module kvm-intel again which has already registered with nested option.

Before running the three lines of command above, check the architecture or the host, server or workstation of the Host Machine used to establish the above scenario, whether it is using Intel or AMD. If it is AMD used then the module which is needed to reconfigure named kvm-amd.

2 thoughts on “Configure KVM for Nested Virtualization

Leave a Reply