Micronics
  • Home
  • Links
  • Contact
Home » Featured, Tutorials

Tutorial: Part 1 of Ultimate Dynamips Dynagen config - focusing on start on boot with Terminal Servers

10 July 2008 5 Comments

This tutorials is going to detail the Dynamips configuration I have setup. It’s designed for remote access via ssh. The client needs two terminals open. One is the control session (dynamips) the other is used to access the terminal server.

Here’s pic of the topology/layout to make things a bit clearer. In regards to dynagen. All four terminal Servers(TS1,TS2,TS3 and TS4) are in the same hypervisor. and each rack is a seperate hypervisor. This may/may not change as I am still investigating things performance wise.

And each rack has an identical topology. As per this diagram.

As a prerequisite to this tutorial. I am assuming that you have already configured your system as per this article. So I hope you are already familiar with terms such as bridge, br-0 tap interface, cloud as they are used quite a bit in this tutorial. Linux knowledge is also very helpfull :) and now its time to start the configuration.

Part1 - Terminal Servers,Dynagen and bridging interface’s in linux.

Part2 - Virtual Racks, rackcontrol scripts and finalizing everything.

Part 1 - Configuring the Linux host for bridging, Tap interfaces. and Configuring the dynagen terminal server instances.

The first thing that needs to be done is acquiring the relevant files.
My host is an OpenSuse 10.3 32bit system.
The virtual routers are 2691’s using ios c2691-i-mz.123-21b.bin.
Dynamips 0.2.8RC2 as found here
Dynagen 0.11.0 as found on the download page here
Terminal Server setup ( included is ts.net and the startup configs

The config files use a specific directory structure/layout. This is how I have set it up and you can deviate from this if you want. But if you do, the files will need to be modified due to some of the path’s being hardcoded in the config files.

/data/cisco - holds the .net files and dynamips,
/data/cisco/ios - Where ios is stored.
/data/cisco/ts_configs - terminal server config files ts1.cfg, ts2.cfg
/data/cisco/ts_working - Working directory for the terminal server instances.
/data/cisco/dynagen - this should contain the contents of the downloaded dynagen archive.

So start off by extracting the contents of termserv.tar.bz2 to /data/cisco . Then move the files ts1.cfg, ts2.cfg,ts3.cfg and ts4.cfg to /data/cisco/ts_configs. If the directory doesn’t exist yet just create it. Make sure to leave the ts.net file in /data/cisco. Make sure to change the ios file in ts.net to the one you are using.

Now extract the dynagen archive to /data/cisco. It should result in a new directory called dynagen-0.11.0 being created. We need to rename this directory to dynagen .

If you have already downloaded dynamips, copy it to /data/cisco. Otherwise download it now and save the file to /data/cisco/.   Make sure dynamips is executable with the following command

chmod +x /data/cisco/dynamips-0.2.8-RC2-x86.bin

Before we continue. Its time to test the setup. Do this by opening a terminal and typing the following

/data/cisco/dynamips-0.2.8-RC2-x86.bin -H 7210

Then in another terminal execute dynagen with the ts.net topology file with the following command

/data/cisco/dynagen/dynagen /data/cisco/ts.net

Dynagen should now start up with out any errors. Verythis by typing list at the dynagen prompt. You should see TS1, TS2, TS3 and TS4 listed and they are already running. Make sure the routers are working by telnetting to them. TS1 uses console port 2001, TS2 - 2002, TS3 - 2003 and TS4 2004. If you statisfied that everything is working. Its time to make the terminal servers start on boot.

This is fairly easy as long as you already have the networking scripts setup that I have mentioned here. First thing is to modify the file /etc/dynamips/config.

HOST_IF="eth1"
HOST_SETUP="static"
HOST_IPADDR="192.168.1.10/24"
HOST_GW="192.168.1.1"
DYNA_USER="nsadmin"
TAPS="tap0"

The line that starts with TAPS needs to be changed to read

TAPS="tap1 tap2 tap3 tap4"

Save and exit the file. Its now time to modify the /etc/init.d/dynamips file. What I have done is added
an extra variable called TERMSERVDIR, created a new function called start_termserv and called the
in the start portion of the case statement.

The variable needs to place below the line “DYNADIR=”/etc/dynamips”

TERMSERVDIR="/data/cisco"

The function should be placed below the line #FUNCTIONS

start_termserv() {
$TERMSERVDIR/dynamips-0.2.8-RC2-x86.bin -H 7210 &
su -c "screen -m -d -S Termserv $TERMSERVDIR/dynagen/dynagen $TERMSERVDIR/ts.net" $DYNA_USER
}

You might be wondering what the “screen -m -d” is for. Screen is a gnu utility which is incredibly
usefull. What this line does is starts dynagen in a screen session as your nominated user. This
user can then at a later stage reattach the screen session to control the dynagen session.
To view the screen sessions available try this from the command line as your dynagen user.

screen --list

You should see output similar to this. Notice the entry 18524.Termserv? Termserv is the name of your
dynagen screen session.

There are screens on:

18524.Termserv (Detached)
18466..mobile (Detached)
30300..mobile (Detached)
30266.top (Detached)
4 Sockets in /var/run/screen/S-josh.

To reattach to the screen session use the following command. Replace 18524.Termserv with your session
identifier.

screen -r 18524.Termserv

Now to call the start_termserv function you need to change the section starting with start) to this.
Note the start_termserv line has been added after the last chmod statement.

start)
enable_bridge
enable_taps
chown $DYNA_USER.users /dev/net/tun
chmod 0666 /dev/net/tun
start_termserv
;;

Otherwise you can download this already modified version of the file.
To install this file. Copy it to /etc/init.d/dynamips. Answering Yes to any overwrite questions.

cp /location/of/dynamips-mod /etc/init.d/dynamips

Remember to make the file executable with the following command

chmod +x /etc/init.d/dynamips

Thats it!. Time for a final reboot and now you should have four terminalservers starting on boot in a detached screen session so they are still manageable.

Part 2 of this tutorial is setting up the 4 virtual racks
As usual. If you have any questions of comments please feel free to leave them.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

5 Comments »

  • Joeri Vanthienen said:

    Tnx for sharing your knowledge! I’m looking forward to part two!

    Great blog and enthusiasm!

    # 12 July 2008 at 8:48 am
  • joshatterbury.com » Blog Archive » Ideas and thoughts. said:

    [...] other thoughts are that once I finish part two of this series. ( next couple of days depending on work ). I am going to create a video tutorial/demo on how to use [...]

    # 13 July 2008 at 11:07 pm
  • joshatterbury.com » Blog Archive » Tutorial: Part 2 of Ultimate Dynamips Dynagen config - focusing on 4 Virtual racks with control scripts. said:

    [...] to Part 2 of the Ultimate Dynamips Dynagen setup. I hope you enjoyed Part 1. Now that you have the terminal servers configured and automatically starting on boot Its time to [...]

    # 14 July 2008 at 7:11 pm
  • AlexM said:

    Your blog is interesting!

    Keep up the good work!

    # 15 August 2008 at 5:10 pm
  • joshatterbury.com - CCIE #23347 » Blog Archive » Tutorial: Part 2 of Ultimate Dynamips Dynagen config - focusing on 4 Virtual racks with control scripts. said:

    [...] to Part 2 of the Ultimate Dynamips Dynagen setup. I hope you enjoyed Part 1. Now that you have the terminal servers configured and automatically starting on boot Its time to [...]

    # 25 March 2009 at 8:01 pm

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Recent Comments

  • blindhog.net » Linux Bridging for GNS3 LAN communications on Part 2 of Dynamips External Cloud Interface on Linux
  • blindhog.net » Linux Bridging for GNS3 LAN communications on Part 1 of Dynamips External Cloud Interface on Linux
  • mihwar on Part 1 of Dynamips External Cloud Interface on Linux
  • Javier on Part 1 of Dynamips External Cloud Interface on Linux
  • Mike on Part 1 of Dynamips External Cloud Interface on Linux
  • Lukasz on CCIE SP Technology Workbooks

    Blogroll

    • Colorlabs Project
    • Michael Jubel
    • Hanna Siahaan
    • Majari Magazine
    • The Bloggerzine
    • Majari Kanayakan
    Powered by WordPress | Log in | Entries (RSS) | Comments (RSS) | Arthemia theme by Michael Hutagalung