My laptop recently started acting up and became very slow. Somehow I was able to determine that it was my hard disk that was about to fail. I frantically tried to backup my files to Dropbox but it didn’t finish before the hard disk finally gave up on me.

I needed a way to get my files out and that’s when I found out I could use the Ubuntu LiveCD to boot my laptop and access my hard disk from there. It worked so well (I got my files out) that I also fell in love with Ubuntu and decided to keep it as my primary OS. Goodbye Windows.

One thing you discover when moving from Windows is that applications are not as easy to install on Linux as double-clicking .exe files in Windows. The same is true for installing GNS3 on Ubuntu. Although you can install GNS3 from the Ubuntu Software Center, you would probably not get the latest version.

Currently, the version available from the software center is 0.8.6 but the most recent version (as of the time of this writing) is 1.3.1. So in this article, I will walk you through installing GNS3 on Ubuntu. I am running Ubuntu 14.04 LTS on a 64-bit machine.

There is a great resource available here that walks you through installing GNS3 1.2.1 on Ubuntu 14.04 so we will reference this resource. There is another one here for GNS3 1.2.3 and we will also use this. You can download GNS3 1.3.1 here. Mine was saved to my “Downloads” directory.

According to our reference articles, the first thing we need to do is install the dependencies required for both GNS3 and Dynamips.

sudo apt-get install python3-setuptools python3-pyqt4 python3-ws4py python3-netifaces python3-zmq python3-tornado
sudo apt-get install libpcap-dev uuid-dev libelf-dev cmake

Next, we need to unzip the GNS3 installation file that we downloaded and then begin installing the different components. To do this, you just use the unzip command followed by the GNS3 source file name. You can use the “-d” option to specify the directory to which the files should be extracted. I will extract mine to “GNS3-1.3.1.source”.

Afterwards, we just need to go into the extracted folder, unzip each ZIP file one after the other and then install. So let’s start with Dynamips. I will navigate to the GNS3-1.3.1.source folder and then unzip the Dynamips ZIP file.

cd GNS3-1.3.1.source/
unzip dynamips-0.2.14.zip

In this case, without specifying the -d option, the extracted files were placed in a folder. I wonder why it didn’t work for the GNS3 source file. Now we just go into the extracted Dynamips folder and we install it using the following commands:

cd dynamips-0.2.14
mkdir build
cd build
cmake ..
make
sudo make install
sudo setcap cap_net_admin,cap_net_raw=ep /usr/local/bin/dynamips

Note: The cmake command above has “..” after it so don’t forget to add that.

The last command above (setcap) relates to Wireshark settings. By default, non-root users cannot capture packets using Wireshark and running Wireshark as root is not recommended; so the above command sets the capabilities just for the process that requires elevated privileges. You can read more about this here.

Now let’s install the GNS3 server and GNS3 GUI. I grouped them together because their installation is similar: you just unzip the ZIP file, go into the unzipped directory and run the command sudo python3 setup.py install.

# Go back to the unzipped GNS3 source file directory
cd ../..
# Install GNS3 server
unzip gns3-server-1.3.1.zip
cd gns3-server-1.3.1
sudo python3 setup.py install
# Go back to the unzipped GNS3 source file directory
cd ..
# Install GNS3 GUI
unzip gns3-gui-1.3.1.zip
cd gns3-gui-1.3.1
sudo python3 setup.py install
cd ..

We can test whether the GNS3 server and the GNS3 GUI are installed now. To check the GNS3 server, we just type “gns3server” in the terminal:

We can also check the GNS3 GUI by typing the “gns3” command at the terminal. The GNS3 interface should open up as shown below:

Next, we can install VPCS with the following commands (remove the “64” if you are using a 32-bit OS):

unzip vpcs-0.6.zip
cd vpcs-0.6/src
./mk.sh 64
sudo cp vpcs /usr/local/bin

We can test that VPCS is installed by entering the “vpcs” command (use “quit” to exit out of VPCS):

I left the IOU and QEMU for last because these are the ones I had a bit of an issue with. To install IOU, I first tried using the following commands (make sure you are in the unzipped folder for the GNS3 source file):

unzip iouyap-0.95.zip
cd iouyap-0.95
make

I got an error “iniparser.h: No such file or directory”:

Apparently, there are some prerequisites before you can install the IOU. The following commands should help you meet those prerequisites:

sudo apt-get install libssl1.0.0:i386
sudo ln -s /lib/i386-linux-gnu/libcrypto.so.1.0.0 /lib/libcrypto.so.4
sudo apt-get install flex bison
cd /tmp
curl -L https://github.com/ndevilla/iniparser/archive/master.tar.gz | tar -xz
cd iniparser*
make
cd /tmp
curl -L https://github.com/GNS3/iouyap/archive/master.tar.gz | tar -xz
cd iouyap*
bison -ydv netmap_parse.y
flex netmap_scan.l
gcc -Wall *.c -I /tmp/iniparser*/src -L /tmp/iniparser* -o iouyap -liniparser -lpthread
strip --strip-unneeded iouyap
sudo mv iouyap /usr/local/bin

I also had issues installing QEMU (so that I can run ASAs) but apparently, it is as easy as running the command sudo apt-get install qemu. Also, if you want to install VirtualBox, you can get that from the Ubuntu Software Center or just run the command sudo apt-get install virtualbox. Finally, you can install Wireshark using the command sudo apt-get install wireshark.

There you have it! GNS3 is all set up and ready to run by typing the “gns3” command in a terminal. Like me, you may prefer to “Lock to Launcher” rather than having to run it from the terminal every time. Now you can just add your IOS, ASA image, IOU images and you should be good to go.

ASA issues

You may get the following error when you try to start an ASA: Server error from 127.0.0.1:8000: ASA-1: cpulimit could not be found, please install it or deactivate CPU throttling. To get rid of this error, install CPU limit using sudo apt-get install cpulimit.

Using Putty as your console application

By default, console access to your devices will be open on the GNOME terminal. If you prefer to use Putty, just install Putty from the terminal using the command: sudo apt-get install putty. Then navigate to GNS3 preferences → General → Console applications. Select “Putty” as the option under the ‘Console settings for Telnet connections’ section and the click on the “Set” button:

You can change the settings by editing the text in the ‘Console application command’ section. For example, to change the colors to green (foreground) and white (background), you can use “-fg green -bg white”.

Another way to change the settings is to open Putty separately, make the changes you want and then go to Session, select Default Settings and then Save.

Summary

In this article, we saw how to install GNS3 on Ubuntu Linux. Unlike Windows OS, things are not as easily done (except when you are using Ubuntu Software Center) so you may have to install the different components manually. Thankfully, you only have to do this installation once.

References