What is GNS3?
GNS3 is abbreviation for Graphical Network Simulator that allows IT students to simulate complex networks that will help them to prepare seriously for CISCO certificates (CCNA, CCNP, CCIE, etc.), Juniper certificates (JNCIA , JNCIS, JNVCIE), Microsoft certificates (MCSA, MCSE, MCITP) and Red Hat certificates (RHCE, RHCT), and it will help IT administrators to implement any technology and test it before purchasing this technology.
Graphical Network Simulator (GNS3) is an open source project that allows you to download the source code and read it for any kind of educational purposes and / or contribution purposes. It works for multiple operating systems (Windows, Linux, Mac OS X), and the most beautiful thing is that GNS3 now is integrated to both VMware and Virtualbox. All versions before 0.8 don’t support
Virtualbox, so take care about which version you will use if you deal with Virtualbox.
Download and Installion
To download GNS3, you have to download it from the official page here. As mentioned earlier,GNS3 supports three different operating systems (Windows, Linux, and Mac OS X) .
The first step in the installation process is to download the all-in-one version from SourceForge here. After downloading, go to the folder that holds the GNS3 executable and double click on it. The wizard will begin directly and it is easy to configure.
As we can see, GNS3 needs to install some components like WinPCAP (used for sniffing packets), Dynamips (Cisco IOS emulator), and Qemu (a generic and open source machine emulator and virtualizer).
The last step in configuring GNS3 in Windows operating systems is to define your own CISCO IOS files. You have to buy the CISCO IOS file for your desired platform and use it in the lab enviroment for educational purposes. You can download it from the Internet for free from torrent sites but of course it breaks CISCO policies and it’s illegal.
The supported platforms are CISCO 7200, 3600 series (3620, 3640 and 3660), 3700 series (3725, 3745) and 2600 series (2610 to 2650XM, 2691).
To add your CISCO IOS image to the GNS3, go to edit, then IOS images and hypervisor, then add your own IOS , then determine your platform and your model, and finally add your IDLE PC value, which is eight hex values (reduces the processor usage). After configuring your router or switch, let the device determine its best value for the IDLE PC, as you can see from the following image.
Then click the save button and then the close button.
For installing GNS3 in the Linux operating system, there are two ways:
1- Install GNS3 using Ubuntu Software Center
2- Install GNS3 from the source code
The first way is the easiest way for configuring GNS3 in the Linux operating system.We can do it by command line or from Ubuntu Software Center. So by command line, type in the following command in the terminal:
sudo apt-get install gns3
It will ask you to download their dependencies software, the software that we have mentioned in the Windows installation.
Or download it from Synaptic Package Manager. To find it, go to the system menu, then choose Ubuntu Software Center, then search for GNS3 and then click the install button, as you can see from the following image.
Put in your mind that when downloading GNS3 from command line or Ubuntu Software Center, it will not install the latest version of it, so you have to download it from the source code, and that is what we will talk about now.
The second way is install GNS3 from the source code. To install it, we must download the source code file from the download page on SourceForge here. Then we have to extract the zipped file by right clicking on it, then choose extract.
- Dynamips 0.2.8-RC3-community binaries for Windows
- Dynamips 0.2.8-RC3-community binary for Mac OS X (Intel 64-bit)
- Dynamips 0.2.8-RC3-community binary for Mac OS X (Intel 32-bit)
- Dynamips 0.2.8-RC3-community binary for Linux (32-bit)
- Dynamips 0.2.8-RC3-community binary for Linux (64-bit)
- Dynamips 0.2.8-RC3-community sources
- Dynamips 0.2.8-RC2 binaries for Windows
- Dynamips 0.2.8-RC2 binary for Mac OS X
- Dynamips 0.2.8-RC2 binary for Linux (32-bit)
- Dynamips 0.2.8-RC2 binary for Linux (64-bit)
- Dynamips 0.2.8-RC2 sources
So we will download Dynamips 0.2.8-RC3-community binary for Linux (32-bit) and we have to make it executable by allowing the execution bit. Then run GNS3 script and the other steps will be the same as the Windows installation.
Sometimes you will get the following error while connecting between devices: “206 unable to create generic ethernet nio”. It may occur because of permission issues. For further details about that error, please visit the GNS3 forum here.
You may also find the error “baseconfig.txt no such file or directory”. To solve it, just remove baseconfig.txt information while you define your CISCO IOS image. For further details, please visit the GNS3 forum here.
Now it’s time to demonstrate how to use GNS3 in a simple topology. I draw my topology in a program called DIA. As you can see from the following picture, the topology is so simple.
Our lab requirements are :
1- vmware workstation
2- two virtual box (XP1 , XP2)
Configuring the Virtual Network
First of all, we have to configure the VMware workstation nework, so go to Edit -> Virtual network editor. There are 10 different Virtual Network Interfaces (VMnet0 to VMnet9).
VMnet 0 is configured for bridging and VMnet8 is configured for NAT, and both of them shouldn’t be modified. Other VMnets we can modify for any values we need to.
So in this demo we will create two networks, VMnet 2 and VMnet 3. Also we will configure the DHCP service to work with this network.
We will configure VMnet2 as a host only by choosing the hostonly option. The VMnet2 IP address
will be 192.168.2.1 and DHCP service IP ranges start from 192.168.2.1 til 192.168.2.254.
The same thing for VMnet3;, IP address will be 192.168.3.1 and DHCP service IP ranges start from 192.168.3.1 till 192.168.3.254. We are using DHCP service for distributing IP addresses to Vms that are connected to this network interface.
Installing and Configuring Virtual machines
We will install Windows XP Service Pack 3 in VMware and called it XP1 so go to File -> News ->
Virtual machine, then keep the default option on VMware hardware capability and click Next. Tthen choose Custom (Advanced) and click next, then choose the installer disk image file, then choose Windows
XP Service pack 1disk image (.ISO) and click Next.
It’s time to choose the name of the machine. Here I’ve choosen XP1. Then specify the path where you want to keep VMware files and click Next.
Chose the proper processor info. If it’s a processor with 2 cores then select No. of Processors: 1 and
No. of cores per Processor: 2 and click Next.
It’s time to allocate memory RAM, so for Windows XP SP3 we will allocate 512 MB of
RAM, then click Next.
In the network type, choose anything because we will configure it later, but you can choose ’Use Bridge Networking’ to enable an Internet connection to your guest machine in VMware, and click Next.
Then we will choose the recommended I/O adapter and click Next. Then we will select ”Create a New Virtual Disk” to create a new virtual hard disk, then click Next. Then use the recommended disk type and click Next, now it’s time to specify 20 GB of disk space and make sure that “Store virtual disk as a single file” is checked and click Next. Finally specify the disk file name and the location where it will be stored, then click Next.
It’stime to customize the Hardware to install additional VMnets that we had created. Because we should assign each guest machine to a different network, we will assign XP1 with Vmnet2, which has the network port 192.168.2.0, and assign XP2 with Vmnet3, which has the network port 192.168.3.0.
So we will follow these instructions:
1- Click on ‘Customize Hardware’ and click on Add.
2- Select Network Adapter and click Next.
3- Chose Custom and select VMnet2.
4- Check ‘Connect on Power on’
Here are some notes:
1- The previous instruction for adding a network adapter in XP1 has us select VMnet2, so when adding a network adapter in XP2, we have to select VMnet 3.
2- To work with the host machine use ctrl+alt.
3- To work with the guest machine use ctrl+g.
So after installation, if we configured the network adapter right, we should see that the guest machine took its IP address from the DHCP service and connected with VMnet2 and VMnet3, so XP1 IP address should be 192.168.2.2 and XP2 IP address should be 192.168.3.2.
- GNS3 Installation
Double click on the all-in-one installer, and install with all default options. Keep clicking ‘Next’ until install is finished, as we mentioned in the Windows installation part earlier.
Now open GNS3 from Desktop. To start working with GNS3, you must have CISCO IOS, so press CTRL+SHIFT+I , you will get a box called “IOS images and hypervisors”.
So now we have to enter the path of the CISCO IOS file, and you should make sure that the platform and model is appropriate to the images file you have selected.
Now we have to start a new project, so press CTRL+N, then put in the project path to store your project there, and make sure you have checked “Save nvrams and other disk files” and
“Export router configuration files”.
So now we are gonna drag the router C3600 icon from the left panel to the work space. Now the router has been configured, then right click on the router R1 and click on configure and go to slot option and add two NM-1FE-TX in slot0 and slot1 (here we add two Fast Ethernet cards) and click on OK.
It’s time to start the router, so right click on the router and click start, then right click on the router and click on console to start the telnet session to configure the router. Now choose the IDLE PC value by right clicking on the router and clicking on IDLE PC. Select the value which is marked with *. By doing this the processor utilization is very much reduced.
Now it’s time to create another router, C3600, and add two fast ethernet interfaces. Right click on the router and click start, then another right click on the router and click console. We will configure our routers later. Of course we can rename our routers by right clicking and choosing “change the host name”.
Connecting Virtual Machines to the Routers
Now we will connect our virtual machines running on VMware to our routers like our topology.We will connect XP1 with Router 1 and XP2 with Router2.
We will connect our virtual machine as a cloud. To do that we must follow these steps:
1- Drag the cloud, present on the left nodes panel, to our workspace.
2- Right click on the cloud and click on configure.
3- In the ‘Generic Ethernet NIO’, select the appropriate VMnet to be connected and click on
ADD and click on OK.
In the third step we will add VMnet 2 with XP1 and VMnet 3 with XP2.
Now we will make the same thing for XP2 by adding VMnet 3 to it.
The configuration we will write in Router 1 are the same as with router 2, but with some differences.
To configure the interfaces :
1- open the console of the router
2- enter the enable mode and write “config terminal”
3- To configure IP addresses of interfaces, write the following commands. Write this configuration for each interface (you should take care for router interfaces and IP addresses of each interface).
Router(config)# int fa 0/0
Router(config-if)# ip add 192.168.2.3 255.255.255.0
Router(config-if)# no shut
4- To configure the routing protocol, we will use RIP V2, but you should take care because the
network command IP addresses differ according to your topology for each router.
You should do the same configuration for the other router, and finally you should be able to ping from XP1 to XP2. Congrats, you have a working topology for any type of testing.