In my previous post I outlined how to get wireless networking working on the Pi’s. While no amazing feat, it was an important test to see how well the drivers functioned for the wifi dongle. Now let’s take the next step and set up an ad-hoc, mesh network!
Setting up Wireless Networking (ad-hoc)
Setting up mesh networking on the Pi’s is fairly straight-forward. It helps if you do not have an ethernet connection and are just working to set up the wifi connection first on the target device.
1. Before you unplug the ethernet, install this package
# packer -S babeld . Note: If the Pi complains about system architecture, just change it in the PKGBUILD.
2. First we need to undo some of the previous steps used for a managed wireless connection. To make sure your wifi card doesn’t associate on boot, execute
# systemctl disable netcfg@PROFILENAME.service && reboot if you followed the previous tutorial.
3. Now your Pi should be up and running again and the wifi dongle should not be powered up. Power up the wifi dongle:
# ip link set wlan0 up .
4. Now let’s configure the network:
# iwconfig wlan0 mode ad-hoc channel 11 essid "mesh" .
5. Right now we need to manually assign each Pi a unique ip address:
# ip addr add 192.168.13.33 dev wlan0 . As you repeat these steps on each Pi, give the next one a different address, for example 192.168.13.34, and so forth.
6. And now we fire up babeld:
# babeld wlan0 & .
7. If everything goes well, you should be on your way to a mesh network. Execute the following steps on the remaining Pis. The routes will be updated automagically as nodes enter or exit the network. Use # route to display the other nodes.