A comprehensive setup script for configuring Batman-adv mesh networking on Raspberry Pi OS, with support for both WiFi and Ethernet interfaces.
- Easy installation of Batman-adv and required dependencies
- Support for both WiFi and Ethernet interfaces
- Automatic gateway selection and load balancing
- Configurable mesh network settings
- Built-in diagnostic tools
- Visualization support with Alfred and batadv-vis
- Backup and restore functionality
- Uninstall option
- Raspberry Pi running Raspberry Pi OS (Bookworm recommended)
- Root access
- Internet connection for initial setup
- WiFi adapter (if using WiFi mesh)
You can run the script directly from GitHub using one of these methods:
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/kimasplund/raspberry_os_batman_bridge/main/enable_batman.sh)"sudo bash -c "$(wget -O- https://raw.githubusercontent.com/kimasplund/raspberry_os_batman_bridge/main/enable_batman.sh)"- Clone the repository:
git clone https://github.com/kimasplund/raspberry_os_batman_bridge.git
cd raspberry_os_batman_bridge- Make the script executable:
chmod +x enable_batman.sh- Run the script as root:
sudo ./enable_batman.shThe script supports the following command-line options:
-h, --help Display help message
-s, --static-ip Configure with static IP instead of DHCP
-w, --wifi-iface NAME Specify WiFi interface name (default: wlan0)
-e, --eth-iface NAME Specify Ethernet interface name (default: eth0)
-v, --visualization Install and configure Alfred visualization tools
-u, --uninstall Remove Batman-adv configuration and restore backupsDuring installation, you'll be prompted to configure:
-
WiFi Settings:
- SSID
- Password
- Country code
-
Batman-adv Settings:
- Mesh network name
- WiFi channel (auto/manual)
- Bandwidth settings
- Routing algorithm (BATMAN_V/BATMAN_IV)
- Gateway mode (server/client/off)
After installation, a diagnostic tool is available at /usr/local/bin/batman-diagnose.sh. Run it with:
sudo batman-diagnose.shThe diagnostic tool provides options to:
- Check internet connectivity
- Monitor gateway selection and status
- View mesh topology and routing
- Check link quality between nodes
- Monitor throughput settings
- Verify system status
After installation, you can use these commands to monitor your mesh network:
# Check interface status
batctl meshif bat0 interface
# Check mesh neighbors
batctl meshif bat0 originators
# Check gateway status
batctl meshif bat0 gateways
# Check routing table
batctl meshif bat0 translocal
# Check interface details
ip link show bat0
# Check gateway selection
batctl meshif bat0 gateways -r
# Check link quality
batctl meshif bat0 interface <iface>The script supports three gateway modes:
- server - This node can act as a gateway (Use if this Pi has internet access)
- client - This node will use other nodes as gateways (Use for most nodes)
- off - This node won't participate in gateway selection (Use for specialized nodes)
Batman-adv automatically selects the best gateway based on:
- Link quality
- Available bandwidth
- Network latency
- Number of hops
Multiple nodes can be set as 'server' - Batman-adv will choose the optimal gateway for each connection.
To remove Batman-adv and restore your original network configuration:
sudo ./enable_batman.sh --uninstall- Kim Asplund
- Website: https://asplund.kim
- GitHub: https://github.com/kimasplund
- Email: kim.asplund@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details.