Next Previous Contents

## 2. About routing tables

BIRD has one or more routing tables which may or may not be synchronized with OS kernel and which may or may not be synchronized with each other (see the Pipe protocol). Each routing table contains a list of known routes. Each route consists of:

- network prefix this route is for (network address and prefix length -- the number of bits forming the network part of the address; also known as a netmask)
- preference of this route
- IP address of router which told us about this route
- IP address of router we should forward the packets to using this route
- other attributes common to all routes
- dynamic attributes defined by protocols which may or may not be present (typically protocol metrics)

Routing table maintains multiple entries for a network, but at most one entry for one network and one protocol. The entry with the highest preference is used for routing (we will call such an entry the selected route). If there are more entries with the same preference and they are from the same protocol, the protocol decides (typically according to metrics). If they aren't, an internal ordering is used to break the tie. You can get the list of route attributes in the Route attributes section.

Each protocol is connected to a routing table through two filters which can accept, reject and modify the routes. An export filter checks routes passed from the routing table to the protocol, an import filter checks routes in the opposite direction. When the routing table gets a route from a protocol, it recalculates the selected route and broadcasts it to all protocols connected to the table. The protocols typically send the update to other routers in the network. Note that although most protocols are interested in receiving just selected routes, some protocols (e.g. the `Pipe` protocol) receive and process all entries in routing tables (accepted by filters).

Usually, a routing table just chooses a selected route from a list of entries for one network. But if the `sorted` option is activated, these lists of entries are kept completely sorted (according to preference or some protocol-dependent metric). This is needed for some features of some protocols (e.g. `secondary` option of BGP protocol, which allows to accept not just a selected route, but the first route (in the sorted list) that is accepted by filters), but it is incompatible with some other features (e.g. `deterministic med` option of BGP protocol, which activates a way of choosing selected route that cannot be described using comparison and ordering). Minor advantage is that routes are shown sorted in `show route`, minor disadvantage is that it is slightly more computationally expensive.

## 2.1 Graceful restart

When BIRD is started after restart or crash, it repopulates routing tables in an uncoordinated manner, like after clean start. This may be impractical in some cases, because if the forwarding plane (i.e. kernel routing tables) remains intact, then its synchronization with BIRD would temporarily disrupt packet forwarding until protocols converge. Graceful restart is a mechanism that could help with this issue. Generally, it works by starting protocols and letting them repopulate routing tables while deferring route propagation until protocols acknowledge their convergence. Note that graceful restart behavior have to be configured for all relevant protocols and requires protocol-specific support (currently implemented for Kernel and BGP protocols), it is activated for particular boot by option `-R`.

Next Previous Contents