1 Title: A Raspberry Pi based batman-adv Mesh network node
2 Tags: english, nuug, freedombox, mesh network
5 <p>The last few days I have been experimenting with the batman-adv
6 mech technology. I want to gain some experience to see if it will fit
7 the Freedombox project, and try to build a mesh network around the
8 park where I live together with my neighbors. Batman-adv is a layer 2
9 mesh system ("ethernet" in other words), where the mesh network appear
10 as if all the mesh clients are connected to the same switch.</p>
12 <p>My hardware of choice were the Linksys WRT54GL routers I had lying
13 around, but I've been unable to get them working with batman-adv. So
14 instead, I started playing with a Raspberry Pi, and tried to get it
15 working as a mesh node. My idea is to use it to create a mesh node
16 which function as a switch port, where everything connected to the
17 Raspberry Pi ethernet plug is connected to the mesh network. This
18 allow me to hook a wifi base station like the Linksys WRT54GL to the
19 mesh by plugging it into a Raspberry Pi, and thus allow non-mesh
20 clients to hook up to the mesh. This in turn is useful for Android
21 phones using <ahref="http://servalproject.org/">the Serval Project</a>
22 voip client, allowing every one around the playground to phone and
23 message each other for free.</p>
25 <p>To get this working, I've created a debian package
26 <ahref="https://github.com/petterreinholdtsen/meshfx-node">meshfx-node</a>
28 <ahref="https://github.com/petterreinholdtsen/meshfx-node/blob/master/build-rpi-mesh-node">build-rpi-mesh-node</a>
29 to create the Raspberry Pi boot image. I'm using Debian Jessie (and
30 not Raspbian), to get more control over the packages available.
31 Unfortunately a huge binary blob need to be inserted into the boot
32 image to get it booting, but I'll ignore that for now.</p>
34 <p>To create an image, run the following with a sudo enabled user
35 after inserting the target SD card into the build machine:</p>
38 % wget -O build-rpi-mesh-node \
39 https://raw.github.com/petterreinholdtsen/meshfx-node/master/build-rpi-mesh-node
40 % sudo bash -x ./build-rpi-mesh-node > build.log 2>&1
41 % dd if=/root/rpi/rpi_basic_jessie_$(date +%Y%m%d).img of=/dev/mmcblk0 bs=1M
45 <p>Booting with the resulting SD card on a Raspberry PI with a USB
46 wifi card inserted should give you a mesh node. The default mesh
47 settings are the ones used by the Oslo mesh project at Hackeriet, as I
49 <ahref="http://people.skolelinux.org/pere/blog/Oslo_community_mesh_network___with_NUUG_and_Hackeriet_at_Hausmania.html">an
50 earlier blog post about this mesh testing</a>.</p>
52 <p>The mesh node was not horribly expensive either. I bought
53 everything over the counter in shops nearby. If I had ordered online
54 from the lowest bidder, the price should be significantly lower:</p>
58 <tr><th>Supplier</th><th>Model</th><th>NOK</th></tr>
59 <tr><td>Teknikkmagasinet</td><td>Raspberry Pi model B</td><td>349.90</td></tr>
60 <tr><td>Teknikkmagasinet</td><td>Raspberry Pi type B case</td><td>99.90</td></tr>
61 <tr><td>Lefdal</td><td>Jensen Air:Link 25150</td><td>295.-</td></tr>
62 <tr><td>Clas Ohlson</td><td>Kingston 16 GB SD card</td><td>199.-</td></tr>
63 <tr><td>Total cost</td><td></td><td>943.80</td></tr>
67 <p>Now my mesh network at home consist of one laptop in the basement
68 connected to my production network, one Raspberry Pi node on the 1th
69 floor that can be seen by my neighbor across the park, and one
70 play-node I use to develop the image building script. I look forward
71 to figuring out what kind of latency the batman-adv setup will give,
72 and how much packet loss we will experience around the park. :)</p>