Set Up GNS3 with Open-Source Routers

GNS3 is a very popular network simulation tool that runs on the major operating systems: Windows, Mac OS, and Linux. GNS3 is primarily used to emulate networks of Cisco routers and is used by professionals studying for Cisco certification exams.

GNS3 supports Cisco router software images running on the Dynamips hardware emulation program. GNS3 also supports other hardware emulation and virtualization technologies that can run Linux virtual machines: Qemu and VirtualBox.

GNS3 network simulator with open-source Linux routers

Our interest is to emulate networks of open-source routers and switches using open-source technologies. While there are many web sites and online tutorials dedicated to using GNS3 to emulate Cisco networks and Juniper networks, I found only a small amount of information about using GNS3 to emulate a network of Linux virtual machines running open-source routing and switching software.

In this post, we show how to install and set up GNS3 and VirtualBox to emulate a network consisting only of open-source routers and hosts.

Install GNS3

This procedure describes how to install GNS3 and its supporting software on a Linux host computer running Xubuntu 13.10. Procedures to install GNS3 in Windows or Mac OS are available in the GNS3 documentation.

GNS3 can be installed using the Ubuntu Software Center but the version available in the standard Ubuntu repositories is not the latest version of GNS3. To install the latest version of GNS3, Dynamips, Qemu, and Wireshark, do the following:

  1. Add the GNS3 PPA to the Xubuntu software repository
    $ sudo add-apt-repository ppa:gns3/ppa
    
  2. Update repository information
    $ sudo apt-get update
    
  3. Install GNS3 package from new, updated PPA repository
    $ sudo apt-get install dynamips gns3
    

    Installing the GNS3 package also installs most supporting software.

  4. I noticed the installer recommends two other packages be installed but does not install them because they are optional, so I installed them:
    $ sudo apt-get install snmp-mibs-downloader wireshark-doc
    
  5. Next I installed the virtual PC simulator program, vpcs which is in the same PPA:
    $ sudo apt-get vpcs
    

Installation complete

We successfully installed GNS3. Next, we need to install software to support running the Linux virtual machines that will be managed by GNS3.

VirtualBox

Many users of GNS3 choose to use VirtualBox to run Linux virtual machines because, like GNS3, it works the same on Windows, Mac OS, and Linux operating systems. VirtualBox can also utilize the hardware virtualization support technologies available on most computers while Qemu can only access these features in the Linux operating system (via KVM), with restrictions. Access to hardware virtualization support makes very noticeable improvement in performance.

The procedures I demonstrate using GNS3 and VirtualBox on my Linux system should also be usable on computers running either Windows or Mac OS.

Install VirtualBox

When emulating nodes other than Cisco routers, GNS3 can use VirtualBox to manage the virtual machines that run linux (or other PC operating systems).

Install from Ubuntu Software Center

The easiest way to install VirtualBox in an Ubuntu Linux-based system (I am using Xubuntu) is to use the Ubuntu Software Center program. Search for VirtualBox in the Ubuntu Software Center and click on “install”.

Install from downloaded package

The version of VirtualBox available in the Ubuntu Software Center is not the latest version available from VirtualBox’s developer, Oracle. The version available from the Ubuntu repositories is good enough. You don’t need the latest version. However, if you — like me — always want the latest and greatest version on your computer, follow the steps described below to install the most recent available version of VirtualBox.

To install the latest version of VirtualBox, download the latest package from the Oracle VirtualBox web site.

Then, in your File Manager, double-click on the .deb package you downloaded. The Ubuntu Software Center will automatically start and install the latest version VirtualBox from the downloaded .deb package.

VirtualBox-install-1

In my case, I chose to install the latest version of VirtualBox, version 4.3, using the procedure described above. At the time of writing this post, the latest VirtualBox package was: virtualbox-4.3_4.3.6-91406~Ubuntu~raring_amd64.deb.

dkms package

The Oracle web site also recommends installing the dkms package to ensure that VirtualBox is properly updated if the Linux kernel version changes during the a system upgrade. To install the dkms package, execute the command:

$ sudo apt-get install dkms

Installation complete

After installation is completed, the Oracle VirtualBox virtual machine manager will appear in the Xfce menu under “System”.

Initial GNS3 setup

In the Xubuntu start menu, GNS3 appears under “Education” and Wireshark appears under “Internet”. To start using GNS3, click on the menu command:

Start → Education → GNS3

We see a setup menu wizard appear. Just click on the “OK” button at the bottom of the wizard window. We do not need any of these setting when working exclusively with Linux virtual machines in GNS3.

Now, we see the blank GNS3 application window. At this point, we still cannot use GNS3 because we need to create the virtual machines that GNS3 will use in the emulated network.

Download Linux virtual appliances

the GNS3 web site provides a set of prepared Linux appliances that can be used to emulate routers, servers, and hosts in a virtual network. Navigate to the Appliances page on the GNS3 web site and download the appliances you will use to create virtual machines in your network emulation scenario.

For our simple tests, we will download two VirtualBox appliances from the GNS3 web site:

  • Linux Core 4.7.7 (link)
  • Linux Core Layer 3 switch with Quagga 0.99.22.4 and Openvswitch 1.11.0 (link)

Create virtual machines in VirtualBox

We must create virtual machines using the appliances we downloaded earlier. We need to create a new VirtualBox virtual machine for every node we plan to use in the virtual network.

The first virtual router

Start VirtualBox and then click the “New” icon in the VirtualBox VM Manager window to start the Create Virtual Machine wizard.

VirtualBox-VM-setup-1

For the first machine, we will create the router VM. In the dialogue box, enter the name “Quagga-1”. The VM Type is “Linux” and the Version is “Other Linux”.

VirtualBox-VM-setup-2

Then, click “Next”.

Set the memory size. Change the value to 128 MBytes. This can be changed later if we need to.

VirtualBox-VM-setup-3

Click “Next”.

Choose the option to “Use an existing virtual hard drive” and then select the VDI file we downloaded earlier: linux-core-4.7.7-openvswitch-1.11.0_guagga-0.99.22.4.vdi.

VirtualBox-VM-setup-4

Click “Create”.

The virtual machine is now created in VirtualBox.

VirtualBox-VM-setup-5

The first virtual host

To create the second virtual machine, which will be used to emulate a host computer in the virtual network, repeat the steps we used to create the virtual router with the following changes:

  • The VM name is Host-1
  • The memory can be reduced to 64 MB
  • The appliance image is linux-core-4.7.7.vdi

Just as a check, to ensure we have the basic VM working, we will start it. Click on the Host-1 virtial machine in the Oracle VM VirtualBox Manager window and then click on the green “Start” arrow. The machine will start up and you will see a terminal window with a login prompt.

VirtualBox-VM-setup-6

Additional virtual machines

To create more virtual routers and hosts, we use VirtualBox’s Clone feature to create clones of the router and host virtual machines we previously created.

Click on the virtual machine you wish to clone, then choose the VirtualBox Virtual Machine Manager menu command:

Machine → Clone...

VirtualBox will open a dialogue box asking you for the name of the new virtual machine. If you are cloning the Host-1 virtual machine, enter Host-2 as the new machine name.

Check the box, Reinitialize the MAC address of all network cards so that the MAC addresses on the new virtual machine’s network interfaces will be different from the MAC addresses on the cloned virtual machine. This will prevent problems when using both virtual machines in the same virtual network. Then, click Next.

VirtualBox-VM-setup-7

Then, you can choose the clone type: either a Full clone or a Linked clone. The Full clone creates a fully independent virtual machine with its own virtual disk image that is a copy of the original virtual machine. The Linked clone creates a smaller virtual disk image that is “linked” to the original virtual machine’s disk image. This linked virtual disk image will contain only the changes made to the second virtual machine so it takes up much less disk space. The Linked clone is dependent on the original virtual machine and it will break if the original virtual machine is modified.

In our case, we should use the full clone type because we have lots of disk space and our disk images are very small (less than 30 MB), and we avoid the problems that can occur if we accidentally modify the original virtual machine that is the source of all the linked clones. Select Full Clone and click Clone.

VirtualBox-VM-setup-8

Repeat this process to create more hosts with the name, Host-x, and more routers with the name, Quagga-x, where x is a number. In my case, I create a total of three hosts and two routers.

VirtualBox-VM-setup-9

Set up VirtualBox devices in GNS3

Each virtual machine we created in VirtualBox needs to be set up in GNS3, so that they will appear in the GNS3 user interface. We need to update the VirtualBox preferences in GNS3. Open teh Preferences dialogue box with the GNS3 menu command:

Edit → Preferences...

Then click on VirtualBox in the preference list.

GNS3- setup-VirtualBox-1

In the VirtualBox preferences panel, click on the VirtualBox Guest tab. In the VirtualBox Guest panel, first click on the Refresh VM List button to load the virtual machines available in VirtualBox. The describe the first VirtualBox virtual machine you wish to use in GNS3:

  • In the Identifier name field, enter name of device as you want it to appear in GNS3 (choose same as in VirtualBox)
  • In the VM list field, choose the VirtualBox VM from the drop-down menu
  • In the Number of NICs field, choose the number of network interfaces for the device:
    • Hosts get 1 interface
    • Routers get 8 interfaces

GNS3- setup-VirtualBox-2

Now set up the console access for each virtual machine. The VirtualBox VMs must be configured to enable serial console access. The appliances we downloaded have this configuration enabled.

  • Uncheck Reserve First NIC for VirtualBox NAT with Host OS
  • Check Enable console support
  • Check Enable console server (for remote access)
  • Check Start in headless mode (without GUI)

GNS3- setup-VirtualBox-3

Click Save to create the Host-1 VirtualBox device in the preferences panel.

Repeat for each of the other devices until all devices are created. The preferences panel will look like the screenshot below:

GNS3- setup-VirtualBox-4

Create a new custom device symbol in GNS3

It is helpful to have a custom device symbol to represent the VirtualBox device running one of the router virtual machines. To create a new custom symbol, open the Symbol Manager dialogue box with the GNS3 menu command:

Edit → Symbol Manager

GNS3- setup-VirtualBox-5

Select a symbol you want to re-use (I chose the router symbol). Then, click on the “>” button to move a copy of the symbol over to the Customized Nodes box.

GNS3- setup-VirtualBox-6

Now we see the router symbol in the Customized nodes box. Click on the new router symbol and change the Name to something descriptive, like “router-virtualbox”, and Type to “VirtualBox guest”.

GNS3- setup-VirtualBox-7

The click the Apply button to make the changes. You now see a customized node, router-virtualbox in the Customized nodes box.

We do not need to create a customized node for the hosts. There is already a virtualbox host symbol in the symbol library: vbox_guest.

Click OK to close the Symbol Manager window.

GNS3- setup-VirtualBox-8

Now, when you click on the Browse all devices button on the GNS3 user interface, the custom node, router-virtualbox is available.

GNS3- setup-VirtualBox-9

Conclusion and next steps

After completing the procedure described above, GNS3 is prepared to set up a network that will include up to two Linux routers and three Linux hosts.

GNS3 provides a lot of functionality that we do not use when we work exclusively with Linux virtual machines as routers and hosts in the GNS3 simulated network. However, there are some specific details that users need to know when setting up and using Linux virtual machines to create a simulated network. In this post, we covered those set up procedures.

We will discuss the details related to using the Linux virtual appliances provided by the GNS3 project in a simulated network in a future post.

14 thoughts on “Set Up GNS3 with Open-Source Routers”

  1. Pingback: Using open-source routers in GNS3 | Open-Source Routing and Network Simulation

  2. Hi

    A very good article on set up open source routers in GNS3.

    I am facing a problem, may be you would better comment on this because I am new to GNS3.

    I have installed fedora 11 in virtual box in GNS3.
    After Click on start button fedora comes up successfully.

    But when we open the console, I am not able to telnet to fedora
    It throws an error “fedora console is now available … Press RETURN to get started.”.
    in Putty.

    I don’t understand what does the above error means.

    and error throws on GNS3 console is —

    22:35:39: DEBUG (2): Start console program SuperPutty.exe -telnet “127.0.0.1 -P 3501 -wt “fedora” -gns3 5 -skin 4″
    22:35:39: DEBUG (2): Unsuccessful bringConsoleToFront() for fedora
    22:35:39: DEBUG (2): fedora has 1 terminal program(s) connected to itself

    Can you please explain the above two errors.
    and Please provide a solution How I would login to fedora either through ssh or telnet in GNS3.

    Regards & Thanks,
    Abhishek

    1. Hi Abhishek,

      I do not know if I can help. I did not encounter this problem so I do not know what would resolve it. I suggest the following:

      – Fedora 11 is a very old release of Fedora. Try using a more modern version of Fedora. The current version is Fedora 20.
      – Use the VM images provided by the GNS3 project. If they work, then you know you need to configure your Fedora VM differently (did you set up the serial console, as recommended by the GNS3 website?).
      – Check your network configuration of the VirtualBox virtual machine.

      I hope this gives you some ideas about how to solve the problem. Sorry I cannot be more helpful.
      Thanks,
      Brian

  3. hi brian

    i want to install strongswan in Linux Core Layer 3 switch with Quagga 0.99.22.4 and Openvswitch 1.11.0 you mentioned in your article, can you help me how i can do that? i’m really not familiar with this dark terminal world!

    regards
    mj

  4. Hi, I would like to know whether Quagga is by default Layer3? Is there is a way I can use it as Layer2 and OpenFlow OVS switch? Thanks.

      1. Thanks a lot Brian for your quick reply. I actually did create a separate Ubuntu VM with Open vSwitch to test a lab…similar to this for some understanding of GNS3 and Open vSwitch commands. Thanks again.

  5. Hi Brian,

    This is a great tutorial.

    I’m wondering if I could use 3com baseline switch 2928 spf with gns3? I think the OS isn’t IOS. I extracted the .bin file from the switch’s flash, and point Qemu to it, but no success.

    Do you know is it possible, or not?

    Thanks,
    Igor

  6. Pingback: Routing – RussFoster.com

  7. Hello Brian

    I tried to do the same only with first instaling Virtual Box on RHEL 7 and then creating hosts and routers. All went well except that when i boot the routers from console ..its stuck and exchanged bytes and never goes to a TC box login. Pls note that my RHEL 7 is itself a VM on hyper V . So do advise what could be the issue

    Thanks
    SamirK

    1. Hi Samir,
      Running GNS3 inside a VM would require you to use VMware. VirtualBox VMs running inside another VM (nested) will not be able to access the hardware virtualization support. I don’t know if that is the cause of your problem but it would result in very slow performance.
      If your host operating system is Linux, then nested virtualization may work with VirtualBox but the guest VM and the GNS3 VMs would all have to use the same architecture (linux 64-bit, for example).
      Brian

Comments are closed.

Scroll to Top