Dynagen

I’m going to start out pretty basic and probably stay that way. The goal isn’t to be able to do super complicated things, its to be able to make a lab environment for CCNA study. I won’t be getting around to using anything PIX for at least a few weeks so if that is your interest I suggest going to the article I mention at topdog. Most of the people I know use windows, I chose to run dynamips/dynagen from my linux machine simply because its easier for me to remote into that, or was at first anyway. To start off, get dynamips/dynagen installed and the dynamips service running. The best Centos guide I’ve ran across is the following so most of this will be cut from Andrew Colin Kissa ‘s howto at http://www.topdog.za.net/centos_5_cisco_lab Initial Setup Linux(Centos 5): Since I used the pre-compiled RPM’s from topdog and it worked perfectly I’d stick with what works.

First off you’ll need to install his key to verify the RPMs


wget http://www.topdog-software.com/oss/roundcube/andrew_topdog-software.com_key.txt
rpm --import andrew_topdog-software.com_key.txt

Install Dynamips(the emulator)


rpm -Uvh http://www.topdog-software.com/oss/dynamips/dynamips-0.2.8RC2-1.i386.rpm

Install Dynagen(Interface, Mangement CLI)


rpm -Uvh http://www.topdog-software.com/oss/dynagen/dynagen-0.11.0-1.noarch.rpm

Install PEMU(PIX Emulator)


rpm -Uvh http://www.topdog-software.com/oss/pemu/pemu-0.0.1-20070420.i386.rpm

Start up the services


service dynamips start
service pemu start

Extracted IOS images load faster, I choose to keep the extraced and compressed in separate folders. Downloaded into ~/Dynagen_Stuff/Images and extracted to ~/Dynagen_Stuff/Images/Extracted


unzip c2691-adventerprisek9-mz.124-23.BIN -d Extracted/

With all that said and done its time to make the network files. For the first “Lab” we’ll make a simple proof of concept network of 2x 2691 routers. lab1.net


#Small lab
model = 2691
ghostios = true #only 1 copy of IOS in memory that routers running the same ios share
sparsemem = true #reduces amount of virtual memory used by router instances
[localhost]  #Which host dynagen will try to talk to dynamips on
[[2691]]   #Apply this to all routers "model = 2691"
image = /home/seth/Dynagen_Stuff/Images/Extracted/C2691-AD.BIN  #our extracted IOS image
ram = 128
slot1 = NM-4T  #Serial Card

[[ROUTER R1]]
console = 2000  #local port you can telnet to and be on the router's console

[[ROUTER R2]]
console = 2001

Now to try this out we can type the command


dynagen lab1.net

Your output should be similar to the following


Reading configuration file...

*** Warning:  Starting R1 with no idle-pc value
*** Warning:  Starting R2 with no idle-pc value
Network successfully loaded

Dynagen management console for Dynamips and Pemuwrapper 0.11.0
Copyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa

=>

Notice the error about “idlepc” not being defined. …Yeah thats not very happy, and if you check top your machine will tell you just how not happy it is. We fix this with the following process First we stop R2


=>stop R2

Now in another window or screen we open a telnet session to localhost on port 2000 to get R1 to the base prompt, answer no to autosetup and watch all your router status information fly by. When this is done go back to your Dynagen Console and issue the following command.


=>idlepc get R1

You’ll get some output similar to the following:


Please wait while gathering statistics...
*  1: 0x60a48bf0 [52]
2: 0x60a48c20 [37]
3: 0x60a48df4 [24]
4: 0x60a48e64 [21]
5: 0x61210eec [38]
6: 0x6121101c [33]
7: 0x60a49150 [43]
8: 0x60a498f8 [46]
9: 0x62361cc8 [41]
10: 0x60a4a194 [34]
Potentially better idlepc values marked with "*"
Enter the number of the idlepc value to apply [1-10] or ENTER for no change:

As it says choose one of the options marked with an asterisk. Check top again to see if your utilization went down. If not rinse and repeat. Once your utilization does go down, save it to the router database( dynagenidledb.ini) with the following command.


=> idlepc save R1 db

That idlepc will now be applied to any router you load with the same model. Go ahead and spin up R2 and check top again. It should be better although quite possibly still a CPU hog.


=>start R2

Grats on having two running routers on your PC but we have the small issue that nothing is connected. For this we need to modify the lab topology. There are two ways to do this. Without reloading dynagen:


=> conf localhost
=>(config-localhost:7200)router R1
=>(config-localhost:7200-router R1)s1/0 = R2 s1/0

Or we can exit dynagen and modify lab1.net:


#Small lab
model = 2691
ghostios = True #only 1 copy of IOS in memory that routers running the same ios share
sparsemem = True        #reduces amount of virtual memory used by router instances
[localhost]
workingdir = /home/seth/Dynagen_Stuff/Lab1/files
[[2691]]
image = /home/seth/Dynagen_Stuff/Images/Extracted/C2691-AD.BIN
ram = 128
slot1 = NM-4T
idlepc = 0x60a48bf0

[[ROUTER R1]]
console = 2000
model = 2691
S1/0 = R2 S1/0
[[ROUTER R2]]
console = 2001
model = 2691
#You don't have to specify S1/0 = R1 S1/0 since the link is in R1's config

Now we have two interfaces with their line protocol up. Our configs are blank though. Lets just set some default to show this actually worked.

Router1:


Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s1/0
Router(config-if)#no shut
Router(config-if)#ip unnumbered fastEthernet 0/0
Router(config-if)#exit
Router(config)#int fa0/0
Router(config-if)#no shut
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 192.168.1.0

Router2:


Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s1/0
Router(config-if)#no shut
Router(config-if)#ip unnumbered fastEthernet 0/0
Router(config-if)#exit
Router(config)#int fa0/0
Router(config-if)#no shut
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 192.168.2.0

Double check that everything is all working.


Router#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0
R    192.168.2.0/24 [120/1] via 192.168.2.1, 00:00:15, Serial1/0
Router#ping 192.168.2.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/11/20 ms

Thats a pretty basic intro. If anyone noticed, there was no clockrate set ever for the serial interface but if you look at your s1/0 controller you’ll see it as a DCE with a received clockrate. That is a result of using emulation that doesn’t emulate physical layer(udp connections virtual router to virtual router).
Obviously there is a lot you can do with this that goes well beyond the standard simulators they package with books. I haven’t gone into the details really at all, if you have a powerful enough machine you can spin up virtual machines to your router interfaces.

In case anyone was wondering you cannot emulate a catalyst switch, you can however put a switch module into a router that supports it. This page is far from refined at the moment. It will get some gradual improvements.

I’ll probably do a howto on setting up GNS3 which is a nice gui for all of this that works on windows/mac/linux sometime in the next week.



Leave a Reply