Create a Dynamips/Dynagen lab with just a Laptop & a Switch

It’s actually just as easy as that.  If you are looking to create a fully functional router and/or server lab used for training classes or a configuration test lab, and looking to do it with the smallest footprint ever, then read on!

The Laptop

I started off trying to find a laptop that would work with the most bare metal of hypervisors out there: VMWare ESXi.  However, after days of frustrating troubleshooting, turns out ESX doesn’t have support for basic laptop NICs (ie RealTek and others).  If you are really determined, then you can find a custom ISO builder that will insert some of these drivers and rebuild the ISO.  This didn’t work for me, but go ahead and try it out.  Quick warning: development is pretty stale.

So the next natural choice is something open source, close to bare metal and performs as well.  Naturally, I began looking at XenServer.  However, a new hypervisor has grabbed some of the leading Linux distros by storm called Linux KVM.  It comes with Ubuntu-Server and I was hooked from install on!  Here’s how to do this:

  • Install Ubuntu-Server 11.10 on your super high performing laptop (Alienware-type) quad-core, 16GB RAM and no less than a 750GB hard drive.
  • Install the VLAN utilities: “apt-get install vlan bridge-utils”
  • configure your network interfaces like Tolaris.com explains on /etc/network/interfaces:

 

# The loopback network interface
auto lo
iface lo inet loopback          

# LAN uses VLAN trunking, so set any IP addresses on appropriate bridge
auto eth0
iface eth0 inet manual
	up ifconfig eth0 up

# VLAN 100
auto eth0.100
iface eth0.100 inet manual
	up ifconfig eth0.100 up

# KVM bridge, VLAN 100, via eth0
auto br100
iface br100 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	gateway 192.168.0.1
	bridge_ports eth0.100
	bridge_maxwait 5
	bridge_fd 1
	bridge_stp on
  • Of course, you can add as many VLAN as you’d like.  Just remember, the point is to be able to converge them onto a single physical interface.
  • Now install ubuntu-desktop “apt-get install ubuntu-desktop” (you’ll need it for the Linux KVM GUI
  • Use Ubuntu’s guide to install KVM.  “apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder”
  • Install Virt-Manager (awesome Virtual Machine manager GUI – think VSphere Client): “apt-get install virt-manager”

Dynamips/Dynagen

This is actually the easier part.  All you have to do is install the dynamips/dynagen server daemon, build a dynagen network file, and get ahold of the Cisco IOS.  Another warning: Using Cisco’s IOSs is strictly forbidden and voids any enterprise service agreement you may have with them.  So do it with Juniper if you’re worried.  Follow these steps:

  • Install both dynamips and dynagen: “apt-get install dynamips dynagen”
  • Start dynamips in daemon mode: “dynamips -H 7200 &”
  • Download your preferred router image and decompress it. “unzip -p c7200-g6ik8s-mz.124-2.T1.bin > c7200-g6ik8s-mz.124-2.T1.image”  **Change to reflect your image.
  • Build your network file.  The network file is what Dynagen is going to use as its configuration instructions.  Here’s a basic one called “test.net”:

[localhost]

[[7200]]

image = /home/lab/router.image

npe = npe-400

ram = 160

[[ROUTER R1]]

s1/0 = R2 s1/0

[[router R2]]

s1/0 = R1 s1/0

  • Now just make sure you have the image in the directory and execute the following command: “dynagen test.net”
  • Once the CLI is up, start one of your routers “start R1”.  Don’t start both because you’ll want to capture the “idlepc” value to ensure it doesn’t eat up your entire CPU.
  • Once it’s started go in and set it:
  1. “idelpc get R1”
  2. select the highest one
  3. then save it “idlepc save R1 db”
  • Now do a “start /all” and have fun and configure away!  Current router support isn’t that great, but it works for most of the ISR series routers.

The Switch

This is actually the easiest part. On your Cisco-like hard switch (i.e. Cisco 2950, 2960, etc), setup the VLANs you created on your Linux box.  Then setup the trunk port:

  • config t
  • vlan 100
  • name VLAN_100_lab
  • exit
  • int fa0/1     ##this is the port where your laptop is connected**
  • switchport trunk enc dot1q
  • switchport mode trunk
  • switchport trunk allowed vlan 100

 

And that’s it!  You can do anything you want here.  Setup servers on your Linux KVM server and have them routed over IPv4 and IPv6.  Or you can have hosts setup as access ports that are on different routers.  The possibilities are endless!                           

 

 

 

 

 

3 thoughts on “Create a Dynamips/Dynagen lab with just a Laptop & a Switch”

Comments are closed.

Scroll to Top