Setting Up GNS3, Part I: Initial Configuration

When I began looking at the world of Cisco certifications, I was overwhelmed by the sheer amount of material there was to learn.  Sure, I went at the CCENT with a baseline knowledge of networking gained from the CompTIA Network+ (and some associated concepts from the Security+), but not everything on the exam is listed on the objectives.

Case in point: establishing a home lab environment.

All the objectives tell you that you need to know is how to configure certain specific feature sets, like VLANs on switches.  That’s great.  But how are you going to do that?  Purchasing lab equipment costs money, and when you’re just starting out you aren’t going to know the differences between a 2950 or a 3570.

The cheapest, easiest option is to download Cisco Packet Tracer.  It’s a great program.  To be honest, that’s what I used for the CCENT, because when I looked at my options it was either that or GNS3 and the first time I tried to figure out how to get GNS3 working my mind almost exploded.

Packet Tracer has limitations though.  Not all commands work in Packet Tracer, and some of them are exam topics you need to know.  If I recall correctly, VTP and STP are two of the feature sets that don’t work properly in Packet Tracer, and those are both important.

My goal here is to provide you with a clear, concise path toward installing GNS3 and getting your first lab up and running based on my own lessons learned from a lot of Googling, swearing, and hair-pulling.

With that said, only real hardware will give you the true, unadulterated experience of working with the Cisco IOS.  Everything in GNS3 is a router in disguise, which means that certain commands – like show vlan – don’t work as expected.  Other features like ip routing should be disabled when you’re emulating a switch.  I will detail these below as well where appropriate.

Download GNS3

The first step is to download GNS3.

This is a bit misleading, though, as there is one important caveat:

If you plan to pursue the CCNA Security certification, or if you plan to emulate a Cisco Adaptive Security Appliance (ASA) at any point, DO NOT DOWNLOAD THE CURRENT RELEASE.  Instead what you need to do is this:

  1. Browse to the GNS3 website at gns3.com.
  2. Click the DOWNLOAD option from the top menu bar:gns3-menu
  3. BELOW the standard, eye-grabbing download icon, click the option to download Version 1.3.13gns3-downl
  4. You will then be taken to the GNS3 GitHub repository. Don’t worry if you’ve never used GitHub and are starting to get intimidated; just download the file named GNS3-1.3.13-all-in-one.exe:gns3-down2
  5. Install away, just like your favorite aunt with all those memory-hogging aftermarket toolbars on her Edge browser.

Import Device Images

Now, we all have a Totally Legit Source for Cisco IOS router images, right?  A working image file garnered off of a Cisco device?  Well, to be honest, I acquired mine after watching Keith Barker’s CCNA Security videos on CBT Nuggets and going some tactical Googling.

CAUTION!
Downloading random files off of the internet is always questionable.  Make sure you have an up-to-date antivirus running (at a bare minimum).

Once you have your image files downloaded, you’ll want to follow the steps below to get them added into GNS3:

  1. In the toolbar, click Edit and then Preferences… to open the Preferences interface.
  2. Under the menu entry for Dynamips, click on IOS routers and then click the New button.
  3. Click Browse, navigate to where you have your image file saved, select it, click Open, then Next.
  4. On the Name and platform screen, keep the default information in place and click Next.
  5. For the Memory screen, bump the Default RAM setting up to at least 256MiB, then click Next.  This is necessary to get Spanning Tree Protocol to work properly in server/client mode later down the line.
  6. Keep the default settings on the Network adapters screen and click Next.
  7. Same with WIC modules – keep the defaults, click Next.
  8. On the Idle-PC screen, click Idle-PC finder.  This will open a progress window.  Wait for this operation to complete and click OK, then click Finish.
  9. Repeat this process for any other router images you may have come across (i.e. the c7200).  You’re done!

Configuring Routers as Switches

Remember when I said that everything in GNS3 is really a router in disguise?  Here’s where that starts coming into play.

In order to configure a device as a switch, you will need to load a router into your topology, add an etherswitch module to it, give it a good spit and polish, then send it out into the world.  Let’s get started.

  1. In your GNS3 project file, click the router icon on the left, select the model of your choice (I’m going to go with the c3725 here), and drag it out into your topology.  It will start up as a router, i.e. R1.  Your screen layout may vary slightly from mine — but you’ll get the idea.
  2. Right click the device, then click the Configure option.
  3. In the Node configurator screen, click on your device to open the device configuration screen (shown here as R1 configuration).  Go ahead and change the name of the device to something…switch-like.  I went with the classic SW1 here but feel free to use your imagination, as long as it’s something that reminds you that you’re dealing with a (soon to be) Layer 2 device.
  4. Click the Slots tab.  Under Adapters, click the drop-down box next to slot 1 and select NM-16ESW.  This module adds 16 FastEthernet switchports to your router.  Click Apply, then Okay to close out of the configuration screen.
  5. Now we’re going to make it look like a switch.  From the topology screen, right click your new switch again, then select Change symbol.  Scroll all the way to the bottom, select ethernet_switch, the click Apply and OK to close back down to your topology view again.  Congratulations — you technically have a switch now!

    From here, I recommend going one additional step further and disabling IP routing on the device to ensure it actually functions as a Layer 2 switching device.

  6. Above your topology, click the green Start arrow to boot up the device.  You’ll notice that the red dot next to the switch in your Topology Summary turns green once the device has started.
    (Alternatively, you could right click the device and select Start.  This boots up only that specific device; using the green Start arrow at the top of the screen boots up ALL devices in your topology.)
  7. Once the switch has started up, right click its icon and select Console.  This, rather intuitively, brings up a console connection to the device where you can begin entering configuration commands.  It will drop you straight into enable mode by default, as indicated by the pound sign behind the switch’s hostname.
  8. From here, disable IP routing by first moving into global configuration mode with the configure terminal command.  Then disable IP routing by entering no ip routing.
  9. Enter the exit command to drop back into enable mode, then enter copy running-config startup-config and press enter a second time to accept the filename startup-config and save your configuration.

That’s it!  You’re officially done implementing your first switch.  To add a second switch to your topology, simply follow these steps over again.  After you do it a few times it will become second nature — I promise.

Using a router as a switch will take some practice.  There are certain commands which do not operate the same way you might expect if you’re going off the Cisco Press material or anything similar — for example, the command show vlan doesn’t work; instead you have to use show vlan-switch.  This, too, comes with practice, and liberal use of the question mark will help you work your way through it.

Connecting Devices

Now that you have a router and a (router set up as a) switch, let’s get them connected in a simple router-on-a-stick configuration.

  1. Start off at your topology view with a router and a switch in place.
  2. On the left hand side of your screen, click the Add a link button.
  3. Click on your router and pick an interface — I’m going with FastEthernet0/0 here.
  4. Click your switch and select an interface.  For the sake of accuracy, using the interfaces which start with the number 1 are in your etherswitch module, so I’m going with FastEthernet1/0.

Voila.  Now you have a router, you have a switch, and they’re connected together.  From here you can begin setting up your first lab environment — simply add devices as appropriate.

In a future blog post, I will detail how to implement a Cisco ASA in GNS3, as well as adding a WAN connection out to an ISP.  (Spoiler alert: it’s a router in disguise.)