In this article I will cover how my Workstation is setup to run GNS3 on a dedicated Server VM that I also use for Docker. Unfortunately some of my clients require me to have Windows tools available and running Windows in a VM on linux typically is a less than good experience if you need to also leverage the GPU. Since I only really need Docker to host my local VyOS build container’s, I decided to avoid the normal Docker for Windows installation for a number of reasons.

  • Docker on Windows requires Hyper-V
  • Hyper-V still does not support Nesting on AMD Zen CPU’s . This is required for GNS3 to function correctly
  • Hyper-V cannot run alongside VMWare or Virtualbox
  • Hyper-V on Windows 10 moves your desktop into a virtual machine and reduces GPU performance in certain instances

I am using the following tools for my Workstation configuration :

If you want to learn more about GNS3, you may be interested in The Book of GNS3 available on Amazon as paperback or Kindle. Check it out using our Amazon affiliate link, https://amzn.to/322eKCO.

  • VMWare Workstation 15
  • WSL (Pengwin Distro)
  • X410 (Running X apps like Meld or Gnome-Terminal)
  • Ubuntu Server 18.04.2 (VM)

This can be done with completely free tools such as Virtualbox 6 and free WSL distros such as vanilla Debian or Ubuntu, however, I like what the Pengwin guys have done to optimize for WSL and running X apps on Windows.

There are also a number of free X servers for Windows, but I’m happy to pay for X410 as it works seamlessly and hasn’t given me any issues. Hopefully by the time WSL2 is released to the stable Windows builds they will have solved the shortcomings of Hyper-V.

If that ends up being the case in say the 1910 build then I will come back with a new article on how to deploy GNS3 inside of Hyper-V

Now that that is out of the way lets get to configuring our server which will start on system boot giving us GNS3 and Docker availability anytime Windows is running.


Create a Shared Ubuntu 18.04 VM

We will start by creating our server as a shared VM in Workstation 15. Shared VM’s are useful as they can start on system boot unlike VM’s local to your main user account which must be manually started.

To begin we will open the Shared VMs tab and Create a new linux VM. In my case I choose 100GB for the VM disk as I do use larger GNS3 appliances as well as build VyOS system iso’s in Docker. Also make sure to enable VT-x//EPT or AMD-V/RVI so that our VM can run KVM inside of it (Nesting).

Once we get to this point we will customize our hardware to something more suitable for running GNS3 simulations and Docker containers that are building system images.

Since I have a 6c/12t CPU and 64GB of system ram I have opted to give the VM 6 cores and 42GB of RAM. We will also change the Networking type to NAT, Generate a MAC Address (Save this for later), as well as attach our Installation ISO.

Once you are at this point we will now open a text editor in Admin mode (Windows search for your text editor of choice, right click, run as Administrator).

Next we will open the DHCP configuration for our NAT network. In this case it is “C:\ProgramData\VMware\vmnetdhcp.conf”. Once that is opened we will add a static DHCP lease for our new VM so that we have a reliable address to SSH into and configure in GNS3.

After you’ve saved the file we can now proceed with installation of the new VM. Please note at this point it will not get it’s static IP, however, we will take care of that in a minute.

During the installation do not forget to enable the SSH server. If you don’t you will need to manually configure SSH once the VM is done installing.

Once the VM has finished installation do not reboot just yet. First we are going to restart the VMware DHCP server so that it will get the static IP address we assigned it earlier.

To do this open the Windows services panel (Win+R and run services.msc) and then right click the service and select restart.

Now we can reboot the server and move to our WSL terminal on the Windows host to generate an SSH key and push it to our new VM. On my system I have created the alias u-server to allow me to quickly spawn an ssh session over to the Linux VM.

Now that we will have configured we will go clean up the VM and set it to autoboot. Shutdown the VM either using VMware or the command “sudo shutdown -h now” and then edit the properties. We want to remove the CD/DVD drive as well as the floppy disk drive. Once completed we will set the machine to start with the system from the shared VMs tab.


Configure VM for GNS3 Server and Docker

Now that we’ve got our new VM created we can get GNS3 installed and running as a service. This is going to be similar to my previous article on GNS3 linux installation, however, there are a few changes required when running as a server.


Set timezone and update the system

Our 1st step will be to set the timezone and update the system. In my case I am in Texas so I will be using US/Central time.

[email protected]:~# dpkg-reconfigure tzdata

Current default time zone: 'US/Central'
Local time is now:      Sun Jun  9 13:35:27 CDT 2019.
Universal Time is now:  Sun Jun  9 18:35:27 UTC 2019.

[email protected]:~# apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
[email protected]:~# apt-get dist-upgrade

Check for KVM support in the VM

We need to ensure our VM will actually be able to run VM’s itself. If your system fails this check ensure you have a CPU that supports nested virtualization and you have the required features enabled.

[email protected]:~# lsmod | grep kvm
kvm_amd                86016  0
kvm                   598016  1 kvm_amd
irqbypass              16384  1 kvm

[email protected]:~# apt-get install cpu-checker

[email protected]:~# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

Install GNS3 Server Packages

Now we can add the GNS3 PPA, install the GNS3 server, and optional packages such as docker or IOU.

[email protected]:~# add-apt-repository ppa:gns3/ppa
 PPA for GNS3 and Supporting Packages. Please see http://www.gns3.com for more details
 More info: https://launchpad.net/~gns3/+archive/ubuntu/ppa
Press [ENTER] to continue or Ctrl-c to cancel adding it.

[email protected]:~# apt-get update && apt-get install gns3-server
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ppa.launchpad.net/gns3/ppa/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
Reading package lists... Done

[email protected]:~# dpkg --add-architecture i386
[email protected]:~# apt-get update && apt-get install gns3-iou

[email protected]:~# apt-get install apt-transport-https ca-certificates curl software-properties-common

[email protected]:~#  apt-get remove docker docker-engine docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'docker-engine' is not installed, so not removed
Package 'docker' is not installed, so not removed
Package 'docker.io' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

[email protected]:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
OK
[email protected]:~# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

[email protected]:~# apt-get update && apt-get install docker-ce

Configure GNS3 to run as a Service

Now that we have all the packages we can get GNS3 configured on our server VM. I will also be configuring it allow me to use docker and KVM outside of GNS3 for day to day work activities.

[email protected]:~# echo "127.0.0.254 xml.cisco.com" | tee --append /etc/hosts
127.0.0.254 xml.cisco.com

[email protected]:~# useradd -d /opt/gns3/ -m gns3
[email protected]:~# usermod -aG ubridge gns3
[email protected]:~# usermod -aG kvm gns3
[email protected]:~# usermod -aG libvirt gns3
[email protected]:~# usermod -aG docker gns3
[email protected]:~# groups gns3
gns3 : gns3 kvm ubridge libvirt docker

[email protected]:~# usermod -aG kvm jbrooks
[email protected]:~# usermod -aG libvirt jbrooks
[email protected]:~# usermod -aG docker jbrooks
[email protected]:~# groups jbrooks
jbrooks : jbrooks adm cdrom sudo dip plugdev lxd kvm ubridge libvirt docker


[email protected]:~# mkdir -p /etc/gns3
[email protected]:~# cat <<EOFC > /etc/gns3/gns3_server.conf
> [Server]
> host = 0.0.0.0
> port = 3080
> images_path = /opt/gns3/images
> projects_path = /opt/gns3/projects
> appliances_path = /opt/gns3/appliances
> configs_path = /opt/gns3/configs
> report_errors = True
>
> [Qemu]
> enable_kvm = True
> require_kvm = True
> EOFC
[email protected]:~#
[email protected]:~# chown -R gns3:gns3 /etc/gns3
[email protected]:~# chmod -R 700 /etc/gns3

[email protected]:~# cat <<EOFI > /lib/systemd/system/gns3.service
> [Unit]
> Description=GNS3 server
>
> [Service]
> Type=forking
> User=gns3
> Group=gns3
> PermissionsStartOnly=true
> ExecStartPre=/bin/mkdir -p /var/log/gns3 /var/run/gns3
> ExecStartPre=/bin/chown -R gns3:gns3 /var/log/gns3 /var/run/gns3
> ExecStart=/usr/bin/gns3server --log /var/log/gns3/gns3.log \
>      --pid /var/run/gns3/gns3.pid --daemon
> Restart=on-abort
> PIDFile=/var/run/gns3/gns3.pid
>
> [Install]
> WantedBy=multi-user.target
> EOFI
[email protected]:~# chmod 755 /lib/systemd/system/gns3.service
[email protected]:~# chown root:root /lib/systemd/system/gns3.service

Reboot and Start GNS3 service

Now that the server is configured we can reboot it and start the new GNS3 service we have configured. Once we confirm that it is running we will enable the service to autostart on subsequent reboots.

[email protected]:~# shutdown -r now
Connection to 172.31.255.15 closed by remote host.
Connection to 172.31.255.15 closed.

[email protected]:~$ u-server
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-51-generic x86_64)
[email protected]:~$ sudo -s
[email protected]:~#

[email protected]:~# systemctl start gns3
[email protected]:~# systemctl status gns3
● gns3.service - GNS3 server
   Loaded: loaded (/lib/systemd/system/gns3.service; disabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-06-09 18:24:18 UTC; 3s ago
  Process: 1806 ExecStart=/usr/bin/gns3server --log /var/log/gns3/gns3.log --pid /var/run/gns3/gns3.pid --daemon (code=exited, st
  Process: 1794 ExecStartPre=/bin/chown -R gns3:gns3 /var/log/gns3 /var/run/gns3 (code=exited, status=0/SUCCESS)
  Process: 1793 ExecStartPre=/bin/mkdir -p /var/log/gns3 /var/run/gns3 (code=exited, status=0/SUCCESS)
 Main PID: 1816 (gns3server)
    Tasks: 1 (limit: 19660)
   CGroup: /system.slice/gns3.service
           └─1816 /usr/share/gns3/gns3-server/bin/python /usr/bin/gns3server --log /var/log/gns3/gns3.log --pid /var/run/gns3/gns

Jun 09 18:24:17 josh-workstation-ubuntu systemd[1]: Starting GNS3 server...
Jun 09 18:24:17 josh-workstation-ubuntu systemd[1]: gns3.service: Can't open PID file /var/run/gns3/gns3.pid (yet?) after start:
Jun 09 18:24:18 josh-workstation-ubuntu systemd[1]: Started GNS3 server.
[email protected]:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1456/dnsmasq
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      798/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1025/sshd
tcp        0      0 0.0.0.0:3080            0.0.0.0:*               LISTEN      1816/python
tcp6       0      0 :::22                   :::*                    LISTEN      1025/sshd

[email protected]:~# systemctl enable gns3
Created symlink /etc/systemd/system/multi-user.target.wants/gns3.service → /lib/systemd/system/gns3.service.

Install Windows GNS3 Client

With the server completed we can now install the GNS3 client. Since we will be running all simulations under the Linux VM we do not need VPCS, Dynamips, QEMU, or Cpulimit installed under Windows.

Once the installation has completed go ahead and launch GNS3.


Configure Windows GNS3 Client

Now that it has been installed we can configure the client to run all simulations on the Server VM we have running. Once you select the option and provide the IP address GNS3 will function like any other installation. Please do note that we are running without authentication for our local installation. This is not advisable where you are running a physically separate server over the network or you have forwarded the port to the VM.


Resource usage

Some might think this would add alot of overhead to the Windows machine, however, in my instance it’s not much worse when idling at the desktop. It is also quite similar to how the GNS3VM functions, but you get more control over the VM’s configuration.


Check out the rest of our GNS3 Posts!