Part 2 of Dynamips External Cloud Interface on Linux
Part 2 of Dynamips External Cloud Interface on Linux
Ok, so you want to make the network changes made in Part 1 permanent? Well its easier than Part 1. Most Linux distributions use an initalization system called “init”. Init is responsible for the way the linux system boots. So what daemons(services) are started, What order they are started in. Init uses scripts located in /etc/init.d/ to control these daemons. So I have taken a script from http://farfewertoes.com/ which was created for virtual box and modified it for dynamips. From your perspective this script does not need any modification as its using a config file.
First you need to download these two file dynamips and config Please remember where you saved them to. Then we need to install the dynamips control script. Do this by opening a terminal and changing to the root user.(su or sudo depending on distro) Then execute the following command which will copy the file to the /etc/init.d/
cp /path/to/your/download/directory/dynamips /etc/init.d/
Secondly so init can launch the script we need to make it executable with the following command.
chmod 755 /etc/init.d/dynamips
The configuration file needs to reside in a directory called dynamips under /etc. This directory doesn’t exist yet so do this by entering
mkdir /etc/dynamips
Now copy the configuration file to the newly created directory
cp /path/to/your/download/directory/config /etc/dynamips
Its time to modify the configuration file with values appropriate for your setup. If your familiar with console based editors great, Otherwise if you want to use a gui based editor you will most likely have to make the file writable for your user. Do this by entering
chmod 666 /etc/dynamips/code
This is a sample of the configuration file, The options are explained below so its time to put in your settings.
HOST_IF="eth1"
HOST_SETUP="static"
HOST_IPADDR="192.168.1.10/24"
HOST_GW="192.168.1.1"
DYNA_USER="user1"
TAPS="tap0"
HOST_IF=”eth1″ - Replace eth1 with your network card name, It might be eth0, eth1, eth2, wlan0. Refer to part1 if your not sure.
HOST_SETUP=”static” - So static means your statically configuring your card, dhcp means autoconfiguration and you can leave HOST_IPADDR and HOST_GW blank.
HOST_IPADDR=’192.168.1.10/24″ - This is your static ip address with subnet mask represented in cidr notation.
HOST_GW=”192.168.1.1″ - Place the ip address of your default gateway here.
DYNA_USER=”user1″ - This should be the name of the user who runs the dynamips/gns3 program
TAPS=”tap0″ - You desired tap interface name, so tap0 tap1 tap2 etc.
Ok all done? Make sure to save the file to and set the permissions back to norma with
chmod 644 /etc/dynamips/config
Now its time to test the setup, Do this by entering the following command as root.
/etc/init.d/dynamips start
The output should be similar to what I have below.
bash:/etc/init.d # /etc/init.d/dynamips start
Set 'tap0' persistent and owned by uid 501
The easiest way to verify the setup is to enter the commands ip a and ip r. Compare your output to the following. Take note of the br0 and tap0 interfaces. They have been created and activated and the br0 interface has been given the correct ip address. The routing table also has the correct default gateway address.
bash:/etc/init.d # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:12:3f:43:a4:b3 brd ff:ff:ff:ff:ff:ff
7: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
link/ether 00:12:3f:43:a4:b3 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/24 scope global br0
8: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 500
link/ether 00:ff:9c:3c:21:23 brd ff:ff:ff:ff:ff:ff
bash# ip r
192.168.1.0/24 dev br0 proto kernel scope link src 192.168.1.10
169.254.0.0/16 dev eth1 scope link
127.0.0.0/8 dev lo scope link
default via 10.27.134.1 dev eth1
Its now time to fire up your relevant dynamips config and test access to the router. If you can succesfully access your router and want to have this configuration applied on startup. Enter the following code.
chkconfig dynamips on
If for some reason you change your mind. Disable the script with the following.
chkconfig dynamips off
The Previous two commands instruct the system to enable or disable our settings on certain events. The major ones being startup and shutdown. If you want to manually start the script you can enter the first of the following commands. To stop it and remove the settings try the second command.
/etc/init.d/dynamips start
/etc/init.d/dynamips stop
Congratulations, You should now have working configuration that automatically starts on system boot. Please feel free to leave any comments or questions you may have.











[...] My project for the last couple of days has been to setup a training environment for the other people I work with. I must say I’m happy with the results. I have setup 4 virtual racks, Each rack consisting of 6 routers, 3 backbone routers. Fully meshed frame setup. 4 x 3700’s acting as layer3 switches using NM-16ESW. Each rack is managed individually with the capability to start,stop the routers remotely. Add in a Terminal Server for easy access and the fact that its automatically started on boot…. :). Hopefully tomorrow I get a chance to document it all and post it up here. Including .net files for the racks and termserv, Config file for the TermServ and the Linux initialization script thats a modified version of this one_here. [...]
[...] 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 [...]
[...] Thats it for now. Feel free to ask any questions you have. My next post will be how to apply that configuration on boot here it is [...]
[...] 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 [...]
Thanks very much for your work.
I got the following message:
service dynamips does not support chkconfig
For my Mandriva system I had to add the following to the script to allow it to be added by chkconfig
#chkconfig: 345 20 80
#description: Tap and Bridge interface for dynamips
[...] I discovered that I was able to communicate with every device on the LAN except the actual host machine. While troubleshooting, I finally read the GNS3 FAQ. Then I learned how to solve the problem with Josh Atterbury’s posts: ‘Dynamips External Cloud Interface on Linux – Part1 and Part2. [...]
Leave your response!
Recent Comments
Blogroll