Wi-Fi mesh builder
Build a batman-adv node on OpenWrt
Turn OpenWrt routers into batman-adv mesh nodes: packages, an 802.11s link layer, bat0 and gateway mode, with dated doc sources and UK Wi-Fi limits.
- Difficulty
- Advanced
- Time
- A few hours for two nodes (our estimate, not from a source)
- Cost
- Two OpenWrt-capable routers you may already own
Updated 27 Nov 2026
Overview
batman-adv is a layer 2 mesh protocol in the Linux kernel. On an OpenWrt router it appears as a
virtual interface, bat0, that behaves like one Ethernet switch spanning every node. It needs a link underneath it. The
OpenWrt batman page says it "can run on top of a variety of mesh implementations, including 802.11s, ad-hoc (IBSS), and
multiple point-to-point links, wired or wireless." This guide uses an 802.11s Wi-Fi mesh
link as that carrier, because it is the case the OpenWrt wiki documents.
What you end up with: two or more routers that find each other over Wi-Fi and forward frames between them. What you do not get: internet access, unless one node has an uplink and you configure gateway mode, and any encryption from batman-adv itself. The wiki page says "batman-adv does not provide encryption or authentication"; any protection has to come from the link underneath or from protocols above it.
If you only want to join an existing network, use that network's firmware instead: see Join a community Wi-Fi mesh. For a firmware that does the configuration for you, see Build a LibreMesh node. For protocol background see the routing protocol comparison.
Which versions this describes
| Item | What we read | Source |
|---|---|---|
| OpenWrt current stable | 25.12.6, GitHub release published 2026-10-18. Previous series 24.10 at 24.10.8 (2026-07-26) | GitHub releases, read 2026-11-04 |
| Package manager | apk from 25.12: "OpenWrt has transitioned from the traditional opkg package manager to apk (Alpine Package Keeper)." |
v25.12.0 release notes |
| batman-adv and batctl on 25.12 | 2025.4 (routing feed branch openwrt-25.12); 24.10 carries 2024.3 |
openwrt/routing Makefiles, read 2026-11-04 |
| batman-adv on OpenWrt master | 2026.3 | openwrt/packages, read 2026-11-04 |
| OpenWrt wiki, batman page | "Last modified: 2024/06/05 20:06", says it applies to "batman-adv 2019.1 and later" | archive copy of 2026-02-17 |
| OpenWrt wiki, 802.11s page | "Last modified: 2024/09/23 17:13" | archive copy of 2025-03-04 |
Do not read 2026.3 as what a 25.12 image carries: that version is only on the development branch. The 25.12 branch also carries bug-fix patches on top of 2025.4, so the exact code differs from the 2025.4 tarball.
Choose hardware that can do mesh
Pick a router from the Table of Hardware and read its own OpenWrt page for the install method.
Not every Wi-Fi driver and firmware combination supports mesh. The batman page says: "Note that not all driver / firmware combinations support 802.11s mesh (or IBSS). This may be checked with iw phy, looking for “mesh point” (or “IBSS”) in the various sections of the output." The 802.11s page prints a longer check:
iw list | grep "Supported interface modes" -A 9.
Things the sources say to watch for:
- The batman page: "It has been reported that certain Marvell chips supported by the mwlwifi driver do not support 802.11s, even if indicated in the capabilities."
- The 802.11s page: "as of Dec 2023, the ath10k-ct wireless driver used in NETGEAR R7800 and other devices with Qualcomm Atheros QCA988x chips doesn't support mesh very well". We did not check whether this still holds.
- A driver can advertise IBSS (ad-hoc) without advertising mesh point. For the Raspberry Pi side of this, see Raspberry Pi mesh lab.
For one example of a small OpenWrt-native router, see the GL.iNet GL-MT3000 device page.
Flash OpenWrt
- Get the image for your exact model. The Firmware Selector builds images and can include extra packages, which matters for the next section.
- Follow the install method on your router's Table of Hardware page. Methods differ by model; we do not summarise them.
- After the first boot, set the Wi-Fi country before enabling a radio (see the UK block below).
OpenWrt's Wi-Fi page describes the options we rely on: country "Specifies the country code, affects the available channels and transmission powers." and txpower "Specifies the maximum desired transmission power in dBm. The actual txpower used depends on regulatory requirements." For DFS channels it says "the 5GHz radio device won’t start up unless the firmware image is able to provide DFS support (i.e. it is both included and enabled)." (page last modified 2025/12/30).
Packages
You need three things: the batman-adv kernel module, batctl, and a wpad build that includes mesh support.
| Need | Package names on 25.12 | Notes |
|---|---|---|
| batman-adv module | kmod-batman-adv |
Feed routing, version 2025.4 |
| Control tool | batctl-tiny, batctl-default or batctl-full |
The wiki says "if batctl isn't available, install batctl-default". We did not establish which one kmod-batman-adv pulls in |
| Mesh-capable Wi-Fi security | wpad-mesh-mbedtls, wpad-mesh-openssl or wpad-mesh-wolfssl; the full wpad-mbedtls, wpad-openssl, wpad-wolfssl also appear |
The 25.12.6 hostapd package describes the mesh variant as "a minimal IEEE 802.1x/WPA Authenticator and Supplicant (with 802.11s mesh and SAE support)." (package/network/services/hostapd/Makefile at tag v25.12.6 of openwrt/openwrt). The default wpad-basic-* builds have no mesh |
Use apk, not opkg. Both wiki pages print opkg update, opkg install and opkg remove lines. They are stale for 25.12. OpenWrt's
cheat sheet (last modified 2026/03/22) maps them: apk update for opkg update, apk add pkg for opkg install pkg,
and apk del pkg for opkg remove pkg.
The cheat sheet shows no recipe for swapping wpad-basic-* for a mesh variant on a running 25.12 system, and we found none
elsewhere. So the safest documented route for a first node is to build the image with the packages already in it
using the Firmware Selector, rather than swapping wpad on a live router. The batman page also notes: "If building/assembling your own image, you will need to remove the default wpad-basic as it conflicts with wpad-mesh-*."
Configure the mesh link
These blocks are quoted from the two wiki pages, with the dates above. They use /etc/config/wireless and
/etc/config/network; the batman page says that since batman-adv 2019.1 "Configuration for batman-adv from 2019.1 and onward is done in /etc/config/network (only). There is no /etc/config/batman-adv file used with current versions."
The wireless interface
From the batman page (last modified 2024/06/05). The page prints the same text on every node.
config wifi-iface 'mesh0'
option device 'radio5pci'
option ifname 'mesh0'
option network 'nwi_mesh0'
option mode 'mesh'
option mesh_fwding '0'
option mesh_id '<your advertised mesh "name" goes here>'
option encryption 'sae'
option key '<your secure pass phrase goes here>'
Two edits to know about:
- Encryption. The batman page prints
option encryption 'psk2+ccmp'on that line. The 802.11s page printsoption encryption 'sae'and its LuCI steps say "WPA3-SAE". We showsaebecause the mesh-capablewpadbuilds list SAE support, but the 802.11s page is the one that carries the LLM warning, and we have not tested either value. The 802.11s page also allows'none'"if you do not want encryption". Test on your hardware; do not take either page as settled. - Radio name. The page says "radio5pci needs to match the declaration in /etc/config/wireless of your device, such as config wifi-device 'radio5pci'". Use your own radio's name.
What the page says about the other options: "mesh_fwding '0' turns off 802.11s forwarding/routing; it will be handled by batman-adv at each node", and "The radios all need to be on the same channel and be configured to interoperate with each other (basically configured the same as each other)". The 802.11s page repeats the idea: "Every device you want to participate in the mesh must be configured in the same way ie same mesh_id, same channel, same key."
The batman-adv interface
From the batman page. We omitted one line the page prints, option network_coding 0: batctl 2025.4 (released 2025-10-24) lists "removed network coding (C.A.T.W.O.M.A.N.) support" in its changelog, and the 25.12 batman-adv package has no network-coding option. We did not test what happens if the line is left in.
config interface 'bat0'
option proto 'batadv'
option routing_algo 'BATMAN_IV'
option aggregated_ogms 1
option ap_isolation 0
option bonding 0
option fragmentation 1
#option gw_bandwidth '10000/2000'
option gw_mode 'off'
#option gw_sel_class 20
option log_level 0
option orig_interval 1000
option bridge_loop_avoidance 1
option distributed_arp_table 1
option multicast_mode 1
option hop_penalty 30
option isolation_mark '0x00000000/0x00000000'
config interface 'nwi_mesh0'
option mtu '2304'
option proto 'batadv_hardif'
option master 'bat0'
Notes from the page: "nwi_mesh0 needs to match the declaration in /etc/config/wireless of your device, such as option network 'nwi_mesh0'". "The MTU is set to 2304 here, what an 802.11s link will support. A minimum of 1532 is suggested to provide batman-adv routing of typical 1500-byte Ethernet packets."
The page picks BATMAN_IV and adds, from autumn 2018 (batman-adv 2018.2): "BATMAN_V (5), in the author's experience, is not robust in this on-premise application." That is one author's dated opinion. See the batman-adv explainer for the difference between the two.
The page's bridging examples (joining bat0 to a LAN) use older ifname syntax and a separate DSA section. We do not reproduce them; read that section for your device's switch type.
Carrier choice: 802.11s or ad-hoc
The batman page lists 802.11s and ad-hoc (IBSS, IBSS) as separate carriers, and its worked configuration is 802.11s only. We found no sourced IBSS configuration for OpenWrt 25.12, so we give none. Practical differences we can source:
- Both are checked the same way: look for “mesh point” or “IBSS” in
iw phyoutput. - Drivers do not always offer both. Source-level examples: the Realtek rtw88 driver advertises IBSS but not mesh point, and the rtl8187 driver advertises IBSS only. See Raspberry Pi mesh lab for the driver table.
- With 802.11s,
mesh_fwding '0'hands forwarding to batman-adv, as above. We found no equivalent note for IBSS.
Check that nodes see each other
At the wireless layer the batman page says: run iw dev mesh0 station dump, and "You should see the other peers in the listing with mesh plink: ESTAB indicating that the peering has been successful."
At the batman-adv layer, use batctl's current syntax. Since batctl 2019.3 (2019-08-01) its commands take a meshif <netdev> prefix instead of the old -m option; the changelog entry reads "use type specific prefixes to select mesh interface or vlan instead of '-m'". The manual page's own examples include:
$ batctl meshif bat0 neighbors
$ batctl meshif bat0 originators
The manual page header is "v2026.3-2-ge01cdd8"; the 2025.4 tarball that OpenWrt 25.12 carries uses the same prefix. The wiki's shorthand batctl n and batctl o are the neighbors|n and originators|o short forms; plain batctl n relies on the bat0 default. The wiki says the output "should indicate that the various batman-adv nodes are “seeing” each other over the mesh." See batctl in the glossary. Do not copy batctl command lines from the kernel documentation: some of them use option letters that do not match the manual page.
Gateway mode
batman-adv can announce a node's internet connection to the mesh. In the interface block above, gw_mode takes off,
client or server. The page says: "Gateway mode, if set to server other nodes are notified of that node's internet connection and must be complemented by gw_bandwidth, that notifies the algorithm that server is one of the best paths for internet access." The defaults it lists are gw_bandwidth 10000/2000, and gw_sel_class 20 for BATMAN_IV (5000 for BATMAN_V).
The batctl manual page describes the same setting: batctl meshif bat0 gw_mode with off, client or server. For a server it says the value is "used to inform other nodes in the network about this node's internet connection bandwidth" and gives a default of "10000 -> 10.0/2.0 MBit". On OpenWrt 25.12 the netifd script calls batctl meshif "$iface" gw_mode "server" "$gw_bandwidth" for servers and the same with gw_sel_class for clients.
The batman page adds a caution from its author, not a kernel fact: "There is a batman-adv feature around advertising gateways. It appears to be designed for larger-scale deployments and seems to work by moderating DHCP assignments, rather than by dynamically routing packets with the mesh-routing logic itself." We did not source the uplink side (address assignment, NAT, firewall), so this guide does not cover it. A mesh with a gateway is also a way of sharing one broadband line; read Point-to-point link to a neighbour for the contract questions that raises.
UK Wi-Fi limits
Wi-Fi limits in the UK are e.i.r.p. limits, and antenna gain counts: e.i.r.p. is transmit power in dBm plus antenna gain in dBi minus cable loss. The rows below were read from Ofcom IR 2030 v1.16 through an archive copy of 24 September 2026 (Ofcom's PDF returned an access block to automated requests on 4 November 2026); the five rows are identical in v1.17 (published 23 October 2026), compared on 4 November 2026. They match the site's rules table.
| Band | Limit | Conditions |
|---|---|---|
| 2400-2483.5 MHz | 100 mW e.i.r.p. | no outdoor restriction in the row |
| 5150-5250 MHz | 200 mW mean e.i.r.p. | outdoor use permitted, but not as part of a fixed outdoor installation |
| 5250-5350 MHz | 200 mW mean e.i.r.p. | indoor only; DFS and TPC |
| 5470-5730 MHz | 1 W mean e.i.r.p. | DFS and TPC |
| 5725-5850 MHz | 200 mW mean e.i.r.p. | not part of a fixed outdoor installation in 5730-5850 MHz |
The Linux regulatory database holds an entry headed country GB (release 2026.09.03). It is stricter than IR 2030 in places: 100 mW in 5250-5350 MHz (IR 2030: 200 mW), 500 mW in 5470-5730 MHz (IR 2030: 1 W), and NO-OUTDOOR on 5150-5250 MHz. A router whose country is set to the UK on a current OpenWrt is therefore held to a lower ceiling than Ofcom's. It is a Linux project artefact, not Ofcom's rule, and we did not check how each driver applies it when an external antenna adds gain. The OpenWrt wiki example uses option country 'DE'; the literal string GB does not appear in the page text we read, so pick the United Kingdom from the country list your own wireless settings offer.
For radios that sit on a rooftop link rather than a mesh, the rules are different again; see Point-to-point link to a neighbour.
What we could not confirm
- We did not run these steps on OpenWrt 25.12.6. All configuration comes from wiki pages last modified in 2024, read from archive copies (batman page snapshot 17 February 2026, 802.11s page snapshot 4 March 2025); the live pages were not readable and may differ.
- How to swap
wpad-basic-*for a mesh build on a running 25.12 system withapk; the cheat sheet gives no recipe. - Which
batctlvariantkmod-batman-advinstalls by default on 25.12. - What happens on 25.12 if
option network_codingis left in the config. - Whether
psk2+ccmporsaeis the better choice for the mesh interface; the two wiki pages disagree and we tested neither. - The literal UK country code string on the OpenWrt wiki page, and the meaning of "fixed outdoor installation" in IR 2030.
- Any sourced IBSS configuration for OpenWrt 25.12, and how to set up the uplink behind a gateway node.
- Whether the BATMAN_V comment on the wiki (2018, batman-adv 2018.2) still reflects current behaviour.
- The release date of OpenWrt 25.12.6 on openwrt.org: that page was behind a bot wall, so the GitHub release timestamp is used.
Sources
- OpenWrt releases on GitHub (v25.12.6, published 2026-10-18)
- OpenWrt v25.12.0 release notes (opkg to apk)
- OpenWrt Firmware Selector
- OpenWrt Table of Hardware
- OpenWrt wiki: batman-adv mesh (archive copy of 2026-02-17; page last modified 2024/06/05)
- OpenWrt wiki: 802.11s mesh (archive copy of 2025-03-04; page last modified 2024/09/23)
- OpenWrt wiki: opkg to apk cheat sheet (archive copy of 2026-09-17; page last modified 2026/03/22)
- OpenWrt wiki: Wi-Fi basic configuration (archive copy of 2026-04-24; page last modified 2025/12/30)
- openwrt/routing, branch openwrt-25.12: batman-adv Makefile
- batctl manual page (html, v2026.3-2-ge01cdd8)
- batctl 2025.4 release tarball (CHANGELOG.rst, man/batctl.8)
- Linux wireless regulatory database release 2026.09.03 (db.txt)
- Ofcom IR 2030 v1.17 (published 23 October 2026)