Install a VirtualBox inside a VirtualBox, or I think we call it Nested VirtualBox

Background

A lot of people asked the possibility of running a VirtualBox machine inside a VirtualBox machine, but it seems that not too many people was actually trying that out. Recently I happened to have the chance to try that because of an assignment from the Uni. My plan was to have 7 to 8 virtual machines running to have a virtual environment that demonstrates network security related setups, like VPN, firewall, IDS, Kerberos, RADIUS, LDAP and many more. Because I already have a home desktop workstation running Arch Linux (more details here) with enough resource for that, I decided to setup the environment on that workstation.

My problem is that I already have few virtual machines running on that and I do not want to mess up the existing environment, so I decided to have a large and relatively powerful virtual machine that “hosts” other 8 virtual machines.

Configuration and Results

My home workstation has i7-4770 CPU and 32G of RAM, which should be enough for that much of virtual machines. So I created a 50G virtual hard drive and allocated 8G of RAM for the 1st level virtual machine. Then I installed VirtualBox in that machine and created few 2nd level virtual machines in it. My VirtualBox is still running

In a word: It works, but limited. I can only have 32-bit virtual machine running as 2nd level, but not 64-bit ones, even my host machine and 1st level virtual machine is 64-bit architecture. The problem I think is that 1st level virtual machine cannot have vt-x working (by runing cat /proc/cpuinfo and check whether you have vmx or svm in the flag section), so it is more likely to be a software level virtualization instead of a hardware level virtualization. For more details on that, read VirtualBox documentation here.

Another thing is that I cannot get RedHat based operating system installed, which includes Fedora 19, CentOS 6.4 and RHEL 6.4 itself. No idea why, I just get a kernel-panic during the installation for CentOS and RHEL 6.4 and a super slow, hardly progressing Fedora installation so I did not even finish the install process.

But anyway, the performance is not too bad and 32-bit virtual machine works just fine for demonstration purpose in the Uni. And I think not many people will be able to allocate too many resources to 2nd level machines because of the fact that home machines are still limited. By the way, I haven’t try any 3 level virtualization or other virtualization technology like VMware or KVM.