Showing posts with label Dynamips. Show all posts
Showing posts with label Dynamips. Show all posts

Sunday, 20 February 2011

Slight workflow increase when using Dynamips

I'm still working my way through the IP Expert Volume 3 Workbooks - primarily going through the troubleshooting sessions at the moment since I don't have the largest amount of time available right now and a 2 hour session under a bit of pressure is a good thing to keep me motivated.

Anyway, the topic for discussion here is about how to slightly speed up getting ready to do a lab - probably a lot of people do something similar already, it's just unfortunate that I have really only woken up to the fact that this can help save about 15-20 minutes and reduce errors.

Firstly - this doesn't help much with when you're using real routers - When I finish up with the lab, I get them erased and reloaded so they're all nice an clear of IOS config and VTP related config

Cat1#wr erase
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
*Mar  1 03:18:23.937: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Cat1#del vlan.dat
Delete filename [vlan.dat]?
Delete flash:vlan.dat? [confirm]
Cat1#reload
Proceed with reload? [confirm]
*Mar  1 03:18:31.672: %SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload command.

On my Ubuntu box, I keep all of the configs I use in a directory funnily enough called cisco:

adam@RouterSim:~/cisco$ pwd
/home/adam/cisco

I then have all the related labs living in sub directories - for example the Volume 3 labs are simply unzipped into a directory called ipexpert_vol3

adam@RouterSim:~/cisco$ ls ipexpert_vol3
LAB-10C  LAB-10T  LAB-1C  LAB-1T  LAB-2C  LAB-2T  LAB-3C  LAB-3T  LAB-4C  LAB-4T  LAB-5C  LAB-5T  LAB-6C  LAB-6T  LAB-7C  LAB-7T  LAB-8C  LAB-8T  LAB-9C  LAB-9T  R&S_Volume_3_Diagrams_v11.0.pdf

The dynamips.net config file I use is set up to a generic version what I used previously the main thing I want to highlight is the reference to "currentlab" in the working dir and cnfg lines, the trick I will be using is "softlinks" to point to the specific lab of interest and be able to load up the lab configs without needing a separate .net file per lab when I start dynamips...



start of ipexpert.net
autostart = false
ghostios = true
sparsemem = true
[localhost]
        workingdir = /home/adam/cisco/currentlab/work_ipexpert
        [[7200]]
                image = /opt/ios/unzipped/c7200-adventerprisek9-mz.124-24.T.bin
                npe = npe-400
                ram = 384
                idlepc = 0x6307ad74
                disk0 = 128

        [[2611]]
                image = /opt/ios/unzipped/c2600-js-mz.123-17a.bin
                ram = 64
                idlepc = 0x803266c4
        [[3725]]
                image = /opt/ios/unzipped/c3725-advsecurityk9-mz.124-15.T12.bin
                #/opt/ios/unzipped/c3725-adventerprisek9-mz.124-15.T10.bin
                ram = 128
                #idlepc = 0x6307ad74
                disk0 = 64
                idlepc = 0x60bb28d0

        [[ROUTER R1]]
                model = 7200
                console = 2001
                slot0 = PA-C7200-IO-2FE
                f0/0 = NIO_gen_eth:eth0.101
                f0/1 = NIO_gen_eth:eth0.102
                cnfg = /home/adam/cisco/currentlab/INITIAL/R1.txt

        [[ROUTER R2]]
                model = 7200
                console = 2002
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.201
                f0/1 = NIO_gen_eth:eth0.203
                s2/1 = FR s0/0
                s2/2 = R5 s2/2
                cnfg = /home/adam/cisco/currentlab/INITIAL/R2.txt

        [[ROUTER R4]]
                model = 7200
                console = 2004
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.401
                f0/1 = NIO_gen_eth:eth0.402
                s2/0 = FR s0/1
                cnfg = /home/adam/cisco/currentlab/INITIAL/R4.txt

        [[ROUTER R5]]
                model = 7200
                console = 2005
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.501
                f0/1 = NIO_gen_eth:eth0.502
                s2/1 = FR s0/2
                cnfg = /home/adam/cisco/currentlab/INITIAL/R5.txt

        [[ROUTER R6]]
                model = 7200
                console = 2006
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.601
                f0/1 = NIO_gen_eth:eth0.602
                s2/1 = FR s0/3
                s2/2 = R9 s2/2
                s2/3 = R9 s2/3
                cnfg = /home/adam/cisco/currentlab/INITIAL/R6.txt

        [[ROUTER R7]]
                model = 7200
                console = 2007
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.701
                f0/1 = NIO_gen_eth:eth0.702
                s2/0 = R8 s2/0
                cnfg = /home/adam/cisco/currentlab/INITIAL/R7.txt

        [[ROUTER R8]]
                model = 7200
                console = 2008
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.801
                f0/1 = NIO_gen_eth:eth0.802
                cnfg = /home/adam/cisco/currentlab/INITIAL/R8.txt

        [[ROUTER R9]]
                model = 7200
                console = 2009
                slot0 = PA-C7200-IO-2FE
                slot2 = PA-4T
                f0/0 = NIO_gen_eth:eth0.901
                f0/1 = NIO_gen_eth:eth0.902
                cnfg = /home/adam/cisco/currentlab/INITIAL/R9.txt

        [[ROUTER BB1]]
                model = 2611
                console = 2101
                e0 = NIO_gen_eth:eth0.11
                e1 = NIO_gen_eth:eth1
                cnfg = /home/adam/cisco/currentlab/INITIAL/BB1.txt

        [[ROUTER BB2]]
                model = 2611
                console = 2102
                e0 = NIO_gen_eth:eth0.22
                cnfg = /home/adam/cisco/currentlab/INITIAL/BB2.txt

        [[ROUTER BB3]]
                model = 2611
                console = 2103
                e0 = NIO_gen_eth:eth0.33
                cnfg = /home/adam/cisco/currentlab/INITIAL/BB3.txt

        [[ROUTER FR]]
                model = 3725
                console = 2104
                WIC0/0 = WIC-2T
                WIC0/1 = WIC-2T
                cnfg = /home/adam/cisco/IPExpertFrame.txt
end of ipexpert.net

IPexpertFrame.txt refers to a configuration for the FR Switch rather than use the built in frame relay switch capacity of dynamips:

start of IPExpertFrame.txt
hostname FR
!
interface Serial0/0
 description R2
 no ip address
 encapsulation frame-relay
 clock rate 2000000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 104 interface Serial0/1 401
 frame-relay route 105 interface Serial0/2 501
 frame-relay route 106 interface Serial0/3 601
 frame-relay route 204 interface Serial0/1 402
 frame-relay route 205 interface Serial0/2 502
 frame-relay route 206 interface Serial0/3 602
 frame-relay route 214 interface Serial0/1 412
 frame-relay route 215 interface Serial0/2 512
 frame-relay route 216 interface Serial0/3 612
 frame-relay route 224 interface Serial0/1 422
 frame-relay route 225 interface Serial0/2 522
 frame-relay route 226 interface Serial0/3 622
 no shutdown
!
interface Serial0/1
 description R4
 no ip address
 encapsulation frame-relay
 clock rate 2000000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 401 interface Serial0/0 104
 frame-relay route 402 interface Serial0/0 204
 frame-relay route 405 interface Serial0/2 504
 frame-relay route 406 interface Serial0/3 604
 frame-relay route 412 interface Serial0/0 214
 frame-relay route 415 interface Serial0/2 514
 frame-relay route 416 interface Serial0/3 614
 frame-relay route 422 interface Serial0/0 224
 frame-relay route 425 interface Serial0/2 524
 frame-relay route 426 interface Serial0/3 624
 no shutdown
!
interface Serial0/2
 description R5
 no ip address
 encapsulation frame-relay
 clock rate 2000000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 501 interface Serial0/0 105
 frame-relay route 502 interface Serial0/0 205
 frame-relay route 504 interface Serial0/1 405
 frame-relay route 506 interface Serial0/3 605
 frame-relay route 512 interface Serial0/0 215
 frame-relay route 514 interface Serial0/1 415
 frame-relay route 516 interface Serial0/3 615
 frame-relay route 522 interface Serial0/0 225
 frame-relay route 524 interface Serial0/1 425
 frame-relay route 526 interface Serial0/3 625
 no shutdown
!
interface Serial0/3
 description R6
 no ip address
 encapsulation frame-relay
 clock rate 2000000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 601 interface Serial0/0 106
 frame-relay route 602 interface Serial0/0 206
 frame-relay route 604 interface Serial0/1 406
 frame-relay route 605 interface Serial0/2 506
 frame-relay route 612 interface Serial0/0 216
 frame-relay route 614 interface Serial0/1 416
 frame-relay route 615 interface Serial0/2 516
 frame-relay route 622 interface Serial0/0 226
 frame-relay route 624 interface Serial0/1 426
 frame-relay route 625 interface Serial0/2 526
 no shutdown
!
end
end of IPExpertFrame.txt

So the deal with the softlinks is to point "currentlab" to the lab you want to work on for example:


adam@RouterSim:~/cisco$ ln -s ipexpert_vol3/LAB-4T/ currentlab
adam@RouterSim:~/cisco$ ls -l currentlab
lrwxrwxrwx 1 adam adam 21 2011-02-20 18:45 currentlab -> ipexpert_vol3/LAB-4T/

Here are a few house keeping tasks that could be easily scripted away - create a working directory for dynamips files to go into and to rework the standard IPExpert config to match the interfaces in my topology


adam@RouterSim:~/cisco$ mkdir currentlab/work_ipexpert
adam@RouterSim:~/cisco$ cd currentlab/INITIAL/
adam@RouterSim:~/cisco/currentlab/INITIAL$ reworkcfg
adam@RouterSim:~/cisco/currentlab/INITIAL$ cd ../..

To load the config onto the external switches, we just paste the output from

adam@RouterSim:~/cisco$ cat currentlab/INITIAL/Cat1.txt
adam@RouterSim:~/cisco$ cat currentlab/INITIAL/Cat2.txt 
adam@RouterSim:~/cisco$ cat currentlab/INITIAL/Cat3.txt  
adam@RouterSim:~/cisco$ cat currentlab/INITIAL/Cat4.txt

So we just start things up normally and go on our merry lab way

adam@RouterSim:~/cisco$ sudo dynagen ipexpert.net
Reading configuration file...

Network successfully loaded

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

=> start /all
100-VM 'R4' started
100-VM 'R5' started
100-VM 'R6' started
100-VM 'R7' started
100-VM 'R1' started
100-VM 'R2' started
100-VM 'FR' started
100-VM 'R8' started
100-VM 'R9' started
100-VM 'BB3' started
100-VM 'BB2' started
100-VM 'BB1' started

Once we have finished the with lab and exited dynagen, we tidy up:

That is write erase/del vlan.dat/reload on the switches and
 
adam@RouterSim:~/cisco$ rm currentlab

Now we're ready for the next lab session:

Saturday, 25 September 2010

Breakout switches and IRB don't play well together

I've discovered another possible caveat when using dynamips for your labs, at least when using a breakout switch.  If you're using locally connected interfaces, or not using real switches it's not going to bite you though.

While working IPExpert Volume 1 Workbook Lab 7 which is a frame relay based lab focusing on bridging, I found that when using Dynamips IRB on ethernet interfaces doesn't work as expected when you're using a 3550 as your breakout switch.

This may be related to the one way CDP "feature" due to the 3550 not supporting l2protocol tunnelling on trunk port.

I found it confusing at the time since the bridging was working fine over the frame cloud but not over the ethernet.

This was the irb config I had on R2:
hostname R2
bridge 1 protocol ieee
bridge 1 route ip
bridge irb
interface Serial2/1.205 point-to-point
 description to R5 via Frame
 frame-relay interface-dlci 205
 bridge-group 1
!
interface BVI1
 ip address 150.100.221.2 255.255.255.0
!

This was the irb config I had on R5:
hostname R5
bridge 1 protocol ieee
bridge 1 route ip
bridge irb
interface FastEthernet0/1
 description to R6 and R7 via Cat3
 no ip address
 duplex auto
 speed auto
 bridge-group 1
!
interface Serial2/1.502 point-to-point
 description to R2 via Frame
 frame-relay interface-dlci 5012
 bridge-group 1
!
interface BVI1
 ip address 150.100.221.5 255.255.255.0
!

R6 and R7 are routers with interfaces on directly attached to the 150.100.221.0/24 subnet.

In the end I installed one of the many USB200M Ethernet Adapters I still have before going the breakout switch route in my Ubuntu Server - which was automatically installed as eth2, I edited the lab .net file to have R5 Fa0/1 use eth2, patched it to Cat3 replacing the feed from the breakout switch and fired things up and obtained the expected connectivity.

R2#ping 150.100.221.5

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

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.100.221.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/10/24 ms
R2#ping 150.100.221.7

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

Total of 300 station blocks, 297 free
Codes: P - permanent, S - self

Bridge Group 1:

    Address       Action   Interface       Age   RX count   TX count
ca05.06f6.0006   forward   Serial2/1.205     0          6          6
ca03.06f6.0006   forward   Serial2/1.205     0          5          4
ca04.06f6.0006   forward   Serial2/1.205     2          6          5

R2#sh arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  150.100.221.2           -   0000.0c81.46a0  ARPA   BVI1
Internet  150.100.221.5          46   ca03.06f6.0006  ARPA   BVI1
Internet  150.100.221.6          46   ca04.06f6.0006  ARPA   BVI1
Internet  150.100.221.7          25   ca05.06f6.0006  ARPA   BVI1
 

R5#sh bridge
Total of 300 station blocks, 297 free
Codes: P - permanent, S - self

Bridge Group 1:

    Address       Action   Interface       Age   RX count   TX count
ca04.06f6.0006   forward   FastEthernet0/1   0          6          5
ca05.06f6.0006   forward   FastEthernet0/1   0          6          5
0000.0c81.46a0   forward   Serial2/1.502     0         15         15
 

R5#sh arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  150.100.220.5           -   ca03.06f6.0008  ARPA   FastEthernet0/0
Internet  150.100.221.2          24   0000.0c81.46a0  ARPA   BVI1
Internet  150.100.221.5           -   ca03.06f6.0006  ARPA   BVI1
Internet  150.100.221.6          45   ca04.06f6.0006  ARPA   BVI1
Internet  150.100.221.7          24   ca05.06f6.0006  ARPA   BVI1


Not necessarily a show stopper but something to be aware of when you're doing a lab and things appear to be correctly configured but aren't working.  It's good to know that I'm not alone with making this observation.  There's something certainly to be said for having plenty of interfaces directly attached to your dynamips box and not needing the breakout switch.

Thursday, 23 September 2010

Started IPExpert Volume 1 Workbook

I have completed the first three labs in the IPexpert Volume 1 Workbook which have been focused on Switching.  While a good number of the tasks are relatively straight forward, some of the tasks introduced some things that I wasn't aware of until looking at the Detailed Solution Guide to track how I went.

One of the commands, that I found interesting which I don't think was specifically mentioned in any of the material I've examined so far (but is there for the looking in the config guide) introduced in one of the tasks is the "switchport protected" command.  It is basically a cut-down version of private-vlans.  The scope of function is switch wide and it basically enables "isolated ports" on the same VLAN - any port or SVI that is not specifically "switchport protected" is basically a promiscuous port.

With the lab exercises, usually initial configurations for LAN switches and Routers are provided which are designed to work on the Proctor Labs equipment and I don't have the same setup which means I need to modify the configs a little.

Below is a pretty simple bash script that uses sed to modify the configs to suit my equipment.


#!/bin/bash

# This script modifies the IPexpert initial configs to match my hardware
# Cat1 + Cat2 = 3750
# Cat3 + Cat4 = 3550
# R1 - R9 = 7200
# BB1 - BB3 = 2611

TEMPFILE="/tmp/rework.sed"
if [ -f $TEMPFILE ]
then
  rm $TEMPFILE
fi

# IPexpert's R2 has Gigabit Ethernet Interfaces - our R2 only has FastEthernet
# Comment out the media-type line
if [ -f R2.txt ]
then
    sed -e 's/GigabitEthernet0/FastEthernet0/g' \
        -e 's/media-type/! media-type/g' \
        R2.txt > $TEMPFILE
        mv $TEMPFILE R2.txt
fi


# Change the Interface numbers to match with my 3750
# Gi0/2 will eventually become a copper SFP but at present we will map it to Fa1/0/12
if [ -f Cat1.txt ]
then
    sed -e 's/FastEthernet0\//FastEthernet1\/0\//g' \
        -e 's/GigabitEthernet0\/2/FastEthernet1\/0\/12/g' \
        -e 's/GigabitEthernet0\//GigabitEthernet1\/0\//g' \
        Cat1.txt > $TEMPFILE
        mv $TEMPFILE Cat1.txt
fi


# Change the Interface numbers to match with my 3750
if [ -f Cat2.txt ]
then
    sed -e 's/FastEthernet0\//FastEthernet1\/0\//g' \
        -e 's/GigabitEthernet0\//GigabitEthernet1\/0\//g' \
        Cat2.txt > $TEMPFILE
        mv $TEMPFILE Cat2.txt
fi

# Change the Serial Interfaces to match the emulated routers
for R in R*.txt
do
    sed -e 's/memory-size/! memory-size/g' \
        -e 's/Serial0\/0\/0/Serial2\/0/gI' \
        -e 's/Serial0\/1\/0/Serial2\/1/gI' \
        -e 's/Serial0\/2\/0/Serial2\/2/gI' \
        -e 's/Serial0\/2\/1/Serial2\/3/gI' \
        -e 's/S0\/0\/0/Serial2\/0/gI' \
        -e 's/S0\/1\/0/Serial2\/1/gI' \
        -e 's/S0\/2\/0/Serial2\/2/gI' \
        -e 's/S0\/2\/1/Serial2\/3/gI' \
        $R > $TEMPFILE
        mv $TEMPFILE $R
done

Saturday, 8 May 2010

My Home lab

I know its been awhile since my last update but I haven't had a great deal of time up my sleeve for Cisco studies lately - a couple of other network related things have been keeping my occupied for the last month.

Firstly, I needed to renew my JNCIS-M, which was actually fun because I was able to play with some Olives and re-affirm my understanding on Juniper policy and configuration as it had been awhile since I had played with Junos (yes I passed that exam)

Also for the last few weeks I have been heavily work on IP/MPLS architecture and systems for SROS which has been a lot of fun and quite educational in building a reasonably sized demonstration network to support a number of current and legacy services.

I guess the take home message here is that while protocol operation is pretty much the same throughout, the way things are implemented and named can be different though and certainly each has a different paradigm in how things are achieved that depending on your particular context can be a bonus or a hindrance.

Anyhow, while I am planning to extend my studies further into the Service Routing Certification Program as certain units have immediate benefits in my workplace - my overall focus is still targeted on reaching CCIE status.

I think that many candidates working towards their R&S and Voice CCIEs are breathing a sigh of relief in that the open ended questions in those tracks are being retired in a couple of days.  It's just that little bit of extra stress that can be avoided while focusing on the main game of troubleshooting and configuration.

Anyhow - the topic of this post is my home lab environment. As I mentioned previously I decided that I would be going the virtualised router and physical switch path.

With the virtualised routers there were still some connectivity related issues to the physical switches that needed to be resolved.  Initially I figured the lowish cost of purchasing a number of Linksys USB200M ethernet NICs may do the job, and to be honest when I had about 4 of these things, they appeared to be fairly reliable even if it was quite messy and were natively supported with Ubuntu.  Once I went up to 12-14 of these things, they would seem to randomly decide to go out of service.

An alternate option is to use quad port ethernet NICs - however the motherboard in my server didn't support that many NICs, though I understand it is quite a good method to use.

In the end, I ended up purchasing a third 3550 to act as a breakout switch thanks to it's dot1q tunnelling and l2protocol tunneling support.  I wont go into detail on how to set up the breakout switch as there are good explanations on how to achieve this already.

My home lab is set up in my garage so that the fan noise does not drive the household crazy.  I have a Baytech RPC3 which enables me to remotely power on the kit to save on power costs - enabling me to work from my home office without having to walk in and turn things on.  Coupled with the VPN capability I previously set up, I can be pretty much anywhere on the internet and still work on my lab.

It's probably easiest for me to show the pictures and then describe if a bit more.

My home lab equipment lives in a Dell Rack which I picked up from Ebay last year, as you can see its only about half populated - plenty of room for more toys in the future.

Removing the doors and side panels, Looking at the front and going from top to bottom:
  • 3550-24PWR acting as a Breakout Switch between the PC and the rest of the switches
  • Cable Management
  • 3750-24TS
  • 3750-24TS
  • 3550-24
  • 3550-24
  • Cable Management
  • Dynamips PC in a Coolermaster Elite 360 case (Powered by an AMD 630 quad core processor with 4 Gig of RAM and running Ubuntu 10.04 a second NIC is installed to provide connectivity to the Breakout Switch)
Hidden under the tray that the PC is residing on is a management switch - it connects my home network to the RPC-3, The Dynamips PC and the 2610 Terminal Server (It's just a little Dlink 10/100 device I had lying around)

Looking from behind we can see:



  • The Baytech RPC-3A which provides remote power control to everything else in the rack (except for the Dlink switch)
  • The 2610 with NM-4A/S acting as a Terminal Server for the 3x3550s and 2x3750s
  • The other gear is the front mounted 3750s, 3550s and Dynamips PC
To give an idea on the depth of the rack, here is a side view shot:

Right now I haven't selected a training vendor for the lab, so I have been really only playing around with things for my own learnings rather than following a structured plan - the cabling is basically:
Green for breakout switch to switch (representing router to switch connectivity)
Red for Switch-Switch connectivity
Yellow - out of band management