How to install GNS3 Server on Ubuntu 20.04

Recently I’ve started using the GNS3 application to learn and practice about networking and related hardware.

GNS3 team provides ready to use VM images for various hypervisors, but since I’ve decided to run it in a VM on my UnRAID server, here’s a quick write-up about how to install the GNS3 server in this scenario. UnRAID virtualization engine is based on KVM.

Note : this guide should applies on bare-metal installation too, just ignore the parts relating to virtualization.

Prerequisites

In this guide, I’m assuming :

  • Your hardware is able to perform nested virtualization and you have enabled nested virtualization both in your BIOS and hypervisor (check this tutorial out for UnRAID for instance).
  • You’ve got a freshly installed Ubuntu Server 20.04 VM, with bridged networking set up.
  • Depending on your needs and plans, you have allocated the VM enough ressources (CPU, RAM and storage).

Enable and check virtualization support

Running VM’s inside a VM is called nested virtualization, let’s first check if this feature is enabled and virtualization instructions are actually passed to the VM by installing this package :

sudo apt-get install cpu-checker

Once installed, run this command :

sudo kvm-ok

Here is a valid output meaning virtualization is enabled :

INFO: /dev/kvm exists
KVM acceleration can be used

Installing the GNS3 Server

GNS3 team provides its own repository, let’s add it to the sources :

sudo add-apt-repository ppa:gns3/ppa

Update the source and install the GNS3 server :

sudo apt-get update && sudo apt-get install gns3-server

If you want Cisco IOU support, add 32bits architecture support to your system and install gns3-iou :

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gns3-iou

Installing Docker

GNS3 supports Docker appliances, so let’s install it. First, install some required packages :

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Next, update the package database with the Docker packages from the newly added repo :

sudo apt update

Install Docker :

sudo apt install docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running :

sudo systemctl status docker
Up and running Docker Engine

Finally, add your user to the following groups :

  • ubridge
  • libvirt
  • kvm
  • docker

Adapt and perform the following command to do so :

sudo usermod -aG group_name your_user_name

Configuring the GNS3 Server as a service

Now that the GNS3 server is installed, let’s create a service to run it at boot :

sudo nano /etc/systemd/system/gns3.service

Copy and paste the following parameters to this blank file :

[Unit]
Description=GNS3 Server


[Service]
ExecStart=/usr/share/gns3/gns3-server/bin/gns3server


[Install]
WantedBy=multi-user.target

Save (Ctrl + O) and exit (Ctrl + x) Nano editor. Make this file executable, enable and start the created service :

sudo chmod +x /etc/systemd/system/gns3.service
sudo systemctl enable gns3
sudo systemctl start gns3

Now check to see if the service is properly working :

sudo systemctl status gns3

Reboot your machine and perform the same command, you should get a similar output, meaning GNS3 server is loading at machine’s boot.

Optional : HTTP authentication and remote VPN connection

Your GNS3 server is now installed and ready to be used with your your client of choice, or from the web UI. If you’re the only user in a local environment, then you can start using it without more settings. But depending on your situation, you might want to enable basic HTTP authentication to your instance.

To do so, grab a sample configuration file, and adapt it to our environment. Review the whole file and locate the authentication part.

Pay attention to the paths in this file, these are default paths, if you followed this guide, ‘root’ user is starting the GNS3 server at boot, so GNS3 files are located in /root/GNS3 and configuration files are in the /root/.config/GNS3/2.2/ folder. Makes changes according to your environment.

If your server is outside your local network, you also might want to set up and enable VPN connection. GNS3 team is providing a guide to achieve this.

Conclusion

GNS3 is a great tool to learn and practice about networking. Setting it up in a server VM offers various advantages : centralizing ressources, easy backup, portability and ease of deployment, ability to use multiple clients… Remember though, virtualization uses a lot of ressources, so experiment by yourself and adapt your VM configuration accordingly.

Also, have a look on this page from the official documentation if you’re interested in security about your new GNS3 server.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.