Outdated Information!
This article contains information that is outdated or no longer valid. You can edit this page to update it.

OLSR has been changed significantly since this article was written, Notably, there is a “v2” that is IETF Standards Track that is described at https://tools.ietf.org/html/rfc7181 and several updates since published in 2014.

Mesh networks self-arrange and auto-configure themselves on the basis of network topology changes. For example, the properly configured OLSR mesh will automatically arrange itself in cases where one node fails, or when a new route emerges, or when a low traffic route becomes available or disappears. The concept of a mesh network is not new; the Internet itself is a huge mesh network. So what's new? Well, mesh networks with wireless technology on OpenWrt simply rocks! ;)

OLSR is one of the routing protocols available to create a Mobile Adhoc Networks (MANET), or rather, in more general terms, a wireless mesh network. The OLSR code developed by Andreas Tønnesen is the best suited for our case as packages have been created for OpenWrt.

This wiki page contains information on how to create an OLSR mesh network by configuring OpenWrt and olsrd (the OLSR daemon process) yourself. If your objective is to get an OLSR network quickly running, you may want to have a look at firmware that has been specifically created for this purpose. An example of this sort of firmare is the Freifunk project. If you're determined to get OLSR running on OpenWrt without the assistance of pre-packaged firmare, keep reading!

olsrd 0.6.1-3
Name Size Description
olsrd 108257 OLSR (Optimized Link State Routing) daemon
olsrd-mod-dyn-gw-plain 2902 Dynamic internet gateway plain plugin
olsrd-mod-bmf 12106 Basic multicast forwarding plugin, dependece: kmod-tun
olsrd-mod-httpinfo 23831 Small informative web server plugin
olsrd-mod-quagga 5848 Quagga plugin
olsrd-mod-dyn-gw 4348 Dynamic internet gateway plugin
olsrd-mod-txtinfo 6201 Small informative web server plugin
olsrd-mod-nameservice 11511 Lightweight hostname resolver plugin
olsrd-mod-dot-draw 4233 Dot topology information plugin
olsrd-mod-mdns 5648 Multicast DNS plugin
olsrd-mod-watchdog 2316 Watchdog plugin
olsrd-mod-arprefresh 2703 Kernel ARP cache refresh plugin
olsrd-mod-p2pd 8066 Peer to Peer Discovery plugin
olsrd-mod-secure 9710 Message signing plugin to secure routing domain

There are an infinite number of ways that a mesh network can be configured; below is a simple example that allows routing over a set of subnets in the range through the OLSR mesh.

      WAN                                                 WAN
       |                                                   |
OpenWrt + OLSR Node 1 ---- wireless link ---- OpenWrt + OLSR Node 2
       |                                                   |
      LAN                                                 LAN
       |                                                   |
  Workstation A                                      Workstation B

Both nodes (in this case the WRT54GL was used) need to have OLSR installed. In general, OLSR will have to be installed on any node that participates in establishing routing between the OLSR-aware subnets that you configure. OLSR needs to be configured to listen on all WIFI interfaces on these routers. Running it on wired interfaces is usually not necessary, and according to some sources may interfere with other services on these interfaces such as DHCP.

If the “wired” interfaces on your router are on a different subnet from the wireless interfaces you can configure OLSR to distribute host and network association (HNA) messages to other routers. Depending on if if you are running IPv4 or IPv6 you will either have Hna4 or Hna6 directives in your /?/olsrd.conf configuration file.

Outdated Information!
This article contains information that is outdated or no longer valid. You can edit this page to update it.

  1. separate the wireless and lan interface in /etc/config/network again, by default they are bridged
  2. configure the WNICs to work in adhoc-mode. Your file /etc/config/wireless might look as follows:
    config wifi-device  wl0
            option type     broadcom
            option channel  11
            # disable radio to prevent an open ap after reflashing:
            option disabled 0
    config wifi-iface
            option device   wl0
            # option network        lan
            option mode     adhoc
            option ssid     OLSR
            option hidden   0
            option encryption none
  3. install olsrd
      opkg update
      opkg install olsrd
  4. Edit the /etc/olsrd.conf and replace “Interface “XXX” with the wireless interface on your router. Example
    # olsr.org OLSR daemon config file
    # /etc/olsrd.conf
    # Modified for sample OLSR network by Justin S. Leiteb
    # http://justin.phq.org/ Fri Jun  8 10:34:27 EDT 2007
    # Many comments and commented line from conf file distributed
    # with olsrd omitted for brevity in wiki.
    DebugLevel	0
    IpVersion	4
    ClearScreen     yes
    # On the second OLSR node (olsrd.conf not supplied for this node, since only one line is different),
    # which has a LAN interface on the network, the Hna4 entry is:
    #  These Hna4 entries are what propagates information about how to route
    # to these subnets through the mesh.
    	# My home LAN
    AllowNoInt	yes
    UseHysteresis	yes
    # Hysteresis parameters
    HystScaling	0.50
    HystThrHigh	0.80
    HystThrLow	0.30
    LinkQualityLevel	0
    Pollrate	0.05
    NicChgsPollInt  3.0
    Interface "wl0"
        AutoDetectChanges            yes
    # Run http server with mesh information.  Won't work unless you've already installed
    # the olsrd_httpinfo plugin through ipkg.
    LoadPlugin "olsrd_httpinfo.so.0.1"
    	PlParam		"port"	"1979"
    	PlParam		"Net"	""
  5. firewall, allow the router to forward packets between the interfaces, example:
    # Copyright (C) 2006 OpenWrt.org
    iptables -F input_rule
    iptables -F output_rule
    iptables -F forwarding_rule
    iptables -t nat -F prerouting_rule
    iptables -t nat -F postrouting_rule
    # The following chains are for traffic directed at the IP of the
    # WAN interface
    iptables -F input_wan
    iptables -F forwarding_wan
    iptables -t nat -F prerouting_wan
    # Does anyone have a command to get the name of the WIFI interface on Kamikaze so
    # that it doesn't have to be hard-coded here?  This is a bit sloppy it seems.
    iptables        -A input_wan      -p tcp --dport 22 -j ACCEPT
    # Allow connections to olsr info port.
    iptables        -A input_wan      -p tcp --dport 1979 -j ACCEPT
    # OLSR needs port 698 to transmit state messages.
    iptables -A input_rule -p udp --dport 698 -j ACCEPT
    # Debugging... do we have WIFI, LAN and WAN appropriately defined?
    # These values are passed to us from /etc/init.d/firewall, which
    # calls this script.
    # echo WIFI == $WIFI
    # echo LAN == $LAN
    # echo WAN == $WAN
    iptables -A forwarding_rule -i $WAN -o $WIFI -j ACCEPT
    iptables -A forwarding_rule -i $WIFI -o $WAN -j ACCEPT
    # For forwarding LAN & WIFI in nodes
    iptables -A forwarding_rule -i $LAN -o $WIFI -j ACCEPT
    # For WIFI clients to connect to nodes.
    iptables -A forwarding_rule -i $WIFI -o $WIFI -j ACCEPT
    # For connecting a wired lan client of node 1 to wired lan client of node 2
    iptables -A forwarding_rule -i $LAN -o $LAN -j ACCEPT
    # WIFI needs to go to LAN ports, too!
    iptables -A forwarding_rule -i $WIFI -o $LAN -j ACCEPT
  6. start olsrd
    /etc/init.d/olsrd start
    /etc/init.d/olsrd enable

Reboot your router and test everything by pinging interfaces on the different devices. Go and have a beverage of choice to celebrate!

You may want to check out some of the plugins that are easy to configure and show you the basic status of your mesh. On my network I run olsrd-mod-httpinfo, which provides a basic http server that shows you the status of the mesh.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/07/30 00:12
  • by vgaetera