I wrote this article a while ago about setting up BATMAN mesh networking with Rasbian Jesse on a Raspberry Pi 3.
This worked well, but stopped working with the newer versions of Rasbian, since there have been changes to the operating system.
After testing for several days, I found adding one command into the original script gets it to work just fine.
How to below.
After a fresh install of Rasbian Buster, connect to the system via ssh and run the following command to install BATMAN.
1 |
apt-get install vim batctl |
Lets create the mesh startup script.
1 |
vim /root/mesh.sh |
The script will contain the instructions for bring up the interfaces and get mesh, just change the IP address at the bottom on the next hosts, increment by one. Copy and past the following into the mesh.sh file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#!/bin/bash sudo modprobe batman-adv killall wpa_supplicant sudo ip link set wlan0 down sudo ifconfig wlan0 mtu 1500 sudo iwconfig wlan0 mode ad-hoc sudo iwconfig wlan0 essid my-mesh-network sudo iwconfig wlan0 ap any sudo iwconfig wlan0 channel 8 sleep 1s sudo ip link set wlan0 up sleep 1s sudo batctl if add wlan0 sleep 1s sudo ifconfig bat0 up sleep 5s sudo ifconfig bat0 172.27.0.1/16 |
Now let make the script executable.
1 |
chmod 700 mesh.sh |
And add to crontab so that its executed at every reboot
1 |
crontab -e |
Add the following
1 |
@reboot /root/mesh |
Reboot and mesh should be up and running.
Test by executing the following command.
1 |
batctl n |
Should see something like this.
1 2 3 4 5 |
root@raspberrypi:~# batctl tg [B.A.T.M.A.N. adv 2018.3, MainIF/MAC: wlan0/b8:27:eb:83:bb:b6 (bat0/32:aa:7d:80:d3:77 BATMAN_IV)] Client VID Flags Last ttvn Via ttvn (CRC ) * 96:6d:04:72:fd:1c -1 [....] ( 1) b8:27:eb:21:96:2e ( 1) (0x3fc26c43) root@raspberrypi:~# |