GNS3 is an open source application for network simulation. I use it since I was studying CCNA, CCNP, and CCIE till now. I can emulate real Cisco IOS in this application. Due to its previous limitation on Switching emulation, now they release an update feature to run Cisco IOU (IOS On Unix) in the new version of GNS3. You can simulate Cisco IOU for L2/L3 device in GNS3. This is what I need to pursue my CCIE certification!
In this session, I want to share a tutorial how to configure GNS IOU VM on 1.5.4 version (the latest version is 2.0.x, but I’m still prefer to use 1.5.4 version due to its stability and compatibility with my notebook). I believe there are people outside there who already familiar and shared this kind of tutorial but I wanna do in my way ~ at least, it’s for personal reference ~.
OK, these are some items we need to prepare before installation.
- Download GNS 3 Installer file for your OS here. There are two files you need to download:
- GNS3.VM.VirtualBox.1.5.4.zip, OR
- GNS3.VM.VMware.Workstation.1.5.4.zip. In my case, I choose VMWare Workstation due to VirtualBox doesn’t support KVM.
- VMWare Workstation/Player 10.0.4, you should buy or find another method to get the full version.
- Cisco IOU L2/L3 image files, please don’t ask me to provide!
- WinSCP to transfer file via SFTP.
Once you prepared all those files, then follow these installation and configuration steps as described below:
1] Install GNS3 1.5.4
As usual, you just need to double click GNS3-1.5.4-all-in-one.exe file then follow its instructions. In my experience, I got trouble when it was starting to install Wireshark but I just ignore it then install Wireshark separately to solve this issue.
2] Install GNS3 VM 1.5.4 on VMWare Workstation
Extract GNS3.VM.VMware.Workstation.1.5.4.zip file into your specific folder, it will give you GNS3 VM.ova file. Then import this .ova file into your VMWare Workstation.
Congrats! You just finished install the GNS3 VM now. Until this step, you should be able ping and access (SSH) to the VM. The IP address of VM might be different on other machine. Let’s continue to configure it:
a) Access the GNS3 VM via SSH and get into the Linux console. As mentioned in the screenshot above, the default username and password are gns3. When it shows you dialog menu, select Shell option to enter into the Linux console.
b) As my standard folder, I would create a folder images/IOU under /opt/gns3 directory.
gns3@gns3vm:~$ cd /opt/gns3 gns3@gns3vm:/opt/gns3$ gns3@gns3vm:/opt/gns3$mkdir images gns3@gns3vm:/opt/gns3$cd images gns3@gns3vm:/opt/gns3/images$mkdir IOU gns3@gns3vm:/opt/gns3/images$ ls -l total 4 drwxrwxr-x 2 gns3 gns3 4096 Aug 3 15:37 IOU gns3@gns3vm:/opt/gns3/images$
c) Upload Cisco IOU image files using WinSCP into /opt/gns3/images/IOU directory and don’t forget to change its profile become executable file using chmod command.
gns3@gns3vm:/opt/gns3/images/IOU$ chmod 755 *.bin gns3@gns3vm:/opt/gns3/images/IOU$ ls -l *.bin -rwxr-xr-x 1 gns3 gns3 72726092 Apr 18 2015 i86bi-linux-l2-adventerprisek9-15.1a.bin -rwxr-xr-x 1 gns3 gns3 152677848 May 7 12:18 i86bi-linux-l3-adventerprisek9-15.4.1T.bin
d) Generate IOU License (iourc.txt) using Python script Keygen. I need to create a python script which will be executed using Python. Here I give you two different scripts sample for Python 2.7 and 3.0, you can choose one of them that suitable with your environment:
Python 2.7 script
#! /usr/bin/python print "*********************************************************************" print "Cisco IOU License Generator - Kal 2011, python port of 2006 C version" import os import socket import hashlib import struct # get the host id and host name to calculate the hostkey hostid=os.popen("hostid").read().strip() hostname = socket.gethostname() ioukey=int(hostid,16) for x in hostname: ioukey = ioukey + ord(x) print "hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:] # create the license using md5sum iouPad1='\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A' iouPad2='\x80' + 39*'\0' md5input=iouPad1 + iouPad2 + struct.pack('!i', ioukey) + iouPad1 iouLicense=hashlib.md5(md5input).hexdigest()[:16] print "\nAdd the following text to ~/.iourc:" print "[license]\n" + hostname + " = " + iouLicense + ";\n" print "You can disable the phone home feature with something like:" print " echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n"
Python 3.0 script
#! /usr/bin/python3 print("*********************************************************************") print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version") import os import socket import hashlib import struct # get the host id and host name to calculate the hostkey hostid=os.popen("hostid").read().strip() hostname = socket.gethostname() ioukey=int(hostid,16) for x in hostname: ioukey = ioukey + ord(x) print("hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:]) # create the license using md5sum iouPad1 = b'\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A' iouPad2 = b'\x80' + 39*b'\0' md5input=iouPad1 + iouPad2 + struct.pack('!i', ioukey) + iouPad1 iouLicense=hashlib.md5(md5input).hexdigest()[:16] print("\nAdd the following text to ~/.iourc:") print("[license]\n" + hostname + " = " + iouLicense + ";\n") with open("iourc.txt", "wt") as out_file: out_file.write("[license]\n" + hostname + " = " + iouLicense + ";\n") print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAlready copy to the file iourc.txt\n ") print("You can disable the phone home feature with something like:") print(" echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n")
Save it as CiscoIOUKeygen.py, then execute using Python to generate the Keygen code.
Find this output line and copy it into a notepad file in your Windows OS (Host machine) that already installed with GNS3:
[license] gns3vm = <some ASCII characters>;
and give it name as iourc.txt. We’ll use this file later in our GNS3 setting.
3] Configure GNS3
Now, open your GNS3 application at the Host OS. If this is your first time run this application, it will show you some dialog boxes wizard to configure the settings. However, I prefer to skip it for this tutorial session. From the application menu, please click Edit –> Preferences or you can press CTRL+Shift+P button at the same time then select Server.
You can refer to my Server setting above, your GNS3 VM should be listed on Local GNS3 VM option, then press OK. Now, select IOS on Unix option then you’ll need to pointing the license into folder where you put the iourc.txt file.
Click OK then move to IOU Devices option to create your L2/L3 devices using IOU image files.
I have created two devices for L2 IOU Devices (Switch) and L3 IOU Devices (Router) as a sample. But, you can follow this steps to create/add another devices.
Once you finished, it will appear in the list device on the left menu of your GNS3 application. Then you’re ready to simulate Cisco router/switch using GNS3 VM.
Finally, you can simulate either Cisco L2 or L3 device using GNS3 IOU VM. Hope this is informative for you and thank you for reading my blog! Anything you want to discuss which related to this post, please leave a comment below. Hasta luego!