Sunday, February 3, 2008

Cisco Router Simulator with Dynamips / Dynagen

I will explain how to emulate our PC in order to emulate Cisco Router hardware and run virtual IOS processes on our local desktop.

What is Dynamips?
Dynamips is an IOS virtualization program that is similar to half VMware on desktop in order to simulate different hardware platforms.
Dynamips is different than traditional simulator e.g. Boson, Packet Tracer, Router eSim.
Dynamips doesn't emulate the IOS, it emulates the router hardware on PC, boot IOS images into different logical router processes, and they're gonna be able to talk with each other with whatever protocols in that particular IOS images.

In order to run dynamips:
-Windows / Mac Os / Linux
-Dynamips "hypervisor" that used to emulate router hardware
-Dynagen that is used to create configuration file and booting the hypervisor processes
-Dynamips included in Dynagen installer packare
-Actual IOS images
-Any Terminal emulation software like HyperTerminal, SecureCRT, Tera Term, etc

Windows (click here for Video Tutorial)
1. install winpcap, in order to support the network interfaces card to talk to the dynamips processes
2. install dynagen that includes the dynamips hypervisor
3. start Dynamips Server
4. run the *.net file config lab

Linux (click here for Video Tutorial)
1. Download dynagen using wget and extract using tar zxvf it to /opt/dynamips directory
2. Change directory to dynagen, check the README.txt to see which version of dynamips is required then go to dynamips blog to download the required version of dynamips.
3. Download the required version of dynamips using wget also into /opt/dynamips directory
4. Use 'chmod 755' command to make the dynamips binary executable
5. Navigate to /usr/bin directory to create symbolic links for the dynamips and dynagen program
6. Create a symbolic link to dynamips program give it a name e.g. dynamips. This will allow you to just type dynamips from anywhere to run the program. Here is the example:
ln -s /opt/dynamips/dynamips-0.2.7.-RC2-x86.bin dynamips
7. Create a symbolic link to dynagen program give it a name e.g. dynagen. This will allow you to just type dynagen from anywhere to run the program. Here is the example:
ln -s /opt/dynamips/dynagen-0.9.1/dynagen dynagen
8. Create a directory for IOS images and move IOS image to this directory.
mkdir /opt/dynamips/images
Configure *.net dynagen lab file that is gonna be used to configure what individual router instances we gonna run, what interfaces they have and what IOS image that they are gonna be running.
In sample_lab there are templates that can be changed. For example we want to try the simple1 lab inside simple1 directory with the name of configuration file is simple1.net. Change the bold text (c7200-adventerprisek9-mz.124-4.T1.bin) below becomes your IOS image file name.

Windows:
# Simple lab

[localhost]

[[7200]]
image = \Program Files\Dynamips\images\c7200-adventerprisek9-mz.124-4.T1.bin
# On Linux / Unix use forward slashes:
# image = /opt/7200-images/
c7200-adventerprisek9-mz.124-4.T1.bin
npe = npe-400
ram = 160

[[ROUTER R1]]
s1/0 = R2 s1/0

[[router R2]]
# No need to specify an adapter here, it is taken care of
# by the interface specification under Router R1


Linux:
# Simple lab

[localhost]

[[7200]]
# image = \Program Files\Dynamips\images\c7200-adventerprisek9-mz.124-4.T1.bin
# On Linux / Unix use forward slashes:
image = /opt/7200-images/
c7200-adventerprisek9-mz.124-4.T1.bin
npe = npe-400
ram = 256

[[ROUTER R1]]
s1/0 = R2 s1/0

[[router R2]]
# No need to specify an adapter here, it is taken care of
# by the interface specification under Router R1



Start Dynamips Server (launch the Hypervisor process).
Windows: Double click the 'Dynamips Server shortcut' usually on desktop

Linux
: dynamips -H 7200 &
Note: The '&' character instructs the process in the background.









Once we have start the Dynamips Server, then we initiate the configured *.net config file lab. In this example I try to run simple.net lab. Then a new window will popped up.

Windows
: Double click the 'simple1.net' file usually in C:\Program Files\Dynamips\sample_labs\simple1

Linux
: dynagen simple1.net





List the available devices in the lab using list command.

Windows: Connect to a router using telnet [device name] command e.g. telnet R1
Linux: Connect to router using telnet client such as putty on port 2000

A new window for the router will came up.


























Windows: You will see some error messages like below
% Crashinfo may not be recovered at bootflash crashinfo % This file system device reports an error
Linux: You might not have this error messages.

Windows: To fix this error we need to format the bootflash using command: format bootflash:
After finish formatting the bootflash, we need to make an adjustment to the idle-pc parameter in order to drop the CPU utilization on PC.

Now close the R1 telnet window and go back to console with a window title "Dynagen"



To get idle-pc value use command:
idlepc get [router name]
e.g. idlepc get R1
Choose the value marked with "*". If there is no "*" mark in first attempt, just try again the command idlepc get R1.

After applied the idlepc value, don't forget to save the idlepc value using command:
idlepc save [router name] db


You will notice the drop in CPU utilization since the idle-pc value already changed.

OK! Now we have a virtual Wide Area Network with Cisco Routers!

Additional information and materials:

5 comments:

lyna said...

hadooww, puyenk

ryknow said...

lahh...yang bwt mac nya mana..xixiixi
jgn lupa titipan bay...
ga nyambung XP

tandamata said...

thx 4 tutor nya mas!
sangat bermanfaat buat pemula seperti saya. next time publish dong info tentang sertifikasi dan biaya nya serta recomended tempatnya :)

pasti seru,,...

thx

BobbyG said...

Excellent post... fir3net.com

javieth said...

In addressing the router enables wireless networking connection, really amazing what Technology has changed these days. I like meeting new things. This is why i have come to this blog, I find it very interesting.This is like
costa rica investment opportunities really interesting too.