Mesh networking

What are AODV, OLSR, and BATMAN?

AODV, OLSR and BATMAN are routing protocols for wireless mesh and mobile ad hoc networks. AODV finds a route only when a device has something to send; OLSR keeps a map of the whole network up to date in advance; and BATMAN keeps no map at all, only the best next neighbour towards each destination, learned from how well other devices' announcements arrive.

Learning objectives

After reading this article you will be able to:

  • Explain how AODV finds a route on demand with requests, replies and errors
  • Describe how OLSR uses multipoint relays and BATMAN uses only the best next hop
  • Compare on-demand and proactive routing on route discovery delay and overhead

The problem they solve

In a mesh network of moving radios, nobody hands out routes. Each device has to work out, by talking to its neighbours, which neighbour to pass a message to so it reaches a device several hops away. Links appear and vanish as devices move, so whatever a device learns goes stale.

The IETF working group on mobile ad hoc networks (MANETs) described this setting in RFC 2501: nodes “free to move arbitrarily”, topologies that change “randomly and rapidly”, links with limited and variable capacity, and devices running on batteries. AODV, OLSR and BATMAN are three widely documented answers. They differ mainly in when they do the work of finding routes, and how much of the network each device tries to know.

AODV: find a route when you need one

The Ad hoc On-Demand Distance Vector protocol is specified in RFC 3561, an Experimental RFC published in 2003. It is reactive: it does nothing for a pair of devices until one of them has something to send.

  • Route request. A device that needs a route broadcasts a route request (RREQ). Neighbours rebroadcast it outwards, each recording which neighbour it came from, so a path back to the sender forms as it spreads.
  • Route reply. When the request reaches the destination, or a device with a fresh enough route to it, a route reply (RREP) is unicast back along that reverse path.
  • Route error. Devices watch the next hops on routes in use. When a link breaks, a route error (RERR) tells the devices that were relying on it.

To keep routes loop-free, AODV attaches to every route a destination sequence number, created by the destination itself, and a device given two routes must pick the one with the greater number. To avoid flooding the whole network for every request, a sender can use an expanding ring search, starting with a small hop limit and widening it only if no reply comes.

The cost of this design is delay at the start: the first message to a new destination waits while a route is found.

OLSR: keep a map ready

The Optimized Link State Routing protocol was first published as RFC 3626, also Experimental and from 2003. It is proactive and table-driven: every router exchanges topology information regularly, so it holds routes to every destination before anyone asks.

OLSR is an optimisation of classic link-state routing, built to cut the number of transmissions needed on a shared radio channel. Its key idea is the multipoint relay (MPR). Each router chooses a subset of its neighbours that together reach all its two-hop neighbours. Only MPRs rebroadcast flooded control messages, and only MPRs need to advertise link-state information, which is enough to compute shortest paths.

OLSRv2, published as Standards Track RFC 7181 in 2014, keeps those mechanisms and adds link metrics other than hop count, so a router can prefer a route over good links to a shorter route over poor ones. It separates flooding MPRs from routing MPRs, and builds on the MANET Neighborhood Discovery Protocol (RFC 6130) and a common packet format (RFC 5444).

The cost here is constant background traffic, even when nobody is sending data.

BATMAN: know only the next hop

B.A.T.M.A.N., short for Better Approach To Mobile Ad-hoc Networking, is developed and documented by the open-mesh.org project. Its designers argued that a link-state protocol’s need to recalculate the whole topology graph is hard on small embedded routers.

Instead, each node periodically broadcasts a small originator message (OGM) with its address and a sequence number. Neighbours rebroadcast it according to set rules, so it floods the network. A node never builds a map. It notes which neighbour delivers a given originator’s messages most often and most reliably, and treats that neighbour as the best next hop towards that originator. Messages that travel over poor links arrive less often, so poor paths lose out.

BATMAN has evolved through versions. B.A.T.M.A.N. IV added a Transmit Quality measure to cope with links that work better in one direction than the other. B.A.T.M.A.N. V moves neighbour discovery to a separate Echo Location Protocol and uses throughput, rather than packet loss, as its metric.

Its kernel implementation, batman-adv, works at layer 2: it carries Ethernet frames and makes the whole mesh look like one virtual switch, so protocols such as IPv4, IPv6 and DHCP run over it unchanged.

How they compare

AODVOLSR / OLSRv2BATMAN
When routes are foundOn demandContinuouslyContinuously
What each device knowsRoutes in active useTopology of the networkBest next hop per destination
Path choiceFresh sequence number, fewer hopsShortest path; OLSRv2 adds link metricsMost reliable (IV) or highest throughput (V) next hop
SpecificationRFC 3561, ExperimentalRFC 3626, Experimental; RFC 7181, Standards Trackopen-mesh.org documentation; Linux kernel module

RFC 2501 sums up the basic trade-off. Demand-based operation can use energy and bandwidth more efficiently “at the cost of increased route discovery delay”; proactive operation avoids that delay where bandwidth and energy allow. The batman-adv kernel documentation makes the same point about its own tuning: a lower originator interval makes the mesh more responsive to topology changes “but will also increase the overhead”.

All three run beneath applications, in routers and operating system network stacks. A mesh built inside an app, such as one over Bluetooth LE between phones, sits at a different layer, but it faces the same questions: how to learn neighbours, when to spend airtime on route information, and how to react when devices move.

Frequently asked questions

Which is best, AODV, OLSR or BATMAN?

None wins everywhere. On-demand routing suits networks where energy and bandwidth are scarce and a short wait for the first route is acceptable. Proactive routing suits networks where routes must be ready immediately and there is capacity for regular updates. Even within one protocol it is a tuning choice: the batman-adv documentation notes that announcing more often makes the mesh more responsive but adds overhead.

Can phones run these protocols?

They are written for routers and operating system network stacks that handle IP packets or Ethernet frames. A mesh built inside a phone app works at a different layer, but it has to solve the same problems these protocols address, and often borrows their ideas.

Build it with Offline Protocol

The transport and routing page describes how the Offline Protocol mesh SDK forwards messages over several hops inside the app, scoring eligible paths and applying switching controls, and what multi-hop forwarding needs from the deployment.

Read transport and routing