Babel is a routing protocol. It allows everyone to "announce" their routes (your local network prefix), or it can simply relay routing information to the other nodes. It works well on a wireless mesh network as well as on a wired network.
In the simplest configuration, your babel node might simply "relay" information and very little configuration is required. With IPv6, every device has a link-local address, and this is sufficient to route. If you also want to route IPv4 (ex: to share your Internet access to the general public), you will have to assign an IPv4 address to your device.
If you want to expose your local network to the mesh, you will probably want your devices to only relay routing information, and install babel on your main router. This way, all computers connected to that router will be able to access the mesh. We will talk more about routing later.
Installation
OpenWRT
Babel is included and configured automatically by default in our Réseau libre firmware. The following installation instructions are generic instructions. For example, it may be of interest if you have installed OpenWRT manually. Your installation must also have the correct ad-hoc wireless configuration to link with other devices.
Install babel and the ipv6 kernel module:
opkg install babeld kmod-ipv6
If you do not have network access, download the babel, kmod-ipv6 and librt packages from the
packages/
directory at the same location where you got the images for flashing. Then you can copy the packages on the router with the following ssh command:scp libpthread*.ipk kmod-ipv6*.ipk babeld*.ipk librt*.ipk root@192.168.1.1: ssh root@192.168.1.1 "opkg install *.ipkg"
To make sure that babel starts on boot on the wireless interface:
/etc/init.d/babeld enable
uci delete babeld.wan.ignore
Configure the wireless interface with an IP and a proper /32
netmask (255.255.255.255
), see the
ip configuration page for more information.
uci set network.wan=interface
uci set network.wan.ifname=wlan0
uci set network.wan.proto=static
uci set network.wan.ipaddr=172.16.0.123
uci set network.wan.netmask=255.255.255.255
Do not forget to save your changes!
uci commit
reboot & exit
To announce routes on the wired intefaces too:
uci delete babeld.lan.ignore
The following UCI config can be imported using uci import
and will record the above configuration:
package babeld
config general
option local_server '33123'
config filter
option ignore 'true'
config interface 'wan'
config interface 'lan'
Note that we do not configure routing rules through UCI (hence the ignore
setting on the config filter
section), but instead
rely on the /etc/babeld.conf
file, see below for config samples.
If you have a Nanostation M2 you can check this config sample.
Firewall configuration
It is important to configure your firewall properly to let the Babel packets go through otherwise you will end up with problems like:
Neighbour fe80::de9f:dbff:fe06:d5be dev wlan0 reach ff2f rxcost 257 txcost 65535 chan 1.
and unreachable
routes. The solution is to add an entry in the
marvelous uci firewall:
config rule
option name Allow-Babel
option src wan
option dest_port 6696
option proto udp
option target ACCEPT
... this needs to be added to your /etc/config/firewall
file and
then the firewall can be restarted with:
/etc/init.d/firewall restart
While you are there, you might as well allow SSH access from the mesh for maintenance:
config rule option name Allow-SSH-wan option src wan option dest_port 22 option proto tcp option target ACCEPT
Simplest babeld.conf
If you followed all the other steps to get here and have a local LAN still configured on your ethernet interface, you at the very least want this one rule to avoid leaking those routes to the mesh:
redistribute local ip 192.168.1.0/24 deny
This can be added to /etc/babeld.conf
.
Debian
- install package:
apt-get install babeld
- stop network manager
setup ad-hoc and babeld
ifconfig wlan0 down iwconfig wlan0 mode ad-hoc essid reseaulibre.ca ap 02:CA:FF:EE:BA:BE channel 1 ifconfig wlan0 up 172.16.0.43/32 babeld -D wlan0
See numbering to choose the proper IP above, but note the netmask (255.255.255.255
or /32
) that needs to be defined for babel to work.
Network Manager
If you are currently using Network Manager on an IPv6 network, there seems to be a bug which makes Babel publish all routing cache entries. This shows up as huge routing tables full of static routes that may look a bit like this:
2001:6f8:1055:deb::80 via fe80::94d6:9eff:fecc:2494 dev bat0 proto 42 metric 1024
2607:f8b0:4007:801::100f via fe80::94d6:9eff:fecc:2494 dev bat0 proto 42 metric 1024
2607:f8b0:400b:800::1017 via fe80::94d6:9eff:fecc:2494 dev bat0 proto 42 metric 1024
2607:f8b0:400b:801::1000 via fe80::94d6:9eff:fecc:2494 dev bat0 proto 42 metric 1024
2607:f8b0:400b:801::1001 via fe80::94d6:9eff:fecc:2494 dev bat0 proto 42 metric 1024
2607:f8b0:400b:801::1002 via fe80::94d6:9eff:fecc:2494 dev bat0 proto 42 metric 1024
...
The possible workaround is to open the Network settings, select the IPv6 parameters page of your connection, click the Routes button and check "Ignore automatically obtained routes".
This bug is described at https://bugzilla.gnome.org/show_bug.cgi?id=682616
FreeBSD
The FreeBSD port needs to be updated, as it is running an old version of the software (1.2, 1.3.3 is current as of this writing).
Updating the port is pretty trivial. And I have submitted it in the "GNATS" bug tracking system.
There are no startup scripts so you need to do that on your own. Also,
contrary to usual BSD practices, the port's configuration file is in
/etc/babeld.conf
(instead of /usr/local/etc
).
Optional
ahcpd -D wlan0
can be used to distribute IPs over the network (without announcing a gateway).
Configuration
Regardless of the install method or platform, you need a
babeld.conf
. This will decide which routes you will announce and
accept and so on, so it is rather important.
Basic open configuration
For testing (and for open relays), this is the simplest babeld.conf
configuration that will allow everything:
redistribute metric 128
This will redistribute all your routes with a non-zero metric so they do not override your default configuration.
It is useful to remember this, as it can also be passed on the commandline directly, as such:
babeld -d1 -C 'redistribute metric 128' wlan0
Another common configuration is to refuse the default route, which is:
in ip 0.0.0.0/32 le 0 deny
This is especially important on routers that do have network access, as babel will happily override existing routes in certain configurations. See the babeld manpage for more information on those rules.
Whitelisting netblocks
Instead of blocking stuff we don't want, it can be easier to just allow the stuff we want:
redistribute local ip 172.16.0.0/12
redistribute local deny
Blocking some announcements
The above will announce all routes, which is really not desirable sometimes, as it may leak your private LAN. To block such addresses, try:
redistribute ip 192.168.1.0/24 deny
redistribute local ip 192.168.1.0/24 deny
Complex router
Here's my configuration for ?roadkiller:
# mesh IPv6 redistribute local ip fd64:2c08:9fa7:1::1/128 metric 128 redistribute local ip fd64:2c08:9fa7::1/128 metric 128 redistribute ip fd64:2c08:9fa7::/48 metric 128 # mesh IPv4 redistribute local ip 172.16.0.1/32 metric 128 redistribute ip 172.16.0.0/12 ge 13 metric 128 # public IPv6 redistribute local ip 2001:1928:1:9::/128 metric 128 redistribute ip 2001:1928:1:9::/64 metric 128 # public IPv4 redistribute local ip 72.0.72.144/32 metric 128 # default route redistribute ip 0.0.0.0/0 le 0 metric 128 # IPv6 default route redistribute ip ::/4 metric 128 # refuse anything else not explicitely allowed redistribute local deny redistribute deny
Other sample configurations
We are working with upstream to have a good default configuration
provided with the package, see
this discussion
and the babeld.conf.sample
file in anarcat's repository:
git://src.anarcat.ath.cx/babeld
See also OpenWRT's sample config.
Advantages of Babel over BATMAN
- no kernel module necessary, which means:
- no need to chase the OpenWRT trunk, and:
- multi-platform support (e.g. FreeBSD)
- uses real routing tables (easier to debug)
- tcpdump parses babel packets properly
- No need to change the MTU of some network interface to 1528, which means:
- Network interfaces can be edited with the web interface luci (mtu field does not accept values > 1500), which means:
- People afraid of command line and ssh could now configure their device
- most importantly: allows for an heterogeneous network with different protocols, as long as they talk IP and their routes are annonced through babeld
Babel is also supported by commotionwireless.
Troubleshooting
Babel should generally "just work". You start it, and it starts exchanging routes with its neighbors through IPv6 broadcast packets.
- During your tests, give some time for Babel to synchronise. Things can take a few seconds (count to 10) to synchronise.
- Vérifiez vous que le nom de l'interface suivant la section config interface est soit le nom du réseau configuré dans openwrt (ex: wan), ou bien le nom de l'interface réseau tel qu'affiché par ifconfig.
Running babel manually
Configure the wireless interface with a test IP (follow the ip configuration to make those settings peristent, but make sure to use 255.255.255.255
as a netmask):
ifconfig wlan0 up 172.16.0.43 netmask 255.255.255.255
To start babel on the console for testing:
babeld -d1 wlan0
Note how you specify the interface names directly on the command line. The output should already show you neighbors, if there are any.
Seeing the babel routes
Basic operation of Babel involves talking with the regular kernel routing table. If Babel sees a neighbor, it will add a route like this to the routing tables:
# ip -6 route
2001:470:b2a7:1::/64 via fe80::de9f:dbff:fe00:11d9 dev wlan0-1 proto 42 metric 1024
This basically means: "I see neighbor 2001:470:b2a7:1::/64 and it's on the interface wlan0".
Getting more information from babel
From the FAQ:
You can ask Babel to dump its internal tables. With the standalone daemon, send a USR1 signal to the daemon to get it to dump its tables to the log file. You can also use:
/etc/init.d/babeld status
The output showing the neighbours and possible routes will be in /var/log/babeld.log.
With the quagga version, type
show babel interface
show babel neighbour
show babel route
You can also start babeld
with -g 33123
to enable monitoring on 33123
, for example with:
telnet ::1 33123
To print the current status only (instead of sending the USR1 kill signal to the process):
nc :: 33123 | awk '{ if (/add/ || /BABEL/) { print } else { exit } }'
Tcpdump groks Babel starting with version 4.2.1. Wireshark has support since version 1.6.0.
Custom tools
babelstatus will give you a more readable output of the routes exported by babel, and routes received from neighbours.
sonar will give you the details on connection quality with shiny colours.
Monitoring
We have not yet adopted a particular monitoring method, we are still experimenting.
The best option is probably to install babelweb.
Another option is to commit your babelstatus output in the wiki using a cron, from another machine that has ssh access to your babel node. When your routes change (i.e. a new route is added, or a node is up/down), the cron will commit the change and it will be announced automatically on IRC by the bot that tracks wiki changes.
For example:
Install babelstatus (and other useful tools):
echo "src reseaulibre http://packages.reseaulibre.ca:8080/Routeurs/reseaulibre-openwrt/aa_beta/ar71xx/packages/" >> /etc/opkg.conf
opkg update
opkg install reseaulibre-mesh
(if you are using something else than ar71xx (Ubiquity Bullet/Nanostation), those packages contain only shell scripts at the moment.)
Clone the git repository of the wiki (may take some time) on a system that has git and can have ssh access to the nodes:
git clone git://wiki.reseaulibre.ca/
Create (if necessary) a public key with no passphrase on the system that has a copy of the git repository:
ssh-keygen
Copy the public key onto the node(s) that you want to monitor (assuming you do not already have keys in the file, otherwise add the key manually to the authorized_keys file, one key per line):
scp ~/.ssh/id_rsa.pub root@node.example.org:/etc/dropbear/authorized_keys
Create a page for your node. You probably want to do this using the wiki on the web, using the template on nodes.
Test babelstatus and commit to git for the first time:
cd wiki.reseaulibre.ca
git pull
mkdir nodes/YOUR-NODE
ssh root@node.example.org babelstatus.sh > nodes/YOUR-NODE/babelstatus
git add nodes/YOUR-NODE/babelstatus
git commit -m "initial commit"
git push
Automate the process using babelwatch.sh :
mkdir ~/bin
cd ~/bin
wget http://redmine.bidon.ca/projects/reseaulibre-scripts/repository/revisions/master/raw/babelwatch.sh
chmod 0755 babelwatch.sh
Create a config file in ~/.babelwatch. For example:
# where the wiki git repo is located
wiki /home/myuser/wiki.reseaulibre.ca
# [node name in wiki] [IP or hostname] [login]
node-a node-a.relais.example.net root
node-b node-b.relais.example.net root
Configure a cron entry such as:
30 */2 * * * babelwatch.sh
Note that the cron is run every two hours to avoid causing a high load on the git server if everyone starts doing the same thing. Choose a random minute (30), to avoid doing your commit at the same time as another node.