Routing Protocols

In a network, a major task is to maintain routing information, so that packets from one node can find their way to other nodes (perhaps gateways to other networks). These routes could be maintained by hand -- adding and removing entries to the kernel routing table -- but this would be an impossibly large amount of work for a human, especially in a wireless mesh network, where changing interference and environmental factors will cause the quality of links to change constantly. The routes should adapt quickly to changes in the environment.

Therefore, routing protocols have been developed that will add and remove routes automatically, in response to the changing environment.

Intra-network routing

There is a staggering array of intra-network routing protocols available for wireless mesh networks. The ostensible purpose of the Battle Mesh was to compare the effectiveness of each of these protocols.

The purpose of an intra-network routing protocol is so that the nodes of the network can communicate their views of the world to one another and determine the best path from any source to any destination, in the network.

For wired networks, you might choose to use one of the older routing protocols, such as OSPF, ISIS, or RIP. These protocols are not optimal for wireless networks, however. This is because they attempt to find the shortest path, but do not take into account characteristics of wireless networks, such as the reliability of a link, or the throughput.

Therefore, a new generation of routing protocols has been developed, with wireless in mind. OSLR, Babel, Batman, and several Batman variants -- BMX, a one-person fork of Batman, and Batman-adv, a Layer 2 routing protocol implemented as a kernel module that was recently accepted into the Linux mainline.

Using multiple protocols

The good news is that you may not have to choose just one routing protocol. You can, for example, assign each node two addresses, each with a different IP prefix, and then have one routing protocol for each of the prefixes. This will help in case you are having problems with one routing protocol (perhaps they have created a routing loop or a black hole). The other protocol might have found a way to nodes that are not available over another routing protocol.

However, running more routing protocols will cause more traffic to be generated on the network, in order to keep the tables synchronized. Also, running more routing protocols will cause more CPU load, to compute the latest routing tables. For these reasons, you might want to watch how many protocols you use.

Also note that Batman-adv cannot be used in conjunction with other protocols, because it is operating on Layer 2 rather than Layer 3, like the other protocols. Therefore, you can't use the trick of routing different prefixes. Batman-adv uses MAC addresses.

If you are running multiple protocols, though, you must eventually choose what prefix to send out to clients on DHCP. This will determine which protocol's routes the client will use when traversing your network. However, if users want, users can manually set their IP address to one managed by another protocol, and be routed over that protocol's routes.

But this method is mostly useful for experimentation and debugging.

Inter-network routing

So far, I have discussed the routing of traffic inside the network. However, when you want to access resources that are not on your network, you need to route your packets to another network. This is what "internet" means.

BGP

On the Internet, each network is assigned an Autonomous System Number (ASN). An Autonomous System (AS) is a network that runs intra-network routing protocols and does not share this information with neighboring networks. In order for two networks to communicate, you will need an ASN from your regional authority, such as RIPE or ARIN. These cost $1300 per year.

To speak with neighboring networks, routers at the edge of each network speak BGP with each other -- the Border Gateway Protocol. An AS compiles lists of prefixes that it knows how to reach and exchanges these lists with other ASes at the edge routers.

Non-BGP

However, a small network may not be able to convince other ISPs to speak BGP with them, and may not be able to afford an ASN. The problem is that, in order for traffic to get routed back to your network, the remote server must be able to find you. If you are not speaking BGP, then you will not be able to advertise prefixes that are available on your network, so nobody will know how to route to you.

However, it so happens that we have another tool at our disposal, due to the way broadband is currently sold: NAT. Most people have one IP address for their house, and communicate to the outside only with NAT. Return communication from the remote server is routed to the house's IP address, where the house's router has stored the association of the outgoing port with the internal address of the machine. Thus, packets from the outside can find their way to machines inside the house. This only works, however, for connections that are initiated from inside the house. The world outside cannot find particular machines that are hidden behind NAT, and are using private, unrouteable IP addresses.

To use this method, you must take care when configuring any "gateway" routers -- that is, routers on your network that also have connections to the internet. You must configure your internal routing protocols so that they the gateway routers advertise a route of 0.0.0.0/0, with the next hop being the gateway provided by the ISP.

IPv6