Olsr_Switch network simulation

Summary

This document gives a brief introduction to the olsr.org OLSR daemon network simulation extentions and tools. The network simulation tool olsr_switch provides olsrd processes running in a special host-emultion mode with access to a virtual network. Multiple such processes can run on a host. This network can be freely manipulated by the user allowing for simulation of dynamic large-scale networks.

Only IPv4 is supported for now.

Background

olsr_switch was inspired by the uml_switch used to communicate between UML instances, which I have used for olsrd testing. Also I remember seeing that the guys at LRI working on the qolsr project has done something similar.

The target users for this kind of things are probably mainly developers and researchers. But it might come in handy for others as well.

Description

olsr.org

The olsr.org OLSR daemon is an implementation of the Optimized Link State Routing protocol a IP routing protocol for mobile ad-hoc networks. Multiple interesting extensions are available for the implementation. Read more at olsr.org.

olsr_switch

The application, called olsr_switch, is really a traffic router that will allow multiple olsrd instances to connect and communicate over TCP via the loopback interface. Connecting to olsr_switch on remote hosts will be possible, but it is not implemented at the current time.

Basically olsr_switch works on two datasets - clients and links. A client is a connected olsrd process and there are two uni-directional link between all nodes(A->B and B->A) that can be manipulated independently. When receiving traffic from a olsrd client the switch will forward this traffic to all other clients to which it has a valid link. Links can be set to three different "modes" based on the quality set on the link:

The application provides the user with a prompt/shell where various commands for topology manipulation or data retrieval are available. A help command is provided for the users convenience. This help command will also provide the user with specific help on all available commands. More on this later.

olsrd host-emulation clients

The communication interface against olsr_switch can naturally not be 100% transparent for the olsrd process which normally runs on UDP/698 on "real" network interfaces. Olsrd itself had to be modified to set up a virtual interface connecting to olsr_switch. This virtual interface is transparent to all overlying functionality. This means that that olsrd host-emulation can run in both RFC and LQ mode, and that plugins can be loaded normally etc. But no routes are added by the olsrd process. Later on route information might be signaled from the olsrd instance to olsr_switch so that a centralized route database is available to the user. As of now, you can watch the olsrd debug output or easier yet, run one node with the httpinfo plugin to get the route/topology/link information.

Currently olsrd cannot run on both real and host-emulation interfaces, but this might change in the future if I get convinced that it is useful. No routes can be added by the host-emulating olsrd instances, so

Building and running

As of yet, olsr_switch builds and runs on GNU/Linux and FreeBSD systems.

Building

The olsr.org olsrd source code and pre-compiled packages can be downloaded from the olsr.org download section. But as of now you need the CVS version if you want the olsr_switch code. To check out the current snapshot do:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/olsrd login

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/olsrd co olsrd-current

Now enter the olsrd source directory and do:

olsrd-current# make

to build olsrd itself, and:

olsrd-current# make switch

to build olsr_switch. If no error messages occurred, you should now have the two executables olsrd and olsr_switch available in the current directory.

Running

Before starting any olsrd host-emu clients the switch must be started. This is done using the command olsr_switch and the application will initiate the communication socket and provide the user with a prompt for input:

olsrd-current# ./olsr_switch
olsrd host-switch daemon version 0.1 starting
Initiating socket TCP port 10150
OHS command interpreter reading from STDIN
>



olsrd_switch has a buildt-in command for starting and stopping local olsrd instances and we will learn more about this later. But olsrd can also be ran in host-emulation mode from the command line. To start olsrd in host-emulation mode do:

./olsrd -hemu IP-ADDRESS

Here IP-ADDRESS will be the IP address that the process will set as its main address in the emulation mode. This address has no connection to the real IP-stack and can be chosen freely. Of cause, no two instances can run using the same IP.
It might be wise to have a separate olsrd configuration file for host-emulation. In that case issue:

./olsrd -f FILENAME -hemu IP-ADDRESS

As of now there is no emulated destination address used. All traffic will be passed on regardless of the network address used. Olsrd communicates using broadcast/multicast so that multiple "overlapping" networks might exist.

Command-line interface

Blah blah blah

help

Type 'help cmd' for help on a specific command

> help
Olsrd host switch version 0.1
Available commands:
        help - Help on shell commands
        exit - Exits olsr host switch
        log - Displays or sets log bits
        list - List all connected clients or links
        link - Manipulate links

list

The list command is used for client and link listing. The help page states:

> help list
Usage: list <clients|links>
Description:
This command will list all the clients or all the links registered 
by olsr_switch. By default clients are listed.

link

The link command is used for manipulating links. Here is the help page for this command:

> help link
Usage: link <bi> [srcIP|*] [dstIP|*] [0-100]
Description:
This command is used for manipulating olsr links. The link quality 
is a number between 0-100 representing the chance in percentage 
for a packet to be forwarded
on the link.
To make the link between 10.0.0.1 and 10.0.0.2 have 50% packetloss do:
 link 10.0.0.1 10.0.0.2 50
Note that this will only effect the unidirectional link 
10.0.0.1 -> 10.0.0.2. To make the changes affect traffic 
in both directions do:
 link bi 10.0.0.1 10.0.0.2 50
To completely block a link do:
 link 10.0.0.1 10.0.0.2 0
To make all traffic pass(delete the entry) do:
 link 10.0.0.1 10.0.0.2 100
Note that "bi" can be used in all these examples.
Wildcard source and/or destinations are also supported.
To block all traffic from a node do:
link 10.0.0.1 * 0
To set 50% packetloss on all links to 10.0.0.2 do:
 link * 10.0.0.2 50
To delete all links do:
 link * * 100
Wildcards can also be used in combination with 'bi'.
To list all manipulated links use 'list links'.

olsrd

The olsrd command is used for manipulating links. Here is the help page for this command:

> help olsrd
Usage: olsrd [start|stop|show|setb|seta] [IP|path|args]
Description:
This command is used for managing local olsrd instances from within olsr_switch.
The command can be configured in runtime using the setb and seta sub-commands.
To show the current olsrd command-configuration do:
 olsrd show
To set the olsrd binary path do:
 olsrd setb /full/path/to/olsrd
To start a olsrd instance with a IP address of 10.0.0.1, do:
 olsrd start 10.0.0.1
To stop that same instance do:
 olsrd stop 10.0.0.1

others

Two other commands are available:

Read the help pages for details.

Running olsrd in host-emulation mode

Now for a real world example of connecting olsrd instances. Let's assume we have a modified configuration file, ./olsrd.emu.conf that we use for host-emu instances. We'll choose the 10.0.0.0/24 IP address space for our clients.
First start the olsr_switch in one terminal:

./olsr_switch

Now start the olsrd instances in other terminal(s). If you want to follow olsrd operation you should use a debug value > 0. To easen CPU usage and terminal count you can start multiple instances that will run in the background using the -d 0 option. In this example we'll run our olsrd instances in the foreground using debug level 1. Start them off(in separate terminals) using:

./olsrd -f /etc/olsrd.emu.conf -hemu 10.0.0.x -d 1

where x is 1-8(we'll run 8 instances). The screen terminal multiplexer application is highly recomended for making your life easier if working on multiple terminals.

Here is the output form the 10.0.0.1 instance of olsrd after some time:

       *** olsr.org - 0.4.10-pre (May 30 2005) ***

--- 20:53:26.58 ---------------------------------------------------- LINKS

IP address       hyst   LQ     lost   total  NLQ    ETX
10.0.0.8         0.000  1.000  0      10     1.000  1.00
10.0.0.7         0.000  1.000  0      10     1.000  1.00
10.0.0.6         0.000  1.000  0      10     1.000  1.00
10.0.0.5         0.000  1.000  0      10     1.000  1.00
10.0.0.4         0.000  1.000  0      10     1.000  1.00
10.0.0.3         0.000  1.000  0      10     1.000  1.00
10.0.0.2         0.000  1.000  0      10     1.000  1.00

--- 20:53:26.58 ------------------------------------------------ NEIGHBORS

IP address       LQ     NLQ    SYM   MPR   MPRS  will
10.0.0.2         1.000  1.000  YES   NO    NO    3
10.0.0.3         1.000  1.000  YES   NO    NO    3
10.0.0.4         1.000  1.000  YES   NO    NO    3
10.0.0.5         1.000  1.000  YES   NO    NO    3
10.0.0.6         1.000  1.000  YES   NO    NO    3
10.0.0.7         1.000  1.000  YES   NO    NO    3
10.0.0.8         1.000  1.000  YES   NO    NO    3

--- 20:53:26.58 ------------------------------------------------- TOPOLOGY

Source IP addr   Dest IP addr     LQ     ILQ    ETX

We now have our own virtual network! Notice that you can start olsrd instances from olsr_switch using the olsrd command. The equvivalent of the above command line statement would be:

olsrd start 10.0.0.x

Given that the olsrd command is configured properly (see olsrd show, setb and seta).

At our switch prompt the command list yields the following output:

All connected clients:
        10.0.0.8 - Rx: 647 Tx: 89 LinkCnt: 0
        10.0.0.7 - Rx: 752 Tx: 105 LinkCnt: 0
        10.0.0.6 - Rx: 790 Tx: 120 LinkCnt: 0
        10.0.0.5 - Rx: 809 Tx: 112 LinkCnt: 0
        10.0.0.4 - Rx: 811 Tx: 125 LinkCnt: 0
        10.0.0.3 - Rx: 804 Tx: 138 LinkCnt: 0
        10.0.0.2 - Rx: 805 Tx: 140 LinkCnt: 0
        10.0.0.1 - Rx: 829 Tx: 119 LinkCnt: 0

Hey - everything is running a-ok!

Manipulating links

So lets create some link trouble. This introduction has become too long already, so we'll introduce two simple example conditions:

Here's what we need to do:

> link bi 10.0.0.1 * 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.8 quality 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.7 quality 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.6 quality 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.5 quality 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.4 quality 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.3 quality 0
Setting bidirectional link(s) 10.0.0.1 <=> 10.0.0.2 quality 0


> link bi 10.0.0.1 10.0.0.2 100
Removing bidirectional link(s) 10.0.0.1 <=> 10.0.0.2 quality 100

> list links
All configured links:
        10.0.0.8 => 10.0.0.1 Quality: 0
        10.0.0.7 => 10.0.0.1 Quality: 0
        10.0.0.6 => 10.0.0.1 Quality: 0
        10.0.0.5 => 10.0.0.1 Quality: 0
        10.0.0.4 => 10.0.0.1 Quality: 0
        10.0.0.3 => 10.0.0.1 Quality: 0
        10.0.0.1 => 10.0.0.3 Quality: 0
        10.0.0.1 => 10.0.0.4 Quality: 0
        10.0.0.1 => 10.0.0.5 Quality: 0
        10.0.0.1 => 10.0.0.6 Quality: 0
        10.0.0.1 => 10.0.0.7 Quality: 0
        10.0.0.1 => 10.0.0.8 Quality: 0

Now our first condition is met. First all bidirectional links from 10.0.0.1 was blocked and then the bidirectional link to 10.0.0.2 was opened. Now 10.0.0.1 can only see 10.0.0.2 as a neighbor. Note that only manipulated links are listed when issuing 'list links'. olsrd at 10.0.0.1 now shows:

       *** olsr.org - 0.4.10-pre (May 30 2005) ***

--- 21:17:46.06 ---------------------------------------------------- LINKS

IP address       hyst   LQ     lost   total  NLQ    ETX
10.0.0.2         0.000  1.000  0      10     1.000  1.00

--- 21:17:46.06 ------------------------------------------------ NEIGHBORS

IP address       LQ     NLQ    SYM   MPR   MPRS  will
10.0.0.2         1.000  1.000  YES   YES   NO    3

--- 21:17:46.06 ------------------------------------------------- TOPOLOGY

Source IP addr   Dest IP addr     LQ     ILQ    ETX
10.0.0.2         10.0.0.1         1.000  1.000  1.00
10.0.0.2         10.0.0.3         1.000  1.000  1.00
10.0.0.2         10.0.0.4         1.000  1.000  1.00
10.0.0.2         10.0.0.5         1.000  1.000  1.00
10.0.0.2         10.0.0.6         1.000  1.000  1.00
10.0.0.2         10.0.0.7         1.000  1.000  1.00
10.0.0.2         10.0.0.8         1.000  1.000  1.00

works like a charm. Now let's make sure we can meet condition two:

> link bi 10.0.0.8 10.0.0.2 25
Setting bidirectional link(s) 10.0.0.8 <=> 10.0.0.2 quality 25

> link bi 10.0.0.8 10.0.0.3 25
Setting bidirectional link(s) 10.0.0.8 <=> 10.0.0.3 quality 25

> link bi 10.0.0.8 10.0.0.4 25
Setting bidirectional link(s) 10.0.0.8 <=> 10.0.0.4 quality 25

> list links
All configured links:
        10.0.0.8 => 10.0.0.4 Quality: 25
        10.0.0.8 => 10.0.0.3 Quality: 25
        10.0.0.8 => 10.0.0.2 Quality: 25
        10.0.0.8 => 10.0.0.1 Quality: 0
        10.0.0.7 => 10.0.0.1 Quality: 0
        10.0.0.6 => 10.0.0.1 Quality: 0
        10.0.0.5 => 10.0.0.1 Quality: 0
        10.0.0.4 => 10.0.0.8 Quality: 25
        10.0.0.4 => 10.0.0.1 Quality: 0
        10.0.0.3 => 10.0.0.8 Quality: 25
        10.0.0.3 => 10.0.0.1 Quality: 0
        10.0.0.2 => 10.0.0.8 Quality: 25
        10.0.0.1 => 10.0.0.3 Quality: 0
        10.0.0.1 => 10.0.0.4 Quality: 0
        10.0.0.1 => 10.0.0.5 Quality: 0
        10.0.0.1 => 10.0.0.6 Quality: 0
        10.0.0.1 => 10.0.0.7 Quality: 0
        10.0.0.1 => 10.0.0.8 Quality: 0

Now for a look at olsrd 10.0.0.8s output:

       *** olsr.org - 0.4.10-pre (May 30 2005) ***

--- 21:23:00.35 ---------------------------------------------------- LINKS

IP address       hyst   LQ     lost   total  NLQ    ETX
10.0.0.7         0.000  1.000  0      10     1.000  1.00
10.0.0.5         0.000  1.000  0      10     1.000  1.00
10.0.0.6         0.000  1.000  0      10     1.000  1.00
10.0.0.2         0.000  0.800  2      10     0.498  2.51
10.0.0.3         0.000  0.600  4      10     0.498  3.35
10.0.0.4         0.000  0.900  1      10     0.800  1.39

--- 21:23:00.35 ------------------------------------------------ NEIGHBORS

IP address       LQ     NLQ    SYM   MPR   MPRS  will
10.0.0.2         0.800  0.498  YES   YES   NO    3
10.0.0.3         0.600  0.498  NO    NO    NO    3
10.0.0.4         0.900  0.800  YES   NO    NO    3
10.0.0.5         1.000  1.000  YES   NO    NO    3
10.0.0.6         1.000  1.000  YES   YES   NO    3
10.0.0.7         1.000  1.000  YES   YES   NO    3

--- 21:23:00.35 ------------------------------------------------- TOPOLOGY

Source IP addr   Dest IP addr     LQ     ILQ    ETX
10.0.0.2         10.0.0.1         1.000  1.000  1.00
10.0.0.2         10.0.0.3         1.000  1.000  1.00
10.0.0.2         10.0.0.4         1.000  1.000  1.00
10.0.0.2         10.0.0.5         1.000  1.000  1.00
10.0.0.2         10.0.0.6         1.000  1.000  1.00
10.0.0.2         10.0.0.7         1.000  1.000  1.00
10.0.0.2         10.0.0.8         0.898  0.498  2.24
10.0.0.5         10.0.0.4         1.000  1.000  1.00
10.0.0.6         10.0.0.8         1.000  1.000  1.00
10.0.0.7         10.0.0.2         1.000  1.000  1.00
10.0.0.7         10.0.0.3         1.000  1.000  1.00
10.0.0.7         10.0.0.8         1.000  1.000  1.00

Yes, there most certainly are some very weak links here.

Well, lets leave it at that :-) The command line interface is meant to be used by applications as well as humans, so if somebody wants to create a GUI front-end that should not be to much work.

Performance

Regarding CPU load I have not done any real testing, but I did try seeing how far I could get on my 1.3Ghz/512MB-RAM desktop system running LQ olsrd instances in the background initiated from olsrd_switch. When reaching a certain amount (15+) the cPU load is very high for neighbor detection, but as soon as links stabelize the CPU is almost idle again. I have ran with 30+ nodes with no problem. But do not start to many instances at the same time.

Note that, this was only using a idle network(no topology changes except new nodes joining). But as soon as olsrd instances can connect from other hosts one can distribute the load. Also the application will be subject to various future optimizations.

Network load measurement tools will also be on the to-do list.


by Andreas Tønnesen