Project

General

Profile

Dynamic Uml Mesh Modeler » History » Version 10

Martin Willi, 14.05.2008 15:45

1 1 Martin Willi
= Dynamic Uml Mesh Modeler =
2 1 Martin Willi
''Dumm'' is a framework to set up a virtual network using user mode linux guests.
3 1 Martin Willi
It cleverly glues together some nice technologies to build networks dynamically.
4 1 Martin Willi
To change the network topology, hosts are not required to reboot, changes apply
5 1 Martin Willi
instantly and configuration can be done on the host (no network connection
6 1 Martin Willi
required to change anything).
7 1 Martin Willi
8 1 Martin Willi
== Status ==
9 9 Martin Willi
''Dumm'' is currently highly experimental and [source:trunk/src/dumm incomplete]. A prototype is running 
10 1 Martin Willi
and a proof of concept has shown that it works.
11 10 Martin Willi
Along with the ''dumm'' library, a graphical GTK client is in developement to interactively set
12 10 Martin Willi
up and reconfigure UML networks. The UML network of the old UML framework can be simulated with another tool.
13 1 Martin Willi
14 10 Martin Willi
The graphical client is incomplete. It is missing:
15 10 Martin Willi
  * Removal of added switches
16 10 Martin Willi
  * Disconnecting guests from switches
17 10 Martin Willi
  * Scenario management
18 1 Martin Willi
19 10 Martin Willi
The framework itself is also missing some features:
20 10 Martin Willi
  * Configuring addresses/routes in guests through hosts
21 10 Martin Willi
  * Invoke commands on guests without ssh
22 10 Martin Willi
  * Scenario scripting
23 10 Martin Willi
24 1 Martin Willi
== Why UML? ==
25 1 Martin Willi
UML is a senior in vitualization technologies, and there is a lot of new
26 1 Martin Willi
hyped stuff about virtualization around. However, UML is lightweight, easy to
27 1 Martin Willi
set up and allows dynamic reconfiguration (e.g. add/remove interfaces at
28 1 Martin Willi
runtime), allows access to the hosts filesystem through hostfs and has some
29 1 Martin Willi
other neat features.
30 1 Martin Willi
Performance is not critical for our needs, and maybe we get hardware
31 1 Martin Willi
virtualization support soon in UML.
32 1 Martin Willi
It is free and fits perfectly.
33 1 Martin Willi
34 1 Martin Willi
== Requirements ==
35 1 Martin Willi
  * Host:
36 1 Martin Willi
    * Kernel:
37 1 Martin Willi
      * A recent 2.6 kernel
38 10 Martin Willi
      * [http://www.user-mode-linux.org/~blaisorblade/patches/skas3-2.6/ SKAS3 patch] recommended
39 1 Martin Willi
      * [http://fuse.sourceforge.net/ FUSE] enabled
40 1 Martin Willi
      * support for TAP devices
41 1 Martin Willi
    * Userland:
42 1 Martin Willi
      * [source:trunk/src/libstrongswan libstrongswan]
43 1 Martin Willi
      * libbridge from [http://linux-net.osdl.org/index.php/Bridge bridge-utils]
44 10 Martin Willi
      * GTK+2 with developement headers
45 10 Martin Willi
      * Gnome !VteTerminal with developement headers
46 1 Martin Willi
  * Guest:
47 1 Martin Willi
    * Kernel:
48 1 Martin Willi
      * hostfs
49 10 Martin Willi
      * tuntap networking
50 10 Martin Willi
      * mcast networking
51 1 Martin Willi
    * Userland:
52 10 Martin Willi
      * none
53 1 Martin Willi
54 1 Martin Willi
== Architecture ==
55 1 Martin Willi
56 1 Martin Willi
=== Working set ===
57 1 Martin Willi
Dumm needs a directory to store all its files, guest configurations and other
58 1 Martin Willi
stuff. Inside that working directory, you'll find:
59 1 Martin Willi
60 2 Martin Willi
{{{
61 3 Martin Willi
workingdir/      - root folder containing a set of hosts and scenarios
62 2 Martin Willi
  guests/        - contains all created guests
63 2 Martin Willi
    alice/       - subdirectory for host "alice"
64 2 Martin Willi
      alice/     - UML created folder (named umid) containing UML runtime files
65 2 Martin Willi
      mem        - memory configuration file (contains amount of guest memory in MB)
66 2 Martin Willi
      linux      - symlinked UML kernel this host uses
67 2 Martin Willi
      master/    - symlinked master root file system for this host
68 2 Martin Willi
      diff/      - copy-on-write overlay to master this host uses
69 2 Martin Willi
      union/     - mounted unified filesystem (master + diff + optional scenario)
70 1 Martin Willi
    bob/
71 2 Martin Willi
      ...        - same stuff as in alice
72 2 Martin Willi
  scenarios/     - contains all scenarios
73 1 Martin Willi
    test1/       - a scenario folder
74 3 Martin Willi
      diff/      - copy-on-write overlays for each guest's union folder
75 3 Martin Willi
        alice/   - COW for alice
76 3 Martin Willi
        bob/     - COW for bob
77 3 Martin Willi
      config     - network configuration file
78 1 Martin Willi
}}}
79 1 Martin Willi
80 1 Martin Willi
=== Networking ===
81 1 Martin Willi
Network connectivity is realized through tap devices. When creating a ''eth0''
82 1 Martin Willi
network device on ''alice'', a ''alice-eth0'' tap device appears on the host. These
83 1 Martin Willi
are directly connected, when ''alice'' sends traffic to ''eth0'', it appears on the
84 1 Martin Willi
host at ''alice-eth0''. You can see that as a small network segment (or just a
85 1 Martin Willi
cable), where these interfaces are attached directly.
86 1 Martin Willi
To build larger network segments, linux bridging on the host comes into play.
87 1 Martin Willi
Segments are created by creating a bridge (as with brctl), and then attaching
88 1 Martin Willi
our tap devices to that bridge. Routing can be done on a UML guest, or even on
89 1 Martin Willi
the host.
90 1 Martin Willi
This setup has some advantages over the ''uml_switch'' solution. Bridging works
91 1 Martin Willi
more reliable in the kernel, and as we see every network interface on the host,
92 1 Martin Willi
we can sniff at every interface to get some clue what the guests are doing.
93 1 Martin Willi
94 1 Martin Willi
== Howto ==
95 1 Martin Willi
In this mini-howto, we build and boot a minimalistic debian guest on a ubuntu host.
96 4 Martin Willi
We do everything as root here to simplify things!
97 10 Martin Willi
98 1 Martin Willi
=== Host setup ===
99 10 Martin Willi
  * install required packages:
100 7 Tobias Brunner
{{{
101 10 Martin Willi
aptitude install libfuse-dev libgtk2.0-dev libvte-dev
102 1 Martin Willi
}}}
103 4 Martin Willi
  * install libbridge:
104 4 Martin Willi
{{{
105 4 Martin Willi
git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/bridge-utils.git
106 4 Martin Willi
cd bridge-utils
107 4 Martin Willi
autoconf
108 4 Martin Willi
./configure
109 1 Martin Willi
cd libbridge
110 1 Martin Willi
make
111 1 Martin Willi
make install
112 8 Tobias Brunner
}}}
113 4 Martin Willi
  * Build and install strongSwan from SVN sources.
114 4 Martin Willi
{{{
115 4 Martin Willi
svn co www.strongswan.org/ikev2/trunk strongswan
116 4 Martin Willi
cd strongswan
117 1 Martin Willi
less HACKING
118 4 Martin Willi
./autogen
119 10 Martin Willi
./configure --enable-dumm [other options]
120 1 Martin Willi
make
121 1 Martin Willi
make install
122 1 Martin Willi
}}}
123 1 Martin Willi
124 1 Martin Willi
  * Ubuntu kernels almost fit our needs, they have FUSE and TAP device support. However, 
125 1 Martin Willi
    SKAS3 mode is missing. Build your own kernel based on the 
126 1 Martin Willi
    [https://wiki.ubuntu.com/KernelCustomBuild Ubuntu Howto], patched with the
127 10 Martin Willi
    [http://www.user-mode-linux.org/~blaisorblade/patches/skas3-2.6/ SKAS3 patch]. SKAS3 is
128 10 Martin Willi
    not required, but guests run much faster with SKAS3 enabled on the host.
129 1 Martin Willi
130 10 Martin Willi
=== Guest master filesystem setup ===
131 1 Martin Willi
  * create a clean directory and a directory for our master filesystem in it:
132 1 Martin Willi
{{{
133 1 Martin Willi
mkdir umldir
134 1 Martin Willi
cd umldir
135 1 Martin Willi
mkdir master
136 1 Martin Willi
}}}
137 10 Martin Willi
  * bootstrap a debian sid system into master:
138 1 Martin Willi
{{{
139 10 Martin Willi
debootstrap sid master http://mirror.switch.ch/ftp/pub/debian/
140 1 Martin Willi
}}}
141 10 Martin Willi
  * enter chroot
142 10 Martin Willi
{{{
143 10 Martin Willi
chroot master
144 10 Martin Willi
}}}
145 10 Martin Willi
  * enable login on tty0
146 10 Martin Willi
{{{
147 10 Martin Willi
echo "0:2345:respawn:/sbin/getty 38400 tty0" >> /etc/inittab
148 10 Martin Willi
echo "tty0" >> /etc/securetty
149 10 Martin Willi
}}}
150 10 Martin Willi
  * Enable main repository
151 10 Martin Willi
{{{
152 10 Martin Willi
echo deb http://mirror.switch.ch/ftp/pub/debian sid main contrib > /etc/apt/sources.list
153 10 Martin Willi
aptitude update
154 10 Martin Willi
}}}
155 10 Martin Willi
  * Install proper locales support
156 10 Martin Willi
{{{
157 10 Martin Willi
aptitude install locales
158 10 Martin Willi
dpkg-reconfigure locales
159 10 Martin Willi
}}}
160 10 Martin Willi
  * Install some packages for strongSwan
161 10 Martin Willi
{{{
162 10 Martin Willi
aptitude install libgmp3c2 libsqlite3-0 libcurl3 dropbear gdb binutils
163 10 Martin Willi
}}}
164 10 Martin Willi
  * leave chroot
165 10 Martin Willi
{{{
166 10 Martin Willi
exit
167 10 Martin Willi
}}}
168 4 Martin Willi
  * build a vanilla UML kernel (using [http://trac.strongswan.org/attachment/wiki/DynamicUmlMeshModeler/.config my config]):
169 4 Martin Willi
{{{
170 4 Martin Willi
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.1.tar.bz2
171 4 Martin Willi
tar jxvf linux-2.6.22.1.tar.bz2
172 4 Martin Willi
cd linux-2.6.22.1
173 4 Martin Willi
make mrproper
174 4 Martin Willi
wget http://trac.strongswan.org/attachment/wiki/DynamicUmlMeshModeler/.config?format=raw -O .config
175 4 Martin Willi
ARCH=um make menuconfig
176 4 Martin Willi
ARCH=um make
177 6 Martin Willi
}}}
178 6 Martin Willi
179 10 Martin Willi
=== Start a network ===
180 10 Martin Willi
You'll have to run the tools as root. Make sure you have a DISPLAY set, e.g. by starting it under ''sudo''.
181 10 Martin Willi
  * Invoke the graphical client
182 4 Martin Willi
{{{
183 10 Martin Willi
sudo ipsec dumm
184 4 Martin Willi
}}}
185 10 Martin Willi
Add guests, select our master filesystem and the compiled kernel. Add a bridges and connect your guests to it.
186 10 Martin Willi
Start your guests and configure them. 
187 10 Martin Willi
188 10 Martin Willi
  * The default strongSwan UML scenario is created by running
189 4 Martin Willi
{{{
190 10 Martin Willi
sudo ipsec testing
191 4 Martin Willi
}}}
192 10 Martin Willi
193 10 Martin Willi
== Installing strongSwan on guests ==
194 10 Martin Willi
As we have full access to the master filesystem on the host, we can build strongSwan on the host and install it to the guests
195 1 Martin Willi
{{{
196 10 Martin Willi
cd path/to/strongswan/
197 10 Martin Willi
DESTDIR=/full/path/to/master make install
198 1 Martin Willi
}}}