Unlike something like Packet Tracer which emulates Cisco devices and provides common commands that a CCNA candidate might need, GNS3 is a network simulator that runs actual Cisco IOS so you have access to the full command line and features.It also allows for nodes to have external connectivity so you can connect your routers to connect to the internet or your local servers.
Using GNS3 you can effectively study from the CCNA level to the CCIE level across several tracks. It also allows you to throw other vendors into the mix through VirtualBox or VMware Workstation integration.
- It is free
- It is fairly flexible
- Multi-Vendor friendly
- Relatively simple
- Self contained, you can run GNS3 directly on your computer.
- You can add and remove links on the fly.
- You need to get your hands on Cisco IOS or IOU images.
- You can occasionally experience weird behavior due in IOS if you are doing advanced tasks. Also there is the odd bug and such with the solution.
- Native switching is very poor though IOU provides a switching experience that is closer to VIRL.
Note: A word about IOU, IOU is a leaked internal tool that Cisco uses to simulate network topologies, the CCIE lab is also run on a variant of IOU. However Cisco doesn’t condone by the public so while I will likely use IOU from time to time in this workbook I won’t provide any pointers on how to set it up or get its images. Likewise your on your own when it comes to getting your hands on IOS images.
Let’s look into installing GNS3, it supports Windows, Linux, and Mac so pick what makes sense for you. I’ll be doing the Windows installation, the Mac version isn’t terribly different aside from the actual setup screens, Linux is a bit more involved but you are probably expecting that to be the case if your a Linux user 🙂
- Download GNS3 and also the GNS3 VM image.
2. Now we will go through the fairly boring install, basically keep clicking next.
3. When you get the components you can choose what else you want installed, you will likely want to keep everything checked unless you already have Wireshark etc installed. If your system happens to have WinPCAP 4.1.3 already installed I recommend unchecking it to save some time.
4. GNS3 also offers a free version of Solarwind’s Standard Toolset, I like the tool but already have it so I’ll say no.
Now we will turn our attention to the GNS3 VM, this is an optional component but I prefer working with the VM for a number of reasons. If you choose not to install it for whatever reason then you will pick the “Local Server” option for anything we do here on out.
I will also be using VMware Workstation for the virtualization solution, if you happen to use VirtualBox then the steps will be similar though you may have more troubleshooting ahead of you.
- Unzip the download and import the OVA file by either double checking it or by opening VMware Workstation and going File -> Open
2. GNS3 looks for a VM named “GNS3 VM” by default and it isn’t really worth the trouble of changing that, though you can call it whatever you want then click the “Import” button.
3. Once that is done right click the VM and go to “Settings”
4. Make sure the networking is setup correctly for your environment. In my case VMnet2 is the connection I use. The other interface is fine for now.
5. Start the VM and once it boots have a look at the networking section.
6. By default the VM will use DHCP but if you want to use static, comment out the DHCP line, uncomment out the static lines and change the info to match your network. Press Ctrl + X to save and exit. The VM will reboot after.
It is finally time to actually open GNS3! When you do for the first time you’ll get this setup wizard asking if you are using the VM or just local server (boo local server! Boo!)
- Select Local GNS3 VM and press next.
2. Select VMware and make sure it finds your GNS3 VM.
3. Adjust the amount of ram etc that the VM can use, generally the more the merrier.
When you click Next GNS3 will try to start the VM and connect to it.
4. Now we need to add IOS images for GNS3 to use. Make sure the “Add an IOS router” checkbox is checked. We’ll look at the other options as we need them.
5. We will be running everything off of the GNS3 VM.
6. When you add an IOS image GNS3 will attempt to decompress the image for better performance, it is a good idea to do so. Once that is done it will upload the IOS image to the server.
7. On this screen you can name the image and tweak some of the platform settings if the image allows it. I typically prefer the c7200-advipservicesk9-mz.152-4.M9 image since it supports most of the things I want but you can experiment with other images.
8. GNS3 will automatically select how much ram it thinks your image will need, you can click the link on the page to bring up Cisco’s Feature Navigator to lookup your images requirements.
9. On this page we tell GNS3 what interfaces the router will have be default.
I typically set the first few slots as dual ethernet ports and the last slot as serial in case I want to do some PPP or something.
9. On this page GNS3 will try to find the ideal idle-pc valve for your image. Idle-pc greatly reduces the CPU it takes to run a virtual router so it is highly recommended to set this value. If you are running GNS3 locally you will find GNS3 maxes out your CPU until you find a working idle-pc value, then it typically drops to around 20%
The GNS3 User Interface
First things first lets see what all the various buttons on the top of the program do. We’ll talk about what the features mean as we go.
On the left hand side of the screen we see all the various nodes we can use.
Routers – This has all the routers that GNS3 is configured to use, our C7200 is in the list.
Switches – Since GNS3 doesn’t directly support switching this section has IOU switches GNS3 is configured to use, Router images that are configured with switch moduels, and logical switches that GNS3 provides these include:
- Ethernet Hub – a logical hub that just a real hub doesn’t offer any configuration aside from how many ports it supports.
- Ethernet Switch – a logical switch that supports basic vlans and trunking.
- Frame-Relay Switch – a logical FR switch that can be configured, this will be mostly ignored by me since I’m focusing on the new CCNA.
Hosts – This section provides external connectivity via the Cloud node as well as either VPCS PCs for the topology to use or VMware Workstation / VirtualBox VMs.
Firewalls – This section would have any ASAs that are configured by GNS3, I’ll probably skip this section since it doesn’t quite apply to us.
All Nodes – This section just displays everything GNS3 knows about.
Connections – This button lets you add links between nodes.
We don’t need to mess around with the preferences all that much however you may want to change the default SSH program that GNS3 uses for consoling into the devices. By default it uses SuperPutty but I since I prefer SecureCRT I’ll change it by going Edit -> Preferences -> General -> Console Applications and editing the console command to match my screenshot.
Alright lets start making a topology!
When you first open GNS3 it will ask you to either make a new project or open a new one. You can also just click cancel but it does cause you some mild headaches if you want to use all the features in your session so it is better to just make a new project.
Now we are in GNS3, click the router section and then click the router node we created. Once that is selected click on the center canvas to add a router into the topology. We aren’t getting fancy yet so lets stick with two routers for now. GNS3 will automatically name the routers R1 and R2 respectively, it will simply prefix R to the number of routers in the topology.
Now click the connections button and click on R1, you will see all the available interfaces on the node that we defined when we added the router image. Select the first interface then click the second router, it will also display the list of available interfaces, click the first interface again.
We have now connected R1’s F0/0 interface to R2’s F0/0 interface. Cool!
Next we will add a logical switch into the mix, go to the switch section and select Ethernet Switch then click on the screen. GNS3 is going to ask you if you want the switch to be local or in the VM. Pick the VM since it is a bit cleaner to keep everything together.
Then we’ll click our Add a link button and click on R1. Notice that FastEthernet0/0 shows it is already connected so we will select F1/0 instead.
Then we will connect R1 to SW1’s port 1.
Finally we will connect SW1 port 2 to R2 F1/0.
If we want to customize the logical switch we can right click it and select Configure.
From here we can assign vlans to ports or create trunk ports.
If we wanted to customize one of the router nodes we could select the router and press configure. The take away is that Configure is contextual.
The most common thing to edit on a router is adjusting the slots. You can also change the hostname of the router under general or by right clicking the node and selecting Change Hostname
We can GNS3’s drawing tools to add some logic (or kitties) to the topology, it is no Visio but it is flexible enough to create scenarios or add logical information like showing routing domains.
Working with Devices
At this point we can start the routers (if you haven’t already) and connect to them by either pressing the Console to All devices button or selecting the devices you want, right clicking and selecting Console. GNS3 will add each new device as a tab in your choosen SSH program.
In modern GNS3 whenever you save your config in the devices, the changes are preserved in the project so you can stop the project and continue later on if need be.
You can choose to import or export configurations by either right clicking nodes and selecting the config option you want.
Or you can do it for all devices by selecting Import/Export device configs from the File menu. This is useful for quickly loading configs for a workbook (like this one perhaps!)
GNS3 allows for easy packet captures, simply right click the link you want to capture and click Start Capture.
GNS3 will then ask you what end of the link you want to capture.
Once that is done Wireshark will open in live capture mode, all traffic across the link will be shown! When you are done with the capture you can stop it by right clicking and picking Stop Capture.
GNS3 is also bundled with Solarwind’s Response Analyzer which is a simple tool for keeping track of connections and their stats. Once a capture is started, you can right click the link for a second time and choose Analyze Capture then pick the link.
Alternately you can save the wireshark file and open it within the Response Analyzer.
Running GNS3 locally is great but there are some cases where you may want to run it remotely. Some reasons might include you want to install the GNS3 VM on a more powerful ESX server or you want to do a large topology so you want to load balance between a few GNS servers.
Fortunately it is pretty easy to add a remote server, go to Edit -> Preferences -> Server -> Remote Servers and enter in your server information. HTTP is typically fine and your default login for a GNS3 VM is gns3/gns3, if you are connecting a local server you will need to use credentials that let you connect to that computer. When you are done press Add.
Now we have a remote server, move down to Dynamips -> IOS routers then click Add.
In the new image screen (we saw this from the beginning) we will pick Run the IOS on a remote computer option and make sure our remote server is shown on the bottom. If you have multiple remote servers you can choose to load balance between them.
Then we can either pick an existing image running on the remote server or upload a new one. One caveat is that GNS3 can’t remote start a VM so the GNS3 VM will need to be always running.
GNS3 also includes the Virtual PC Simulator node which is a simple lightweight “PC” that lets do basic testing in your environment. Lets test this out by adding a VPCS node to the topology and connecting it to our switch.
Lets test this out by setting up HSRP on the router’s F1/0 interface.
R1(config)#int f1/0 R1(config-if)#ip add 10.0.123.11 255.255.255.0 R1(config-if)#standby 1 ip 10.0.123.1 R1(config-if)#no shut R2(config)#int f1/0 R2(config-if)#ip add 10.0.123.12 255.255.255.0 R1(config-if)#standby 1 ip 10.0.123.1 R2(config-if)#no shut R2(config-if)# *May 27 01:27:57.683: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up *May 27 01:27:58.683: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
The VPCS node has a simple CLI that lets you setup an IP address and do a variety of diag tests like pings.
PC1> ? ? Print help ! COMMAND [ARG ...] Invoke an OS COMMAND with optional ARG(s) arp Shortcut for: show arp. Show arp table clear ARG Clear IPv4/IPv6, arp/neighbor cache, command history dhcp [OPTION] Shortcut for: ip dhcp. Get IPv4 address via DHCP disconnect Exit the telnet session (daemon mode) echo TEXT Display TEXT in output. See also set echo ? help Print help history Shortcut for: show history. List the command history ip ARG ... [OPTION] Configure the current VPC's IP settings. See ip ? load [FILENAME] Load the configuration/script from the file FILENAME ping HOST [OPTION ...] Ping HOST with ICMP (default) or TCP/UDP. See ping ? quit Quit program relay ARG ... Configure packet relay between UDP ports. See relay ? rlogin [ip] port Telnet to port on host at ip (relative to host PC) save [FILENAME] Save the configuration to the file FILENAME set ARG ... Set VPC name and other options. Try set ? show [ARG ...] Print the information of VPCs (default). See show ? sleep [seconds] [TEXT] Print TEXT and pause running script for seconds trace HOST [OPTION ...] Print the path packets take to network HOST version Shortcut for: show version To get command syntax help, please enter '?' as an argument of the command.
To see what kind of options we have for setting an ip we’ll just type ip all by its self.
ip ARG ... [OPTION] Configure the current VPC's IP settings ARG ...: address [mask] [gateway] address [gateway] [mask] Set the VPC's ip, default gateway ip and network mask Default IPv4 mask is /24, IPv6 is /64. Example: ip 10.1.1.70/26 10.1.1.65 set the VPC's ip to 10.1.1.70, the gateway to 10.1.1.65, the netmask to 255.255.255.192. In tap mode, the ip of the tapx is the maximum host ID of the subnet. In the example above the tapx ip would be 10.1.1.126 mask may be written as /26, 26 or 255.255.255.192 auto Attempt to obtain IPv6 address, mask and gateway using SLAAC dhcp [OPTION] Attempt to obtain IPv4 address, mask, gateway, DNS via DHCP -d Show DHCP packet decode -r Renew DHCP lease -x Release DHCP lease dns ip Set DNS server ip, delete if ip is '0' dns6 ipv6 Set DNS server ipv6, delete if ipv6 is '0' domain NAME Set local domain name to NAME
Finally we’ll set the ip address to be 10.0.123.100
PC1> ip 10.0.123.100 255.255.255.0 10.0.123.1 Checking for duplicate address... PC1 : 10.0.123.100 255.255.255.0 gateway 10.0.123.1
Now we should be able to ping our router’s VIP.
PC1> ping 10.0.123.1 10.0.123.1 icmp_seq=1 timeout 84 bytes from 10.0.123.1 icmp_seq=2 ttl=255 time=6.569 ms 84 bytes from 10.0.123.1 icmp_seq=3 ttl=255 time=6.050 ms 84 bytes from 10.0.123.1 icmp_seq=4 ttl=255 time=5.573 ms 84 bytes from 10.0.123.1 icmp_seq=5 ttl=255 time=4.542 ms ^C PC1>
We can also use the host node to make our GNS3 VM or local server reachable to the topology. Alternately we can add a VM found in VMware Workstation or VirtualBox into the mix by selecting the virtual machine in Preferences under VirtualBox VMs or VMware VMs.
One advantage that running a Local Server has over the VM is that you can use the snapshot feature to “go back” to an earlier topology. This can be handy when say working through a workbook where you are using a standard topology for most of the section but then you get to a single lab where you need to change a bunch of interfaces around or add some nodes. With Snapshots you can simply save where you were and go back to it later.
To take a snapshot, stop the devices if they are running and then press the Manage Snapshots button. Click create and enter a name for the snapshot.
Once it is done we will see the snapshot and the time it was created. Now our topology is saved which is a good thing because it would take us weeks to remake it!
Now we will change our topology a bit.
Next we will test this out by going back into Snapshot Manager and press the restore button.
It will give us a warning and then it will restore our original topology.
We’ll close this up by talking about providing external connectivity, this is achieved by using the cloud node, once you add it to the topology you have to configure it to suit your setup. Most of the time using the Generic Ethernet section is all you need for this work, add your VMs second interface and click ok. You may need to adjust your VMs networking for the second nic in VMware Workstation if you didn’t do it earlier.
Next we simply connect the cloud node to a router. You can only connect a single cloud node to a single device so you will need to create multiple clouds if you want a bunch of external connectivity.
Now on the router if I give the F2/0 interface a LAN IP on my network and enable OSPF it peers with my lab routers and switches!
R1(config)#int f2/0 R1(config-if)#ip add 10.10.2.80 255.255.255.0 R1(config-if)#ip ospf 1 area 0 R1(config-if)#no shut R1(config-if)# *May 27 01:45:18.423: %OSPF-5-ADJCHG: Process 1, Nbr 126.96.36.199 on FastEthernet2/0 from LOADING to FULL, Loading Done