August 2, 2011 5 Comments
GNS3 version 0.8.0 has been out for a while and for the first time released by someone else than the main developer Jeremy Grossman.
The purpose of this tutorial is to show installation VirtualBox 4.x on Fedora Linux. The next step is GNS3 configuration for VirtualBox support. Once VirtualBox and GNS3 are ready, Qemu images can be converted to vdi format and the new VirtualBox machine created. Finally, a short summary sums up benefits of Virtualbox integration in GNS3 project.
1. Install VirtualBox repo
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -P /etc/yum.repos.d/
2. Install packages needed by VirtualBox
sudo yum install gcc kernel-devel kernel-headers dkms.noarch xdotool
3. Install the latest version of VirtualBox
sudo yum install VirtualBox-4.2
This command create automatically vboxusers group and VirtualBox user must be member of that group. It also builds VirtualBox kernel module.
4. Add your user account to vboxusers group
What a surprise, mine is brezular ;-)
sudo usermod -a -G vboxusers brezular
If you plan to run GNS3 as root you also need to add user root to the vboxusers group.
sudo usermod -a -G vboxusers root
5. Convert existing Qemu disk image to normal VDI disk image
qemu-img convert -O raw linux-microcore-3.4.img linux-microcore-3.4.raw
VBoxManage convertfromraw -format VDI linux-microcore-3.4.raw linux-microcore-3.4.vdi
6. Convert existing normal type VDI hard disk image to multiattach image
We need to convert normal VDI image to the multi-attach image which can be used by many VBox virtual machines simultaneously. In order to do it, you have to create a new VirtualBox machine with attached linux-microcore -3.4.vdi image. The steps are detailed described in the following part - Creating the New Virtual Box Machine. Then you must deattach linux-microcore-3.4.vdi image from VirtualBox machine using this way.
a. Right click on Virtual Box machine and select option Settings
b. Navigate to Storage and make left-click on linux-microcore-3.4.vdi (under option SATA controller)
c. Right click on linux-microcore-3.4.vdi and select Remove Attachement. Close virtualbox GUI.
Now you can convert normal VDI image type to multiattach VDI image type with the command.
VBoxManage modifyhd linux-microcore-3.4.vdi --type multiattach
You can show info about hard disk image with following command. Notice, image is now multiattach type.
VBoxManage showhdinfo linux-microcore-3.4.vdi
Logical size: 100 MBytes
Current size on disk: 25 MBytes
Storage format: VDI
Format variant: dynamic default
Creating The New Virtual Box Machine
You need to create the new Vbox machine for each VirtalBox network device you want to use. All the VBoxes machines will share the existing multi-attach linux-microcore-3.4.vdi image.
The default store for Vbox machines is
echo `cd ~; pwd`/VirtualBox VMs. If you wish to store VirtualBoxes in another place, you can change that path just running virtualbox command. Invoke the command under the user whose account is typically used to start GNS3 application. If it is a root, start the VirtualBox as the root.
Go to File-> Preferences-> General and change parameter Default Machine folder.
Press Ctrl-N – Create New Vbox machine.
Choose the Name of VM, Operating System and Version. Click Next.
Choose RAM: For Linux Microcore, 48 MB should be enough.
Click Next and Select option “Use Existing Hard disk“. Navigate to your new created linux-microcore-3.4.vdi disk.
Click Next and Create.
Your Vbox machine is created and we can continue with configuring GNS3 for VirtualBox support.
GNS3 configuration for VirtualBox support
Assuming that your GNS3 0.8.0 is correctly installed and running we are going to configure GNS3 to support VirtualBox virtualization.
Go to Edit-> Preferences-> VirtualBox
Set path to the Vboxwrapper and click on the Test button. The green colour mesage “VBoxwrapper and VirtualBox 4.1.0 have succesfully started” should appear .
Now, switch to the VirtualBox Guest window. In this window we need to define VirtualBox machine we were previously created.
VM Name/UUID must match the name of VM. In our case it is Microcore_3.4. For Identifier name field choose the name whatever you want to have.
Cloning VirtualBox machine
Now we are in situation when the first VirtualBox machine – Microcore_3.4 has been created and defined in GNS3 VirtualBox Guest setting. If we want to have another VirtualBox Guest, we must create the new VirtualBox machine. The fastest method is to clone original Mircorcore_3.4 Vbox machine.
Press Ctrl-O – Clone and click on Clone button.
The new cloned VirtualBox machine – Microcore_3.4 Clone is created.
We are going to attach linux-microcore-3.4.vdi hardisk which was created in section 5 of this tutorial, to the Microcore-3.4 Clone VirtualBox machine. Right click on Microcore_3.4 Cloned and select Settings (Ctrl-S). Navigate to the Storage section.
Under SATA Controller, make a right click on Microcore_3.4 Clone-disk.vdi. Select option Remove Attachment.
Click on Add HardDisk icon. A new dialog window should appear.
Click on Choose existing disk button and navigate to exisiting multi-attached linux-microcore-3.4.vdi hard disk.
You have successfully attached linux-microcore-3.4.vdi hard disk to Microcore_3.4 Clone VirtualBox machine.
Although I have not done any performance test, obviously x86 machines virtualized by VirtualBox run much faster than those virtualized by Qemu when it is running without support of hardware acceleration. It makes Virtualbox virtualization very efficient on legacy computers with CPUs that do not support hardware virtualization with kvm. In addition, the only Qemu software accelerator Kqemu – is available only up to Qemu version 0.11.x.
Regardless of indisputable benefit of VirtualBox GNS3 integration there are some issues that should be mentioned. First, it is the strange mismatch labelling of Ethernet interfaces, originally mentioned here. For instance, when the Ethernet interface shown by GNS3 is eth1, it is actually interface eth2 in VirtualBox machine configuration.
The second issue is related to the VirtualBox implementation. Unlike Qemu, VirtualBox GNS3 imlementation does not offer concept of automatically created VMs based upon the single base image. Every time is a new VitualBox Guest device needed, user must start VirtualBox GUI and manually clone existing base image. After that this new VirtualBox machine can be defined in GNS3 “VirtualBox Guest settings” window. If other GNS3 project is created, another new VirtualBox machine has be created (or cloned) from VirtualBox GUI and defined in GNS3. If they are five GNS3 projects and ten VirtualBox Guests are required per project, user has to create and define fifty Virtualbox machines.
Qemu clones implementation is much clever. Every time the new Qemu device is placed to GNS3 desktop, clone of base image is created behind the scene, with no user intervention. Thanks to this concept, user only define Qemu base image in GNS3 setting and it is no need to define every single Qemu image.