Ubiquiti makes a line of highly integrated routers that are basically small, outdoor Linux machines with an 802.11a/n radio and a wired nic, some also come with a built in antenna, which makes setting up a long-distance outdoor network really easy and cheaply.
At NrVissing.Net which I do tech for we now have 25 Access points and 70 CPEs, all of them Ubiquiti NanoStation 5, NanoBridge 5M and other 5M gear. The APs are placed at 4 different physical locations and linked via 802.11n.
The Ubiquiti gear works really well, but there's no redundancy, which means that I'm only one breakdown away from having 70 angry, Internet deprived neighbors. Another problem is that maintaining the routing is quickly becoming harder as more bits of network appears. The solution, as you might have guessed is called OSPF.
OSPF allows routers to figure out which links exist in the network topology for them selves and set up several routes that allow the kernel to balance the traffic between several routes and take down routes that have failed.
For Linux there is a popular package called Quagga, which has already been ported to openwrt, which AirOS V is based on, so adding it to the AirOS SDK was easy enough.
Inveneo did much the same work for the older non-openwrt-based AirOS, so for the older AirOS versions I've been using a solution based on their work.
Some people swear by BIRD, so I thought I'd take a stab at using it on AirOS, some random thoughts in this regard:
I don't expect to be able to replace all the existing non-OSPF APs all at once, but I'd still like them to keep working if their default gateway goes down, for this I'm using CARP as implemented by the portable UCARP daemon to automatically switch the default gateway IP from one of the OSPF-enabled uplinks to another. Nobody has ported and published an openwrt port of ucarp before me, so for this bit I had to start from scratch, but since first doing this a port has appeared and I'm now using that.
What you get with my firmware mod are the following ingredients:
|Component||Version||What it is|
|AirOS||5.5 SDK||Exact version downloaded directly from ubnt.com|
|UCARP||1.5.2||Exact version downloaded directly from the openwrt svn server.|
|BIRD||1.3.7||Exact version downloaded directly from the openwrt svn server.|
|saveconfig||n/a||A small script that does: 'cfgmtd -w -p /etc/'.|
|Patches||2012-08-31||Patches to build and hook into the ubnt init.|
|2010-02-10||Configured Linux with multipath (aka. ECMP) support, without it routes would disappear if Quagga could see more than one route.|
|2010-02-14||Ported BIRD 1.2.1 and added saveconfig.|
|2010-02-21||Disabled the buggy and OOPSy CONFIG_IP_ROUTE_MULTIPATH_CACHED kernel option, multipath routing now works correctly.|
|2010-02-23||Updated to SDK 5.1.2 and added a README file, no other changes.|
|2012-08-31||Updated to SDK 5.5, removed Quagga, upgraded to newer versions of BIRD and UCARP, moved to github.|
Rather than do all the work and distribute the resulting image, I'm publishing a small perl script which will do all the downloading, patching and building needed to get the finished image in about half an hour on a reasonable 64bit ubunutu 12.04 machine. Distributing the modification this way allows anybody to modify the parts they need and as it's a fairly minimal set of diffs, it allows me to upgrade the solution to a newer version of AirOS much easier.
Once the firmware has been installed you need to configure at least BIRD, without it the daemon will not be started.
Create the config file called /etc/persistent/bird4.conf and run saveconfig, then reboot to have the BIRD daemon started.
If /etc/persistent/bird4.conf exists then init will be configured to keep bird running via /etc/inittab
No routes should be configured in AirOS, not even the default route, because those routes will not be distributed by OSPF and they will interfere, to get AirOS to stop creating any routes, set:
UCARP is configured by a simple shell script named /etc/persistent/ucarp.conf, there is an example version of this file located in SDK.UBNT.v5.5/openwrt/package/ucarp/files/ucarp.conf once the script has patched it into the SDK. This is the example file:
# Usage for AirOS: # 1) Edit this file and copy it to /etc/persistent/ucarp.conf # 2) Test: ucarp.init test # 3) When it works run: saveconfig # Run in background BACKGROUND=1 # Interface to run CARP on IF=eth0 # Virtual IP shared with the other system VIP=10.0.0.117 # Size of the network mask for the virtual IP VMASK=24 # Real, static IP of this host MYIP=192.168.1.20 # Password shared with the other system PASSWORD=love # IP addresses to arping after taking over the shared IP, # you should list all known systems, those not listed can # take up to a minute to notice the change. PINGIP="10.0.0.1 10.0.0.20" # Set this instance to be the preferred master or an explicit backup: # ROLE=master # ROLE=backup
If you set ROLE=master on one router and ROLE=backup on another, then the master will always own the shared IP if it's online.
I don't have a tip jar, but if you found something on this page useful then feel free to buy me a book from my Amazon wishlist.