Hack 68. Set Up an OLSR Mesh Network
Always wondered about mesh networking, but afraid to try? The lads at Freifunk have made it easy for all of us.
The Freifunk Firmware (FFF) is a friendly repackaging of the OpenWRT embedded Linux [Hack #67] for the Linksys WRT54G and some other wireless routers. It offers a nice web admin interface that is easily customizable with your own templates and opens SSH, not Telnet, by default.
Most interestingly, the FFF allows you to easily enable Freifunk's implementation of OLSR mesh networking. If your node can get a signal from another OLSR node, appropriately configured, they will agree to carry traffic for each other and for other nodes on the mesh. If one node has a connection to the Internet, Net traffic will go through it transparently. This makes it easy to purchase a lot of bandwidth collectively, and then distribute it throughout a wide cloud of meshed nodes.
5.7.1. Getting the Firmware
To download the Freifunk Firmware, visit http://ff-firmware.sourceforge.net, or go straight to Sven-Ola's (the maintainer) package directory: http://styx.commando.de/sven-ola/ipkg.
You want the file labeled g/openwrt-freifunk-language-version number.bin, with your language of choice (en, de, etc.) and the latest version number. If your WRT is a 54GS or GS, look for the appropriate directory.
|
5.7.2. Uploading the Firmware
See "Upgrade Your Wireless Router" [Hack #67] for information on how to flash a WRT with a new firmware. If you have an untouched Linksys WRT unit, it has a web admin interface to which you can upload the .bin file; otherwise, you might have to upload it using TFTP.
Once you've flashed the WRT with the new firmware and rebooted, you should see an admin interface that looks something like Figure 5-3.
5.7.3. Getting Meshed Up
Clicking the Admin link leads you to a set of interesting configuration options. The Freifunk Firmware almost comes ready to mesh out of the box.
Figure 5-3. Freifunk Firmware web admin GUI
You must make sure to assign a different, non-conflicting IP address to each of the routers that you're going to mesh. By default, each new Linksys WRT comes configured as 192.168.1.1. Many people prefer to allocate a chunk of the 10.*.*.* space instead. It should be noted that both of these IP address ranges follow the Internet RFC 1918, which defines private IP addresses that are not routable on the Internet.
In the Admin
The Admin
Figure 5-4. Configuring the Admin
The Freifunk Firmware will mesh via OLSR out of the box, once you've configured your OLSR settings as described previously. The Admin
5.7.4. Rinse and Repeat
Now, take a second WRT. It's best to unplug the first one, in case you accidentally associate with it, or talk to it through an Ethernet cable instead. Go through the same process.
In the Admin
Finally, reboot the WRT. Repeat this process on as many nodes as you want to add to your mesh.
5.7.5. Meshing Made Easy
Once you've configured all your mesh nodes, turn the whole lot off then on again. Using the Status interface in the web admin GUI, you can watch the nodes discover each other and create routes back towards the Internet.
Figure 5-5 shows the Status/Routes display on a mesh node. As you can see, the Internet gateway is 10.1.50.1, which is the wireless interface on the second router.
Figure 5-5. Node with Internet gateway showing OLSR routes
Adding new nodes to the mesh and watching them discover each other is lovely to see!
5.7.6. Troubleshooting the Firmware Upload
If your WRT is in a state where it won't appear to boot properly, it might give you some indications of trouble. For example, it might be hanging while the DMZ light shines constantly. Try putting the firmware into failsafe mode; power on the router, and then, just as the DMZ light starts to flash, hold down the Reset button on the back of the WRT with a small implement, such as a pen tip, for a few seconds.
This should cause the WRT to boot into failsafe mode, which should enable you to upload new firmware and connect to the device via Telnet. You should also be able to flash a new firmware to the device, using an Ethernet cable, your laptop, and a TFTP client such as atftp. When the WRT boots up, it waits for a three-second window in which it can expect to have a new firmware flashed onto it.
Here's a sample conversation between atftp and a WRT:
jo@frot:~$ atftp tftp> connect 192.168.1.1 tftp> mode octet tftp> timeout 1 tftp> trace tftp> put openwrt-g-freifunk-1.0.2-en.bin … [ lots of activity ensues ]
It might be that you have installed an OpenWRT-based firmware without an admin GUI and it boots immediately, without waiting for three seconds while the DMZ light flashes. The NVRAM, the writeable permanent memory of the WRT, needs to be told to boot_wait for a new firmware image via TFTP:
frot:/home/jo# telnet 192.168.1.1 [login screen exchanged; type in admin username and password.] @OpenWrt:/# nvram set boot_wait=on @OpenWrt:/# nvram commit
Next time you reboot, you should see the WRT waiting for a few seconds before the DMZ light starts to flash.
5.7.7. See Also
- freifunk.net (http://www.freifunk.net; in German)
- OpenWRT (http://www.openwrt.org)
- What A Mesh (http://www.whatamesh.net)
Jo Walsh