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:
- Wireless clients;
- 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
There are two main operating modes for wireless mesh network:
|Model||Infrastructure mesh network||Client mesh network|
|Traffic||Practically 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.|
|Example||An 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-WR703N||Atheros AR9331||400||4||32|
|TP-Link TL-MR3020||Atheros AR9331||400||4||32|
|GL.iNet 6416||Atheros AR9331||400||16||64|
|Raspberry Pi 2 Model B||BCM2836||900||-||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)|
|Mechanism||These 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.|
|Disadvantages||The 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.|
|Protocols||OLSR, DSDV, Babel, B.A.T.M.A.N-Adv, BMX6, R.O.B.I.N||AODV, 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:
(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!
|kmod-batman-adv||B.A.T.M.A.N. advanced is a kernel module which allows to build layer 2 mesh networks.|
|batctl||batctl is a user space configuration & management tool for B.A.T.M.A.N. advanced.|
config mesh 'bat0'
option interfaces 'mesh0'
option bridge_loop_avoidance '1'
option gw_mode 'off'
config interface 'lan'
option ifname 'eth0 bat0'
option type 'bridge'
option proto 'static'
option ipaddr '172.22.190.186' # use different IP for different mesh node
option netmask '255.255.0.0'
config interface 'mesh'
option proto 'batadv'
option mesh 'bat0'
option mtu '1532'
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11g'
option path 'platform/ar933x_wmac'
option htmode 'HT20'
option channel '1'
option disabled '0'
option device 'radio0'
option encryption 'none'
option network 'lan'
option mode 'ap'
option ssid 'mesh-client-ap'
option device 'radio0'
option encryption 'none'
option network 'mesh'
option mode 'mesh'
option mesh_id 'meshnet'
option mesh_fwding '0'