OLSR is a network protocol used to propagate route information in a decentralized and highly resilient manner.

Experimental results

experiment 2

problem: uses MAC discovery instead of sending packets to the detected route, because all IPs are in the same subnet. olsrd is not actually adding routes.

steps taken:

  1. configure laptop 1 (lap1) with ad-hoc and a static IP (10.0.1.44)
  2. configure laptop 2 (lap2) with ad-hoc and a static IP (10.0.1.42)
  3. connect lap2 with a linksys router (rtr1) on the upstream port (ethernet)
  4. configure rtr1's upstream port with static IP 10.0.1.20
  5. configure a wifi access point on rtr1
  6. start OLSRd on all nodes

expected result:

  • route for lap1 via lap2 gets added to rtr1's routing table
  • another laptop (lap3) connected to rtr1's wifi access point can ping lap1

actual result:

  • no route added
  • rtr1 sends ARP requests for 10.0.1.44 to lap2, no ping replys from lap3

i tried bridging the wifi and ethernet interfaces of lap2 but this failed:

can't add wlan0 to bridge br0: Operation not supported

commands were:

brctl addbr br0
brctl addif br0 eth0
brctl addif br0 wlan0

this would have somehow helped lap2 in figuring out where to send the packets at least...

(!) note: the interface 1 of the openwrt is left configured with factory-standard 192.168.1.1 to ease debugging

Experiment 1

Now it seems the routes are propagating properly, but for some reason, the second i start OLSRd, packets do not get through anymore.

My routing table before OLSRd:

root@angela:/etc/olsrd# route -n
Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0

OLSRd output:

       *** olsr.org - 0.5.6-r7 (2009-11-11 17:29:46 on matrix) ***

--- 02:58:47.285323 ---------------------------------------------------- LINKS

IP address       hyst         LQ       ETX
10.0.1.1         0.000  1.000/1.000    1.000

--- 02:58:47.285348 ----------------------- TWO-HOP NEIGHBORS

IP addr (2-hop)  IP addr (1-hop)  Total cost

--- 02:58:47.285359 ------------------------------------------------- TOPOLOGY

Source IP addr  Dest IP addr          LQ        ETX
10.0.1.1        10.0.1.2        1.000/1.000    1.000
10.0.1.2        10.0.1.1        1.000/1.000    1.000

New routing table:

Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 eth0
10.0.1.1        0.0.0.0         255.255.255.255 UH    2      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0

There has to be something i am missing here.... Now the cool thing is that I can manually add 10.0.1.1 as a default gw and it actually routes my packets through, but i still can't ping 10.0.1.1 directly.

Base configuration

Before you configure OLSR, you probably want a basic ad-hoc configuration, especially having an IP on some link, even if it's ad-hoc and you do not know your neighbors yet. As long as the SSID is the same, you will be able to pick them up through OLSRd.

OpenWRT config

  1. install the packages

    opkg update
    opkg install olsrd-luci luci-app-olsr
    
  2. enable the OLSR daemon and start it in Services -> Initscripts

  3. configure OLSR in Services -> OLSR (just enable it on the lan) (!) you may need to reboot the box for this service to appear.

Those instructions were taken from here. This is the package source.

Debian wired config

This configuration will enable olsrd on the wired interface of a machine:

apt-get install olsrd
olsrd -i eth0 -d 1 # to run in debugging mode for now
echo 'DAEMON_OPTS="-i eth0"' >> /etc/default/olsrd

Route announcements

By default, OLSRd only announces the IP address of the interface it is configured on. To announce more routes, you need to add an HNA block. This can be done through the OpenWRT interface or as a code block. For example, if your node can route (say) 72.0.72.144/32 (your static IP), you will want a block like this:

Hna4
{
    # my public IP
    72.0.72.144 255.255.255.255
}

You can of course announce whole netblocks in there and even a default route, if you want to give everyone access to the internets:

Hna4
{
    # my local network
    192.168.42.0 255.255.255.0
    # this machine is a gateway
    0.0.0.0 0.0.0.0
}

IPv6 is also supported, of course.

Web interface

[!] Warning: this makes the web interface available to everybody.

LoadPlugin "olsrd_httpinfo.so.0.1"
{
    # defaults to 1978
    PlParam "Port" "8080"
    # if you dont set these, the default is to listen only on the loopback device
    #PlParam "Host"   "80.23.53.22"
    #PlParam "Net"    "10.0.0.0 255.0.0.0"
    # gives access to everybody!!
    PlParam "Net" "0.0.0.0 0.0.0.0"
}

References

Howtos

Firmwares based on OLSR