Why you should be using GNS3 and How to start

I have been mentioning the GNS3 for last 2 Networking blog posts and still using Cisco Packet Tracer to show network topologies and Router Configurations. So, I believe the time has finally come to say a few words about GNS3.

After this, I will be able to use GNS3 in some future blog post about networking and not feel bad about it. :)

What is GNS3?

GNS is a shorthand for Graphical Network Simulator. GNS3 allows you the emulation of network hardware on your PC, similar to Windows Virtual PC. Windows Virtual PC enables you to run operating systems inside the virtual environment. You may have heard of Windows XP mode in Windows 7 for example.

GNS3 does basically the same. It emulates network hardware and enables you to run Cisco IOS on your computer. I guess by now you already realized that this ROCKS big time! Why?

For instance, Packet Tracer is a limited tool. It has only those commands that are necessary for a CCNA exam practice, and lacks advanced functionalities. On GNS3 you run complete Cisco IOS, which means you see everything and work with everything exactly as you would if you connected to a real Router via the console cable. You also have access to all the functions and their parameters in the Cisco IOS.

The Catch

One little catch is that you must provide your own Cisco IOS images to work with GNS3. Well, that shouldn’t be too hard for you, you know with all the modern search engines and such. And there is software to help you, such as IOSHunter for example.

The list of supported hardware is available at the GNS3 website, but IOS Images aren’t that large. Larger ones are about 25 MB, so you don’t have to be too picky about which ones to acquire.

Another tricky thing could be your high CPU usage when running GNS3, but there are ways to deal with that and we’ll get to them.

Install & Configuration

You can obtain GNS3 at the GNS3 website, imagine that! And there’s a big green button labeled Download, you can’t miss it.

Of course, download all-in-one package which automatically installs everything you need.

Installation is very easy, no need to go into details or screenshots. The installer will also prompt you to install WinPcap. Basically, if you ever installed a program under Windows you should be fine. If you didn’t you’ll be fine also. Just keep clicking Next. :)

After you install and run GNS3 you will see a screen similar to this:

Also, you will see a Setup Wizard screen to which you can use to configure Dynamips and add IOS images.

GNS3 Setup Wizard

If you clicked OK immediately, don’t worry. To check Dynamips configuration simply go to: Edit -> Preferences and switch to Dynamips. There you can change the configuration and test it with the Test button.

But, generally there’s no need for path configuration, because installer configures Dynamips location for us. For advanced configuration settings please check the official GNS3 documentation.

So, let’s add images to GNS3. Either click on the button 2 in the Setup wizard or go to Edit -> IOS images and hypervisors.

A screen will open where you can add IOS Images.

Once you select the IOS image you obtained earlier, GNS3 will attempt to recognize the platform and model that the image is for. Make sure that the platform and model are appropriate for the image you choose. Also I recommend to put a little extra effort and use the link „Check for minimum RAM requirement” and configure the value based on the information for that particular image.

After you’re done with one image, click save. Then you can select another, configure it and click save again until you’re done.

Once you have at least one image you’re ready for action.

Router configuration

For start, drag only one Router for which you have the image to the middle section. I used Router c3600. Once you have it there right click it and select Configuration.

Once you’re in the configuration click on R1 and switch to the Slots tab. Here you can add adapters to the router. Add the Fast Ethernet interface to the router by selecting an adapter that contains letters FE. You can also add other adapters. You should definitely add an adapter with Serial interfaces for router-to-router connections.

Once you finish adding adapters, we need to start the router. Right click on the router and choose Start. When you start the router your PC’s processor usage will go to 100%, so we need to do something about that. Right click on the R1 and choose Idle PC.

GNS3 will spend a few moments calculating Idle PC values and will present you a window to choose the Idle PC value. As GNS3 says, potentially better Idle PC values are marked with an asterisk. So, choose Idle PC value.

When you choose Idle PC value you will notice the CPU usage has dropped. That’s because now GNS3 puts to sleep any routers that aren’t being used. There is a better technical explanation in the documentation if you’re interested.

OK, that’s all the configuration needed to use routers in GNS3.

Hosts

GNS3 also enables you to have hosts. As with routers you mush have a host image. Luckily, there is a great image available on the GNS3 website, under downloads. It’s called Microcore Linux Qemu image and it’s about 35 MB in size.

Once you download the image, we need to tell GNS3 where it’s located. Go to Edit -> Preferences -> Qemu and switch to the Qemu host tab.

Under „Qemu Options” add -no-acpi. OK, that’s it. GNS3 is ready to rock. Let’s create a simple topology.

Simple topology

Create topology like in the picture:

Addresses used:

  • Host network connected to R1 - 192.168.1.0/24
  • Network between the routers - 172.16.0.0/30

To add cabling there is a button on the GNS3 tool bar labeled Add a link. Once you added links, you can verify on which interface it’s connected by hovering the mouse above the cable. You also can see the connections in the right site of the GNS3 window, under Topology Summary, if you expand the nodes.

Our goal is to be able to reach PC from R2. and we’ll use one static route to do so. So, nothing complicated at all, just a simple example how to work with GNS3.

Once you created the topology, start Router R1 by right clicking it and choosing Start. If you used same router this time you don’t need to calculate Idle PC value, because it’s already calculated for that IOS version.

After you start the router right-click it and choose Console. Putty window will open and you’ll be in the EXEC mode.

From there it’s easy to know what to do. :) So, let’s configure R1:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:01:24.291: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:01:25.291: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

And the Serial interface:

R1(config-if)#int ser0/0
R1(config-if)#ip add 172.16.0.1 255.255.255.252
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:02:38.251: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:02:39.255: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
*Mar  1 00:03:02.883: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down

That’s it for R1. When you enable R2’s Serial interface, link will be UP/UP.

Time for R2. Start it first, and go to console. So, let’s configure R2:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#int s0/0
R2(config-if)#ip address 172.16.0.2 255.255.255.252
R2(config-if)#no shut
R2(config-if)#
*Mar  1 00:01:05.367: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:01:06.371: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up

We can verify that the link is working:

R2(config-if)#do ping 172.16.0.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/168/388 ms

However, we still cannot ping R1’s interface FastEthernet1/0, because R2 doesn’t know how to reach 192.168.1.0/24 network. For more information refer to the Introduction to Routing blog post.

So, we need to add a static route to R2, so it knows how to reach 192.168.1.0 network:

R2(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.1

Once we added the static route it works:

R2(config)#end
R2#
*Mar  1 00:12:07.015: %SYS-5-CONFIG_I: Configured from console by console
R2#ping 192.168.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/119/236 ms
R2#

OK, now just to configure the host, so it can ping R2 and vice-versa. As with the Routers, right-click on a host and choose Start.

Once started, a QEMU window should open and eventually you’ll get to the prompt. Once on the prompt we can configure an IP address on the Ethernet interface. We use the Linux ifconfig command:

sudo ifconfig eth0 192.168.1.17 netmask 255.255.255.0

When you configure an IP address on an interface, the interface is brought UP. Now we can ping our default gateway on 192.168.1.1. Note that we didn’t even need netmask part of the command, but it’s nice to know how to configure it should the need arise.

Now just to add the default gateway to the host:

sudo route add default gw 192.168.1.1

Once we added the default gateway, we can reach R2 from the Host, which means we successfully finished our little topology.

In this short blog post, we went over the basics of GNS3. So, in any future blog post about Networking we can skip GNS3 basics and dive immediately into good stuff.

However, please note that this was an introduction. If you need further help with GNS3 and it’s configuration, or have some problems, best place to turn is the documentation and forum on GNS3 website. Both have been extremely helpful in both my experiences with GNS3, as with writing this blog post.

Thanks for visiting, stay tuned.

Comments are closed