One of the most useful (and cheapest!) ways to learn is to practice with Dynamips, Dynagen, and GNS3. In this post, I’ll show how I configure my environment – both for ccie lab practicing, as well as testing new configurations when other people are hogging the real lab routers at work.
I have two servers that I use. One at home, and one in our lab at work.
My home server is not nearly as powerful as my work computer, but it still does the job just fine. I got a great deal from Dell on a SC1430 server with dual quad Xeons just before they retired the model. When I bought it, it came with only 1GB of RAM and Dell is about as insane as Cisco is for branded memory. So, I opted to buy from my favorite place – newegg. If I remember right, I paid just under $800 total for the server and memory. Not friggin’ bad.
My OS of choice is Fedora. I’ve used Redhat since moving away from Slackware way back in the day. Man, that makes me feel old. Any OS should be fine. Windows (runs fewer routers), MacOS, or any flavor of Linux. Use what you feel comfortable with.
Our monster at work is a Sun X4150. This bad boy also has dual quad Xeons and 16GB of ram, plus around 420GB of SAS storage. The storage array might be a bit overkill, but we also use it as a test platform for our custom Netflow collection software. It also runs Fedora 12.
Installation
We need to download the packages. If you run Windows, you can download the all-in-one package from http://www.gns3.net/download. This contains everything needed to run virtual routers.
On Linux, I download the packages individually from the following locations:
- GNS3 v0.7RC1
- Dynamips 0.2.8-RC2 binary for Linux x86_64 (same link as above)
- The latest dynagen from SVN (http://sourceforge.net/projects/dyna-gen/develop)
Once I have those, I create a directory in /opt/dynamips, which is where I put dynagen and dynamips binaries.
pts/4 jrowley@enlil:/home/jrowley $> cd dyna-gen/code/trunk/ pts/4 jrowley@enlil:/home/jrowley/dyna-gen/code/trunk $> cp -R * /opt/dynamips/
Now, let’s download the dynamips binary, make it executable, and rename it.
pts/4 jrowley@enlil:/opt/dynamips $> wget http://downloads.sourceforge.net/project/gns-3/Dynamips/0.2.8-RC2/dynamips-0.2.8-RC2-amd64.bin?use_mirror=voxel --2010-01-02 19:59:54-- http://downloads.sourceforge.net/project/gns-3/Dynamips/0.2.8-RC2/dynamips-0.2.8-RC2-amd64.bin?use_mirror=voxel Resolving downloads.sourceforge.net... 216.34.181.59 Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://voxel.dl.sourceforge.net/project/gns-3/Dynamips/0.2.8-RC2/dynamips-0.2.8-RC2-amd64.bin [following] --2010-01-02 19:59:54-- http://voxel.dl.sourceforge.net/project/gns-3/Dynamips/0.2.8-RC2/dynamips-0.2.8-RC2-amd64.bin Resolving voxel.dl.sourceforge.net... 74.63.52.169, 69.9.191.19, 74.63.52.167, ... Connecting to voxel.dl.sourceforge.net|74.63.52.169|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1017080 (993K) [application/octet-stream] Saving to: dynamips-0.2.8-RC2-amd64.bin 100%[=================================================================================================================>] 1,017,080 1.06M/s in 0.9s 2010-01-02 19:59:56 (1.06 MB/s) - dynamips-0.2.8-RC2-amd64.bin saved [1017080/1017080] pts/4 jrowley@enlil:/opt/dynamips $> chmod +x dynamips-0.2.8-RC2-amd64.bin pts/4 jrowley@enlil:/opt/dynamips $> mv dynamips-0.2.8-RC2-amd64.bin dynamips pts/4 jrowley@enlil:/opt/dynamips $>
Finally, we download and extract GNS3. I just extract it to my desktop, though you could put it anywhere.
tar fxz GNS3-0.7RC1-src.tar.gz
Provided you have all the required dependencies*, you should be able to double click the GNS3 file.
IOS
Note: Please don’t ask me for any copies of IOS. You will be ignored.
Now, let’s prepare an IOS image for our router. This step is optional, but it speeds router start up since the images don’t need to be uncompressed. I also keep the uncompressed copies in my dynamips directory.
pts/4 jrowley@enlil:/home/jrowley/ios $> unzip c7200-advipservicesk9-mz.122-33.SRD3.bin Archive: c7200-advipservicesk9-mz.122-33.SRD3.bin warning [c7200-advipservicesk9-mz.122-33.SRD3.bin]: 39000 extra bytes at beginning or within zipfile (attempting to process anyway) inflating: C7200-AD.BIN pts/4 jrowley@enlil:/home/jrowley/ios $> mv C7200-AD.BIN c7200-advipservicesk9-mz.122-33.SRD3.bin pts/4 jrowley@enlil:/home/jrowley/ios $> mkdir /opt/dynamips/ios pts/4 jrowley@enlil:/home/jrowley/ios $> mv c7200-advipservicesk9-mz.122-33.SRD3.bin /opt/dynamips/ios pts/4 jrowley@enlil:/home/jrowley/ios $>
Don’t worry about the message about the extra bytes.
GNS3 Configuration
If GNS3 is running, we can move on to configuring it. If you get errors about missing libraries, see the section at the end of this post.
The first thing we need to do is tell GNS3 where to find our IOS. Click Edit -> IOS images and hypervisors.
Next, we just choose the IOS we put in our /opt/dynamips/ios directory previously. Don’t worry about the idle-pc settings yet.
Close the window and now click Edit -> Preferences to give the locations of dynamips. Click Dynamips on the left to set this.
If you have the path and working directory right, click the test button.
We also need to go to General and change the terminal. Most likely, you’ll just need to change the %h to 127.0.0.1, but I also had to change xterm to gnome-terminal
gnome-terminal -e "telnet 127.0.0.1 %p" -t %d
Hit Ok to close and now, we’re ready to add some routers. To do this, select the router type you want to create and drag it to the center panel. In our case, we only have a 7200 image, so let’s use that.
Now, right click the router to configure it
The next window lets us add port adapters. I typically leave the rest defaults.
Do this for as many routers as you wish.
Now, it’s time to connect the routers. To do this, click the connector button in the toolbar.
Connecting routers is as easy as clicking two routers.
Now, we can click the play button to start the routers. You can start them individually by right clicking on each router, or start them all with the toolbar above.
After the routers are running for a bit, we’ll want to configure idle-pc values, otherwise at least one of our cores will be at 100% all the time. Right click a router and select “Idle PC”.
You’ll get a splash screen while GNS calculates the values. Select any value that as an asterisk next to it. If there are none, rerun idle pc.
Note: you should do this for each router even though GNS3 tells you there is already a value for all of them after the first is configured. If you don’t do all routers, you don’t get much benefit.
Here, we can see where the CPU usage dropped after both routers were configured.
To access the routers, simply right click them and select Console. You should get a terminal window (or telnet window on Windows platforms)
Voila! We now have two routers we can configure.
Router>en Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R1 R1(config)#int gi1/0 R1(config-if)#no shut R1(config-if)#ip add 19 *Jan 2 20:44:20.123: %LINK-3-UPDOWN: Interface GigabitEthernet1/0, changed state to up *Jan 2 20:44:21.123: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0, changed state to up2.168.0.1 255.255.255.252 R1(config-if)#end R1# *Jan 2 20:44:31.103: %SYS-5-CONFIG_I: Configured from console by console telnet> quit Connection closed. pts/4 jrowley@enlil:/home/jrowley/Desktop $> telnet 0 2001 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. Connected to Dynamips VM "R2" (ID 1, type c7200) - Console port Router>en Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R2 R2(config)#int gi1/0 R2(config-if)#ip add 192.168.0.2 255.255.255.252 R2(config-if)#no shut R2(config-if)#end R2# *Jan 2 20:45:04.395: %SYS-5-CONFIG_I: Configured from console by console *Jan 2 20:45:04.875: %LINK-3-UPDOWN: Interface GigabitEthernet1/0, changed state to up *Jan 2 20:45:05.875: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0, changed state to up R2# R2#ping 192.168.0.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 8/9/12 ms R2#
From here, you can continue adding routers or just play around with the two we created.
Requirements
GNS3 depends on the following packages:
- Qt 4.3 (or higher)
- Python 2.4 (or higher)
- Sip 4.5 (or higher)
- PyQt 4.1 (or higher)
If you use yum, installing them is as easy as:
yum install qt-devel sip-devel PyQt4-devel python-devel
Windows users shouldn’t need these, as they’re included in the all-in-one package.
Other thoughts
GNS3 also allows you to create Olives (JunOS virtual routers) if you ever need to test a multi-vendor configuration. Very useful for learning your way around the CLI of my favorite router vendor.
Have fun!











#1 by Colby on January 3, 2010 - 1:38 am
GNS3 and not straight CLI (Dynagen)? I’m shocked and appalled.
#2 by jrowley on January 3, 2010 - 10:58 am
Hey now. I’ll never get rid of my scenario scripts. I’ve never used GNS before and it’s kind of nifty.
How’s the job down there?
#3 by Colby on January 3, 2010 - 12:51 pm
Job’s good, I’d rather be doing SP stuff, but enterprise isn’t terrible.
GNS3 is very cool, especially for beginners. Eventually most people seem to realize how buggy it is and give up on it.
#4 by shivlu jain on July 18, 2010 - 10:52 am
have you ever worked on junos
#5 by jrowley on July 18, 2010 - 1:37 pm
Sure have. Been working on both olives and regular routers for a long while