Jump to navigation Jump to search

Nested Virtualization - Running virtual machines on top of virtual machines!

Nested virtualization is one of the hottest buzz-words recently, and for good reason! This technology allows for the maximum return on hardware investment by allowing virtual machines on top of other virtual machines, hence the name "Nested" virtual machines.


Nested virtualization has some specific requirements in order for it to function as intended. Here are the basic requirements:

  • RAM Memory - The minimum about of RAM memory on the host machines should be at least 8 GB, and the more, the better, as with current technology and costs for computer hardware, having the maximum amount of memory your motherboard/system board can utilize is preferable. With other computer hardware being extremely inexpensive, most hardware bottlenecks occur with insufficient RAM memory, causing swapping/pagefile usage.
  • CPU Features/Flags - The CPU MUST support virtualization the the BIOS/UEFI and be enabled within the BIOS or UEFI configuration settings. Specifically, the Intel CPU must have the "VT-x" and/or "VT" feature available, and AMD CPU's require the "AMD-V" feature/flag enabled to support virtualization.
  • CPU Cores - The number of CPU cores you will need is fully dependent on the number of VM's(Virtual Machines) you intend to run on the host VM. The minimum number of CPU cores is 2(Two), if only intending on running one VM with one CPU core on the host VM. As above, the more cores you have available, the better performance and options!
  • Hard or SSD Drive/Storage - The amount of drive storage is totally dependents on the the guest VM's OS, along with sufficient storage for working data, along with sufficient drive storage on the host VM for it to support both the guest VM and host VM, with at least 10 GB of working storage. As is the case with the other requirements, the more storage space available, the better!

Running Nested Virtualization Using Virtualbox

Virtualbox can be used to create a nested virtualization lab setup for proof of concept as well as providing a great learning environment!

A common issue when first setting up this type of environment is when creating a host VM for another VM to run on top of, often times the required "Enabled Nested VT-x/AMD-V" option is grayed out, preventing you from selecting it's radio-button to enable the required feature on the host VM.

The work-around to force this feature/option for the host OS is to use the "VBoxManage" command as shown here:

[]$ vboxmanage modifyvm Rocky8VM52_NGINX_Test_Lab --nested-hw-virt on

Be SURE to modify the command by substituing the actual virtual machine's full name. If you are unsure of the actual full name Virtualbox uses for all commands, you can use the "VBoxManage" as shown in this example:

[]$ vboxmanage list vms
"Win10VM10" {ef8be776-b79a-487b-a021-004fa5ad4d9c}
"Rocky8VM52_NGINX_Test_Lab" {c3e7f965-02b6-4b8c-8d5a-0d71265a5db3}
"Ubuntu-20.04.2_Server-01" {9af734e3-5c85-49f7-a26d-b9ded78806dc}
"Puppetmaster2" {0e593fac-4d7a-492c-bf20-cb3aa62fe541}

As seen from the output of the "vboxmanage list vms" command, it shows the full name of the VM we are using for these examples, which lists "Rocky8VM52".