How to setup a CCIE lab using dynamips and dynagen, Step-By-Step

This text is copied from Himawan Nugroho's web site, "inevitable".
It is re-formated here to make it easier to read and print.

:: Vim ::

This page was created using the Vim text editor.

Vim logo

What is Vim?

Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Vim is distributed free as charityware. If you find Vim a useful addition to your life please consider helping needy children in Uganda.

Linux Journal 2005 Readers' Choice

Friday, September 01, 2006

Become a CCIE with Simulator

By Himawan Nugroho

Several months ago I wrote 'How to Become a CCIE', a step-by-step for wanna-be-CCIE out there based on my own experience passing two lab exams. In point no. 3 I mentioned that it's compulsory to have a home lab to be able to practice anytime.

How if we can save some money by not buying the equipment but using simulator instead? Thanks to Christophe Fillot. the author of Dynamips - Cisco 7200 Simulator, now it's possible to have a full CCIE lab in our PC.

The idea of this simulator is to emulate Cisco 7200 environment with MIPS processor in normal PC, so we can boot the genuine IOS for Cisco 7200 with 12.2 and 12.4 version. It can simulate various type of network modules such as PA-4T or PA-TE-FX to provide enough serial and ethernet interfaces. The simulator offers virtual ATM, FR and ethernet switch too. If we can simulate 8-9 routers, with ATM, FR and ethernet switch, and put proper interconnection between those routers..voila! we have a complete CCIE lab!

Actually this simulator has been around for quite some time. But when the first time I used this simulator, I faced so many minor issues that almost made me stop thinking about the idea to simulate CCIE lab. Before I found Dynagen, the front end interface for Dynamips, I had to map the port manually between interface in one router to another interface in another router to provide interconnectivity between them. That's because each interface in this virtual router consumes 1 UDP port. So if we want to connect one router to another router with serial connection, we need to map udp port that represents the serial interface in the first router, to the udp port that represents the serial interface in the second router.

The beauty of this is: we can connect virtual routers in one PC to another virtual routers in diferent PC through normal TCP/IP connection.

But if you have to do the mapping manually for let's say 8-9 routers..hmm, it's better to do something else with our life.

So I like to share the step-by-step how to setup CCIE lab in the PC quickly, so you can join me and all my friends who already started pursuing CCIE in this new and cheap way :)

1. You need a good PC for this simulator.

I bought a new PC for this purpose. It's a Shuttle XPC SD36G5 with Intel Dual Core 3.2 GHz and 2 GB DDR memory. Small but powerful.

With Windows OS I can simulate up to 11 routers. With Linux OS in the same machine I can simulate more than 15 routers. I read it somewhere that it's because the limitation in Windows for one process, such as this Dynamips, can take only up to 2 GB memory. While in Linux the limit for one process is 3 GB. So if one virtual router uses 128 MB, multiple this number by number of routers plus additional memory usage by the process, it makes sense to have the process crashed when the number of routers reaches more than 10.

But fear not, there are so many ways to resolve this problem. Use Linux is one solution. Or just run Dynamips in two different processes.

Surely you don't have to compete with my PC. Any decent PC with lots of memory should be enough.

2. You need Cisco IOS for 7200 routers.

Don't ask me, please. I am not allowed to distribute any IOS image. Just get it from your close friend who works in Cisco partner and can download this IOS for you. Since IOS comes as compressed binary, we need to unzip it first and keep the .bin extension:

$unzip -p c7200-js-mz.122-25.S9.bin > image.bin

I use the enterprise feature with 12.2.29S version.

3. Download Dynagen and Dynamips.

If you want to use Windows, Dynagen in SourceForge has already provided a package with Dynamips included and all the scripts to make our life easier.

4. Find the idle-pc value to avoid 100% CPU utilization.

Without idle-pc feature, even 1 single virtual router can shoot our PC CPU to 100%. To find the idle-pc value is simple:

use the same IOS, NPE and memory that you want to use for your lab. For example, I choose NPE-400 and 96 MB ram for each virtual router:

$./dynamips -t npe-400 -r 96 image.bin
Please wait while gathering statistics...
Done. Suggested idling PC:
Restart the emulator with "--idle-pc=0x60693f8c" (for example)
$./dynamips -t npe-400 -r 96 -idle-pc=0x60693f8c image.bin

5. Run Dynamips in Hipervisor mode

We need to tell Dynamips to run in hipervisor mode which is basically waiting for connection in TCP port 7200 (default) for next instruction from Dynagen.

In Windows, there is a script called 'dynamips-start.cmd' to do this.

$./dynamips.exe -H 7200

Cisco 7200 Simulation Platform (version 0.2.5-RC2-x86)
Copyright (c) 2005,2006 Christophe Fillot.

Hypervisor TCP control server started.
Shutdown in progress...
Shutdown completed.

6. Create the Dynagen config file

Dynagen is awesome. The configuration is a text file that very easy to understand. It comes with sample labs and a text file, all_config_options, that explains all available options.

To practice IE Mentor and IP Expert CCIE Service Provider workbook, this is how I built my dynagen config file:

# I want to boot my routers manually

autostart = false

# I have the Dynamips in the same PC I run this Dynagen


# This is where I specify the location of IOS and options for
# NPE, RAM and idle-pc value

image = /home/himawan/IOS/c7200-js-mz.122-25.S9.bin
npe = npe-400
ram = 96
idlepc = 0xffffffff8075374c

# Each router's name and connectivity information, only
# showing some of them here

[[router CE1]]
f0/0 = CoreSW 1

[[router CE2]]
f0/0 = CoreSW 2

[[router PE1]]
f0/0 = CoreSW 10
f1/0 = CoreSW 11
a3/0 = A1 1
s2/0 = ASBR1 s1/2

[[router ASBR1]]
f0/0 = CoreSW 15
s1/0 = ASBR2 s1/0
s1/1 = ASBR2 s1/1

[[router ASBR2]]
f0/0 = CoreSW 16

# section for virtual ATM and ethernet switch, only showing
# few ports here

[[ETHSW CoreSW]]
1 = access 13
2 = access 23
3 = dot1q 1

[[ATMSW A1]]
1:1:100 = 2:1:100

As you can see the configuration file of Dynagen is very easy and straight forward. We can build as many routers as we want and put the interconnectivity information under each router. The good thing about Dynagen, we don't even need to specify which network module want to load, it will figure it out automatically.

For example, when I ASBR1 s1/0 is connected ASBR2 s1/0 interface, Dynagen will load PA-8T modules to those routers when I boot them. And one more thing, since I have specified it under ASBR1, under ASBR2 I don't need to specify that s1/0 needs to connect to ASBR1, Dynagen will take care of it automatically.

Under the virtual switch, we can assign either VLAN or dot1q trunk to the port. And for ATM switch, we can assign the value for VPI/VCI easily. Awesome, eh?

7. Execute Dynagen

Once you finish with the configuration, just make this file as executable in Linux or run Dynagen to use this configuration file:

C:\Program Files\Dynamips>dynagen.exe

Reading configuration file...
Network successfully started

Dynamips management console
=> list
Name Type State Server Console
CE1 c7200 stopped localhost 2000
CE2 c7200 stopped localhost 2001
CE3 c7200 stopped localhost 2002

8. Start the routers, offcourse, and start playing with it!

=> start CE1
100-C7200 'CE1' started

If you don't put the Dynamips process in the background, you should see something like this:

CPU0: carved JIT exec zone of 16 Mb into 512 pages of 32 Kb.
C7200 instance 'CE1' (id 0):
VM Status : 0
RAM size : 96 Mb
IOMEM size : 0 Mb
NVRAM size : 128 Kb
NPE model : npe-400
Midplane : vxr
IOS image : c7200-js-mz.122-25.S9.bin

Loading ELF file 'c7200-js-mz.122-25.S9.bin'...
ELF entry point: 0x80008000

C7200 'CE1': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.

You can even see the booting process if you want, by connecting to the console port which is starting from TCP port 2000 by default:

=> telnet CE1
telnet 2000

Now you have your lab ready, what are you waiting for?

Two more additional steps:

9. Googling or RTFM when you have problems

Read Chris's blog, check the FAQ, read the Dynagen tutorial, googling.. don't be lazy!

10. Simulating remote lab

I have a good PC at home but I have already got used to my IBM Thinkpad keyboard to practice CCIE lab. So what I did to simulate remote lab is:

CE1.cmd file: start "CE1" telnet 2000
CE2.cmd file: start "CE2" telnet 2001

and so on

Now I just need to click CE1 shortcut to connect to CE1, CE2 to connect to CE2 and so on. It gives me the same feeling like when I had my CCIE lab in Brussels.

One thing to remember: this simulator can only simulate routers with ATM, frame-relay and virtual switch. It means if you are planning to go to CCIE lab other than R&S and Service Provider, you still need to buy some equipments such as Firewall for Security track or router with E1 interface for Voice track.

And also if you have less experience with Cisco IOS behaviour, when you face some issues in your lab you may not be able to distinguish the cause of the problem whether it's because of wrong configuration or Dynamips bugs or IOS bugs or lack of faith.

I may still require to rent a rack for some equipment that can't be simulated just like Cisco 3550. But the amount of time required in renting should be reduced significantly with this simulator.

So practice with simulator at home, and rent a rack several days before the exam.

It sounds like a good plan.

My only challenge now is that my PC is so powerful for gaming, especially after I added NVidia GeForce 6800XT 512Mb PCI Express graphic card. I can play The Battle for Middle Earth, Star Wars Empire at War, Ghost Recon Advance War Fighter and my most favorit game for whole time: Battle Field 2 with highest quality.

So now my CCIE SP plan has to compete with Snowboarding and Battle Field. What a tough life!