GNS3, Qemu, VirtualBox and Dynamips on Debian

GNS3 is based on Dynamips and Dynagen (a text-based front-end for Dynamips) to create a complete virtual Cisco network, adding many additional features and most importantly making it easy to create, change and save your network topologies. It also supports Qemu virtualizer/emulator and VirtualBox.

The tutorial shows installation of Qemu and Dynamips on Debian from sources. VirtualBox and KVM installation will be automated thanks to using Advanced Packaing Tool (APT) that cares about all dependencies. Finally, we will install the last available GNS3 version.

1. Qemu Emulator / Virtualizer Installation

QEMU is a generic and open source machine emulator and virtualizer. When Qemu is used as a machine emulator, it can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. on x86 architecture). When Qemu is used as a virtualizer, it achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux.

1.1 Install required dependencies needed for building Qemu from sources

$ sudo apt-get install glib-2.0 pkg-config libglib2.0 build-essential libsdl1.2-dev libsdl-image1.2-dev

1.2 Download Qemu sources

$ wget
$ tar jxvf qemu-1.6.1.tar.bz2
$ cd qemu-1.6.1/

1.3 Configure, compile and install Qemu

Specifying a target list for i386, x86-64 and Sparc architectures, Qemu binaries will be built for these architectures only. To see the list of all architectures supported by Qemu, issue the command below.

$ ./configure --target-list

Note As the configure command detects installed packages libsdl1.2-dev libsdl-image1.2-dev, Qemu will be automatically configured for SDL support. Therefore emulation can run in a graphic window, every time Qemu is started.

$ ./configure --target-list=i386-softmmu,x86_64-softmmu,sparc-softmmu
$ make
$ sudo make install

Check if Qemu is correctly installed:

$ /usr/local/bin/qemu-system-i386 -version
QEMU emulator version 1.6.1, Copyright (c) 2003-2008 Fabrice Bellard


2. KVM Installation

KVM installation on Debian is very similar to KVM installation on other Linux distributions. Therefore I am sharing a link to the tutorial that describes KVM installation on Fedora Linux. The only difference between KVM installation on Debian and Fedora Linux is that apt command is used on Debian.

$ sudo apt-get install qemu-kvm

3. Oracle VirtualBox Installation

When apt is used to download and install VirtualBox, installation is easy and automated. But first Debian Contrib repository has to be added to be able to get the last VirtualBox Debian package.

3.1 Add contrib repository

Starting with version 4.0 VirtualBox binaries are located in the contrib repository.

$ sudo su
# echo "deb wheezy contrib" >> ls /etc/apt/sources.list

3.2 Download and add Oracle public key

$ wget
$ sudo apt-key add oracle_vbox.asc

Check if Oracle public key is listed in the list of keys.

$ sudo apt-key list

3.3 Install VirtualBox package

$ sudo apt-get update
$ sudo apt-get install virtualbox-4.3

3.4 Install DKMS package

We must install the dkms package to ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes during the next apt-get upgrade.

$ sudo apt-get install dkms

3.5 Start Virtualbox and recompile the kernel driver if it is needed

$ virtualbox

If you notice the message below, you must recompile the kernel modules otherwise virtual machines will not be started.

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (3.2.0-4-686-pae) or it failed to
load. Please recompile the kernel module and install it by

sudo /etc/init.d/vboxdrv setup

You will not be able to start VMs until this problem is fixed.

Close Virtualbox and issue the command:

$ sudo /etc/init.d/vboxdrv setup

It takes while to recompile appropriate kernel modules. After that we should be able to start virtual machines. You can check the status of modules with the commands:

$ sudo /etc/init.d/vboxdrv status
VirtualBox kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) are loaded.


Picture 1 - Output of lsmod command

4. Building Dynamips

Building Dynamips on Fedora from source is described here:

4.1 Download and uzip Dynamips sources

Download Dynamips tarball and extract it with unzip utility.

$ wget
$ unzip
$ cd dynamips-0.2.10-source/

4.2 Install dependencies

To successfully build Dynamips the following packages are required to install.

$ sudo apt-get install libelf-dev uuid-dev libpcap-dev

4.3 Build Dynamips

Use make command to build Dynamips from sources. Even Dynamips can detect architecture on which is being installed it is probably a good idea to specify architecture.

Building Dynamips on 32 bit Debian:
$ make DYNAMIPS_ARCH=x86

Building Dynamips on 64 bit Debian:
$ make DYNAMIPS_ARCH=amd64

Finally, copy Dynamips binary to the directory where locally built binaries are stored.

$ sudo cp ./dynamips.stable /usr/local/bin/dynamips-0.2.10-x86.bin

5. GNS3 Installation

GNS3 installation is pretty straightforward on Debian. All we need is to use apt to install Python and associated packages.

5.1 Install Python

$ sudo apt-get install python-qt4 xdotool

5.2 Download and extract GNS3

$ wget

$ tar zxvf GNS3-0.8.6-src.tar.gz

5.3 Assign run privilegies to GNS3

$ cd gns3-legacy-GNS3-0.8.6/
$ chmod +x gns3.pyw


5 thoughts on “GNS3, Qemu, VirtualBox and Dynamips on Debian

  1. Unable to run gns3 from terminal...all steps were successful...

    In the last step after changing permission, when i typed gns3 i get the follwoing error:
    bash: gns3: command not found

    • kayal,
      navigate to the source directory, issue the command below and post the output.
      $ ls -l | grep gns3
      lrwxrwxrwx. 1 brezular brezular 8 Jul 8 04:28 gns3 -> gns3.pyw
      -rwxrwxr-x. 1 brezular brezular 9460 Jul 8 04:28 gns3.icns
      -rwxrwxr-x. 1 brezular brezular 2739 Jul 8 04:28 gns3.pyw

      • root@kayal-Veriton-Series:/home/kayal/qemu-1.6.1/dynamips-0.2.10-source/gns3-legacy-GNS3-0.8.6# ls -l | grep gns3

        lrwxrwxrwx 1 root root 8 Oct 23 2013 gns3 -> gns3.pyw
        -rwxrwxr-x 1 root root 9460 Oct 23 2013 gns3.icns
        -rwxrwxr-x 1 root root 2739 Oct 23 2013 gns3.pyw

        • File permissions seem to be set correctly. Navigate to GNS3 source directory and issue the command:
          This tells your OS to locate gns3 in a actual directory instead of those that are set by environment variable PATH. Is it working for you?

Leave a comment

Your email address will not be published. Required fields are marked *