Wednesday, July 7, 2010

DRAGON Network user mode linux setup

This tutorial uses only p2p mode.
below from
http://dragon.maxgigapop.net/twiki/bin/view/DRAGON/UserModeLinux

(1)install Linux/Ubuntu

(2)install python, in Debian/Ubuntu, run apt-get install python

(3)install uml-utilities package. NOTE: uml_utilities relies on several dependencies. Run apt-get install libreadline5-dev and apt-get install libfuse-dev
in Debian/Ubuntu, run apt-get install uml-utilities
this is a rather old copy of this package, see below for a newer revision
alternatively, download & install the UML utilities package from the UML mini-HOWTOs page
if that link doesn't work, try http://user-mode-linux.sourceforge.net/downloads.html
or use locally cached copy at the above website
build using make all and make install DESTDIR=/

(4)install xterm
in Debian/Ubuntu, run apt-get install xterm. NOTE: in Debian, X11 forwarding will not work if the xauth application is missing
run apt-get install xorg to make sure xauth is properly installed

(5)install GNU screen
in Debian/Ubuntu, run apt-get install screen

(6)install Virtual Distributed Ethernet (vde) package
this package includes the vde_switch application, which is used for establishing network connectivity between UML instances
in Debian/Ubuntu, run apt-get install vde2
alternatively, see the VDE homepage and download the latest version of vde2 or download a locally cached copy from the above website

(7)install the pre-compiled UML kernel binary, or optionally compile your own UML kernel
download uml_linux-2.6.27.8.bz2 from the above website: linux 2.6.27.8 pre-compiled UML kernel
install this file into a directory such as /a/uml/debian and run bzip2 -d to decompress

(8)install custom UML root filesystem
download Debian-4.0-x86-root_fs-2008Dec10.bz2 — Debian 4.0 x86 root filesystem + dragon-sw (144 MBytes) from the above website
install this file into a directory such /a/uml/debian and run bzip2 -d to decompress

(9)install VNE
download VNE-snapshot-2009Jan12.tar.bz2 from the above website: Virtual Network Experiments (VNE) snapshot as of 2009-Jan-12 (this version is patched to work with vde_switch)
decompress this file into a directory such as /home/dragon
install the dependency sudo apt-get python-setuptools, the link in the VNE package is invalid.
install: cd /home/dragon/VNE-snapshot-2009Jan12/src; python setup.py install





CONFIGURATIONS:
(1)This example assume the following structure:
everything is running as user "dragon"
location of root filesystem: /a/uml/debian/Debian-4.0-x86-root_fs
location of UML kernel binary: /a/uml/debian/uml_linux

(2)Create the file ~/.vnerc (in your home directory) that contains the following, changing any paths as needed for your system. The defaults are contained in a text file called VNEDefaults.cfg within the VNE distribution.

[DEFAULT]
kernel = /a/uml/debian/uml_linux
filesystem = /a/uml/debian/Debian-4.0-x86-root_fs
fstype = cow
xmllint = /usr/bin/xmllint
screen = /usr/bin/screen
xterm = /usr/bin/xterm
uml_switch = /usr/bin/vde_switch
memorysize = 64
logdir = /home/dragon/uml
removecow = True
tap_device = tap0


(3)Use which to find the location of the binaries on your system, e.g. which screen
default location for screen binary is /usr/bin on Debian/Ubuntu
default location for xterm binary is /usr/bin on Debian/Ubuntu
default location for vde_switch binary is /usr/bin/vde_switch on Debian/Ubuntu
vde_switch will be located at /usr/local/bin/vde_switch if you build/install vde2 from source (by default)

(4)If your system has a lot of memory, you can change memorysize to a higher number. This will allow you to perform development work, e.g. re-compiling the DRAGON software. We recommend setting memorysize to 256 or 512 for development work.

(5)Set UML kernel binary to be executable: chmod +x /a/uml/debian/uml_linux-2.6.27.8


(6)mkdir ~/uml
This is where the copy-on-write (COW) files will be placed, one for each UML instance
COW files contain changes/diffs to the read-only root filesystem (so they allow for a full read-write root partition in UML




Next is the steps I took to get it working:
(1)suppose the file system we use is /a/uml/Debian/Debian-4.0-x86-root_fs as mentioned above. Let's mount it and chroot it to make some changes to it.

(2)the first thing I found out is: Debian-4.0-x86-root_fs will not work out of the box. you have to rebuild and reinstall the DRAGON software suite contained in it. Let's do these:
cd /mnt
sudo mkdir Debian
sudo mount /a/uml/Debian/Debian-4.0-x86-root_fs /mnt/Debian -o loop
sudo chroot /mnt/Debian

Now we're root inside Debian-4.0-x86-root_fs. Let's rebuild and reinstall DRAGON:

sudo mount -t proc proc /proc (mount this or there will be error when building DRAGON)
cd /home/dragon/snapshot.current/dragon-sw
sudo ./do_build.sh vlsr-linux
when CLI prompt comes out, type: shell (NOTE: IMPORTANT!!! because the default is none)
then click enter twice to ignore user name and psword.
after the building:
sudo ./do_install.sh
cd /home/dragon/snapshot.current/narb-sw
sudo ./do_build.sh
sudo ./do_install.sh


Now let's make some changes to the configurations files

(I)
cd /home/dragon
sudo vi .bashrc

add this line at the end of .bashrc file and save it:
"tset -s"
so the narb will not crash when you click backspace.


(II)
then for p2p test xml file, we have to add another port for vlsr1 and vlsr2:
cd /usr/local/dragon/bin
sudo vi genDragonConfig.pl

locate the line:
"set local-id port 1"
add the line below under the above line:
"set local-id port 6"
and save it.

NOTE: you can use "brctl show" in vlsr1/vlsr2 to see the bridge after the bridge is setup and use "/dragon_installation_file_folder/dragon-sw/utils/show-linux-switch-ports.pl" to see the port/switch connection. Also the log files are in /var/log including RSVPD.log and etc. these log files could be great resources for debugging



Finally, to test p2p mode:
sudo VNE config-narb-intra-p2p-csa.xml
start all

open vlsr1, type in:
telnet localhost 2611
edit lsp test
set source ip 10.0.0.3 port 6 destination ip 10.0.0.4 port 6
set bandwidth eth100M swcap l2sc enc eth gpid eth
set vtag any
exit
commit lsp test

wait for a while then type in
show lsp

see if it is "IN service"

1 comment:

  1. Good morning,
    In my case I have a scenario with three machines: csa, vlsr, csa. In vlsr I have installed LinuxSwitch, I can not access it, via telnet, How can I access the settings LinuxSwitch?, How I can configure linuxSwitch?
    thanks for your help!!

    ReplyDelete