Skip to main content
This section explains how to configure the wireless mesh network directly from the terminal. The commands are based on the configuration used during the verified T3 Gemstone O1 mesh test. Each configuration step is explained directly so that the mesh network can be reproduced using only the commands in this guide. Repeat the configuration on every node. This guide uses wlan0 on the tested T3 Gemstone O1 boards. On another system, replace the IFACE value with the appropriate IBSS-capable wireless interface name. Each node must use:
  • A suitable wireless interface that supports IBSS
  • The same SSID
  • The same frequency
  • The same BSSID
  • The same BATMAN-adv routing algorithm
  • A unique node number
The examples in this guide use node numbers 1, 2, and 3, but the mesh is not limited to three nodes.

1. Requirements

The tested T3 Gemstone O1 image already includes the batman-adv kernel module. Install the required userspace tools:
Check that the wireless device supports IBSS mode:
Under Supported interface modes, verify that IBSS is listed. You can also check that the BATMAN-adv kernel module is available:

2. Select a Node Number

Each board needs a unique node number. The node number is used to derive:
  • The direct IBSS address: 192.168.100.N/24
  • The mesh address: 192.168.200.N/24
  • A unique locally administered bat0 MAC address
On each board, set NODE to a different value. For Node 1:
For Node 2:
For Node 3:
The tested configuration accepts node numbers from 1 to 250. The rest of the commands use the $NODE variable, so the same procedure can be repeated on every board.

3. Configure IBSS

First define the shared wireless parameters:
All nodes must use exactly the same SSID, FREQ, and BSSID.

Disable automatic Wi-Fi management

The normal Wi-Fi management services may change the interface back to managed mode while IBSS is being configured. Stop and mask both possible Wi-Fi backends:
Disconnect wlan0 from NetworkManager and mark it as unmanaged:
Note: NetworkManager itself is not stopped. This avoids interrupting other interfaces such as usb0, which may be used for SSH access.

Switch wlan0 to IBSS mode

Bring the interface down:
Change the wireless interface type to IBSS:
Bring the interface back up:
Allow the interface state to settle:
Verify that the interface remained in IBSS mode. The output should contain type IBSS:
If the interface changes back to managed mode, inspect the wireless management services:

Join the IBSS cell

Join the shared gemstone-mesh cell:
Every node must join the same IBSS cell.

Configure MTU

The tested setup attempts to use an MTU of 1532 on wlan0 so that BATMAN-adv can expose a 1500 byte MTU on bat0. Run:
Remove any existing address from wlan0:
Assign the node-specific IBSS address:
Allow peer discovery to begin:

4. Verify IBSS

Inspect the interface:
Inspect the current IBSS connection:
Inspect detected peer stations:
Inspect the current regulatory domain:
A successful configuration should show:
  • wlan0 in IBSS mode
  • Membership in the gemstone-mesh cell
  • The configured frequency
  • Peer stations after neighboring nodes join the same cell
  • A node-specific 192.168.100.N/24 address
Check the address with:
At this point, IBSS provides direct wireless connectivity between nodes that can reach each other over the radio link.

5. Configure BATMAN-adv

Configure BATMAN-adv only after IBSS is active. Define the mesh interface and routing algorithm:
Generate a unique locally administered MAC address from the node number:
Generate the node-specific mesh IP address:
You can inspect the generated values with:

Check the IBSS prerequisite

Confirm that wlan0 is still in IBSS mode:
Confirm that the interface joined an IBSS cell:
Do not continue until the interface is in IBSS mode and the output shows that it has joined the expected cell.

Remove an existing BATMAN-adv configuration

If bat0 already exists from an earlier configuration, remove the previous interface association before rebuilding the mesh. Check whether the interface exists:
If it exists, run:
If bat0 does not exist, continue to the next step.

Load BATMAN-adv

Load the kernel module:
Allow the module to initialize:

Select BATMAN_V

Select the routing algorithm before adding the wireless interface:
Check the selected algorithm:
All nodes must use the same routing algorithm.

Add wlan0 to BATMAN-adv

Add the IBSS interface to the BATMAN-adv mesh:
BATMAN-adv creates the virtual bat0 interface after the physical interface is added to the mesh.

Configure the bat0 MAC address

Bring bat0 down before changing its MAC address:
Assign the node-specific MAC address:
Using a unique bat0 MAC address on each board is important when multiple boards originate from the same system image.

Configure the mesh IP address

Remove any existing address from bat0:
Bring bat0 up:
Assign the node-specific mesh address:
Verify the configured MAC address:
It should match the value generated in $BAT_MAC.

6. Wait for Mesh Discovery

BATMAN-adv needs time to exchange mesh information with neighboring nodes. Wait for discovery:
Then inspect the interface association:
Inspect bat0:
Check its MTU:
The tested configuration expects bat0 to use an MTU of 1500.

7. Check the Mesh

Display direct BATMAN-adv neighbors:
Display known originators and selected next hops:
Check the BATMAN-adv kernel module version:
Check the batctl version:
If sudo batctl n does not show any neighbors, verify that:
  • Other nodes completed the IBSS configuration
  • Other nodes completed the BATMAN-adv configuration
  • Every node uses BATMAN_V
  • Every node uses the same IBSS SSID, frequency, and BSSID
  • iw dev wlan0 station dump shows the expected IBSS peers

8. Test Mesh Connectivity

Applications should use the bat0 addresses for mesh communication. For example, from Node 1 to Node 2:
From Node 1 to Node 3:
For additional nodes, use the address derived from their node number in the 192.168.200.N form. A successful ping confirms end-to-end connectivity, but it does not by itself prove that the path is multi-hop. The verification section explains how to inspect the neighbor and originator tables and how the three-node test was used to verify an intermediate forwarding path.

9. Cleanup

When the mesh is no longer needed, remove the BATMAN-adv layer first and then return wlan0 to normal managed Wi-Fi mode.

Remove BATMAN-adv

Define the interfaces if they are not already present in the current shell:
Remove the IP address from bat0:
Bring bat0 down:
Remove wlan0 from BATMAN-adv:
Unload the BATMAN-adv kernel module:
Check that the module and interface were removed:

Restore managed Wi-Fi mode

Remove the IBSS IP address:
Bring wlan0 down:
Return the interface to managed mode:
Restore the default MTU:
Unmask the normal Wi-Fi services:
The tested T3 Gemstone O1 image uses iwd as the managed Wi-Fi backend. Start that backend:
If the active backend before the mesh setup was wpa_supplicant, start it instead of iwd:
Return wlan0 to NetworkManager management:
Bring the interface up:
The board can now return to its normal managed Wi-Fi configuration.