This article and the next one following it will be precursors to a series we will be starting on the Cisco Configuration Professional (CCP) which will be especially helpful to those studying for their CCNA Security certification exam.
For those who want a more realistic and flexible configuration environment while preparing for their certification exams or even lab environments in general, GNS3 is a good option which is also free (except, of course, the Cisco IOS that will be used). In this article, we will be considering how to connect GNS3 devices (e.g. routers, ASAs, etc.) to a host system such as the one GNS3 is installed on or even virtual machines. I have used this method during my CCIE prep to build full labs including Intrusion Prevention Systems and Windows server operating systems.
CCNA Training – Resources (Intense)
I’d be using GNS3 version 0.8.3.1 and although there is a newer version out now, the basics will be the same. First, we will take a look at the ‘Node Types’ in GNS3 and the ones that we will make use of for this article.
This article is not an introduction to GNS3, so we will not look at all these node types in detail but they are mostly self-explanatory. You have several variations of routers, switches, firewalls and hosts. One thing to note in the diagram above is that an “EtherSwitch router” is just a router installed with switch modules. Also, a “Host” is just a ‘Cloud’ with a PC symbol. The different symbols help you differentiate your devices on the GNS3 design stage.
In this article, we will be connecting a router to our host system using a loopback interface. This is mostly helpful to simulate a host on a local area network. Using a loopback interface is non-intrusive because you can modify the settings without affecting other connections, for example, your wireless Internet connection.
For any connection you need to make outside GNS3, you will need a ‘Cloud’. Like I said above, a ‘Host’ is a Cloud with a PC symbol. In fact, we can change symbols of GNS3 devices to suit our needs.
For this article, we will be using one router and one host. My basic setup is as shown below:
Let’s change symbols and hostnames to give you an idea of how it is done. Just right click on the device you want to edit and select what you want to do. Keep in mind that there will be different options depending on the device you right-click on.
The screenshot below is a snippet of some symbols you can use.
After my changes, this is what my setup looks like:
A note on hostnames: You can only use alphanumeric characters meaning spaces or even hyphens (“-“) are not allowed. As you can see from above, underscores are allowed.
Configuring your Cloud/Host
We can now go ahead to configure our cloud. I mentioned that we will be using a loopback interface and I assume you already have one configured on your system. If you don’t, you can do a quick search on Google for how to. For example, you can see how to configure a loopback interface on Windows 7 here.
To configure a device, we double-click on it or right-click and select “Configure”. The node configuration screen comes up as shown below:
Select the node you want to configure (in our case, My_Host) and the node configuration page loads up.
I’m using a Windows OS so we would be focusing on the “Generic Ethernet NIO” section. Notice the “Administrator or root access required” text: running GNS3 with root or Administrative privileges will also save you a lot of hassle.
The dropdown box gives us a list of all the adapters on our system. As you can see from the screenshot below, I have a couple of adapters including virtual machine interfaces, Bluetooth, Wireless and so on.
It may be worth expanding the screen so that you see the list properly because right now, I don’t know which one of them is my Loopback adapter.
Once you select the adapter you want to use, it will be filled in the text field below and you can then use the Add button to make it accessible to the cloud.
Also keep in mind that you can add more than one adapter to the cloud but it could get clumsy when selecting it back in the GNS3 design stage because of the “weird” names.
We only need one adapter in our case so I will go ahead and click on the OK button at the bottom of the screen. This will take us back to the GNS3 design stage like nothing happened but you will know it got applied when you try to use that adapter.
Connecting the host to the router
We can now use the ‘Add a link’ button to connect the host to the router.
A FastEthernet interface will work well for us so I will select that and click on the Host.
Notice that it does not show us whether it is a Loopback or a Wireless adapter name but shows the system name of the adapters. Perhaps there’s a way around this that I don’t know of yet. This is why I said it may be a problem to select the right adapter if you have multiple adapters on one cloud.
If we didn’t configure an adapter for the cloud, and tried adding a link, we will have gotten an error dialog box similar to the one shown below:
At the end of my setup, this is what I have:
I connected the cloud to the Fa0/0 interface of my router.
Configuring the router
We don’t have to do anything extra (outside of normal Cisco configuration) on the router to get it to work with the cloud. Of course if you want connectivity (which I suppose you do), you need to configure an IP address on the router’s interface. I am using a 192.168.10.0/24 on my loopback interface with a default gateway of 192.168.10.1. I can use this IP address for my router. It really depends on your design and what you are hoping to achieve. In the next article, we will consider the default gateway problem.
In theory, everything should work now so you should be able to ping your host from the router and vice versa.
However, as shown above, that is not always the reality. The host can ping the router but the router cannot ping the host. Before you go off in a frantic search for the error in your configuration, think about two things: firewall and antivirus software, both operating on the host machine. If you didn’t know about these things, you will be really stressed and probably be like this guy:
(Photo credit: www.dougblackie.com)
Moving on, I know my firewall is turned off but I also have antivirus software that has a firewall. I’d turn off the firewall feature of my antivirus for now and ping again.
We now have dual connectivity. Let’s wrap this article up at this point.
In this article, we looked at a way to connect GNS3 devices to real (or virtual) host machines because GNS3 does not have pre-installed OS emulators like Packet Tracer or other emulation software. This is a good thing because we can keep everything real.
We walked through the process of connecting a router to our host PC by adding a loopback adapter to our GNS3 cloud. We also discovered that host firewalls and antivirus software can prevent connectivity so they may need to be turned off or configured with exceptions.
In the next article, we will use another adapter to connect our hosts, for example, our wireless internet connection. Using this method, we can connect our GNS3 routers to the Internet.
I hope you have found this article helpful and I look forward to the next article.
GNS3: Graphical Network Simulator: http://www.gns3.net/
How to install Microsoft Loopback Adapter: http://social.technet.microsoft.com/Forums/windows/en-US/259c7ef2-3770-4212-8fca-c58936979851/how-to-install-microsoft-loopback-adapter