1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
5 <TITLE>Olsr Switch</TITLE>
9 P { color: #000000; font-family: "verdana", "arial", sans-serif; font-size: 10pt }
12 PRE { color: #000000 }
17 <H1>Olsr_Switch network simulation</H1>
18 <P><I>$Id: README-Olsr-Switch.html,v 1.3 2005/06/04 22:28:27 kattemat Exp $</I>
21 <P>This document gives a brief introduction to the <A HREF="http://www.olsr.org/">olsr.org</A>
22 OLSR daemon network simulation extentions and tools. The network
23 simulation tool olsr_switch provides olsrd processes running in a
24 special <I>host-emultion</I> mode with access to a virtual network.
25 Multiple such processes can run on a host. This network can be freely
26 manipulated by the user allowing for simulation of dynamic
29 <P>Only IPv4 is supported for now.
32 <P>olsr_switch was inspired by the uml_switch used to communicate
33 between <A HREF="http://user-mode-linux.sourceforge.net/">UML</A>
34 instances, which I have used for olsrd testing. Also I remember
35 seeing that the guys at LRI working on the <A HREF="http://qolsr.lri.fr/">qolsr</A>
36 project has done something similar.
38 <P>The target users for this kind of things are probably mainly
39 developers and researchers. But it might come in handy for others as
44 <P>The olsr.org OLSR daemon is an implementation of the <A HREF="http://ietf.org/rfc/rfc3626.txt">Optimized
45 Link State Routing protocol</A> a IP routing protocol for mobile
46 ad-hoc networks. Multiple interesting extensions are available for
47 the implementation. Read more at <A HREF="http://www.olsr.org/">olsr.org</A>.
50 <P>The application, called olsr_switch, is really a traffic router
51 that will allow multiple olsrd instances to connect and communicate
52 over TCP via the loopback interface. Connecting to olsr_switch on
53 remote hosts will be possible, but it is not implemented at the
56 <P>Basically olsr_switch works on two datasets - clients and links. A
57 client is a connected olsrd process and there are two uni-directional
58 link between all nodes(A->B and B->A) that can be manipulated
59 independently. When receiving traffic from a olsrd client the switch
60 will forward this traffic to all other clients to which it has a
61 valid link. Links can be set to three different "modes"
62 based on the <I>quality</I> set on the link:
65 <LI><P STYLE="margin-bottom: 0in"><B>Open</B>(quality 100) - all
66 traffic will be forwarded over this link.
68 <LI><P STYLE="margin-bottom: 0in"><B>Closed</B>(quality 0) - no
69 traffic will be forwarded over this link.
71 <LI><P><B>Lossy</B>(quality 1-99) - in this mode the quality
72 constraint is used as the chance in percentage, for traffic to be
73 forwarded over the link. So if quality is set to 25 there will in
74 average be 75% packet loss.
77 <P>The application provides the user with a prompt/shell where
78 various commands for topology manipulation or data retrieval are
79 available. A help command is provided for the users convenience. This
80 help command will also provide the user with specific help on all
81 available commands. More on this later.
83 <H3>olsrd host-emulation clients</H3>
84 <P>The communication interface against olsr_switch can naturally not
85 be 100% transparent for the olsrd process which normally runs on
86 UDP/698 on "real" network interfaces. Olsrd itself had to
87 be modified to set up a virtual interface connecting to olsr_switch.
88 This virtual interface is transparent to all overlying functionality.
89 This means that that olsrd host-emulation can run in both RFC and LQ
90 mode, and that plugins can be loaded normally etc. But no routes are
91 added by the olsrd process. Later on route information might be
92 signaled from the olsrd instance to olsr_switch so that a centralized
93 route database is available to the user. As of now, you can watch the
94 olsrd debug output or easier yet, run one node with the httpinfo
95 plugin to get the route/topology/link information.
97 <P>Currently olsrd cannot run on both real and host-emulation
98 interfaces, but this might change in the future if I get convinced
99 that it is useful. No routes can be added by the host-emulating olsrd
102 <H2>Building and running</H2>
103 <P>As of yet, olsr_switch builds and runs on GNU/Linux and FreeBSD
107 <P>The olsr.org olsrd source code and pre-compiled packages can be
108 downloaded from the olsr.org <A HREF="http://www.olsr.org/index.cgi?action=download">download</A>
109 section. But as of now you need the CVS version if you want the
110 olsr_switch code. To check out the current snapshot do:
112 <PRE>cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/olsrd login
114 cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/olsrd co olsrd-current</PRE><P>
115 Now enter the olsrd source directory and do:
117 <PRE STYLE="margin-bottom: 0.2in">olsrd-current# make</PRE><P>
118 to build olsrd itself, and:
120 <PRE STYLE="margin-bottom: 0.2in">olsrd-current# make switch</PRE><P>
121 to build olsr_switch. If no error messages occurred, you should now
122 have the two executables <I>olsrd</I> and <I>olsr_switch</I>
123 available in the current directory.
126 <P>Before starting any olsrd host-emu clients the switch must be
127 started. This is done using the command <I>olsr_switch</I> and the
128 application will initiate the communication socket and provide the
129 user with a prompt for input:
131 <PRE>olsrd-current# ./olsr_switch
132 olsrd host-switch daemon version 0.1 starting
133 Initiating socket TCP port 10150
134 OHS command interpreter reading from STDIN
138 <P>olsrd_switch has a buildt-in command for starting and
139 stopping local olsrd instances and we will learn more about
140 this later. But olsrd can also be ran in host-emulation mode
141 from the command line. To start olsrd in host-emulation mode do:
143 <PRE STYLE="margin-bottom: 0.2in">./olsrd -hemu <B>IP-ADDRESS</B></PRE><P>
144 Here <I>IP-ADDRESS</I> will be the IP address that the process will
145 set as its main address in the emulation mode. This address has no
146 connection to the real IP-stack and can be chosen freely. Of cause,
147 no two instances can run using the same IP.<BR>It might be wise to
148 have a separate olsrd configuration file for host-emulation. In that
151 <PRE STYLE="margin-bottom: 0.2in">./olsrd -f <B>FILENAME</B> -hemu <B>IP-ADDRESS</B></PRE><P>
152 As of now there is no emulated destination address used. All traffic
153 will be passed on regardless of the network address used. Olsrd
154 communicates using broadcast/multicast so that multiple "overlapping"
155 networks might exist.
157 <H2>Command-line interface</H2>
161 <P>Type 'help cmd' for help on a specific command
164 Olsrd host switch version 0.1
166 help - Help on shell commands
167 exit - Exits olsr host switch
168 log - Displays or sets log bits
169 list - List all connected clients or links
170 link - Manipulate links</PRE><H3>
172 <P>The <I>list</I> command is used for client and link listing. The
176 Usage: <B>list <clients|links></B>
178 <I>This command will list all the clients or all the links registered </I>
179 <I>by olsr_switch. By default clients are listed.</I></PRE><H3>
181 <P>The <I>link</I> command is used for manipulating links. Here is
182 the help page for this command:
185 Usage: <B>link <bi> [srcIP|*] [dstIP|*] [0-100]</B>
187 <I>This command is used for manipulating olsr links. The link quality </I>
188 <I>is a number between 0-100 representing the chance in percentage </I>
189 <I>for a packet to be forwarded</I>
191 To make the link between 10.0.0.1 and 10.0.0.2 have 50% packetloss do:
192 link 10.0.0.1 10.0.0.2 50
193 Note that this will only effect the unidirectional link
194 10.0.0.1 -> 10.0.0.2. To make the changes affect traffic
195 in both directions do:
196 link bi 10.0.0.1 10.0.0.2 50
197 To completely block a link do:
198 link 10.0.0.1 10.0.0.2 0
199 To make all traffic pass(delete the entry) do:
200 link 10.0.0.1 10.0.0.2 100
201 Note that "bi" can be used in all these examples.
202 Wildcard source and/or destinations are also supported.
203 To block all traffic from a node do:
205 To set 50% packetloss on all links to 10.0.0.2 do:
207 To delete all links do:
209 Wildcards can also be used in combination with 'bi'.
210 To list all manipulated links use 'list links'.</PRE>
212 <P>The <I>olsrd</I> command is used for manipulating links. Here is
213 the help page for this command:
217 Usage: <B>olsrd [start|stop|show|setb|seta] [IP|path|args]</B>
219 <I>This command is used for managing local olsrd instances from within olsr_switch.</I>
220 <I>The command can be configured in runtime using the setb and seta sub-commands.</I>
221 To show the current olsrd command-configuration do:
223 To set the olsrd binary path do:
224 olsrd setb /full/path/to/olsrd
225 To start a olsrd instance with a IP address of 10.0.0.1, do:
227 To stop that same instance do:
231 <P>Two other commands are available:
234 <LI><P STYLE="margin-bottom: 0in"><B>exit</B> - terminates
237 <LI><P><B>log</B> - sets the log level.
240 <P>Read the help pages for details.
242 <H2>Running olsrd in host-emulation mode</H2>
243 <P>Now for a real world example of connecting olsrd instances. Let's
244 assume we have a modified configuration file, <I>/etc/olsrd.emu.conf</I>
245 that we use for host-emu instances. We'll choose the 10.0.0.0/24 IP
246 address space for our clients.<BR>First start the olsr_switch in one
249 <PRE STYLE="margin-bottom: 0.2in">./olsr_switch</PRE><P>
250 Now start the olsrd instances in other terminal(s). If you want to
251 follow olsrd operation you should use a debug value > 0. To easen
252 CPU usage and terminal count you can start multiple instances that
253 will run in the background using the <I>-d 0</I> option. In this
254 example we'll run our olsrd instances in the foreground using debug
255 level 1. Start them off(in separate terminals) using:
257 <PRE STYLE="margin-bottom: 0.2in">./olsrd -f /etc/olsrd.emu.conf -hemu 10.0.0.x -d 1</PRE><P>
258 where x is 1-8(we'll run 8 instances). The <A HREF="http://www.gnu.org/software/screen/">screen</A>
259 terminal multiplexer application is <I>highly</I> recomended for
260 making your life easier if working on multiple terminals.
262 <P>Here is the output form the 10.0.0.1 instance of olsrd after some
265 <PRE> *** olsr.org - 0.4.10-pre (May 30 2005) ***
267 --- 20:53:26.58 ---------------------------------------------------- LINKS
269 IP address hyst LQ lost total NLQ ETX
270 10.0.0.8 0.000 1.000 0 10 1.000 1.00
271 10.0.0.7 0.000 1.000 0 10 1.000 1.00
272 10.0.0.6 0.000 1.000 0 10 1.000 1.00
273 10.0.0.5 0.000 1.000 0 10 1.000 1.00
274 10.0.0.4 0.000 1.000 0 10 1.000 1.00
275 10.0.0.3 0.000 1.000 0 10 1.000 1.00
276 10.0.0.2 0.000 1.000 0 10 1.000 1.00
278 --- 20:53:26.58 ------------------------------------------------ NEIGHBORS
280 IP address LQ NLQ SYM MPR MPRS will
281 10.0.0.2 1.000 1.000 YES NO NO 3
282 10.0.0.3 1.000 1.000 YES NO NO 3
283 10.0.0.4 1.000 1.000 YES NO NO 3
284 10.0.0.5 1.000 1.000 YES NO NO 3
285 10.0.0.6 1.000 1.000 YES NO NO 3
286 10.0.0.7 1.000 1.000 YES NO NO 3
287 10.0.0.8 1.000 1.000 YES NO NO 3
289 --- 20:53:26.58 ------------------------------------------------- TOPOLOGY
291 Source IP addr Dest IP addr LQ ILQ ETX
293 We now have our own virtual network! Notice that you can
294 start olsrd instances from olsr_switch using the <i>olsrd</i>
295 command. The equvivalent of the above command line statement
301 Given that the olsrd command is configured properly
302 (see olsrd show, setb and seta).
305 At our switch prompt the command
306 <I>list</I> yields the following output:
308 <PRE>All connected clients:
309 10.0.0.8 - Rx: 647 Tx: 89 LinkCnt: 0
310 10.0.0.7 - Rx: 752 Tx: 105 LinkCnt: 0
311 10.0.0.6 - Rx: 790 Tx: 120 LinkCnt: 0
312 10.0.0.5 - Rx: 809 Tx: 112 LinkCnt: 0
313 10.0.0.4 - Rx: 811 Tx: 125 LinkCnt: 0
314 10.0.0.3 - Rx: 804 Tx: 138 LinkCnt: 0
315 10.0.0.2 - Rx: 805 Tx: 140 LinkCnt: 0
316 10.0.0.1 - Rx: 829 Tx: 119 LinkCnt: 0</PRE><P>
317 Hey - everything is running a-ok!
319 <H2>Manipulating links</H2>
320 <P>So lets create some link trouble. This introduction has become too
321 long already, so we'll introduce two simple example conditions:
324 <LI><P STYLE="margin-bottom: 0in">We want 10.0.0.1 only to have a
325 link to 10.0.0.2 and no one else.
327 <LI><P>We want 10.0.0.8 only to have 25% chance of getting direct
328 traffic trough to 10.0.0.2,3,4
331 <P>Here's what we need to do:
333 <PRE>> link bi 10.0.0.1 * 0
334 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.8 quality 0
335 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.7 quality 0
336 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.6 quality 0
337 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.5 quality 0
338 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.4 quality 0
339 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.3 quality 0
340 Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.2 quality 0
343 > link bi 10.0.0.1 10.0.0.2 100
344 Removing bidirectional link(s) 10.0.0.1 <=> 10.0.0.2 quality 100
347 All configured links:
348 10.0.0.8 => 10.0.0.1 Quality: 0
349 10.0.0.7 => 10.0.0.1 Quality: 0
350 10.0.0.6 => 10.0.0.1 Quality: 0
351 10.0.0.5 => 10.0.0.1 Quality: 0
352 10.0.0.4 => 10.0.0.1 Quality: 0
353 10.0.0.3 => 10.0.0.1 Quality: 0
354 10.0.0.1 => 10.0.0.3 Quality: 0
355 10.0.0.1 => 10.0.0.4 Quality: 0
356 10.0.0.1 => 10.0.0.5 Quality: 0
357 10.0.0.1 => 10.0.0.6 Quality: 0
358 10.0.0.1 => 10.0.0.7 Quality: 0
359 10.0.0.1 => 10.0.0.8 Quality: 0
361 Now our first condition is met. First all bidirectional links from
362 10.0.0.1 was blocked and then the bidirectional link to 10.0.0.2 was
363 opened. Now 10.0.0.1 can only see 10.0.0.2 as a neighbor. Note that
364 only manipulated links are listed when issuing 'list links'. olsrd at
367 <PRE> *** olsr.org - 0.4.10-pre (May 30 2005) ***
369 --- 21:17:46.06 ---------------------------------------------------- LINKS
371 IP address hyst LQ lost total NLQ ETX
372 10.0.0.2 0.000 1.000 0 10 1.000 1.00
374 --- 21:17:46.06 ------------------------------------------------ NEIGHBORS
376 IP address LQ NLQ SYM MPR MPRS will
377 10.0.0.2 1.000 1.000 YES YES NO 3
379 --- 21:17:46.06 ------------------------------------------------- TOPOLOGY
381 Source IP addr Dest IP addr LQ ILQ ETX
382 10.0.0.2 10.0.0.1 1.000 1.000 1.00
383 10.0.0.2 10.0.0.3 1.000 1.000 1.00
384 10.0.0.2 10.0.0.4 1.000 1.000 1.00
385 10.0.0.2 10.0.0.5 1.000 1.000 1.00
386 10.0.0.2 10.0.0.6 1.000 1.000 1.00
387 10.0.0.2 10.0.0.7 1.000 1.000 1.00
388 10.0.0.2 10.0.0.8 1.000 1.000 1.00</PRE><P>
389 works like a charm. Now let's make sure we can meet condition two:
391 <PRE>> link bi 10.0.0.8 10.0.0.2 25
392 Setting bidirectional link(s) 10.0.0.8 <=> 10.0.0.2 quality 25
394 > link bi 10.0.0.8 10.0.0.3 25
395 Setting bidirectional link(s) 10.0.0.8 <=> 10.0.0.3 quality 25
397 > link bi 10.0.0.8 10.0.0.4 25
398 Setting bidirectional link(s) 10.0.0.8 <=> 10.0.0.4 quality 25
401 All configured links:
402 10.0.0.8 => 10.0.0.4 Quality: 25
403 10.0.0.8 => 10.0.0.3 Quality: 25
404 10.0.0.8 => 10.0.0.2 Quality: 25
405 10.0.0.8 => 10.0.0.1 Quality: 0
406 10.0.0.7 => 10.0.0.1 Quality: 0
407 10.0.0.6 => 10.0.0.1 Quality: 0
408 10.0.0.5 => 10.0.0.1 Quality: 0
409 10.0.0.4 => 10.0.0.8 Quality: 25
410 10.0.0.4 => 10.0.0.1 Quality: 0
411 10.0.0.3 => 10.0.0.8 Quality: 25
412 10.0.0.3 => 10.0.0.1 Quality: 0
413 10.0.0.2 => 10.0.0.8 Quality: 25
414 10.0.0.1 => 10.0.0.3 Quality: 0
415 10.0.0.1 => 10.0.0.4 Quality: 0
416 10.0.0.1 => 10.0.0.5 Quality: 0
417 10.0.0.1 => 10.0.0.6 Quality: 0
418 10.0.0.1 => 10.0.0.7 Quality: 0
419 10.0.0.1 => 10.0.0.8 Quality: 0
421 Now for a look at olsrd 10.0.0.8s output:
423 <PRE> *** olsr.org - 0.4.10-pre (May 30 2005) ***
425 --- 21:23:00.35 ---------------------------------------------------- LINKS
427 IP address hyst LQ lost total NLQ ETX
428 10.0.0.7 0.000 1.000 0 10 1.000 1.00
429 10.0.0.5 0.000 1.000 0 10 1.000 1.00
430 10.0.0.6 0.000 1.000 0 10 1.000 1.00
431 10.0.0.2 0.000 0.800 2 10 0.498 2.51
432 10.0.0.3 0.000 0.600 4 10 0.498 3.35
433 10.0.0.4 0.000 0.900 1 10 0.800 1.39
435 --- 21:23:00.35 ------------------------------------------------ NEIGHBORS
437 IP address LQ NLQ SYM MPR MPRS will
438 10.0.0.2 0.800 0.498 YES YES NO 3
439 10.0.0.3 0.600 0.498 NO NO NO 3
440 10.0.0.4 0.900 0.800 YES NO NO 3
441 10.0.0.5 1.000 1.000 YES NO NO 3
442 10.0.0.6 1.000 1.000 YES YES NO 3
443 10.0.0.7 1.000 1.000 YES YES NO 3
445 --- 21:23:00.35 ------------------------------------------------- TOPOLOGY
447 Source IP addr Dest IP addr LQ ILQ ETX
448 10.0.0.2 10.0.0.1 1.000 1.000 1.00
449 10.0.0.2 10.0.0.3 1.000 1.000 1.00
450 10.0.0.2 10.0.0.4 1.000 1.000 1.00
451 10.0.0.2 10.0.0.5 1.000 1.000 1.00
452 10.0.0.2 10.0.0.6 1.000 1.000 1.00
453 10.0.0.2 10.0.0.7 1.000 1.000 1.00
454 10.0.0.2 10.0.0.8 0.898 0.498 2.24
455 10.0.0.5 10.0.0.4 1.000 1.000 1.00
456 10.0.0.6 10.0.0.8 1.000 1.000 1.00
457 10.0.0.7 10.0.0.2 1.000 1.000 1.00
458 10.0.0.7 10.0.0.3 1.000 1.000 1.00
459 10.0.0.7 10.0.0.8 1.000 1.000 1.00
461 Yes, there most certainly are some very weak links here.
463 <P>Well, lets leave it at that :-) The command line interface is
464 meant to be used by applications as well as humans, so if somebody
465 wants to create a GUI front-end that should not be to much work.
468 <P>Regarding CPU load I have not done any real testing, but I did try
469 seeing how far I could get on my 1.3Ghz/512MB-RAM desktop system
470 running LQ olsrd instances in the background initiated from olsrd_switch.
471 When reaching a certain amount (15+) the cPU load is very high for
472 neighbor detection, but as soon as links stabelize the CPU is almost
473 idle again. I have ran with 30+ nodes with no problem. But do not start
474 to many instances at the same time.
478 was only using a idle network(no topology changes except new nodes joining).
479 But as soon as olsrd instances can connect from other hosts one can
480 distribute the load. Also the application will be subject to various future
484 Network load measurement tools will also be on the to-do list.
487 <P><I>by <A HREF="mailto:andreto--at--olsr.org">Andreas Tønnesen</A></I>