My mad Dynamips/Dynagen Topology

On October 27, 2009, in CCIE, Dynamips, Linux, by Darren

This has taken me absolutely hours to finally finish. I wanted to create a topology that I’ll be able to run all kind of different labs on. i.e. the topology is extremely complex. I’ve configured all the connections through my .net file as well as saving base configs (hostname and IP addresses) so I don’t have to put these in each time I load up my .net file.

This is the topology itself. You need to click the picture to get the full picture.

Topology small My mad Dynamips/Dynagen Topology

My .net file is pretty much configured like so:

#Topology created by Darren O'Connor
#www.mellowd.co.uk/ccie

[localhost:7200]
workingdir = /data/dynamips/working

[[3745]]
 image = /data/dynamips/IOS_Images/3745/c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin
 ram = 128
 disk0 = 16
 disk1 = 0
 mmap = true
 ghostios = true
###########################
#                         #
# Mad Topology            #
#                         #
###########################

 [[Router R1]]
  model = 3745
  console = 2001
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 1
  s1/1 = R6 s1/1
  s1/2 = R8 s1/2
  s1/3 = R2 s1/3
  Fa0/0 = R9 F0/1
  cnfg = /data/dynamips/Topology/Topology_Config/R1.cfg

[[Router R2]]
  model = 3745
  console = 2002
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 2
  Fa0/1 = R8 Fa0/0
  s1/2 = R9 s1/2
  s1/1 = R3 s1/3
  Fa0/0 = R10 Fa0/1
  cnfg = /data/dynamips/Topology/Topology_Config/R2.cfg

[[Router R3]]
  model = 3745
  console = 2003
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 3
  Fa0/1 = R9 Fa0/0
  s1/2 = R10 s1/2
  Fa0/0 = R11 Fa0/1
  s1/1 = R4 s1/3
  cnfg = /data/dynamips/Topology/Topology_Config/R3.cfg

[[Router R4]]
  model = 3745
  console = 2004
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 4
  Fa0/1 = R10 Fa0/0
  s1/2 = R11 s1/2
  Fa0/0 = R12 Fa0/1
  s1/1 = R5 s1/3
  cnfg = /data/dynamips/Topology/Topology_Config/R4.cfg

[[Router R5]]
  model = 3745
  console = 2005
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 5
  Fa0/1 = R11 Fa0/0
  s1/2 = R12 s1/2
  cnfg = /data/dynamips/Topology/Topology_Config/R5.cfg

[[Router R6]]
  model = 3745
  console = 2006
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 6
  s1/2 = R13 s1/2
  Fa0/0 = R14 Fa0/1
  s1/3 = R7 s1/3
  cnfg = /data/dynamips/Topology/Topology_Config/R6.cfg

[[Router R7]]
  model = 3745
  console = 2007
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/0 = F1 7
  Fa0/1 = R13 Fa0/0
  s1/2 = R14 s1/2
  Fa0/0 = SW2 Fa1/7
  cnfg = /data/dynamips/Topology/Topology_Config/R7.cfg

[[Router R8]]
  model = 3745
  console = 2008
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  slot2 = NM-1FE-TX
  s1/3 = R9 s1/3
  Fa2/0 = SW1 Fa1/8
  cnfg = /data/dynamips/Topology/Topology_Config/R8.cfg

[[Router R9]]
  model = 3745
  console = 2009
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  slot2 = NM-1FE-TX
  s1/1 = R10 s1/3
  Fa2/0 = SW1 Fa1/9
  cnfg = /data/dynamips/Topology/Topology_Config/R9.cfg

[[Router R10]]
  model = 3745
  console = 2010
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  slot2 = NM-1FE-TX
  s1/1 = R11 s1/3
  Fa2/0 = SW1 Fa1/10
  cnfg = /data/dynamips/Topology/Topology_Config/R10.cfg

[[Router R11]]
  model = 3745
  console = 2011
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  slot2 = NM-1FE-TX
  s1/1 = R12 s1/3
  Fa2/0 = SW1 Fa1/11
  cnfg = /data/dynamips/Topology/Topology_Config/R11.cfg

[[Router R12]]
  model = 3745
  console = 2012
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  slot2 = NM-1FE-TX
  Fa2/0 = SW1 Fa1/12
  cnfg = /data/dynamips/Topology/Topology_Config/R12.cfg

[[Router R13]]
  model = 3745
  console = 2013
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  s1/3 = R14 s1/3
  cnfg = /data/dynamips/Topology/Topology_Config/R13.cfg

[[Router R14]]
  model = 3745
  console = 2014
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-4T
  Fa0/0 = SW2 Fa1/14
  cnfg = /data/dynamips/Topology/Topology_Config/R14.cfg

[[Router SW1]]
  model = 3745
  console = 2021
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-16ESW
  Fa0/0 = SW2 Fa0/0
  cnfg = /data/dynamips/Topology/Topology_Config/SW1.cfg

[[Router SW2]]
  model = 3745
  console = 2022
  autostart = false
  idlepc = 0x61239894
  slot1 = NM-16ESW
  cnfg = /data/dynamips/Topology/Topology_Config/SW2.cfg

[[FRSW F1]]
 1:102 = 2:201
 1:103 = 3:301
 1:104 = 4:401
 1:105 = 5:501
 1:106 = 6:601
 1:107 = 7:701
 2:203 = 3:302
 2:204 = 4:402
 2:205 = 5:502
 2:206 = 6:602
 2:207 = 7:702
 3:304 = 4:403
 3:305 = 5:503
 3:306 = 6:603
 3:307 = 7:703
 4:405 = 5:504
 4:406 = 6:604
 4:407 = 7:704
 5:506 = 6:605
 5:507 = 7:705
 6:607 = 7:706

The actual IP config files are separate. If you want them feel free to ask

Tagged with:  

Now tht I’ve got my basic configuration up, we now need to set idlepc values for dynamips. If you load up even just 1 router without doing this, you’ll end up with 100% CPU usage. As an added bonus I’ve measured power draw from the wall just to see exactly how much power this set up pulls.

At idle my server pulls exactly 75watts.

I’ve now loaded up dynamips/dynagen with 20 router instances with NO idlepc values set and this is the result:

$top
Tasks: 109 total,   2 running, 106 sleeping,   1 stopped,   0 zombie
Cpu(s): 99.8%us,  0.2%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3996956k total,  3014956k used,   982000k free,     5576k buffers
Swap:  7960168k total,        0k used,  7960168k free,  1563492k cached

As you can see I’m sitting on 99.8% CPU usage. These are the routers running:

=> list
Name       Type       State      Server          Console   
R1         3745       running    localhost:7200  2001      
R2         3745       running    localhost:7200  2002      
R3         3745       running    localhost:7200  2003      
R4         3745       running    localhost:7200  2004      
R5         3745       running    localhost:7200  2005      
R6         3745       running    localhost:7200  2006      
R7         3745       running    localhost:7200  2007      
R8         3745       running    localhost:7200  2008      
R9         3745       running    localhost:7200  2009      
R10        3745       running    localhost:7200  2010      
R11        3745       running    localhost:7200  2011      
R12        3745       running    localhost:7200  2012      
R13        3745       running    localhost:7200  2013      
R14        3745       running    localhost:7200  2014      
R15        3745       running    localhost:7200  2015      
R16        3745       running    localhost:7200  2016      
R17        3745       running    localhost:7200  2017      
R18        3745       running    localhost:7200  2018      
R19        3745       running    localhost:7200  2019      
R20        3745       running    localhost:7200  2020

I’m now pulling a total of 160watts from the wall.

In order to get my idlepc value I do this:

=> idlepc get R2
Please wait while gathering statistics...

Please wait while gathering statistics...
Done. Suggested idling PC:
   0x61239894 (count=55)
   0x604ebf00 (count=31)
   0x60aacff8 (count=41)
   0x60aad000 (count=23)
   0x6123552c (count=72)
   0x6123558c (count=65)
   0x612355d4 (count=22)
   0x60aa6490 (count=34)
   0x60aa64c0 (count=29)
   0x60aa6694 (count=33)
Restart the emulator with "--idle-pc=0x61239894" (for example)
*  1: 0x61239894 [55]
   2: 0x604ebf00 [31]
   3: 0x60aacff8 [41]
   4: 0x60aad000 [23]
   5: 0x6123552c [72]
   6: 0x6123558c [65]
   7: 0x612355d4 [22]
   8: 0x60aa6490 [34]
   9: 0x60aa64c0 [29]
  10: 0x60aa6694 [33]
Potentially better idlepc values marked with "*"
Enter the number of the idlepc value to apply [1-10] or ENTER for no change: 1
Applied idlepc value 0x61239894 to R2

I’ve now applied an idlepc value to R2, but I need this replicated across all routers. This isn’t a problem as all my routers are the same type. All I need to do is this:

=> idlepc copy R2 /all
R4: idlepc set to 0x61239894
R5: idlepc set to 0x61239894
R6: idlepc set to 0x61239894
R7: idlepc set to 0x61239894
R12: idlepc set to 0x61239894
R1: idlepc set to 0x61239894
R3: idlepc set to 0x61239894
R20: idlepc set to 0x61239894
R11: idlepc set to 0x61239894
R8: idlepc set to 0x61239894
R9: idlepc set to 0x61239894
R18: idlepc set to 0x61239894
R10: idlepc set to 0x61239894
R15: idlepc set to 0x61239894
R14: idlepc set to 0x61239894
R17: idlepc set to 0x61239894
R16: idlepc set to 0x61239894
R19: idlepc set to 0x61239894
R13: idlepc set to 0x61239894

You can do this for every router type. In other words, if I had 2 different router types, I’d have to do these commands for each type and then copy the values.

My CPU usage has now jumped down, while still running 20 routers:

Tasks: 109 total,   2 running, 106 sleeping,   1 stopped,   0 zombie
Cpu(s): 64.8%us,  0.0%sy,  0.0%ni, 35.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3996956k total,  3053568k used,   943388k free,     7524k buffers
Swap:  7960168k total,        0k used,  7960168k free,  1591900k cached

Power draw at the wall has jumped down to 94Watts. Quite a big saving on juice!

In order to save yourself from having to do this each time, you can just save the idlepc values in your .net file. This means that when you load up your routers, it’ll apply the idlepc value straight away. Do it like so in your .net file:

 [[Router R1]]
  model = 3745
  console = 2001
  autostart = false
  idlepc = 0x61239894

[[Router R2]]
  model = 3745
  console = 2002
  autostart = false
  idlepc = 0x61239894

Note. Do NOT use my values. See what works for you. Use a few different ones and see what happens. Once I’ve actually got protocols running in my lab I’m sure I’ll need to change these values, so please do this for yourself as well.

Tagged with:  

Dynamips server up and running

On October 26, 2009, in CCIE, Dynamips, Linux, by Darren

So I’ve got everything almost as I want it. Dynamips is running fine and I’m using SecureCRT to log into all my routers. I normally use Putty but it isn’t a tabbed application, so SecureCRT fits the bill.

I’m going to share my configuration here, but please be aware that you’ll need to change certain things to fit your topology. My simplified topology looks like so:

Drawing1 Dynamips server up and running

Dynamips/Dynagen will be running on the server alone. I’ll be accessing the emulated routers from my main PC. Network-wise the server only really has to have a connection to the local network. This is the configuration of my network on Ubuntu:

$sudo less /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 10.10.10.5
netmask 255.255.255.0
gateway 10.10.10.1
network 10.10.10.0
broadcast 10.10.10.255

If you have DHCP setup, you could always allow the server to get a dynamically assigned IP, but I recommend against this. This will cause issues later when telnetting it as the IP will consistently change.

Now for my dynagen configuartion file. This will need a fair amount of editing from you in order to work on your system. You’ll need to change the folder names as well as the image names to match what it is on your system.

$ sudo less /data/dynamips/Topology/inet.net

[localhost:7200]
workingdir = /data/dynamips/working

[[3745]]
 #
 image = /data/dynamips/IOS_Images/3745/c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin
 #
 ram = 128
 disk0 = 16
 disk1 = 0
 mmap = true
 ghostios = true

###########################
#
# Define router instances
#
###########################
[[Router R1]]
  model = 3745
  console = 2001
  autostart = false

[[Router R2]]
  model = 3745
  console = 2002
  autostart = false

[[Router R3]]
  model = 3745
  console = 2003
  autostart = false

[[Router R4]]
  model = 3745
  console = 2004
  autostart = false

[[Router R5]]
  model = 3745
  console = 2005
  autostart = false

[[Router R6]]
  model = 3745
  console = 2006
  autostart = false

[[Router R7]]
  model = 3745
  console = 2007
  autostart = false

Keep adding more routers as you see fit. I’ve got the option of autostart = false in each router instance. This is to prevent the routers starting up automatically when I load up the topology. If you want them to start up automatically, just remove this line under each router as the default is for them to start up.

I have no idle-pc vaules set yet. This is a very important step and I’ll cover this in a new post.

Now to test we can start it all up. First we need to load up dynamips to run in the background like so:

$sudo dynamips -H 7200 &

Now we can load up our topology:

$sudo dynagen /data/dynamips/Topology/inet.net

We should see something like this:

~$ sudo dynagen /data/dynamips/Topology/inet.net
Reading configuration file...
Shutdown in progress...
Shutdown completed.
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
NVRAM is empty, setting config register to 0x2142
C3745 instance 'ghost-c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin-localhost.ghost' (id 20):
  VM Status  : 0
  RAM size   : 128 Mb
  NVRAM size : 128 Kb
  IOS image  : /data/dynamips/IOS_Images/3745/c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin

Loading ELF file '/data/dynamips/IOS_Images/3745/c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin'...
ELF entry point: 0x80008000

C3745 'ghost-c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin-localhost.ghost': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
C3745 'ghost-c3745-adventerprisek9-mz.124-25b.UNCOMPRESSED.bin-localhost.ghost': stopping simulation.
Network successfully loaded

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

=>

If we now type list, we can see all our router instances:

=> list
Name       Type       State      Server          Console
R1         3745       stopped    localhost:7200  2001
R2         3745       stopped    localhost:7200  2002
R3         3745       stopped    localhost:7200  2003
R4         3745       stopped    localhost:7200  2004
R5         3745       stopped    localhost:7200  2005
R6         3745       stopped    localhost:7200  2006
R7         3745       stopped    localhost:7200  2007

From here I can start my routers up as I see fit:

=>start R1

Or simply start them all up:

=>start /all

So now to access them, I access them from my Windows 7 PC. As a quick test I’m going to use the command prompt as it’s easy to copy and paste. The important thing to note from the list command previously is the port number. In my setup Router1 is on port 2001. So in order to now telnet to it I need to telnet to my servers IP (10.10.10.5 as previously shown) on that port. So to connect to Router1 I do this from the Windows command prompt:

>telnet 10.10.10.5 2001

Connected to Dynamips VM "R1" (ID 0, type c3745) - Console port

% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]:no

Press RETURN to get started!

Router>

So here we are connected to Router1! :) To connect to the others you just use port 2002, 2003 and so on. You can see now why it’s useful to have a tabbed telnet application.

In a future post I’ll show you how to connect these router interfaces to each other as well as looking at how to configure the idlepc values.

Tagged with:  

BSCI Labs – IPv6 and OSPFv3

On October 22, 2009, in JNCIE, by Darren

The BSCI doesn’t go too much into IPv6 and OSPFv3 but this will eventually become more and more common in future. This lab is actually a very simple one.

OSPFv3 and IPv6 lab1:

  • Set up the adjacencies using only IPv6
  • The only IPv4 addresses to be used are the loopback addresses
  • Create IPv6 loopbacks on each router and advertise into Area0

OSPFv3 and IPv6 1 BSCI Labs – IPv6 and OSPFv3

Tagged with:  

Dynamips basic configuration

On October 21, 2009, in CCIE, Dynamips, by Darren

Now that my server is up running with it’s wireless card just fine, it’s time to begin configuring dynamips/dynagen. The first thing you’ll need is a few IOS images. Of course I cannot provide this for you, you’ll have to get it yourself.

You can put your IOS images wherever you want, but I’ve put mine in the following folder: /data/dynamips/IOS_Images/7200

If you remember back from your CCNA studies, you’ll remember that IOS images are in fact COMPRESSED. You can leave it like this but it’s easier to just uncompress it now. You’ll have plenty of hard drive space and this will allow dynamips to actually use less horsepower later as it won’t have to uncompress on the fly.

Make sure unzip is installed. If not on Ubuntu just type:

sudo aptitude install unzip

Once that’s complete just go to the folder in which you have you IOS image and unzip it. This is my example:

o@dynamips:/data/dynamips/IOS_Images/7200$ ls
c7200-a3jk9s-mz.124-25b.bin

$ unzip c7200-a3jk9s-mz.124-25b.bin
Archive:  c7200-a3jk9s-mz.124-25b.bin
warning [c7200-a3jk9s-mz.124-25b.bin]:28712 extra bytes at beginning or within zipfile
(attempting to process anyway)
inflating: C7200-A3.BIN

$ ls
C7200-A3.BIN  c7200-a3jk9s-mz.124-25b.bin

$ mv C7200-A3.BIN c7200-a3jk9s-mz.124-25b.UNCOMPRESSED.bin
$ rm c7200-a3jk9s-mz.124-25b.bin

As you can see it’ll spit out a warning but just ignore that.

You now need to configure your telnet client. This can be done like so:

$ sudo vi /etc/dynagen.ini

Just uncomment and/or change the relevant paths so it’s correctly configured for your platform.

Now it’s time to create the topology itself. I’ve created mine in /data/dynamips/Topology/simple.net (You’ll need to change the paths to match yours)

[localhost]
autostart = false
workingdir = /data/dynamips/working

[[7200]]
      image = /data/dynamips/IOS_Images/7200/c7200-a3jk9s-mz.124-25b.UNCOMPRESSED.bin
      npe = npe-400
      ram = 160

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

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

Now start dynamips like so:

dynamips –H 7200 &

Now load your topology:

dynagen /path/to/sample.net

You’ve now got dynamips/dynagen running. In future blogs I’ll get a lot more advanced. We also need to set the idle pc values which really is one of the most imporant things you’ll need to do

Tagged with:  

© 2009-2014 Darren O'Connor All Rights Reserved