Friday, March 25, 2011

GNS3 Using remote Hypervisors

I have for a while now used Dynamips,Dynagen and Qemu for emulating IOS and Junos. Dynamips as everyone thats tried using it is a huge resource hog and if not properly managed can be quite a pain to work with.

For the troubleshooting exam, you need to load well over 20 routers and a few switches. While this can be done in isolation ie subsections of a lab done separately maybe with 5 routers max, I prefered getting a platform that allowed me to load them all up.

I assume here that you are familiar with GNS3. If not please check out the link below:
http://www.gns3.net/documentation

To get this working for me, I used GNS3 and a remote hypervisor. This sort of outsources the intensive processing to a powerful server and my laptop managed the frontend/topology.

I used just one server but you can use many. On the server (I am using a server running Ubunu 10.10, 128GB memory and several processors), Do the following:

Prepare the serverside environment and download Dynamips (make sure you get the proper version for your platform):
root@scc-sfc-mgt-devsvr:/home/jgitau# mkdir dynamips
root@scc-sfc-mgt-devsvr:/home/jgitau# cd dynamips/
wget http://www.ipflow.utc.fr/dynamips/dynamips-0.2.8-RC2-amd64.bin
Create a folder for your IOS and a temporary folder to use as a working directory
root@scc-sfc-mgt-devsvr:/home/jgitau/dynamips# mkdir ios
root@scc-sfc-mgt-devsvr:/home/jgitau/dynamips# mkdir tmp
Your folder should resemble something like:
root@scc-sfc-mgt-devsvr:/home/jgitau/dynamips# ls
dynamips-0.2.8-RC2-amd64.bin  dynamips_log.txt  ios  tmp
Place the IOS you'll be using in the IOS folder then start dynamips. Also ensure its networked duh! and can 'ping' your laptop/pc/whatever you run the GNS3 on.

Next, start the dynamips engine:

Note on a server with multiple CPU's, it helps if you start several instances on different ports.
root@scc-sfc-mgt-devsvr:/home/jgitau/dynamips# ./dynamips-0.2.8-RC2-amd64.bin -H 7201
Cisco Router Simulation Platform (version 0.2.8-RC2-amd64)
Copyright (c) 2005-2007 Christophe Fillot.
Build date: Oct 14 2007 10:46:52

ILT: loaded table "mips64j" from cache.
ILT: loaded table "mips64e" from cache.
ILT: loaded table "ppc32j" from cache.
ILT: loaded table "ppc32e" from cache.
Hypervisor TCP control server started (port 7201).


Next up, fire up GNS3 on your laptop, we'll create a 20 router topology for demo purposes. I am running GNS3 0.6.

- Click on Edit --> Ios Images and Hypervisors 
Navigate to "External Hypervisors" tab
- Put in the host details , ensure the port matches the port you started on the server (7201).
- Put in the base UDP Port (10004), Base console (2000) and the working directory: /home/jgitau/dynamips/tmp 
(This is the folder you created on the server)
- save.
Next, Navigate to "IOS Images" tab.
Image file is the image location on your server, use whatever platform your IOS matches
Image file: /home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin
platform :7200
On your right,
Unclick the "use Hypervisor manager"
save

Create a topology, I did the one showed on the image below, start up the lab, on the server side you'll see the routers loading up. Sort out the idle PC as usual. Monitor the CPU using top or htop. Sample output follows.



Loading ELF file '/home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin'...
ELF loading skipped, using a ghost RAM file.
ELF entry point: 0x80008000

C7200 'QOA.PE.2': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C7200 instance 'QOA.PE.1' (id 19):
  VM Status  : 0
  RAM size   : 256 Mb
  IOMEM size : 0 Mb
  NVRAM size : 128 Kb
  NPE model  : npe-400
  Midplane   : vxr
  IOS image  : /home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin

Loading ELF file '/home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin'...
ELF loading skipped, using a ghost RAM file.
ELF entry point: 0x80008000

C7200 'QOA.PE.1': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C7200 instance 'KBW.P' (id 20):
  VM Status  : 0
  RAM size   : 256 Mb
  IOMEM size : 0 Mb
  NVRAM size : 128 Kb
  NPE model  : npe-400
  Midplane   : vxr
  IOS image  : /home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin

Loading ELF file '/home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin'...
ELF loading skipped, using a ghost RAM file.
ELF entry point: 0x80008000

C7200 'KBW.P': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C7200 instance 'SCC.RR' (id 21):
  VM Status  : 0
  RAM size   : 256 Mb
  IOMEM size : 0 Mb
  NVRAM size : 128 Kb
  NPE model  : npe-400
  Midplane   : vxr
  IOS image  : /home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin

Loading ELF file '/home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin'...
ELF loading skipped, using a ghost RAM file.
ELF entry point: 0x80008000

C7200 'SCC.RR': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C7200 instance 'MSA.P' (id 22):
  VM Status  : 0
  RAM size   : 256 Mb
  IOMEM size : 0 Mb
  NVRAM size : 128 Kb
  NPE model  : npe-400
  Midplane   : vxr
  IOS image  : /home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin

Loading ELF file '/home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin'...
ELF loading skipped, using a ghost RAM file.
ELF entry point: 0x80008000

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

The above shows a sample output you get on the server side.
noc@scc-sfc-mgt-devsvr:~$ htop
Sample .net file:
autostart = False
[192.168.13.2:7201]
    workingdir = /home/jgitau/dynamips/tmp
    udp = 10004
    [[7200]]
        image = /home/jgitau/dynamips/ios/c7200-p-mz.124-25d.bin
        ghostios = True
        sparsemem = True
    [[ROUTER MSA.PE.2]]
        console = 2046
        slot1 = PA-GE
        g1/0 = MSA.PE.1 g2/0
        slot2 = PA-GE
        g2/0 = MSA.P g4/0
        x = 874.788888605
        y = 753.254833996
    [[ROUTER SCC.MCE.2]]
        console = 2054
        slot1 = PA-GE
        g1/0 = SCC.MCE.1 g1/0
        slot2 = PA-GE
        g2/0 = SCC.PE.1 g1/0
        slot3 = PA-GE
        g3/0 = SCC.PE.2 g2/0
        x = -1235.54415588
        y = 811.297690046
    [[ROUTER EDT.PE.2]]
        console = 2065
        slot1 = PA-GE
        g1/0 = EDT.PE.1 g2/0
        slot2 = PA-GE
        g2/0 = SCC.P g6/0
        slot3 = PA-GE
        slot4 = PA-GE
        slot5 = PA-GE
        slot6 = PA-4E
        x = -1679.1445866
        y = -389.695526217
    [[ROUTER EDT.PE.1]]
        console = 2066
        slot1 = PA-8E
        e1/0 = NKU.P e6/0
        slot2 = PA-GE
        g2/0 = EDT.PE.2 g1/0
        slot3 = PA-GE
        slot4 = PA-GE
        slot5 = PA-GE
        slot6 = PA-4E
        x = -1506.61053199
        y = -389.695526217
    [[ROUTER SCC.MCE.1]]
        console = 2055
        slot1 = PA-GE
        g1/0 = SCC.MCE.2 g1/0
        slot2 = PA-GE
        g2/0 = SCC.PE.2 g1/0
        slot3 = PA-GE
        g3/0 = SCC.PE.1 g2/0
        x = -1499.27416998
        y = 810.611398545
    [[ROUTER SCC.P]]
        console = 2021
        f0/0 = QOA.P f0/0
        slot1 = PA-GE
        g1/0 = MSA.P g2/0
        slot2 = PA-GE
        g2/0 = NKU.P g1/0
        slot3 = PA-GE
        g3/0 = SCC.PE.2 g3/0
        slot4 = PA-GE
        g4/0 = QOA.PE.1 g2/0
        slot5 = PA-GE
        g5/0 = SCC.RR g1/0
        slot6 = PA-GE
        g6/0 = EDT.PE.2 g2/0
        x = -1260.55277785
        y = 323.885822331

- Note:
You can use as many servers as you want. technically the server side stuff can be a friends laptop when he's not using it. Since there's not much in the name of installation, a friendly systems admin can also 'allow' you to run this on a test server, it can also be done remotely. There's a clearer video I found showing the same thing here: http://www.brainbump.net/tutorials/gns3/multiplepcgns3topology.htm

- The other upside is anyone I share this with on our network won't suffer CPU issues and can just focus on the simulations. It comes quite handy as a training tool as well since multiple hypervisors can be used. This particular server has at one point run 80 routers....(4 guys doing 20'something routers each) thats some serious steroids right there.

No comments:

Post a Comment