Building a Wireless Mesh Network


Wireless mesh network is a communication network made up of radio nodes organized in a mesh topology. Some may address it as wireless ad-hoc network, mobile ad-hoc network (MANET) or mesh-net. These networks are resilient due to its self-forming and self-healing characteristics.

I started building my own wireless mesh nodes using low-cost routers and open-source software back in year 2015.

A wireless mesh network typically comprise:

  1. Wireless clients;
  2. Wireless mesh nodes (i.e. wireless routers and/or wireless gateway).

Unlike a regular wireless network which wireless clients and access points connect in a hub-and-spoke fashion, the wireless mesh nodes (of a wireless mesh network) are interconnected and (often) have multiple paths between a source and destination.

Some uses of wireless mesh networks are:

  • Mobile ad-hoc communication in areas where telecommunication infrastructure are absent or lacking. For example, having a reliable means of communication during trekking;
  • Establishing a permanent (wireless) communication infrastructure in rural areas where laying fixed lines like fiber or copper are cost prohibitive.

Wireless Mesh Operating Modes

Infrastructure Mesh Network
Infrastructure Mesh Network

There are two main operating modes for wireless mesh network:

Model Infrastructure mesh network Client mesh network
TrafficPractically all the traffic is either forwarded to or from a gateway to Internet or an external network.The traffic flows between the devices or nodes within the same network.
ExampleAn example is having a wireless router at home providing Internet to your devices over wireless. Wireless mesh nodes can be scatted around the house to extend Internet coverage to areas where the main wireless router have problem reaching. As a result, wireless clients on the wireless mesh network will be able to connect to the Internet as long as they can connect to a wireless mesh node.Just imagine the trekking scenario where your friends walk in an a single file. In the case of using regular radios, there would be situations where the first guy have problem communicating with the last guy. If everyone is equipped with a mesh node, the message will be received by the last guy by relaying through the intermediate nodes.

The wireless mesh nodes (or equipment) are available commercially off the shelf but they can also be built using opensource software and hardware. And so I built my own wireless mesh network using opensource software and affordable hardware.

Software and Hardware Platform

Choice of software

Software-wise, I am amazed by the amount of wireless mesh communities out there, each with their own community specific software. There are also non-community-based software that allows users to freely create their own wireless mesh network. Generally, these software are based on Linux and are meant to run on commercial routers. However, the support for desktop computers or Raspberry Pi is limited.

In the end, I settled for OpenWRT and Debian as my platform. I will be putting together the software and configuration to turn (supported) commercial routers and Raspberry Pi into wireless mesh nodes.

Choice of hardware

After choosing the target platform, the selection of hardware is easier and focused. The routers will need to support OpenWRT and the necessary kernel modules. For the computers, they will need to support Debian and equipped with the necessary wireless adapters.

For a start, I settled for the following hardware:

Model SoC CPU (MHz) Flash (MB) RAM (MB)
TP-Link TL-WR703NAtheros AR9331400432
TP-Link TL-MR3020Atheros AR9331400432
GL.iNet 6416Atheros AR93314001664
Raspberry Pi 2 Model BBCM2836900-1024

With the software platform and hardware decided, it is time to delve slightly deeper into the whole wireless mesh network mojo.

Choosing the Mesh Routing Protocol

Mesh routing protocols

At the very core of a mesh node, the routing protocols handle the route discovery and route maintenance. Route discovery finds the path between a source and destination while route maintenance responds to changes in network topology.

Routing protocols are generally classified into the following three genres:

Type Proactive (table-driven) Reactive (on-demand) Hybrid (Proactive + Reactive)
MechanismThese protocols maintain fresh lists of destinations and their routes by periodically distributing routing tables throughout the network.These protocols find a route on demand by flooding the network with Route Request packets.This type of protocol combines the advantages of proactive and reactive routing. The routing is initially established with some proactively prospected routes and then serves the demand from additionally activated nodes through reactive flooding.
DisadvantagesThe amount of data can be huge if network is big and this leads to resource depletion on mesh nodes.Potential high latency in path-finding which increase the latency between source and destination.
ProtocolsOLSR, DSDV, Babel, B.A.T.M.A.N-Adv, BMX6, R.O.B.I.NAODV, DSR ZRP

After much research on routing protocol, I chose to experiment proactive mesh routing protocols. I continued to research on routing protocols that are well supported on OpenWRT platform.

I shortlisted the following protocols as they have more success stories on OpenWRT:

OS SupportOpenWRT
Operating Layer2
(Essentially working like a ethernet switch)

After much researching, I decided to try both B.A.T.M.A.N-Adv and BMX6.

Setting up the Mesh Nodes software

If you don’t require much customisation, the setting up of mesh node is pretty straight-forward. In here, I will document the straight-forward way which I initially did to trial out wireless mesh on the routers.

I had since progressed to building my own OpenWRT firmware and configuration to meet my performance and security requirements.

Like I mentioned earlier, I decided to trial out both B.A.T.M.A.N-Adv and BMX6 mesh routing protocol. The trials are mutually exclusive, that is they either use B.A.T.M.A.N-Adv or BMX6. I will not be documenting the configurations for BMX6.

Setting up for B.A.T.M.A.N-Adv

For this, you will need to have OpenWRT running on the routers. I won’t be covering this as the flashing method is widely documented on the Internet for the various router. For example, I documented my process of flashing OpenWRT onto TP-Link TL-WR703N.

After getting OpenWRT onto the router, install the B.A.T.M.A.N-Adv and batctl package. For configuration wise, I found that the B.A.T.M.A.N-Adv configuration documented here works pretty well.

You will need at least 2 mesh nodes to know whether have you set it up properly. Well, if it doesn’t work, try again. Some useful commands to aid your troubleshooting are:

  • iw wlan0 station dump
  • iw wlan0 mpath dump
  • batctl s
  • batctl tg


Setting up a small mesh network is straight forward. However, things start to get more complex/challenging once the number of mesh nodes increases.


One of the problems is IP address assignment to mesh nodes and mesh clients. IP address conflicts need to be avoided and address assignment services need to be highly available even in the situation of mesh network split.

Another problem is having a configurable system to tackle both Infrastructure and Client mesh network. Both of them got different routing consideration.

If you have innovative solutions for the problems, do drop me an email. Thanks in advance!

Configurations (Simple)

Required Packages
kmod-batman-advB.A.T.M.A.N. advanced is a kernel module which allows to build layer 2 mesh networks.
batctlbatctl is a user space configuration & management tool for B.A.T.M.A.N. advanced.


Treat shadowandy!

If these step-by-step guides have been very helpful to you and saved you a lot of time, please consider treating shadowandy to a cup of Starbucks.