If you’re like myself who doesn’t have the space, time, money or power in your own home, having a large scale network lab isn’t really possible. So network in a box would be ideal. Having worked with a couple of pretty cool and smart engineers PacketJedi from thepacketstream.com and Darren from mellowd.co.uk, they suggested that I should look into creating a Virtual Cisco Lab with a server. Originally, I was using GNS3 (an awesome tool for network engineers, whether a noob or a season vet) to emulate Cisco IOS routers. The issue I found was when I wanted to have large scale topologies, my laptop wasn’t able to cope and the heat was amazing (not in the good way!). To get around this, I got went and got myself a dedicated server from UK Dedicated Servers and installed the packages that were being used behind the GNS3 GUI interface.

This is how I got my network in a box created:

You will need be root or a sudo privileged user.

Update your server, install the packages and persistent iptables so that when you reboot your box you wont need to keep updating iptables

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install dynagen dynamips iptables-persistent
sudo nano /etc/iptables/rules.v4

Create iptables rules for dynamips

-A INPUT -p tcp -m multiport --dports 7200:7201 -j ACCEPT
-A INPUT -p udp -m multiport --dports 7200:7201 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 2100:2199 -j ACCEPT
-A INPUT -p udp -m multiport --dports 2100:2199 -j ACCEPT
-A INPUT -p udp -m udp --dport 10000 -j ACCEPT

Restart iptables and run lab script

sudo service iptables-persistent restart
cd /usr/sbin/
sudo touch startlab.sh
sudo nano startlab.sh

Use a script to run dynamips (heavily borrowed from Darren’s blog)

#!/bin/bash

function killdyn() {

\# This function kills all existing dynamips and dynagen processes

echo "Killing any existing Dynamips processes ..."

pkill -5 dynamips

pkill -5 dynagen

}

function startdyn() {

\# This function starts the dynamips hypervisors

echo "Initializing Dynamips Hypervisors ..."

#/usr/bin/dynamips.bin -H 7201 > /dev/null 2>&1 & /usr/bin/dynamips -H 7201 > /dev/null 2>&1 &

}

function cleanfolder() {

\# This functions cleans the working folder out

echo "Clearing out folder" find -name 'c7200\_\*' -exec rm {} + }

clear

while :

do

echo " 1. The Basic"

echo -n "Make A Selection: "

\# read opt

case $opt in 1)killdyn; cd /home/kmarquis/working; cleanfolder; startdyn; /usr/bin/dynagen /home/kmarquis/dynamips/net/Basic.net;;

99)killdyn;

exit 1;;

\*)echo "$opt is not a valid option";

echo "Press \[enter\] key to continue...";

read enterKey;;

esac

done

sudo chmod -R 766 startlab.sh

In your home directory

mkdir -p IOS
mkdir -p dynamips/net
mkdir -p working
mkdir -p config

You can now create/copy your .net topologies into the related folder (dynamips/net for my example) then all you would need to do is run the script

startlab.sh

Now you will be able to get started with labbing :)

You can get Cisco IOS images from the Cisco website, if you have support contract with them. Outside of that I can’t tell you where you can find them, but as ever with the internet if you look hard enough you may get luck!

Share on LinkedIn
Share on Reddit