]> git.ipfire.org Git - thirdparty/bird.git/blob - doc/bird.sgml
c69ab87fddd788e68555b0cb7457b47822f93206
[thirdparty/bird.git] / doc / bird.sgml
1 <!doctype birddoc system>
2
3 <!--
4 BIRD 2.0 documentation
5
6 This documentation can have 4 forms: sgml (this is master copy), html, ASCII
7 text and dvi/postscript (generated from sgml using sgmltools). You should always
8 edit master copy.
9
10 This is a slightly modified linuxdoc dtd. Anything in <descrip> tags is
11 considered definition of configuration primitives, <cf> is fragment of
12 configuration within normal text, <m> is "meta" information within fragment of
13 configuration - something in config which is not keyword.
14
15 (set-fill-column 80)
16
17 Copyright 1999,2000 Pavel Machek <pavel@ucw.cz>, distribute under GPL version 2 or later.
18
19 -->
20
21 <book>
22
23 <title>BIRD 2.0 User's Guide
24 <author>
25 Ondrej Filip <it/&lt;feela@network.cz&gt;/,
26 Pavel Machek <it/&lt;pavel@ucw.cz&gt;/,
27 Martin Mares <it/&lt;mj@ucw.cz&gt;/,
28 Maria Matejka <it/&lt;mq@jmq.cz&gt;/,
29 Ondrej Zajicek <it/&lt;santiago@crfreenet.org&gt;/
30 </author>
31
32 <abstract>
33 This document contains user documentation for the BIRD Internet Routing Daemon project.
34 </abstract>
35
36 <!-- Table of contents -->
37 <toc>
38
39 <!-- Begin the document -->
40
41
42 <chapt>Introduction
43 <label id="intro">
44
45 <sect>What is BIRD
46 <label id="what-is-bird">
47
48 <p>The name `BIRD' is actually an acronym standing for `BIRD Internet Routing
49 Daemon'. Let's take a closer look at the meaning of the name:
50
51 <p><em/BIRD/: Well, we think we have already explained that. It's an acronym
52 standing for `BIRD Internet Routing Daemon', you remember, don't you? :-)
53
54 <p><em/Internet Routing/: It's a program (well, a daemon, as you are going to
55 discover in a moment) which works as a dynamic router in an Internet type
56 network (that is, in a network running either the IPv4 or the IPv6 protocol).
57 Routers are devices which forward packets between interconnected networks in
58 order to allow hosts not connected directly to the same local area network to
59 communicate with each other. They also communicate with the other routers in the
60 Internet to discover the topology of the network which allows them to find
61 optimal (in terms of some metric) rules for forwarding of packets (which are
62 called routing tables) and to adapt themselves to the changing conditions such
63 as outages of network links, building of new connections and so on. Most of
64 these routers are costly dedicated devices running obscure firmware which is
65 hard to configure and not open to any changes (on the other hand, their special
66 hardware design allows them to keep up with lots of high-speed network
67 interfaces, better than general-purpose computer does). Fortunately, most
68 operating systems of the UNIX family allow an ordinary computer to act as a
69 router and forward packets belonging to the other hosts, but only according to a
70 statically configured table.
71
72 <p>A <em/Routing Daemon/ is in UNIX terminology a non-interactive program
73 running on background which does the dynamic part of Internet routing, that is
74 it communicates with the other routers, calculates routing tables and sends them
75 to the OS kernel which does the actual packet forwarding. There already exist
76 other such routing daemons: routed (RIP only), GateD (non-free),
77 <HTMLURL URL="http://www.zebra.org" name="Zebra"> and
78 <HTMLURL URL="http://sourceforge.net/projects/mrt" name="MRTD">,
79 but their capabilities are limited and they are relatively hard to configure
80 and maintain.
81
82 <p>BIRD is an Internet Routing Daemon designed to avoid all of these shortcomings,
83 to support all the routing technology used in the today's Internet or planned to
84 be used in near future and to have a clean extensible architecture allowing new
85 routing protocols to be incorporated easily. Among other features, BIRD
86 supports:
87
88 <itemize>
89 <item>both IPv4 and IPv6 protocols
90 <item>multiple routing tables
91 <item>the Border Gateway Protocol (BGPv4)
92 <item>the Routing Information Protocol (RIPv2, RIPng)
93 <item>the Open Shortest Path First protocol (OSPFv2, OSPFv3)
94 <item>the Babel Routing Protocol
95 <item>the Router Advertisements for IPv6 hosts
96 <item>a virtual protocol for exchange of routes between different
97 routing tables on a single host
98 <item>a command-line interface allowing on-line control and inspection
99 of status of the daemon
100 <item>soft reconfiguration (no need to use complex online commands to
101 change the configuration, just edit the configuration file and
102 notify BIRD to re-read it and it will smoothly switch itself to
103 the new configuration, not disturbing routing protocols unless
104 they are affected by the configuration changes)
105 <item>a powerful language for route filtering
106 </itemize>
107
108 <p>BIRD has been developed at the Faculty of Math and Physics, Charles
109 University, Prague, Czech Republic as a student project. It can be freely
110 distributed under the terms of the GNU General Public License.
111
112 <p>BIRD has been designed to work on all UNIX-like systems. It has been
113 developed and tested under Linux 2.0 to 2.6, and then ported to FreeBSD, NetBSD
114 and OpenBSD, porting to other systems (even non-UNIX ones) should be relatively
115 easy due to its highly modular architecture.
116
117 <p>BIRD 1.x supported either IPv4 or IPv6 protocol, but had to be compiled separately
118 for each one. BIRD~2 supports both of them with a possibility of further extension.
119 BIRD~2 supports Linux at least 3.16, FreeBSD 10, NetBSD 7.0, and OpenBSD 5.8.
120 Anyway, it will probably work well also on older systems.
121
122 <sect>Installing BIRD
123 <label id="install">
124
125 <p>On a recent UNIX system with GNU development tools (GCC, binutils, m4, make)
126 and Perl, installing BIRD should be as easy as:
127
128 <code>
129 ./configure
130 make
131 make install
132 vi /usr/local/etc/bird.conf
133 bird
134 </code>
135
136 <p>You can use <tt>./configure --help</tt> to get a list of configure
137 options. The most important ones are: <tt/--with-protocols=/ to produce a slightly smaller
138 BIRD executable by configuring out routing protocols you don't use, and
139 <tt/--prefix=/ to install BIRD to a place different from <file>/usr/local</file>.
140
141
142 <sect>Running BIRD
143 <label id="argv">
144
145 <p>You can pass several command-line options to bird:
146
147 <descrip>
148 <tag><label id="argv-config">-c <m/config name/</tag>
149 use given configuration file instead of <it/prefix/<file>/etc/bird.conf</file>.
150
151 <tag><label id="argv-debug">-d</tag>
152 enable debug messages to stderr, and run bird in foreground.
153
154 <tag><label id="argv-debug-file">-D <m/filename of debug log/</tag>
155 enable debug messages to given file.
156
157 <tag><label id="argv-foreground">-f</tag>
158 run bird in foreground.
159
160 <tag><label id="argv-group">-g <m/group/</tag>
161 use that group ID, see the next section for details.
162
163 <tag><label id="argv-help">-h, --help</tag>
164 display command-line options to bird.
165
166 <tag><label id="argv-local">-l</tag>
167 look for a configuration file and a communication socket in the current
168 working directory instead of in default system locations. However, paths
169 specified by options <cf/-c/, <cf/-s/ have higher priority.
170
171 <tag><label id="argv-parse">-p</tag>
172 just parse the config file and exit. Return value is zero if the config
173 file is valid, nonzero if there are some errors.
174
175 <tag><label id="argv-pid">-P <m/name of PID file/</tag>
176 create a PID file with given filename.
177
178 <tag><label id="argv-recovery">-R</tag>
179 apply graceful restart recovery after start.
180
181 <tag><label id="argv-socket">-s <m/name of communication socket/</tag>
182 use given filename for a socket for communications with the client,
183 default is <it/prefix/<file>/var/run/bird.ctl</file>.
184
185 <tag><label id="argv-user">-u <m/user/</tag>
186 drop privileges and use that user ID, see the next section for details.
187
188 <tag><label id="argv-version">--version</tag>
189 display bird version.
190 </descrip>
191
192 <p>BIRD writes messages about its work to log files or syslog (according to config).
193
194
195 <sect>Privileges
196 <label id="privileges">
197
198 <p>BIRD, as a routing daemon, uses several privileged operations (like setting
199 routing table and using raw sockets). Traditionally, BIRD is executed and runs
200 with root privileges, which may be prone to security problems. The recommended
201 way is to use a privilege restriction (options <cf/-u/, <cf/-g/). In that case
202 BIRD is executed with root privileges, but it changes its user and group ID to
203 an unprivileged ones, while using Linux capabilities to retain just required
204 privileges (capabilities CAP_NET_*). Note that the control socket is created
205 before the privileges are dropped, but the config file is read after that. The
206 privilege restriction is not implemented in BSD port of BIRD.
207
208 <p>An unprivileged user (as an argument to <cf/-u/ options) may be the user
209 <cf/nobody/, but it is suggested to use a new dedicated user account (like
210 <cf/bird/). The similar considerations apply for the group option, but there is
211 one more condition -- the users in the same group can use <file/birdc/ to
212 control BIRD.
213
214 <p>Finally, there is a possibility to use external tools to run BIRD in an
215 environment with restricted privileges. This may need some configuration, but it
216 is generally easy -- BIRD needs just the standard library, privileges to read
217 the config file and create the control socket and the CAP_NET_* capabilities.
218
219
220 <chapt>Architecture
221 <label id="architecture">
222
223 <sect>Routing tables
224 <label id="routing-tables">
225
226 <p>The heart of BIRD is a routing table. BIRD has several independent routing tables;
227 each of them contains routes of exactly one <m/nettype/ (see below). There are two
228 default tables -- <cf/master4/ for IPv4 routes and <cf/master6/ for IPv6 routes.
229 Other tables must be explicitly configured.
230
231 <p>
232 These routing tables are not kernel forwarding tables. No forwarding is done by
233 BIRD. If you want to forward packets using the routes in BIRD tables, you may
234 use the Kernel protocol (see below) to synchronize them with kernel FIBs.
235
236 <p>
237 Every nettype defines a (kind of) primary key on routes. Every route source can
238 supply one route for every possible primary key; new route announcement replaces
239 the old route from the same source, keeping other routes intact. BIRD always
240 chooses the best route for each primary key among the known routes and keeps the
241 others as suboptimal. When the best route is retracted, BIRD re-runs the best
242 route selection algorithm to find the current best route.
243
244 <p>
245 The global best route selection algorithm is (roughly) as follows:
246
247 <itemize>
248 <item>Preferences of the routes are compared.
249 <item>Source protocol instance preferences are compared.
250 <item>If source protocols are the same (e.g. BGP vs. BGP), the protocol's route selection algorithm is invoked.
251 <item>If source protocols are different (e.g. BGP vs. OSPF), result of the algorithm is undefined.
252 </itemize>
253
254 <p><label id="dsc-table-sorted">Usually, a routing table just chooses a selected
255 route from a list of entries for one network. But if the <cf/sorted/ option is
256 activated, these lists of entries are kept completely sorted (according to
257 preference or some protocol-dependent metric). This is needed for some features
258 of some protocols (e.g. <cf/secondary/ option of BGP protocol, which allows to
259 accept not just a selected route, but the first route (in the sorted list) that
260 is accepted by filters), but it is incompatible with some other features (e.g.
261 <cf/deterministic med/ option of BGP protocol, which activates a way of choosing
262 selected route that cannot be described using comparison and ordering). Minor
263 advantage is that routes are shown sorted in <cf/show route/, minor disadvantage
264 is that it is slightly more computationally expensive.
265
266 <sect>Routes and network types
267 <label id="routes">
268
269 <p>BIRD works with several types of routes. Some of them are typical IP routes,
270 others are better described as forwarding rules. We call them all routes,
271 regardless of this difference.
272
273 <p>Every route consists of several attributes (read more about them in the
274 <ref id="route-attributes" name="Route attributes"> section); the common for all
275 routes are:
276
277 <itemize>
278 <item>IP address of router which told us about this route
279 <item>Source protocol instance
280 <item>Route preference
281 <item>Optional attributes defined by protocols
282 </itemize>
283
284 <p>Other attributes depend on nettypes. Some of them are part of the primary key, these are marked (PK).
285
286 <sect1>IPv4 and IPv6 routes
287 <label id="ip-routes">
288
289 <p>The traditional routes. Configuration keywords are <cf/ipv4/ and <cf/ipv6/.
290
291 <itemize>
292 <item>(PK) Route destination (IP prefix together with its length)
293 <item>Route next hops (see below)
294 </itemize>
295
296 <sect1>IPv6 source-specific routes
297 <label id="ip-sadr-routes">
298
299 <p>The IPv6 routes containing both destination and source prefix. They are used
300 for source-specific routing (SSR), also called source-address dependent routing
301 (SADR), see <rfc id="8043">. Currently limited mostly to the Babel protocol.
302 Configuration keyword is <cf/ipv6 sadr/.
303
304 <itemize>
305 <item>(PK) Route destination (IP prefix together with its length)
306 <item>(PK) Route source (IP prefix together with its length)
307 <item>Route next hops (see below)
308 </itemize>
309
310 <sect1>VPN IPv4 and IPv6 routes
311 <label id="vpn-routes">
312
313 <p>Routes for IPv4 and IPv6 with VPN Route Distinguisher (<rfc id="4364">).
314 Configuration keywords are <cf/vpn4/ and <cf/vpn6/.
315
316 <itemize>
317 <item>(PK) Route destination (IP prefix together with its length)
318 <item>(PK) Route distinguisher (according to <rfc id="4364">)
319 <item>Route next hops
320 </itemize>
321
322 <sect1>Route Origin Authorization for IPv4 and IPv6
323 <label id="roa-routes">
324
325 <p>These entries can be used to validate route origination of BGP routes.
326 A ROA entry specifies prefixes which could be originated by an AS number.
327 Their keywords are <cf/roa4/ and <cf/roa6/.
328
329 <itemize>
330 <item>(PK) IP prefix together with its length
331 <item>(PK) Matching prefix maximal length
332 <item>(PK) AS number
333 </itemize>
334
335 <sect1>Flowspec for IPv4 and IPv6
336 <label id="flow-routes">
337
338 <p>Flowspec rules are a form of firewall and traffic flow control rules
339 distributed mostly via BGP. These rules may help the operators stop various
340 network attacks in the beginning before eating up the whole bandwidth.
341 Configuration keywords are <cf/flow4/ and <cf/flow6/.
342
343 <itemize>
344 <item>(PK) IP prefix together with its length
345 <item>(PK) Flow definition data
346 <item>Flow action (encoded internally as BGP communities according to <rfc id="5575">)
347 </itemize>
348
349 <sect1>MPLS switching rules
350 <label id="mpls-routes">
351
352 <p>This nettype is currently a stub before implementing more support of <rfc id="3031">.
353 BIRD currently does not support any label distribution protocol nor any label assignment method.
354 Only the Kernel, Pipe and Static protocols can use MPLS tables.
355 Configuration keyword is <cf/mpls/.
356
357 <itemize>
358 <item>(PK) MPLS label
359 <item>Route next hops
360 </itemize>
361
362 <sect1>Route next hops
363 <label id="route-next-hop">
364
365 <p>This is not a nettype. The route next hop is a complex attribute common for many
366 nettypes as you can see before. Every next hop has its assigned device
367 (either assumed from its IP address or set explicitly). It may have also
368 an IP address and an MPLS stack (one or both independently).
369 Maximal MPLS stack depth is set (in compile time) to 8 labels.
370
371 <p>Every route (when eligible to have a next hop) can have more than one next hop.
372 In that case, every next hop has also its weight.
373
374 <sect>Protocols and channels
375 <label id="protocols-concept">
376
377 <p>BIRD protocol is an abstract class of producers and consumers of the routes.
378 Each protocol may run in multiple instances and bind on one side to route
379 tables via channels, on the other side to specified listen sockets (BGP),
380 interfaces (Babel, OSPF, RIP), APIs (Kernel, Direct), or nothing (Static, Pipe).
381
382 <p>There are also two protocols that do not have any channels -- BFD and Device.
383 Both of them are kind of service for other protocols.
384
385 <p>Each protocol is connected to a routing table through a channel. Some protocols
386 support only one channel (OSPF, RIP), some protocols support more channels (BGP, Direct).
387 Each channel has two filters which can accept, reject and modify the routes.
388 An <it/export/ filter is applied to routes passed from the routing table to the protocol,
389 an <it/import/ filter is applied to routes in the opposite direction.
390
391 <sect>Graceful restart
392 <label id="graceful-restart">
393
394 <p>When BIRD is started after restart or crash, it repopulates routing tables in
395 an uncoordinated manner, like after clean start. This may be impractical in some
396 cases, because if the forwarding plane (i.e. kernel routing tables) remains
397 intact, then its synchronization with BIRD would temporarily disrupt packet
398 forwarding until protocols converge. Graceful restart is a mechanism that could
399 help with this issue. Generally, it works by starting protocols and letting them
400 repopulate routing tables while deferring route propagation until protocols
401 acknowledge their convergence. Note that graceful restart behavior have to be
402 configured for all relevant protocols and requires protocol-specific support
403 (currently implemented for Kernel and BGP protocols), it is activated for
404 particular boot by option <cf/-R/.
405
406
407 <chapt>Configuration
408 <label id="config">
409
410 <sect>Introduction
411 <label id="config-intro">
412
413 <p>BIRD is configured using a text configuration file. Upon startup, BIRD reads
414 <it/prefix/<file>/etc/bird.conf</file> (unless the <tt/-c/ command line option
415 is given). Configuration may be changed at user's request: if you modify the
416 config file and then signal BIRD with <tt/SIGHUP/, it will adjust to the new
417 config. Then there's the client which allows you to talk with BIRD in an
418 extensive way.
419
420 <p>In the config, everything on a line after <cf/#/ or inside <cf>/* */</cf> is
421 a comment, whitespace characters are treated as a single space. If there's a
422 variable number of options, they are grouped using the <cf/{ }/ brackets. Each
423 option is terminated by a <cf/;/. Configuration is case sensitive. There are two
424 ways how to name symbols (like protocol names, filter names, constants etc.).
425 You can either use a simple string starting with a letter followed by any
426 combination of letters and numbers (e.g. <cf/R123/, <cf/myfilter/, <cf/bgp5/) or
427 you can enclose the name into apostrophes (<cf/'/) and than you can use any
428 combination of numbers, letters. hyphens, dots and colons (e.g.
429 <cf/'1:strange-name'/, <cf/'-NAME-'/, <cf/'cool::name'/).
430
431 <p>Here is an example of a simple config file. It enables synchronization of
432 routing tables with OS kernel, learns network interfaces and runs RIP on all
433 network interfaces found.
434
435 <code>
436 protocol kernel {
437 ipv4 {
438 export all; # Default is export none
439 };
440 persist; # Don't remove routes on BIRD shutdown
441 }
442
443 protocol device {
444 }
445
446 protocol rip {
447 ipv4 {
448 import all;
449 export all;
450 };
451 interface "*";
452 }
453 </code>
454
455
456 <sect>Global options
457 <label id="global-opts">
458
459 <p><descrip>
460 <tag><label id="opt-include">include "<m/filename/";</tag>
461 This statement causes inclusion of a new file. The <m/filename/ could
462 also be a wildcard, in that case matching files are included in
463 alphabetic order. The maximal depth is 8. Note that this statement can
464 be used anywhere in the config file, even inside other options, but
465 always on the beginning of line. In the following example, the first
466 semicolon belongs to the <cf/include/, the second to <cf/ipv6 table/.
467 If the <file/tablename.conf/ contains exactly one token (the name of the
468 table), this construction is correct:
469 <code>
470 ipv6 table
471 include "tablename.conf";;
472 </code>
473
474 <tag><label id="opt-log">log "<m/filename/" [<m/limit/ "<m/backup/"] | syslog [name <m/name/] | stderr all|{ <m/list of classes/ }</tag>
475 Set logging of messages having the given class (either <cf/all/ or <cf>{
476 error|trace [, <m/.../] }</cf> etc.) into selected destination - a file
477 specified as a filename string (with optional log rotation information),
478 syslog (with optional name argument), or the stderr output.
479
480 Classes are:
481 <cf/info/, <cf/warning/, <cf/error/ and <cf/fatal/ for messages about local problems,
482 <cf/debug/ for debugging messages,
483 <cf/trace/ when you want to know what happens in the network,
484 <cf/remote/ for messages about misbehavior of remote machines,
485 <cf/auth/ about authentication failures,
486 <cf/bug/ for internal BIRD bugs.
487
488 Logging directly to file supports basic log rotation -- there is an
489 optional log file limit and a backup filename, when log file reaches the
490 limit, the current log file is renamed to the backup filename and a new
491 log file is created.
492
493 You may specify more than one <cf/log/ line to establish logging to
494 multiple destinations. Default: log everything to the system log, or
495 to the debug output if debugging is enabled by <cf/-d//<cf/-D/
496 command-line option.
497
498 <tag><label id="opt-debug-protocols">debug protocols all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag>
499 Set global defaults of protocol debugging options. See <cf/debug/ in the
500 following section. Default: off.
501
502 <tag><label id="opt-debug-commands">debug commands <m/number/</tag>
503 Control logging of client connections (0 for no logging, 1 for logging
504 of connects and disconnects, 2 and higher for logging of all client
505 commands). Default: 0.
506
507 <tag><label id="opt-debug-latency">debug latency <m/switch/</tag>
508 Activate tracking of elapsed time for internal events. Recent events
509 could be examined using <cf/dump events/ command. Default: off.
510
511 <tag><label id="opt-debug-latency-limit">debug latency limit <m/time/</tag>
512 If <cf/debug latency/ is enabled, this option allows to specify a limit
513 for elapsed time. Events exceeding the limit are logged. Default: 1 s.
514
515 <tag><label id="opt-watchdog-warn">watchdog warning <m/time/</tag>
516 Set time limit for I/O loop cycle. If one iteration took more time to
517 complete, a warning is logged. Default: 5 s.
518
519 <tag><label id="opt-watchdog-timeout">watchdog timeout <m/time/</tag>
520 Set time limit for I/O loop cycle. If the limit is breached, BIRD is
521 killed by abort signal. The timeout has effective granularity of
522 seconds, zero means disabled. Default: disabled (0).
523
524 <tag><label id="opt-mrtdump">mrtdump "<m/filename/"</tag>
525 Set MRTdump file name. This option must be specified to allow MRTdump
526 feature. Default: no dump file.
527
528 <tag><label id="opt-mrtdump-protocols">mrtdump protocols all|off|{ states|messages [, <m/.../] }</tag>
529 Set global defaults of MRTdump options. See <cf/mrtdump/ in the
530 following section. Default: off.
531
532 <tag><label id="opt-filter">filter <m/name local variables/{ <m/commands/ }</tag>
533 Define a filter. You can learn more about filters in the following
534 chapter.
535
536 <tag><label id="opt-function">function <m/name/ (<m/parameters/) <m/local variables/ { <m/commands/ }</tag>
537 Define a function. You can learn more about functions in the following chapter.
538
539 <tag><label id="opt-protocol">protocol rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag>
540 Define a protocol instance called <cf><m/name/</cf> (or with a name like
541 "rip5" generated automatically if you don't specify any
542 <cf><m/name/</cf>). You can learn more about configuring protocols in
543 their own chapters. When <cf>from <m/name2/</cf> expression is used,
544 initial protocol options are taken from protocol or template
545 <cf><m/name2/</cf> You can run more than one instance of most protocols
546 (like RIP or BGP). By default, no instances are configured.
547
548 <tag><label id="opt-template">template rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag>
549 Define a protocol template instance called <m/name/ (or with a name like
550 "bgp1" generated automatically if you don't specify any <m/name/).
551 Protocol templates can be used to group common options when many
552 similarly configured protocol instances are to be defined. Protocol
553 instances (and other templates) can use templates by using <cf/from/
554 expression and the name of the template. At the moment templates (and
555 <cf/from/ expression) are not implemented for OSPF protocol.
556
557 <tag><label id="opt-define">define <m/constant/ = <m/expression/</tag>
558 Define a constant. You can use it later in every place you could use a
559 value of the same type. Besides, there are some predefined numeric
560 constants based on /etc/iproute2/rt_* files. A list of defined constants
561 can be seen (together with other symbols) using 'show symbols' command.
562
563 <tag><label id="opt-attribute">attribute <m/type/ <m/name/</tag>
564 Declare a custom route attribute. You can set and get it in filters like
565 any other route atribute. This feature is intended for marking routes
566 in import filters for export filtering purposes instead of locally
567 assigned BGP communities which have to be deleted in export filters.
568
569 <tag><label id="opt-router-id">router id <m/IPv4 address/</tag>
570 Set BIRD's router ID. It's a world-wide unique identification of your
571 router, usually one of router's IPv4 addresses. Default: the lowest
572 IPv4 address of a non-loopback interface.
573
574 <tag><label id="opt-router-id-from">router id from [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../]</tag>
575 Set BIRD's router ID based on an IPv4 address of an interface specified by
576 an interface pattern.
577 See <ref id="proto-iface" name="interface"> section for detailed
578 description of interface patterns with extended clauses.
579
580 <tag><label id="opt-graceful-restart">graceful restart wait <m/number/</tag>
581 During graceful restart recovery, BIRD waits for convergence of routing
582 protocols. This option allows to specify a timeout for the recovery to
583 prevent waiting indefinitely if some protocols cannot converge. Default:
584 240 seconds.
585
586 <tag><label id="opt-timeformat">timeformat route|protocol|base|log "<m/format1/" [<m/limit/ "<m/format2/"]</tag>
587 This option allows to specify a format of date/time used by BIRD. The
588 first argument specifies for which purpose such format is used.
589 <cf/route/ is a format used in 'show route' command output,
590 <cf/protocol/ is used in 'show protocols' command output, <cf/base/ is
591 used for other commands and <cf/log/ is used in a log file.
592
593 "<m/format1/" is a format string using <it/strftime(3)/ notation (see
594 <it/man strftime/ for details). It is extended to support sub-second
595 time part with variable precision (up to microseconds) using "%f"
596 conversion code (e.g., "%T.%3f" is hh:mm:ss.sss time). <m/limit/ and
597 "<m/format2/" allow to specify the second format string for times in
598 past deeper than <m/limit/ seconds.
599
600 There are several shorthands: <cf/iso long/ is a ISO 8601 date/time
601 format (YYYY-MM-DD hh:mm:ss) that can be also specified using <cf/"%F
602 %T"/. Similarly, <cf/iso long ms/ and <cf/iso long us/ are ISO 8601
603 date/time formats with millisecond or microsecond precision.
604 <cf/iso short/ is a variant of ISO 8601 that uses just the time format
605 (hh:mm:ss) for near times (up to 20 hours in the past) and the date
606 format (YYYY-MM-DD) for far times. This is a shorthand for <cf/"%T"
607 72000 "%F"/. And there are also <cf/iso short ms/ and <cf/iso short us/
608 high-precision variants of that.
609
610 By default, BIRD uses the <cf/iso short ms/ format for <cf/route/ and
611 <cf/protocol/ times, and the <cf/iso long ms/ format for <cf/base/ and
612 <cf/log/ times.
613
614 <tag><label id="opt-table"><m/nettype/ table <m/name/ [sorted]</tag>
615 Create a new routing table. The default routing tables <cf/master4/ and
616 <cf/master6/ are created implicitly, other routing tables have to be
617 added by this command. Option <cf/sorted/ can be used to enable sorting
618 of routes, see <ref id="dsc-table-sorted" name="sorted table">
619 description for details.
620
621 <tag><label id="opt-eval">eval <m/expr/</tag>
622 Evaluates given filter expression. It is used by the developers for testing of filters.
623 </descrip>
624
625
626 <sect>Protocol options
627 <label id="protocol-opts">
628
629 <p>For each protocol instance, you can configure a bunch of options. Some of
630 them (those described in this section) are generic, some are specific to the
631 protocol (see sections talking about the protocols).
632
633 <p>Several options use a <m/switch/ argument. It can be either <cf/on/,
634 <cf/yes/ or a numeric expression with a non-zero value for the option to be
635 enabled or <cf/off/, <cf/no/ or a numeric expression evaluating to zero to
636 disable it. An empty <m/switch/ is equivalent to <cf/on/ ("silence means
637 agreement").
638
639 <descrip>
640 <tag><label id="proto-disabled">disabled <m/switch/</tag>
641 Disables the protocol. You can change the disable/enable status from the
642 command line interface without needing to touch the configuration.
643 Disabled protocols are not activated. Default: protocol is enabled.
644
645 <tag><label id="proto-debug">debug all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag>
646 Set protocol debugging options. If asked, each protocol is capable of
647 writing trace messages about its work to the log (with category
648 <cf/trace/). You can either request printing of <cf/all/ trace messages
649 or only of the types selected: <cf/states/ for protocol state changes
650 (protocol going up, down, starting, stopping etc.), <cf/routes/ for
651 routes exchanged with the routing table, <cf/filters/ for details on
652 route filtering, <cf/interfaces/ for interface change events sent to the
653 protocol, <cf/events/ for events internal to the protocol and <cf/packets/
654 for packets sent and received by the protocol. Default: off.
655
656 <tag><label id="proto-mrtdump">mrtdump all|off|{ states|messages [, <m/.../] }</tag>
657 Set protocol MRTdump flags. MRTdump is a standard binary format for
658 logging information from routing protocols and daemons. These flags
659 control what kind of information is logged from the protocol to the
660 MRTdump file (which must be specified by global <cf/mrtdump/ option, see
661 the previous section). Although these flags are similar to flags of
662 <cf/debug/ option, their meaning is different and protocol-specific. For
663 BGP protocol, <cf/states/ logs BGP state changes and <cf/messages/ logs
664 received BGP messages. Other protocols does not support MRTdump yet.
665
666 <tag><label id="proto-router-id">router id <m/IPv4 address/</tag>
667 This option can be used to override global router id for a given
668 protocol. Default: uses global router id.
669
670 <tag><label id="proto-description">description "<m/text/"</tag>
671 This is an optional description of the protocol. It is displayed as a
672 part of the output of 'show protocols all' command.
673
674 <tag><label id="proto-vrf">vrf "<m/text/"</tag>
675 Associate the protocol with specific VRF. The protocol will be
676 restricted to interfaces assigned to the VRF and will use sockets bound
677 to the VRF. Appropriate VRF interface must exist on OS level. For kernel
678 protocol, an appropriate table still must be explicitly selected by
679 <cf/table/ option. Note that for proper VRF support it is necessary to
680 use Linux kernel version at least 4.14, older versions have limited VRF
681 implementation.
682
683 <tag><label id="proto-channel"><m/channel name/ [{<m/channel config/}]</tag>
684 Every channel must be explicitly stated. See the protocol-specific
685 configuration for the list of supported channel names. See the
686 <ref id="channel-opts" name="channel configuration section"> for channel
687 definition.
688 </descrip>
689
690 <p>There are several options that give sense only with certain protocols:
691
692 <descrip>
693 <tag><label id="proto-iface">interface [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../] [ { <m/option/; [<m/.../] } ]</tag>
694 Specifies a set of interfaces on which the protocol is activated with
695 given interface-specific options. A set of interfaces specified by one
696 interface option is described using an interface pattern. The interface
697 pattern consists of a sequence of clauses (separated by commas), each
698 clause is a mask specified as a shell-like pattern. Interfaces are
699 matched by their name.
700
701 An interface matches the pattern if it matches any of its clauses. If
702 the clause begins with <cf/-/, matching interfaces are excluded. Patterns
703 are processed left-to-right, thus <cf/interface "eth0", -"eth*", "*";/
704 means eth0 and all non-ethernets.
705
706 Some protocols (namely OSPFv2 and Direct) support extended clauses that
707 may contain a mask, a prefix, or both of them. An interface matches such
708 clause if its name matches the mask (if specified) and its address
709 matches the prefix (if specified). Extended clauses are used when the
710 protocol handles multiple addresses on an interface independently.
711
712 An interface option can be used more times with different interface-specific
713 options, in that case for given interface the first matching interface
714 option is used.
715
716 This option is allowed in Babel, BFD, Device, Direct, OSPF, RAdv and RIP
717 protocols. In OSPF protocol it is used in the <cf/area/ subsection.
718
719 Default: none.
720
721 Examples:
722
723 <cf>interface "*" { type broadcast; };</cf> - start the protocol on all
724 interfaces with <cf>type broadcast</cf> option.
725
726 <cf>interface "eth1", "eth4", "eth5" { type ptp; };</cf> - start the
727 protocol on enumerated interfaces with <cf>type ptp</cf> option.
728
729 <cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol
730 on all interfaces that have address from 192.168.0.0/16, but not from
731 192.168.1.0/24.
732
733 <cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol
734 on all interfaces that have address from 192.168.0.0/16, but not from
735 192.168.1.0/24.
736
737 <cf>interface "eth*" 192.168.1.0/24;</cf> - start the protocol on all
738 ethernet interfaces that have address from 192.168.1.0/24.
739
740 <tag><label id="proto-tx-class">tx class|dscp <m/num/</tag>
741 This option specifies the value of ToS/DS/Class field in IP headers of
742 the outgoing protocol packets. This may affect how the protocol packets
743 are processed by the network relative to the other network traffic. With
744 <cf/class/ keyword, the value (0-255) is used for the whole ToS/Class
745 octet (but two bits reserved for ECN are ignored). With <cf/dscp/
746 keyword, the value (0-63) is used just for the DS field in the octet.
747 Default value is 0xc0 (DSCP 0x30 - CS6).
748
749 <tag><label id="proto-tx-priority">tx priority <m/num/</tag>
750 This option specifies the local packet priority. This may affect how the
751 protocol packets are processed in the local TX queues. This option is
752 Linux specific. Default value is 7 (highest priority, privileged traffic).
753
754 <tag><label id="proto-pass">password "<m/password/" [ { <m>password options</m> } ]</tag>
755 Specifies a password that can be used by the protocol as a shared secret
756 key. Password option can be used more times to specify more passwords.
757 If more passwords are specified, it is a protocol-dependent decision
758 which one is really used. Specifying passwords does not mean that
759 authentication is enabled, authentication can be enabled by separate,
760 protocol-dependent <cf/authentication/ option.
761
762 This option is allowed in BFD, OSPF and RIP protocols. BGP has also
763 <cf/password/ option, but it is slightly different and described
764 separately.
765 Default: none.
766 </descrip>
767
768 <p>Password option can contain section with some (not necessary all) password sub-options:
769
770 <descrip>
771 <tag><label id="proto-pass-id">id <M>num</M></tag>
772 ID of the password, (1-255). If it is not used, BIRD will choose ID based
773 on an order of the password item in the interface. For example, second
774 password item in one interface will have default ID 2. ID is used by
775 some routing protocols to identify which password was used to
776 authenticate protocol packets.
777
778 <tag><label id="proto-pass-gen-from">generate from "<m/time/"</tag>
779 The start time of the usage of the password for packet signing.
780 The format of <cf><m/time/</cf> is <tt>dd-mm-yyyy HH:MM:SS</tt>.
781
782 <tag><label id="proto-pass-gen-to">generate to "<m/time/"</tag>
783 The last time of the usage of the password for packet signing.
784
785 <tag><label id="proto-pass-accept-from">accept from "<m/time/"</tag>
786 The start time of the usage of the password for packet verification.
787
788 <tag><label id="proto-pass-accept-to">accept to "<m/time/"</tag>
789 The last time of the usage of the password for packet verification.
790
791 <tag><label id="proto-pass-from">from "<m/time/"</tag>
792 Shorthand for setting both <cf/generate from/ and <cf/accept from/.
793
794 <tag><label id="proto-pass-to">to "<m/time/"</tag>
795 Shorthand for setting both <cf/generate to/ and <cf/accept to/.
796
797 <tag><label id="proto-pass-algorithm">algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 )</tag>
798 The message authentication algorithm for the password when cryptographic
799 authentication is enabled. The default value depends on the protocol.
800 For RIP and OSPFv2 it is Keyed-MD5 (for compatibility), for OSPFv3
801 protocol it is HMAC-SHA-256.
802
803 </descrip>
804
805
806 <sect>Channel options
807 <label id="channel-opts">
808
809 <p>Every channel belongs to a protocol and is configured inside its block. The
810 minimal channel config is empty, then it uses default values. The name of the
811 channel implies its nettype. Channel definitions can be inherited from protocol
812 templates. Multiple definitions of the same channel are forbidden, but channels
813 inherited from templates can be updated by new definitions.
814
815 <descrip>
816 <tag><label id="proto-table">table <m/name/</tag>
817 Specify a table to which the channel is connected. Default: the first
818 table of given nettype.
819
820 <tag><label id="proto-preference">preference <m/expr/</tag>
821 Sets the preference of routes generated by the protocol and imported
822 through this channel. Default: protocol dependent.
823
824 <tag><label id="proto-import">import all | none | filter <m/name/ | filter { <m/filter commands/ } | where <m/boolean filter expression/</tag>
825 Specify a filter to be used for filtering routes coming from the
826 protocol to the routing table. <cf/all/ is for keeping all routes,
827 <cf/none/ is for dropping all routes. Default: <cf/all/ (except for
828 EBGP).
829
830 <tag><label id="proto-export">export <m/filter/</tag>
831 This is similar to the <cf>import</cf> keyword, except that it works in
832 the direction from the routing table to the protocol. Default: <cf/none/
833 (except for EBGP).
834
835 <tag><label id="proto-import-keep-filtered">import keep filtered <m/switch/</tag>
836 Usually, if an import filter rejects a route, the route is forgotten.
837 When this option is active, these routes are kept in the routing table,
838 but they are hidden and not propagated to other protocols. But it is
839 possible to show them using <cf/show route filtered/. Note that this
840 option does not work for the pipe protocol. Default: off.
841
842 <tag><label id="proto-import-limit">import limit [<m/number/ | off ] [action warn | block | restart | disable]</tag>
843 Specify an import route limit (a maximum number of routes imported from
844 the protocol) and optionally the action to be taken when the limit is
845 hit. Warn action just prints warning log message. Block action discards
846 new routes coming from the protocol. Restart and disable actions shut
847 the protocol down like appropriate commands. Disable is the default
848 action if an action is not explicitly specified. Note that limits are
849 reset during protocol reconfigure, reload or restart. Default: <cf/off/.
850
851 <tag><label id="proto-receive-limit">receive limit [<m/number/ | off ] [action warn | block | restart | disable]</tag>
852 Specify an receive route limit (a maximum number of routes received from
853 the protocol and remembered). It works almost identically to <cf>import
854 limit</cf> option, the only difference is that if <cf/import keep
855 filtered/ option is active, filtered routes are counted towards the
856 limit and blocked routes are forgotten, as the main purpose of the
857 receive limit is to protect routing tables from overflow. Import limit,
858 on the contrary, counts accepted routes only and routes blocked by the
859 limit are handled like filtered routes. Default: <cf/off/.
860
861 <tag><label id="proto-export-limit">export limit [ <m/number/ | off ] [action warn | block | restart | disable]</tag>
862 Specify an export route limit, works similarly to the <cf>import
863 limit</cf> option, but for the routes exported to the protocol. This
864 option is experimental, there are some problems in details of its
865 behavior -- the number of exported routes can temporarily exceed the
866 limit without triggering it during protocol reload, exported routes
867 counter ignores route blocking and block action also blocks route
868 updates of already accepted routes -- and these details will probably
869 change in the future. Default: <cf/off/.
870 </descrip>
871
872 <p>This is a trivial example of RIP configured for IPv6 on all interfaces:
873 <code>
874 protocol rip ng {
875 ipv6;
876 interface "*";
877 }
878 </code>
879
880 <p>This is a non-trivial example.
881 <code>
882 protocol rip ng {
883 ipv6 {
884 table mytable6;
885 import filter { ... };
886 export filter { ... };
887 import limit 50;
888 };
889 interface "*";
890 }
891 </code>
892
893 <p>And this is even more complicated example using templates.
894 <code>
895 template bgp {
896 local 198.51.100.14 as 65000;
897
898 ipv4 {
899 table mytable4;
900 import filter { ... };
901 export none;
902 };
903 ipv6 {
904 table mytable6;
905 import filter { ... };
906 export none;
907 };
908 }
909
910 protocol bgp from {
911 neighbor 198.51.100.130 as 64496;
912
913 # IPv4 channel is inherited as-is, while IPv6
914 # channel is adjusted by export filter option
915 ipv6 {
916 export filter { ... };
917 };
918 }
919 </code>
920
921
922 <chapt>Remote control
923 <label id="remote-control">
924
925 <p>You can use the command-line client <file>birdc</file> to talk with a running
926 BIRD. Communication is done using a <file/bird.ctl/ UNIX domain socket (unless
927 changed with the <tt/-s/ option given to both the server and the client). The
928 commands can perform simple actions such as enabling/disabling of protocols,
929 telling BIRD to show various information, telling it to show routing table
930 filtered by filter, or asking BIRD to reconfigure. Press <tt/?/ at any time to
931 get online help. Option <tt/-r/ can be used to enable a restricted mode of BIRD
932 client, which allows just read-only commands (<cf/show .../). Option <tt/-v/ can
933 be passed to the client, to make it dump numeric return codes along with the
934 messages. You do not necessarily need to use <file/birdc/ to talk to BIRD, your
935 own applications could do that, too -- the format of communication between BIRD
936 and <file/birdc/ is stable (see the programmer's documentation).
937
938 <p>There is also lightweight variant of BIRD client called <file/birdcl/, which
939 does not support command line editing and history and has minimal dependencies.
940 This is useful for running BIRD in resource constrained environments, where
941 Readline library (required for regular BIRD client) is not available.
942
943 <p>Many commands have the <m/name/ of the protocol instance as an argument.
944 This argument can be omitted if there exists only a single instance.
945
946 <p>Here is a brief list of supported functions:
947
948 <descrip>
949 <tag><label id="cli-show-status">show status</tag>
950 Show router status, that is BIRD version, uptime and time from last
951 reconfiguration.
952
953 <tag><label id="cli-show-interfaces">show interfaces [summary]</tag>
954 Show the list of interfaces. For each interface, print its type, state,
955 MTU and addresses assigned.
956
957 <tag><label id="cli-show-protocols">show protocols [all]</tag>
958 Show list of protocol instances along with tables they are connected to
959 and protocol status, possibly giving verbose information, if <cf/all/ is
960 specified.
961
962 <!-- TODO: Move these protocol-specific remote control commands to the protocol sections -->
963 <tag><label id="cli-show-ospf-iface">show ospf interface [<m/name/] ["<m/interface/"]</tag>
964 Show detailed information about OSPF interfaces.
965
966 <tag><label id="cli-show-ospf-neighbors">show ospf neighbors [<m/name/] ["<m/interface/"]</tag>
967 Show a list of OSPF neighbors and a state of adjacency to them.
968
969 <tag><label id="cli-show-ospf-state">show ospf state [all] [<m/name/]</tag>
970 Show detailed information about OSPF areas based on a content of the
971 link-state database. It shows network topology, stub networks,
972 aggregated networks and routers from other areas and external routes.
973 The command shows information about reachable network nodes, use option
974 <cf/all/ to show information about all network nodes in the link-state
975 database.
976
977 <tag><label id="cli-show-ospf-topology">show ospf topology [all] [<m/name/]</tag>
978 Show a topology of OSPF areas based on a content of the link-state
979 database. It is just a stripped-down version of 'show ospf state'.
980
981 <tag><label id="cli-show-ospf-lsadb">show ospf lsadb [global | area <m/id/ | link] [type <m/num/] [lsid <m/id/] [self | router <m/id/] [<m/name/] </tag>
982 Show contents of an OSPF LSA database. Options could be used to filter
983 entries.
984
985 <tag><label id="cli-show-rip-interfaces">show rip interfaces [<m/name/] ["<m/interface/"]</tag>
986 Show detailed information about RIP interfaces.
987
988 <tag><label id="cli-show-rip-neighbors">show rip neighbors [<m/name/] ["<m/interface/"]</tag>
989 Show a list of RIP neighbors and associated state.
990
991 <tag><label id="cli-show-static">show static [<m/name/]</tag>
992 Show detailed information about static routes.
993
994 <tag><label id="cli-show-bfd-sessions">show bfd sessions [<m/name/]</tag>
995 Show information about BFD sessions.
996
997 <tag><label id="cli-show-symbols">show symbols [table|filter|function|protocol|template|roa|<m/symbol/]</tag>
998 Show the list of symbols defined in the configuration (names of
999 protocols, routing tables etc.).
1000
1001 <tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table (<m/t/ | all)] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag>
1002 Show contents of specified routing tables, that is routes, their metrics
1003 and (in case the <cf/all/ switch is given) all their attributes.
1004
1005 <p>You can specify a <m/prefix/ if you want to print routes for a
1006 specific network. If you use <cf>for <m/prefix or IP/</cf>, you'll get
1007 the entry which will be used for forwarding of packets to the given
1008 destination. By default, all routes for each network are printed with
1009 the selected one at the top, unless <cf/primary/ is given in which case
1010 only the selected route is shown.
1011
1012 <p>The <cf/show route/ command can process one or multiple routing
1013 tables. The set of selected tables is determined on three levels: First,
1014 tables can be explicitly selected by <cf/table/ switch, which could be
1015 used multiple times, all tables are specified by <cf/table all/. Second,
1016 tables can be implicitly selected by channels or protocols that are
1017 arguments of several other switches (e.g., <cf/export/, <cf/protocol/).
1018 Last, the set of default tables is used: <cf/master4/, <cf/master6/ and
1019 each first table of any other network type.
1020
1021 <p>You can also ask for printing only routes processed and accepted by
1022 a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ }
1023 </cf> or matching a given condition (<cf>where <m/condition/</cf>).
1024
1025 The <cf/export/, <cf/preexport/ and <cf/noexport/ switches ask for
1026 printing of routes that are exported to the specified protocol or
1027 channel. With <cf/preexport/, the export filter of the channel is
1028 skipped. With <cf/noexport/, routes rejected by the export filter are
1029 printed instead. Note that routes not exported for other reasons
1030 (e.g. secondary routes or routes imported from that protocol) are not
1031 printed even with <cf/noexport/. These switches also imply that
1032 associated routing tables are selected instead of default ones.
1033
1034 <p>You can also select just routes added by a specific protocol.
1035 <cf>protocol <m/p/</cf>. This switch also implies that associated
1036 routing tables are selected instead of default ones.
1037
1038 <p>If BIRD is configured to keep filtered routes (see <cf/import keep
1039 filtered/ option), you can show them instead of routes by using
1040 <cf/filtered/ switch.
1041
1042 <p>The <cf/stats/ switch requests showing of route statistics (the
1043 number of networks, number of routes before and after filtering). If
1044 you use <cf/count/ instead, only the statistics will be printed.
1045
1046 <tag><label id="cli-mrt-dump">mrt dump table <m/name/|"<m/pattern/" to "<m/filename/" [filter <m/f/|where <m/c/]</tag>
1047 Dump content of a routing table to a specified file in MRT table dump
1048 format. See <ref id="mrt" name="MRT protocol"> for details.
1049
1050 <tag><label id="cli-configure">configure [soft] ["<m/config file/"] [timeout [<m/num/]]</tag>
1051 Reload configuration from a given file. BIRD will smoothly switch itself
1052 to the new configuration, protocols are reconfigured if possible,
1053 restarted otherwise. Changes in filters usually lead to restart of
1054 affected protocols.
1055
1056 If <cf/soft/ option is used, changes in filters does not cause BIRD to
1057 restart affected protocols, therefore already accepted routes (according
1058 to old filters) would be still propagated, but new routes would be
1059 processed according to the new filters.
1060
1061 If <cf/timeout/ option is used, config timer is activated. The new
1062 configuration could be either confirmed using <cf/configure confirm/
1063 command, or it will be reverted to the old one when the config timer
1064 expires. This is useful for cases when reconfiguration breaks current
1065 routing and a router becomes inaccessible for an administrator. The
1066 config timeout expiration is equivalent to <cf/configure undo/
1067 command. The timeout duration could be specified, default is 300 s.
1068
1069 <tag><label id="cli-configure-confirm">configure confirm</tag>
1070 Deactivate the config undo timer and therefore confirm the current
1071 configuration.
1072
1073 <tag><label id="cli-configure-undo">configure undo</tag>
1074 Undo the last configuration change and smoothly switch back to the
1075 previous (stored) configuration. If the last configuration change was
1076 soft, the undo change is also soft. There is only one level of undo, but
1077 in some specific cases when several reconfiguration requests are given
1078 immediately in a row and the intermediate ones are skipped then the undo
1079 also skips them back.
1080
1081 <tag><label id="cli-configure-check">configure check ["<m/config file/"]</tag>
1082 Read and parse given config file, but do not use it. useful for checking
1083 syntactic and some semantic validity of an config file.
1084
1085 <tag><label id="cli-enable-disable-restart">enable|disable|restart <m/name/|"<m/pattern/"|all</tag>
1086 Enable, disable or restart a given protocol instance, instances matching
1087 the <cf><m/pattern/</cf> or <cf/all/ instances.
1088
1089 <tag><label id="cli-reload">reload [in|out] <m/name/|"<m/pattern/"|all</tag>
1090 Reload a given protocol instance, that means re-import routes from the
1091 protocol instance and re-export preferred routes to the instance. If
1092 <cf/in/ or <cf/out/ options are used, the command is restricted to one
1093 direction (re-import or re-export).
1094
1095 This command is useful if appropriate filters have changed but the
1096 protocol instance was not restarted (or reloaded), therefore it still
1097 propagates the old set of routes. For example when <cf/configure soft/
1098 command was used to change filters.
1099
1100 Re-export always succeeds, but re-import is protocol-dependent and might
1101 fail (for example, if BGP neighbor does not support route-refresh
1102 extension). In that case, re-export is also skipped. Note that for the
1103 pipe protocol, both directions are always reloaded together (<cf/in/ or
1104 <cf/out/ options are ignored in that case).
1105
1106 <tag><label id="cli-down">down</tag>
1107 Shut BIRD down.
1108
1109 <tag><label id="cli-debug">debug <m/protocol/|<m/pattern/|all all|off|{ states|routes|filters|events|packets [, <m/.../] }</tag>
1110 Control protocol debugging.
1111
1112 <tag><label id="cli-dump">dump resources|sockets|interfaces|neighbors|attributes|routes|protocols</tag>
1113 Dump contents of internal data structures to the debugging output.
1114
1115 <tag><label id="cli-echo">echo all|off|{ <m/list of log classes/ } [ <m/buffer-size/ ]</tag>
1116 Control echoing of log messages to the command-line output.
1117 See <ref id="opt-log" name="log option"> for a list of log classes.
1118
1119 <tag><label id="cli-eval">eval <m/expr/</tag>
1120 Evaluate given expression.
1121 </descrip>
1122
1123
1124 <chapt>Filters
1125 <label id="filters">
1126
1127 <sect>Introduction
1128 <label id="filters-intro">
1129
1130 <p>BIRD contains a simple programming language. (No, it can't yet read mail :-).
1131 There are two objects in this language: filters and functions. Filters are
1132 interpreted by BIRD core when a route is being passed between protocols and
1133 routing tables. The filter language contains control structures such as if's and
1134 switches, but it allows no loops. An example of a filter using many features can
1135 be found in <file>filter/test.conf</file>.
1136
1137 <p>Filter gets the route, looks at its attributes and modifies some of them if
1138 it wishes. At the end, it decides whether to pass the changed route through
1139 (using <cf/accept/) or whether to <cf/reject/ it. A simple filter looks like
1140 this:
1141
1142 <code>
1143 filter not_too_far
1144 int var;
1145 {
1146 if defined( rip_metric ) then
1147 var = rip_metric;
1148 else {
1149 var = 1;
1150 rip_metric = 1;
1151 }
1152 if rip_metric &gt; 10 then
1153 reject "RIP metric is too big";
1154 else
1155 accept "ok";
1156 }
1157 </code>
1158
1159 <p>As you can see, a filter has a header, a list of local variables, and a body.
1160 The header consists of the <cf/filter/ keyword followed by a (unique) name of
1161 filter. The list of local variables consists of <cf><M>type name</M>;</cf>
1162 pairs where each pair declares one local variable. The body consists of <cf>
1163 { <M>statements</M> }</cf>. Each <m/statement/ is terminated by a <cf/;/. You
1164 can group several statements to a single compound statement by using braces
1165 (<cf>{ <M>statements</M> }</cf>) which is useful if you want to make a bigger
1166 block of code conditional.
1167
1168 <p>BIRD supports functions, so that you don't have to repeat the same blocks of
1169 code over and over. Functions can have zero or more parameters and they can have
1170 local variables. Recursion is not allowed. Function definitions look like this:
1171
1172 <code>
1173 function name ()
1174 int local_variable;
1175 {
1176 local_variable = 5;
1177 }
1178
1179 function with_parameters (int parameter)
1180 {
1181 print parameter;
1182 }
1183 </code>
1184
1185 <p>Unlike in C, variables are declared after the <cf/function/ line, but before
1186 the first <cf/{/. You can't declare variables in nested blocks. Functions are
1187 called like in C: <cf>name(); with_parameters(5);</cf>. Function may return
1188 values using the <cf>return <m/[expr]/</cf> command. Returning a value exits
1189 from current function (this is similar to C).
1190
1191 <p>Filters are defined in a way similar to functions except they can't have
1192 explicit parameters. They get a route table entry as an implicit parameter, it
1193 is also passed automatically to any functions called. The filter must terminate
1194 with either <cf/accept/ or <cf/reject/ statement. If there's a runtime error in
1195 filter, the route is rejected.
1196
1197 <p>A nice trick to debug filters is to use <cf>show route filter <m/name/</cf>
1198 from the command line client. An example session might look like:
1199
1200 <code>
1201 pavel@bug:~/bird$ ./birdc -s bird.ctl
1202 BIRD 0.0.0 ready.
1203 bird> show route
1204 10.0.0.0/8 dev eth0 [direct1 23:21] (240)
1205 195.113.30.2/32 dev tunl1 [direct1 23:21] (240)
1206 127.0.0.0/8 dev lo [direct1 23:21] (240)
1207 bird> show route ?
1208 show route [<prefix>] [table <t>] [filter <f>] [all] [primary]...
1209 bird> show route filter { if 127.0.0.5 &tilde; net then accept; }
1210 127.0.0.0/8 dev lo [direct1 23:21] (240)
1211 bird>
1212 </code>
1213
1214
1215 <sect>Data types
1216 <label id="data-types">
1217
1218 <p>Each variable and each value has certain type. Booleans, integers and enums
1219 are incompatible with each other (that is to prevent you from shooting in the
1220 foot).
1221
1222 <descrip>
1223 <tag><label id="type-bool">bool</tag>
1224 This is a boolean type, it can have only two values, <cf/true/ and
1225 <cf/false/. Boolean is the only type you can use in <cf/if/ statements.
1226
1227 <tag><label id="type-int">int</tag>
1228 This is a general integer type. It is an unsigned 32bit type; i.e., you
1229 can expect it to store values from 0 to 4294967295. Overflows are not
1230 checked. You can use <cf/0x1234/ syntax to write hexadecimal values.
1231
1232 <tag><label id="type-pair">pair</tag>
1233 This is a pair of two short integers. Each component can have values
1234 from 0 to 65535. Literals of this type are written as <cf/(1234,5678)/.
1235 The same syntax can also be used to construct a pair from two arbitrary
1236 integer expressions (for example <cf/(1+2,a)/).
1237
1238 <tag><label id="type-quad">quad</tag>
1239 This is a dotted quad of numbers used to represent router IDs (and
1240 others). Each component can have a value from 0 to 255. Literals of
1241 this type are written like IPv4 addresses.
1242
1243 <tag><label id="type-string">string</tag>
1244 This is a string of characters. There are no ways to modify strings in
1245 filters. You can pass them between functions, assign them to variables
1246 of type <cf/string/, print such variables, use standard string
1247 comparison operations (e.g. <cf/=, !=, &lt;, &gt;, &lt;=, &gt;=/), but
1248 you can't concatenate two strings. String literals are written as
1249 <cf/"This is a string constant"/. Additionally matching (<cf/&tilde;,
1250 !&tilde;/) operators could be used to match a string value against
1251 a shell pattern (represented also as a string).
1252
1253 <tag><label id="type-ip">ip</tag>
1254 This type can hold a single IP address. The IPv4 addresses are stored as
1255 IPv4-Mapped IPv6 addresses so one data type for both of them is used.
1256 Whether the address is IPv4 or not may be checked by <cf>.is_ip4</cf>
1257 which returns <cf/bool/. IP addresses are written in the standard
1258 notation (<cf/10.20.30.40/ or <cf/fec0:3:4::1/). You can apply special
1259 operator <cf>.mask(<M>num</M>)</cf> on values of type ip. It masks out
1260 all but first <cf><M>num</M></cf> bits from the IP address. So
1261 <cf/1.2.3.4.mask(8) = 1.0.0.0/ is true.
1262
1263 <tag><label id="type-prefix">prefix</tag>
1264 This type can hold a network prefix consisting of IP address, prefix
1265 length and several other values. This is the key in route tables.
1266
1267 Prefixes may be of several types, which can be determined by the special
1268 operator <cf/.type/. The type may be:
1269
1270 <cf/NET_IP4/ and <cf/NET_IP6/ prefixes hold an IP prefix. The literals
1271 are written as <cf><m/ipaddress//<m/pxlen/</cf>. There are two special
1272 operators on these: <cf/.ip/ which extracts the IP address from the
1273 pair, and <cf/.len/, which separates prefix length from the pair.
1274 So <cf>1.2.0.0/16.len = 16</cf> is true.
1275
1276 <cf/NET_IP6_SADR/ nettype holds both destination and source IPv6
1277 prefix. The literals are written as <cf><m/ipaddress//<m/pxlen/ from
1278 <m/ipaddress//<m/pxlen/</cf>, where the first part is the destination
1279 prefix and the second art is the source prefix. They support the same
1280 operators as IP prefixes, but just for the destination part.
1281
1282 <cf/NET_VPN4/ and <cf/NET_VPN6/ prefixes hold an IP prefix with VPN
1283 Route Distinguisher (<rfc id="4364">). They support the same special
1284 operators as IP prefixes, and also <cf/.rd/ which extracts the Route
1285 Distinguisher. Their literals are written
1286 as <cf><m/vpnrd/ <m/ipprefix/</cf>
1287
1288 <cf/NET_ROA4/ and <cf/NET_ROA6/ prefixes hold an IP prefix range
1289 together with an ASN. They support the same special operators as IP
1290 prefixes, and also <cf/.maxlen/ which extracts maximal prefix length,
1291 and <cf/.asn/ which extracts the ASN.
1292
1293 <cf/NET_FLOW4/ and <cf/NET_FLOW6/ hold an IP prefix together with a
1294 flowspec rule. Filters currently don't support flowspec parsing.
1295
1296 <cf/NET_MPLS/ holds a single MPLS label and its handling is currently
1297 not implemented.
1298
1299 <tag><label id="type-vpnrd">vpnrd</tag>
1300 This is a route distinguisher according to <rfc id="4364">. There are
1301 three kinds of RD's: <cf><m/asn/:<m/32bit int/</cf>, <cf><m/asn4/:<m/16bit int/</cf>
1302 and <cf><m/IPv4 address/:<m/32bit int/</cf>
1303
1304 <tag><label id="type-ec">ec</tag>
1305 This is a specialized type used to represent BGP extended community
1306 values. It is essentially a 64bit value, literals of this type are
1307 usually written as <cf>(<m/kind/, <m/key/, <m/value/)</cf>, where
1308 <cf/kind/ is a kind of extended community (e.g. <cf/rt/ / <cf/ro/ for a
1309 route target / route origin communities), the format and possible values
1310 of <cf/key/ and <cf/value/ are usually integers, but it depends on the
1311 used kind. Similarly to pairs, ECs can be constructed using expressions
1312 for <cf/key/ and <cf/value/ parts, (e.g. <cf/(ro, myas, 3*10)/, where
1313 <cf/myas/ is an integer variable).
1314
1315 <tag><label id="type-lc">lc</tag>
1316 This is a specialized type used to represent BGP large community
1317 values. It is essentially a triplet of 32bit values, where the first
1318 value is reserved for the AS number of the issuer, while meaning of
1319 remaining parts is defined by the issuer. Literals of this type are
1320 written as <cf/(123, 456, 789)/, with any integer values. Similarly to
1321 pairs, LCs can be constructed using expressions for its parts, (e.g.
1322 <cf/(myas, 10+20, 3*10)/, where <cf/myas/ is an integer variable).
1323
1324 <tag><label id="type-set">int|pair|quad|ip|prefix|ec|lc|enum set</tag>
1325 Filters recognize four types of sets. Sets are similar to strings: you
1326 can pass them around but you can't modify them. Literals of type <cf>int
1327 set</cf> look like <cf> [ 1, 2, 5..7 ]</cf>. As you can see, both simple
1328 values and ranges are permitted in sets.
1329
1330 For pair sets, expressions like <cf/(123,*)/ can be used to denote
1331 ranges (in that case <cf/(123,0)..(123,65535)/). You can also use
1332 <cf/(123,5..100)/ for range <cf/(123,5)..(123,100)/. You can also use
1333 <cf/*/ and <cf/a..b/ expressions in the first part of a pair, note that
1334 such expressions are translated to a set of intervals, which may be
1335 memory intensive. E.g. <cf/(*,4..20)/ is translated to <cf/(0,4..20),
1336 (1,4..20), (2,4..20), ... (65535, 4..20)/.
1337
1338 EC sets use similar expressions like pair sets, e.g. <cf/(rt, 123,
1339 10..20)/ or <cf/(ro, 123, *)/. Expressions requiring the translation
1340 (like <cf/(rt, *, 3)/) are not allowed (as they usually have 4B range
1341 for ASNs).
1342
1343 Also LC sets use similar expressions like pair sets. You can use ranges
1344 and wildcards, but if one field uses that, more specific (later) fields
1345 must be wildcards. E.g., <cf/(10, 20..30, *)/ or <cf/(10, 20, 30..40)/
1346 is valid, while <cf/(10, *, 20..30)/ or <cf/(10, 20..30, 40)/ is not
1347 valid.
1348
1349 You can also use expressions for int, pair, EC and LC set values.
1350 However, it must be possible to evaluate these expressions before daemon
1351 boots. So you can use only constants inside them. E.g.
1352
1353 <code>
1354 define one=1;
1355 define myas=64500;
1356 int set odds;
1357 pair set ps;
1358 ec set es;
1359
1360 odds = [ one, 2+1, 6-one, 2*2*2-1, 9, 11 ];
1361 ps = [ (1,one+one), (3,4)..(4,8), (5,*), (6,3..6), (7..9,*) ];
1362 es = [ (rt, myas, 3*10), (rt, myas+one, 0..16*16*16-1), (ro, myas+2, *) ];
1363 </code>
1364
1365 Sets of prefixes are special: their literals does not allow ranges, but
1366 allows prefix patterns that are written
1367 as <cf><M>ipaddress</M>/<M>pxlen</M>{<M>low</M>,<M>high</M>}</cf>.
1368 Prefix <cf><m>ip1</m>/<m>len1</m></cf> matches prefix
1369 pattern <cf><m>ip2</m>/<m>len2</m>{<m>l</m>,<m>h</m>}</cf> if the
1370 first <cf>min(len1, len2)</cf> bits of <cf/ip1/ and <cf/ip2/ are
1371 identical and <cf>len1 &lt;= ip1 &lt;= len2</cf>. A valid prefix pattern
1372 has to satisfy <cf>low &lt;= high</cf>, but <cf/pxlen/ is not
1373 constrained by <cf/low/ or <cf/high/. Obviously, a prefix matches a
1374 prefix set literal if it matches any prefix pattern in the prefix set
1375 literal.
1376
1377 There are also two shorthands for prefix patterns: <cf><m/address//<m/len/+</cf>
1378 is a shorthand for <cf><m/address//<m/len/{<m/len/,<m/maxlen/}</cf>
1379 (where <cf><m/maxlen/</cf> is 32 for IPv4 and 128 for IPv6), that means
1380 network prefix <cf><m/address//<m/len/</cf> and all its subnets.
1381 <cf><m/address//<m/len/-</cf> is a shorthand for
1382 <cf><m/address//<m/len/{0,<m/len/}</cf>, that means network prefix
1383 <cf><m/address//<m/len/</cf> and all its supernets (network prefixes
1384 that contain it).
1385
1386 For example, <cf>[ 1.0.0.0/8, 2.0.0.0/8+, 3.0.0.0/8-, 4.0.0.0/8{16,24}
1387 ]</cf> matches prefix <cf>1.0.0.0/8</cf>, all subprefixes of
1388 <cf>2.0.0.0/8</cf>, all superprefixes of <cf>3.0.0.0/8</cf> and prefixes
1389 <cf/4.X.X.X/ whose prefix length is 16 to 24. <cf>[ 0.0.0.0/0{20,24} ]</cf>
1390 matches all prefixes (regardless of IP address) whose prefix length is
1391 20 to 24, <cf>[ 1.2.3.4/32- ]</cf> matches any prefix that contains IP
1392 address <cf>1.2.3.4</cf>. <cf>1.2.0.0/16 &tilde; [ 1.0.0.0/8{15,17} ]</cf>
1393 is true, but <cf>1.0.0.0/16 &tilde; [ 1.0.0.0/8- ]</cf> is false.
1394
1395 Cisco-style patterns like <cf>10.0.0.0/8 ge 16 le 24</cf> can be expressed
1396 in BIRD as <cf>10.0.0.0/8{16,24}</cf>, <cf>192.168.0.0/16 le 24</cf> as
1397 <cf>192.168.0.0/16{16,24}</cf> and <cf>192.168.0.0/16 ge 24</cf> as
1398 <cf>192.168.0.0/16{24,32}</cf>.
1399
1400 It is possible to mix IPv4 and IPv6 prefixes/addresses in a prefix/ip set
1401 but its behavior may change between versions without any warning; don't do
1402 it unless you are more than sure what you are doing. (Really, don't do it.)
1403
1404 <tag><label id="type-enum">enum</tag>
1405 Enumeration types are fixed sets of possibilities. You can't define your
1406 own variables of such type, but some route attributes are of enumeration
1407 type. Enumeration types are incompatible with each other.
1408
1409 <tag><label id="type-bgppath">bgppath</tag>
1410 BGP path is a list of autonomous system numbers. You can't write
1411 literals of this type. There are several special operators on bgppaths:
1412
1413 <cf><m/P/.first</cf> returns the first ASN (the neighbor ASN) in path <m/P/.
1414
1415 <cf><m/P/.last</cf> returns the last ASN (the source ASN) in path <m/P/.
1416
1417 <cf><m/P/.last_nonaggregated</cf> returns the last ASN in the non-aggregated part of the path <m/P/.
1418
1419 Both <cf/first/ and <cf/last/ return zero if there is no appropriate
1420 ASN, for example if the path contains an AS set element as the first (or
1421 the last) part. If the path ends with an AS set, <cf/last_nonaggregated/
1422 may be used to get last ASN before any AS set.
1423
1424 <cf><m/P/.len</cf> returns the length of path <m/P/.
1425
1426 <cf><m/P/.empty</cf> makes the path <m/P/ empty.
1427
1428 <cf>prepend(<m/P/,<m/A/)</cf> prepends ASN <m/A/ to path <m/P/ and
1429 returns the result.
1430
1431 <cf>delete(<m/P/,<m/A/)</cf> deletes all instances of ASN <m/A/ from
1432 from path <m/P/ and returns the result. <m/A/ may also be an integer
1433 set, in that case the operator deletes all ASNs from path <m/P/ that are
1434 also members of set <m/A/.
1435
1436 <cf>filter(<m/P/,<m/A/)</cf> deletes all ASNs from path <m/P/ that are
1437 not members of integer set <m/A/. I.e., <cf/filter/ do the same as
1438 <cf/delete/ with inverted set <m/A/.
1439
1440 Statement <cf><m/P/ = prepend(<m/P/, <m/A/);</cf> can be shortened to
1441 <cf><m/P/.prepend(<m/A/);</cf> if <m/P/ is appropriate route attribute
1442 (for example <cf/bgp_path/). Similarly for <cf/delete/ and <cf/filter/.
1443
1444 <tag><label id="type-bgpmask">bgpmask</tag>
1445 BGP masks are patterns used for BGP path matching (using <cf>path
1446 &tilde; [= 2 3 5 * =]</cf> syntax). The masks resemble wildcard patterns
1447 as used by UNIX shells. Autonomous system numbers match themselves,
1448 <cf/*/ matches any (even empty) sequence of arbitrary AS numbers and
1449 <cf/?/ matches one arbitrary AS number. For example, if <cf>bgp_path</cf>
1450 is 4 3 2 1, then: <tt>bgp_path &tilde; [= * 4 3 * =]</tt> is true,
1451 but <tt>bgp_path &tilde; [= * 4 5 * =]</tt> is false. BGP mask
1452 expressions can also contain integer expressions enclosed in parenthesis
1453 and integer variables, for example <tt>[= * 4 (1+2) a =]</tt>. You can
1454 also use ranges, for example <tt>[= * 3..5 2 100..200 * =]</tt>.
1455
1456 <tag><label id="type-clist">clist</tag>
1457 Clist is similar to a set, except that unlike other sets, it can be
1458 modified. The type is used for community list (a set of pairs) and for
1459 cluster list (a set of quads). There exist no literals of this type.
1460 There are three special operators on clists:
1461
1462 <cf><m/C/.len</cf> returns the length of clist <m/C/.
1463
1464 <cf><m/C/.empty</cf> makes the list <m/C/ empty.
1465
1466 <cf>add(<m/C/,<m/P/)</cf> adds pair (or quad) <m/P/ to clist <m/C/ and
1467 returns the result. If item <m/P/ is already in clist <m/C/, it does
1468 nothing. <m/P/ may also be a clist, in that case all its members are
1469 added; i.e., it works as clist union.
1470
1471 <cf>delete(<m/C/,<m/P/)</cf> deletes pair (or quad) <m/P/ from clist
1472 <m/C/ and returns the result. If clist <m/C/ does not contain item
1473 <m/P/, it does nothing. <m/P/ may also be a pair (or quad) set, in that
1474 case the operator deletes all items from clist <m/C/ that are also
1475 members of set <m/P/. Moreover, <m/P/ may also be a clist, which works
1476 analogously; i.e., it works as clist difference.
1477
1478 <cf>filter(<m/C/,<m/P/)</cf> deletes all items from clist <m/C/ that are
1479 not members of pair (or quad) set <m/P/. I.e., <cf/filter/ do the same
1480 as <cf/delete/ with inverted set <m/P/. <m/P/ may also be a clist, which
1481 works analogously; i.e., it works as clist intersection.
1482
1483 Statement <cf><m/C/ = add(<m/C/, <m/P/);</cf> can be shortened to
1484 <cf><m/C/.add(<m/P/);</cf> if <m/C/ is appropriate route attribute (for
1485 example <cf/bgp_community/). Similarly for <cf/delete/ and <cf/filter/.
1486
1487 <tag><label id="type-eclist">eclist</tag>
1488 Eclist is a data type used for BGP extended community lists. Eclists
1489 are very similar to clists, but they are sets of ECs instead of pairs.
1490 The same operations (like <cf/add/, <cf/delete/ or <cf/&tilde;/ and
1491 <cf/!&tilde;/ membership operators) can be used to modify or test
1492 eclists, with ECs instead of pairs as arguments.
1493
1494 <tag><label id="type-lclist">lclist/</tag>
1495 Lclist is a data type used for BGP large community lists. Like eclists,
1496 lclists are very similar to clists, but they are sets of LCs instead of
1497 pairs. The same operations (like <cf/add/, <cf/delete/ or <cf/&tilde;/
1498 and <cf/!&tilde;/ membership operators) can be used to modify or test
1499 lclists, with LCs instead of pairs as arguments.
1500 </descrip>
1501
1502
1503 <sect>Operators
1504 <label id="operators">
1505
1506 <p>The filter language supports common integer operators <cf>(+,-,*,/)</cf>,
1507 parentheses <cf/(a*(b+c))/, comparison <cf/(a=b, a!=b, a&lt;b, a&gt;=b)/.
1508 Logical operations include unary not (<cf/!/), and (<cf/&amp;&amp;/), and or
1509 (<cf/&verbar;&verbar;/). Special operators include (<cf/&tilde;/,
1510 <cf/!&tilde;/) for "is (not) element of a set" operation - it can be used on
1511 element and set of elements of the same type (returning true if element is
1512 contained in the given set), or on two strings (returning true if first string
1513 matches a shell-like pattern stored in second string) or on IP and prefix
1514 (returning true if IP is within the range defined by that prefix), or on prefix
1515 and prefix (returning true if first prefix is more specific than second one) or
1516 on bgppath and bgpmask (returning true if the path matches the mask) or on
1517 number and bgppath (returning true if the number is in the path) or on bgppath
1518 and int (number) set (returning true if any ASN from the path is in the set) or
1519 on pair/quad and clist (returning true if the pair/quad is element of the
1520 clist) or on clist and pair/quad set (returning true if there is an element of
1521 the clist that is also a member of the pair/quad set).
1522
1523 <p>There is one operator related to ROA infrastructure - <cf/roa_check()/. It
1524 examines a ROA table and does <rfc id="6483"> route origin validation for a
1525 given network prefix. The basic usage is <cf>roa_check(<m/table/)</cf>, which
1526 checks current route (which should be from BGP to have AS_PATH argument) in the
1527 specified ROA table and returns ROA_UNKNOWN if there is no relevant ROA,
1528 ROA_VALID if there is a matching ROA, or ROA_INVALID if there are some relevant
1529 ROAs but none of them match. There is also an extended variant
1530 <cf>roa_check(<m/table/, <m/prefix/, <m/asn/)</cf>, which allows to specify a
1531 prefix and an ASN as arguments.
1532
1533
1534 <sect>Control structures
1535 <label id="control-structures">
1536
1537 <p>Filters support two control structures: conditions and case switches.
1538
1539 <p>Syntax of a condition is: <cf>if <M>boolean expression</M> then <m/commandT/;
1540 else <m/commandF/;</cf> and you can use <cf>{ <m/command1/; <m/command2/;
1541 <M>...</M> }</cf> instead of either command. The <cf>else</cf> clause may be
1542 omitted. If the <cf><m>boolean expression</m></cf> is true, <m/commandT/ is
1543 executed, otherwise <m/commandF/ is executed.
1544
1545 <p>The <cf>case</cf> is similar to case from Pascal. Syntax is <cf>case
1546 <m/expr/ { else: | <m/num_or_prefix [ .. num_or_prefix]/: <m/statement/ ; [
1547 ... ] }</cf>. The expression after <cf>case</cf> can be of any type which can be
1548 on the left side of the &tilde; operator and anything that could be a member of
1549 a set is allowed before <cf/:/. Multiple commands are allowed without <cf/{}/
1550 grouping. If <cf><m/expr/</cf> matches one of the <cf/:/ clauses, statements
1551 between it and next <cf/:/ statement are executed. If <cf><m/expr/</cf> matches
1552 neither of the <cf/:/ clauses, the statements after <cf/else:/ are executed.
1553
1554 <p>Here is example that uses <cf/if/ and <cf/case/ structures:
1555
1556 <code>
1557 case arg1 {
1558 2: print "two"; print "I can do more commands without {}";
1559 3 .. 5: print "three to five";
1560 else: print "something else";
1561 }
1562
1563 if 1234 = i then printn "."; else {
1564 print "not 1234";
1565 print "You need {} around multiple commands";
1566 }
1567 </code>
1568
1569
1570 <sect>Route attributes
1571 <label id="route-attributes">
1572
1573 <p>A filter is implicitly passed a route, and it can access its attributes just
1574 like it accesses variables. There are common route attributes, protocol-specific
1575 route attributes and custom route attributes. Most common attributes are
1576 mandatory (always defined), while remaining are optional. Attempts to access
1577 undefined attribute result in a runtime error; you can check if an attribute is
1578 defined by using the <cf>defined( <m>attribute</m> )</cf> operator. One notable
1579 exception to this rule are attributes of bgppath and *clist types, where
1580 undefined value is regarded as empty bgppath/*clist for most purposes.
1581
1582 Attributes can be defined by just setting them in filters. Custom attributes
1583 have to be first declared by <ref id="opt-attribute" name="attribute"> global
1584 option. You can also undefine optional attribute back to non-existence by using
1585 the <cf>unset( <m/attribute/ )</cf> operator.
1586
1587 Common route attributes are:
1588
1589 <descrip>
1590 <tag><label id="rta-net"><m/prefix/ net</tag>
1591 The network prefix or anything else the route is talking about. The
1592 primary key of the routing table. Read-only. (See the <ref id="routes"
1593 name="chapter about routes">.)
1594
1595 <tag><label id="rta-scope"><m/enum/ scope</tag>
1596 The scope of the route. Possible values: <cf/SCOPE_HOST/ for routes
1597 local to this host, <cf/SCOPE_LINK/ for those specific for a physical
1598 link, <cf/SCOPE_SITE/ and <cf/SCOPE_ORGANIZATION/ for private routes and
1599 <cf/SCOPE_UNIVERSE/ for globally visible routes. This attribute is not
1600 interpreted by BIRD and can be used to mark routes in filters. The
1601 default value for new routes is <cf/SCOPE_UNIVERSE/.
1602
1603 <tag><label id="rta-preference"><m/int/ preference</tag>
1604 Preference of the route. Valid values are 0-65535. (See the chapter
1605 about routing tables.)
1606
1607 <tag><label id="rta-from"><m/ip/ from</tag>
1608 The router which the route has originated from.
1609
1610 <tag><label id="rta-gw"><m/ip/ gw</tag>
1611 Next hop packets routed using this route should be forwarded to.
1612
1613 <tag><label id="rta-proto"><m/string/ proto</tag>
1614 The name of the protocol which the route has been imported from.
1615 Read-only.
1616
1617 <tag><label id="rta-source"><m/enum/ source</tag>
1618 what protocol has told me about this route. Possible values:
1619 <cf/RTS_DUMMY/, <cf/RTS_STATIC/, <cf/RTS_INHERIT/, <cf/RTS_DEVICE/,
1620 <cf/RTS_STATIC_DEVICE/, <cf/RTS_REDIRECT/, <cf/RTS_RIP/, <cf/RTS_OSPF/,
1621 <cf/RTS_OSPF_IA/, <cf/RTS_OSPF_EXT1/, <cf/RTS_OSPF_EXT2/, <cf/RTS_BGP/,
1622 <cf/RTS_PIPE/, <cf/RTS_BABEL/.
1623
1624 <tag><label id="rta-dest"><m/enum/ dest</tag>
1625 Type of destination the packets should be sent to
1626 (<cf/RTD_ROUTER/ for forwarding to a neighboring router,
1627 <cf/RTD_DEVICE/ for routing to a directly-connected network,
1628 <cf/RTD_MULTIPATH/ for multipath destinations,
1629 <cf/RTD_BLACKHOLE/ for packets to be silently discarded,
1630 <cf/RTD_UNREACHABLE/, <cf/RTD_PROHIBIT/ for packets that should be
1631 returned with ICMP host unreachable / ICMP administratively prohibited
1632 messages). Can be changed, but only to <cf/RTD_BLACKHOLE/,
1633 <cf/RTD_UNREACHABLE/ or <cf/RTD_PROHIBIT/.
1634
1635 <tag><label id="rta-ifname"><m/string/ ifname</tag>
1636 Name of the outgoing interface. Sink routes (like blackhole, unreachable
1637 or prohibit) and multipath routes have no interface associated with
1638 them, so <cf/ifname/ returns an empty string for such routes. Setting it
1639 would also change route to a direct one (remove gateway).
1640
1641 <tag><label id="rta-ifindex"><m/int/ ifindex</tag>
1642 Index of the outgoing interface. System wide index of the interface. May
1643 be used for interface matching, however indexes might change on interface
1644 creation/removal. Zero is returned for routes with undefined outgoing
1645 interfaces. Read-only.
1646
1647 <tag><label id="rta-igp-metric"><m/int/ igp_metric</tag>
1648 The optional attribute that can be used to specify a distance to the
1649 network for routes that do not have a native protocol metric attribute
1650 (like <cf/ospf_metric1/ for OSPF routes). It is used mainly by BGP to
1651 compare internal distances to boundary routers (see below).
1652 </descrip>
1653
1654 <p>Protocol-specific route attributes are described in the corresponding
1655 protocol sections.
1656
1657
1658 <sect>Other statements
1659 <label id="other-statements">
1660
1661 <p>The following statements are available:
1662
1663 <descrip>
1664 <tag><label id="assignment"><m/variable/ = <m/expr/</tag>
1665 Set variable (or route attribute) to a given value.
1666
1667 <tag><label id="filter-accept-reject">accept|reject [ <m/expr/ ]</tag>
1668 Accept or reject the route, possibly printing <cf><m>expr</m></cf>.
1669
1670 <tag><label id="return">return <m/expr/</tag>
1671 Return <cf><m>expr</m></cf> from the current function, the function ends
1672 at this point.
1673
1674 <tag><label id="print">print|printn <m/expr/ [<m/, expr.../]</tag>
1675 Prints given expressions; useful mainly while debugging filters. The
1676 <cf/printn/ variant does not terminate the line.
1677
1678 <tag><label id="quitbird">quitbird</tag>
1679 Terminates BIRD. Useful when debugging the filter interpreter.
1680 </descrip>
1681
1682
1683 <chapt>Protocols
1684 <label id="protocols">
1685
1686 <sect>Babel
1687 <label id="babel">
1688
1689 <sect1>Introduction
1690 <label id="babel-intro">
1691
1692 <p>The Babel protocol
1693 (<rfc id="6126">) is a loop-avoiding distance-vector routing protocol that is
1694 robust and efficient both in ordinary wired networks and in wireless mesh
1695 networks. Babel is conceptually very simple in its operation and "just works"
1696 in its default configuration, though some configuration is possible and in some
1697 cases desirable.
1698
1699 <p>The Babel protocol is dual stack; i.e., it can carry both IPv4 and IPv6
1700 routes over the same IPv6 transport. For sending and receiving Babel packets,
1701 only a link-local IPv6 address is needed.
1702
1703 <p>BIRD implements an extension for IPv6 source-specific routing (SSR or SADR),
1704 but must be configured accordingly to use it. SADR-enabled Babel router can
1705 interoperate with non-SADR Babel router, but the later would ignore routes
1706 with specific (non-zero) source prefix.
1707
1708 <sect1>Configuration
1709 <label id="babel-config">
1710
1711 <p>The Babel protocol support both IPv4 and IPv6 channels; both can be
1712 configured simultaneously. It can also be configured with <ref
1713 id="ip-sadr-routes" name="IPv6 SADR"> channel instead of regular IPv6
1714 channel, in such case SADR support is enabled. Babel supports no global
1715 configuration options apart from those common to all other protocols, but
1716 supports the following per-interface configuration options:
1717
1718 <code>
1719 protocol babel [<name>] {
1720 ipv4 { <channel config> };
1721 ipv6 [sadr] { <channel config> };
1722 randomize router id <switch>;
1723 interface <interface pattern> {
1724 type <wired|wireless>;
1725 rxcost <number>;
1726 limit <number>;
1727 hello interval <time>;
1728 update interval <time>;
1729 port <number>;
1730 tx class|dscp <number>;
1731 tx priority <number>;
1732 rx buffer <number>;
1733 tx length <number>;
1734 check link <switch>;
1735 next hop ipv4 <address>;
1736 next hop ipv6 <address>;
1737 };
1738 }
1739 </code>
1740
1741 <descrip>
1742 <tag><label id="babel-channel">ipv4 | ipv6 [sadr] <m/channel config/</tag>
1743 The supported channels are IPv4, IPv6, and IPv6 SADR.
1744
1745 <tag><label id="babel-random-router-id">randomize router id <m/switch/</tag>
1746 If enabled, Bird will randomize the top 32 bits of its router ID whenever
1747 the protocol instance starts up. If a Babel node restarts, it loses its
1748 sequence number, which can cause its routes to be rejected by peers until
1749 the state is cleared out by other nodes in the network (which can take on
1750 the order of minutes). Enabling this option causes Bird to pick a random
1751 router ID every time it starts up, which avoids this problem at the cost
1752 of not having stable router IDs in the network. Default: no.
1753
1754 <tag><label id="babel-type">type wired|wireless </tag>
1755 This option specifies the interface type: Wired or wireless. On wired
1756 interfaces a neighbor is considered unreachable after a small number of
1757 Hello packets are lost, as described by <cf/limit/ option. On wireless
1758 interfaces the ETX link quality estimation technique is used to compute
1759 the metrics of routes discovered over this interface. This technique will
1760 gradually degrade the metric of routes when packets are lost rather than
1761 the more binary up/down mechanism of wired type links. Default:
1762 <cf/wired/.
1763
1764 <tag><label id="babel-rxcost">rxcost <m/num/</tag>
1765 This option specifies the nominal RX cost of the interface. The effective
1766 neighbor costs for route metrics will be computed from this value with a
1767 mechanism determined by the interface <cf/type/. Note that in contrast to
1768 other routing protocols like RIP or OSPF, the <cf/rxcost/ specifies the
1769 cost of RX instead of TX, so it affects primarily neighbors' route
1770 selection and not local route selection. Default: 96 for wired interfaces,
1771 256 for wireless.
1772
1773 <tag><label id="babel-limit">limit <m/num/</tag>
1774 BIRD keeps track of received Hello messages from each neighbor to
1775 establish neighbor reachability. For wired type interfaces, this option
1776 specifies how many of last 16 hellos have to be correctly received in
1777 order to neighbor is assumed to be up. The option is ignored on wireless
1778 type interfaces, where gradual cost degradation is used instead of sharp
1779 limit. Default: 12.
1780
1781 <tag><label id="babel-hello">hello interval <m/time/ s|ms</tag>
1782 Interval at which periodic Hello messages are sent on this interface,
1783 with time units. Default: 4 seconds.
1784
1785 <tag><label id="babel-update">update interval <m/time/ s|ms</tag>
1786 Interval at which periodic (full) updates are sent, with time
1787 units. Default: 4 times the hello interval.
1788
1789 <tag><label id="babel-port">port <m/number/</tag>
1790 This option selects an UDP port to operate on. The default is to operate
1791 on port 6696 as specified in the Babel RFC.
1792
1793 <tag><label id="babel-tx-class">tx class|dscp|priority <m/number/</tag>
1794 These options specify the ToS/DiffServ/Traffic class/Priority of the
1795 outgoing Babel packets. See <ref id="proto-tx-class" name="tx class"> common
1796 option for detailed description.
1797
1798 <tag><label id="babel-rx-buffer">rx buffer <m/number/</tag>
1799 This option specifies the size of buffers used for packet processing.
1800 The buffer size should be bigger than maximal size of received packets.
1801 The default value is the interface MTU, and the value will be clamped to a
1802 minimum of 512 bytes + IP packet overhead.
1803
1804 <tag><label id="babel-tx-length">tx length <m/number/</tag>
1805 This option specifies the maximum length of generated Babel packets. To
1806 avoid IP fragmentation, it should not exceed the interface MTU value.
1807 The default value is the interface MTU value, and the value will be
1808 clamped to a minimum of 512 bytes + IP packet overhead.
1809
1810 <tag><label id="babel-check-link">check link <m/switch/</tag>
1811 If set, the hardware link state (as reported by OS) is taken into
1812 consideration. When the link disappears (e.g. an ethernet cable is
1813 unplugged), neighbors are immediately considered unreachable and all
1814 routes received from them are withdrawn. It is possible that some
1815 hardware drivers or platforms do not implement this feature. Default:
1816 yes.
1817
1818 <tag><label id="babel-next-hop-ipv4">next hop ipv4 <m/address/</tag>
1819 Set the next hop address advertised for IPv4 routes advertised on this
1820 interface. Default: the preferred IPv4 address of the interface.
1821
1822 <tag><label id="babel-next-hop-ipv6">next hop ipv6 <m/address/</tag>
1823 Set the next hop address advertised for IPv6 routes advertised on this
1824 interface. If not set, the same link-local address that is used as the
1825 source for Babel packets will be used. In normal operation, it should not
1826 be necessary to set this option.
1827 </descrip>
1828
1829 <sect1>Attributes
1830 <label id="babel-attr">
1831
1832 <p>Babel defines just one attribute: the internal babel metric of the route. It
1833 is exposed as the <cf/babel_metric/ attribute and has range from 1 to infinity
1834 (65535).
1835
1836 <sect1>Example
1837 <label id="babel-exam">
1838
1839 <p><code>
1840 protocol babel {
1841 interface "eth*" {
1842 type wired;
1843 };
1844 interface "wlan0", "wlan1" {
1845 type wireless;
1846 hello interval 1;
1847 rxcost 512;
1848 };
1849 interface "tap0";
1850
1851 # This matches the default of babeld: redistribute all addresses
1852 # configured on local interfaces, plus re-distribute all routes received
1853 # from other babel peers.
1854
1855 ipv4 {
1856 export where (source = RTS_DEVICE) || (source = RTS_BABEL);
1857 };
1858 ipv6 {
1859 export where (source = RTS_DEVICE) || (source = RTS_BABEL);
1860 };
1861 }
1862 </code>
1863
1864 <sect1>Known issues
1865 <label id="babel-issues">
1866
1867 <p>When retracting a route, Babel generates an unreachable route for a little
1868 while (according to RFC). The interaction of this behavior with other protocols
1869 is not well tested and strange things may happen.
1870
1871
1872 <sect>BFD
1873 <label id="bfd">
1874
1875 <sect1>Introduction
1876 <label id="bfd-intro">
1877
1878 <p>Bidirectional Forwarding Detection (BFD) is not a routing protocol itself, it
1879 is an independent tool providing liveness and failure detection. Routing
1880 protocols like OSPF and BGP use integrated periodic "hello" messages to monitor
1881 liveness of neighbors, but detection times of these mechanisms are high (e.g. 40
1882 seconds by default in OSPF, could be set down to several seconds). BFD offers
1883 universal, fast and low-overhead mechanism for failure detection, which could be
1884 attached to any routing protocol in an advisory role.
1885
1886 <p>BFD consists of mostly independent BFD sessions. Each session monitors an
1887 unicast bidirectional path between two BFD-enabled routers. This is done by
1888 periodically sending control packets in both directions. BFD does not handle
1889 neighbor discovery, BFD sessions are created on demand by request of other
1890 protocols (like OSPF or BGP), which supply appropriate information like IP
1891 addresses and associated interfaces. When a session changes its state, these
1892 protocols are notified and act accordingly (e.g. break an OSPF adjacency when
1893 the BFD session went down).
1894
1895 <p>BIRD implements basic BFD behavior as defined in <rfc id="5880"> (some
1896 advanced features like the echo mode or authentication are not implemented), IP
1897 transport for BFD as defined in <rfc id="5881"> and <rfc id="5883"> and
1898 interaction with client protocols as defined in <rfc id="5882">.
1899 We currently support at most one protocol instance.
1900
1901 <p>BFD packets are sent with a dynamic source port number. Linux systems use by
1902 default a bit different dynamic port range than the IANA approved one
1903 (49152-65535). If you experience problems with compatibility, please adjust
1904 <cf>/proc/sys/net/ipv4/ip_local_port_range</cf>
1905
1906 <sect1>Configuration
1907 <label id="bfd-config">
1908
1909 <p>BFD configuration consists mainly of multiple definitions of interfaces.
1910 Most BFD config options are session specific. When a new session is requested
1911 and dynamically created, it is configured from one of these definitions. For
1912 sessions to directly connected neighbors, <cf/interface/ definitions are chosen
1913 based on the interface associated with the session, while <cf/multihop/
1914 definition is used for multihop sessions. If no definition is relevant, the
1915 session is just created with the default configuration. Therefore, an empty BFD
1916 configuration is often sufficient.
1917
1918 <p>Note that to use BFD for other protocols like OSPF or BGP, these protocols
1919 also have to be configured to request BFD sessions, usually by <cf/bfd/ option.
1920
1921 <p>Some of BFD session options require <m/time/ value, which has to be specified
1922 with the appropriate unit: <m/num/ <cf/s/|<cf/ms/|<cf/us/. Although microseconds
1923 are allowed as units, practical minimum values are usually in order of tens of
1924 milliseconds.
1925
1926 <code>
1927 protocol bfd [&lt;name&gt;] {
1928 interface &lt;interface pattern&gt; {
1929 interval &lt;time&gt;;
1930 min rx interval &lt;time&gt;;
1931 min tx interval &lt;time&gt;;
1932 idle tx interval &lt;time&gt;;
1933 multiplier &lt;num&gt;;
1934 passive &lt;switch&gt;;
1935 authentication none;
1936 authentication simple;
1937 authentication [meticulous] keyed md5|sha1;
1938 password "&lt;text&gt;";
1939 password "&lt;text&gt;" {
1940 id &lt;num&gt;;
1941 generate from "&lt;date&gt;";
1942 generate to "&lt;date&gt;";
1943 accept from "&lt;date&gt;";
1944 accept to "&lt;date&gt;";
1945 from "&lt;date&gt;";
1946 to "&lt;date&gt;";
1947 };
1948 };
1949 multihop {
1950 interval &lt;time&gt;;
1951 min rx interval &lt;time&gt;;
1952 min tx interval &lt;time&gt;;
1953 idle tx interval &lt;time&gt;;
1954 multiplier &lt;num&gt;;
1955 passive &lt;switch&gt;;
1956 };
1957 neighbor &lt;ip&gt; [dev "&lt;interface&gt;"] [local &lt;ip&gt;] [multihop &lt;switch&gt;];
1958 }
1959 </code>
1960
1961 <descrip>
1962 <tag><label id="bfd-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag>
1963 Interface definitions allow to specify options for sessions associated
1964 with such interfaces and also may contain interface specific options.
1965 See <ref id="proto-iface" name="interface"> common option for a detailed
1966 description of interface patterns. Note that contrary to the behavior of
1967 <cf/interface/ definitions of other protocols, BFD protocol would accept
1968 sessions (in default configuration) even on interfaces not covered by
1969 such definitions.
1970
1971 <tag><label id="bfd-multihop">multihop { <m/options/ }</tag>
1972 Multihop definitions allow to specify options for multihop BFD sessions,
1973 in the same manner as <cf/interface/ definitions are used for directly
1974 connected sessions. Currently only one such definition (for all multihop
1975 sessions) could be used.
1976
1977 <tag><label id="bfd-neighbor">neighbor <m/ip/ [dev "<m/interface/"] [local <m/ip/] [multihop <m/switch/]</tag>
1978 BFD sessions are usually created on demand as requested by other
1979 protocols (like OSPF or BGP). This option allows to explicitly add
1980 a BFD session to the specified neighbor regardless of such requests.
1981
1982 The session is identified by the IP address of the neighbor, with
1983 optional specification of used interface and local IP. By default
1984 the neighbor must be directly connected, unless the session is
1985 configured as multihop. Note that local IP must be specified for
1986 multihop sessions.
1987 </descrip>
1988
1989 <p>Session specific options (part of <cf/interface/ and <cf/multihop/ definitions):
1990
1991 <descrip>
1992 <tag><label id="bfd-interval">interval <m/time/</tag>
1993 BFD ensures availability of the forwarding path associated with the
1994 session by periodically sending BFD control packets in both
1995 directions. The rate of such packets is controlled by two options,
1996 <cf/min rx interval/ and <cf/min tx interval/ (see below). This option
1997 is just a shorthand to set both of these options together.
1998
1999 <tag><label id="bfd-min-rx-interval">min rx interval <m/time/</tag>
2000 This option specifies the minimum RX interval, which is announced to the
2001 neighbor and used there to limit the neighbor's rate of generated BFD
2002 control packets. Default: 10 ms.
2003
2004 <tag><label id="bfd-min-tx-interval">min tx interval <m/time/</tag>
2005 This option specifies the desired TX interval, which controls the rate
2006 of generated BFD control packets (together with <cf/min rx interval/
2007 announced by the neighbor). Note that this value is used only if the BFD
2008 session is up, otherwise the value of <cf/idle tx interval/ is used
2009 instead. Default: 100 ms.
2010
2011 <tag><label id="bfd-idle-tx-interval">idle tx interval <m/time/</tag>
2012 In order to limit unnecessary traffic in cases where a neighbor is not
2013 available or not running BFD, the rate of generated BFD control packets
2014 is lower when the BFD session is not up. This option specifies the
2015 desired TX interval in such cases instead of <cf/min tx interval/.
2016 Default: 1 s.
2017
2018 <tag><label id="bfd-multiplier">multiplier <m/num/</tag>
2019 Failure detection time for BFD sessions is based on established rate of
2020 BFD control packets (<cf>min rx/tx interval</cf>) multiplied by this
2021 multiplier, which is essentially (ignoring jitter) a number of missed
2022 packets after which the session is declared down. Note that rates and
2023 multipliers could be different in each direction of a BFD session.
2024 Default: 5.
2025
2026 <tag><label id="bfd-passive">passive <m/switch/</tag>
2027 Generally, both BFD session endpoints try to establish the session by
2028 sending control packets to the other side. This option allows to enable
2029 passive mode, which means that the router does not send BFD packets
2030 until it has received one from the other side. Default: disabled.
2031
2032 <tag>authentication none</tag>
2033 No passwords are sent in BFD packets. This is the default value.
2034
2035 <tag>authentication simple</tag>
2036 Every packet carries 16 bytes of password. Received packets lacking this
2037 password are ignored. This authentication mechanism is very weak.
2038
2039 <tag>authentication [meticulous] keyed md5|sha1</tag>
2040 An authentication code is appended to each packet. The cryptographic
2041 algorithm is keyed MD5 or keyed SHA-1. Note that the algorithm is common
2042 for all keys (on one interface), in contrast to OSPF or RIP, where it
2043 is a per-key option. Passwords (keys) are not sent open via network.
2044
2045 The <cf/meticulous/ variant means that cryptographic sequence numbers
2046 are increased for each sent packet, while in the basic variant they are
2047 increased about once per second. Generally, the <cf/meticulous/ variant
2048 offers better resistance to replay attacks but may require more
2049 computation.
2050
2051 <tag>password "<M>text</M>"</tag>
2052 Specifies a password used for authentication. See <ref id="proto-pass"
2053 name="password"> common option for detailed description. Note that
2054 password option <cf/algorithm/ is not available in BFD protocol. The
2055 algorithm is selected by <cf/authentication/ option for all passwords.
2056
2057 </descrip>
2058
2059 <sect1>Example
2060 <label id="bfd-exam">
2061
2062 <p><code>
2063 protocol bfd {
2064 interface "eth*" {
2065 min rx interval 20 ms;
2066 min tx interval 50 ms;
2067 idle tx interval 300 ms;
2068 };
2069 interface "gre*" {
2070 interval 200 ms;
2071 multiplier 10;
2072 passive;
2073 };
2074 multihop {
2075 interval 200 ms;
2076 multiplier 10;
2077 };
2078
2079 neighbor 192.168.1.10;
2080 neighbor 192.168.2.2 dev "eth2";
2081 neighbor 192.168.10.1 local 192.168.1.1 multihop;
2082 }
2083 </code>
2084
2085
2086 <sect>BGP
2087 <label id="bgp">
2088
2089 <p>The Border Gateway Protocol is the routing protocol used for backbone level
2090 routing in the today's Internet. Contrary to other protocols, its convergence
2091 does not rely on all routers following the same rules for route selection,
2092 making it possible to implement any routing policy at any router in the network,
2093 the only restriction being that if a router advertises a route, it must accept
2094 and forward packets according to it.
2095
2096 <p>BGP works in terms of autonomous systems (often abbreviated as AS). Each AS
2097 is a part of the network with common management and common routing policy. It is
2098 identified by a unique 16-bit number (ASN). Routers within each AS usually
2099 exchange AS-internal routing information with each other using an interior
2100 gateway protocol (IGP, such as OSPF or RIP). Boundary routers at the border of
2101 the AS communicate global (inter-AS) network reachability information with their
2102 neighbors in the neighboring AS'es via exterior BGP (eBGP) and redistribute
2103 received information to other routers in the AS via interior BGP (iBGP).
2104
2105 <p>Each BGP router sends to its neighbors updates of the parts of its routing
2106 table it wishes to export along with complete path information (a list of AS'es
2107 the packet will travel through if it uses the particular route) in order to
2108 avoid routing loops.
2109
2110 <sect1>Supported standards
2111 <label id="bgp-standards">
2112
2113 <p>
2114 <itemize>
2115 <item> <rfc id="4271"> - Border Gateway Protocol 4 (BGP)
2116 <item> <rfc id="1997"> - BGP Communities Attribute
2117 <item> <rfc id="2385"> - Protection of BGP Sessions via TCP MD5 Signature
2118 <item> <rfc id="2545"> - Use of BGP Multiprotocol Extensions for IPv6
2119 <item> <rfc id="2918"> - Route Refresh Capability
2120 <item> <rfc id="3107"> - Carrying Label Information in BGP
2121 <item> <rfc id="4360"> - BGP Extended Communities Attribute
2122 <item> <rfc id="4364"> - BGP/MPLS IPv4 Virtual Private Networks
2123 <item> <rfc id="4456"> - BGP Route Reflection
2124 <item> <rfc id="4486"> - Subcodes for BGP Cease Notification Message
2125 <item> <rfc id="4659"> - BGP/MPLS IPv6 Virtual Private Networks
2126 <item> <rfc id="4724"> - Graceful Restart Mechanism for BGP
2127 <item> <rfc id="4760"> - Multiprotocol extensions for BGP
2128 <item> <rfc id="4798"> - Connecting IPv6 Islands over IPv4 MPLS
2129 <item> <rfc id="5065"> - AS confederations for BGP
2130 <item> <rfc id="5082"> - Generalized TTL Security Mechanism
2131 <item> <rfc id="5492"> - Capabilities Advertisement with BGP
2132 <item> <rfc id="5549"> - Advertising IPv4 NLRI with an IPv6 Next Hop
2133 <item> <rfc id="5575"> - Dissemination of Flow Specification Rules
2134 <item> <rfc id="5668"> - 4-Octet AS Specific BGP Extended Community
2135 <item> <rfc id="6286"> - AS-Wide Unique BGP Identifier
2136 <item> <rfc id="6608"> - Subcodes for BGP Finite State Machine Error
2137 <item> <rfc id="6793"> - BGP Support for 4-Octet AS Numbers
2138 <item> <rfc id="7313"> - Enhanced Route Refresh Capability for BGP
2139 <item> <rfc id="7606"> - Revised Error Handling for BGP UPDATE Messages
2140 <item> <rfc id="7911"> - Advertisement of Multiple Paths in BGP
2141 <item> <rfc id="7947"> - Internet Exchange BGP Route Server
2142 <item> <rfc id="8092"> - BGP Large Communities Attribute
2143 <item> <rfc id="8203"> - BGP Administrative Shutdown Communication
2144 <item> <rfc id="8212"> - Default EBGP Route Propagation Behavior without Policies
2145 </itemize>
2146
2147 <sect1>Route selection rules
2148 <label id="bgp-route-select-rules">
2149
2150 <p>BGP doesn't have any simple metric, so the rules for selection of an optimal
2151 route among multiple BGP routes with the same preference are a bit more complex
2152 and they are implemented according to the following algorithm. It starts the
2153 first rule, if there are more "best" routes, then it uses the second rule to
2154 choose among them and so on.
2155
2156 <itemize>
2157 <item>Prefer route with the highest Local Preference attribute.
2158 <item>Prefer route with the shortest AS path.
2159 <item>Prefer IGP origin over EGP and EGP origin over incomplete.
2160 <item>Prefer the lowest value of the Multiple Exit Discriminator.
2161 <item>Prefer routes received via eBGP over ones received via iBGP.
2162 <item>Prefer routes with lower internal distance to a boundary router.
2163 <item>Prefer the route with the lowest value of router ID of the
2164 advertising router.
2165 </itemize>
2166
2167 <sect1>IGP routing table
2168 <label id="bgp-igp-routing-table">
2169
2170 <p>BGP is mainly concerned with global network reachability and with routes to
2171 other autonomous systems. When such routes are redistributed to routers in the
2172 AS via BGP, they contain IP addresses of a boundary routers (in route attribute
2173 NEXT_HOP). BGP depends on existing IGP routing table with AS-internal routes to
2174 determine immediate next hops for routes and to know their internal distances to
2175 boundary routers for the purpose of BGP route selection. In BIRD, there is
2176 usually one routing table used for both IGP routes and BGP routes.
2177
2178 <sect1>Protocol configuration
2179 <label id="bgp-proto-config">
2180
2181 <p>Each instance of the BGP corresponds to one neighboring router. This allows
2182 to set routing policy and all the other parameters differently for each neighbor
2183 using the following configuration parameters:
2184
2185 <descrip>
2186 <tag><label id="bgp-local">local [<m/ip/] [port <m/number/] [as <m/number/]</tag>
2187 Define which AS we are part of. (Note that contrary to other IP routers,
2188 BIRD is able to act as a router located in multiple AS'es simultaneously,
2189 but in such cases you need to tweak the BGP paths manually in the filters
2190 to get consistent behavior.) Optional <cf/ip/ argument specifies a source
2191 address, equivalent to the <cf/source address/ option (see below).
2192 Optional <cf/port/ argument specifies the local BGP port instead of
2193 standard port 179. The parameter may be used multiple times with
2194 different sub-options (e.g., both <cf/local 10.0.0.1 as 65000;/ and
2195 <cf/local 10.0.0.1; local as 65000;/ are valid). This parameter is
2196 mandatory.
2197
2198 <tag><label id="bgp-neighbor">neighbor [<m/ip/ | range <m/prefix/] [port <m/number/] [as <m/number/] [internal|external]</tag>
2199 Define neighboring router this instance will be talking to and what AS
2200 it is located in. In case the neighbor is in the same AS as we are, we
2201 automatically switch to IBGP. Alternatively, it is possible to specify
2202 just <cf/internal/ or </cf/external/ instead of AS number, in that case
2203 either local AS number, or any external AS number is accepted.
2204 Optionally, the remote port may also be specified. Like <cf/local/
2205 parameter, this parameter may also be used multiple times with different
2206 sub-options. This parameter is mandatory.
2207
2208 It is possible to specify network prefix (with <cf/range/ keyword)
2209 instead of explicit neighbor IP address. This enables dynamic BGP
2210 behavior, where the BGP instance listens on BGP port, but new BGP
2211 instances are spawned for incoming BGP connections (if source address
2212 matches the network prefix). It is possible to mix regular BGP instances
2213 with dynamic BGP instances and have multiple dynamic BGP instances with
2214 different ranges.
2215
2216 <tag><label id="bgp-iface">interface <m/string/</tag>
2217 Define interface we should use for link-local BGP IPv6 sessions.
2218 Interface can also be specified as a part of <cf/neighbor address/
2219 (e.g., <cf/neighbor fe80::1234%eth0 as 65000;/). The option may also be
2220 used for non link-local sessions when it is necessary to explicitly
2221 specify an interface, but only for direct (not multihop) sessions.
2222
2223 <tag><label id="bgp-direct">direct</tag>
2224 Specify that the neighbor is directly connected. The IP address of the
2225 neighbor must be from a directly reachable IP range (i.e. associated
2226 with one of your router's interfaces), otherwise the BGP session
2227 wouldn't start but it would wait for such interface to appear. The
2228 alternative is the <cf/multihop/ option. Default: enabled for eBGP.
2229
2230 <tag><label id="bgp-multihop">multihop [<m/number/]</tag>
2231 Configure multihop BGP session to a neighbor that isn't directly
2232 connected. Accurately, this option should be used if the configured
2233 neighbor IP address does not match with any local network subnets. Such
2234 IP address have to be reachable through system routing table. The
2235 alternative is the <cf/direct/ option. For multihop BGP it is
2236 recommended to explicitly configure the source address to have it
2237 stable. Optional <cf/number/ argument can be used to specify the number
2238 of hops (used for TTL). Note that the number of networks (edges) in a
2239 path is counted; i.e., if two BGP speakers are separated by one router,
2240 the number of hops is 2. Default: enabled for iBGP.
2241
2242 <tag><label id="bgp-source-address">source address <m/ip/</tag>
2243 Define local address we should use as a source address for the BGP
2244 session. Default: the address of the local end of the interface our
2245 neighbor is connected to.
2246
2247 <tag><label id="bgp-dynamic-name">dynamic name "<m/text/"</tag>
2248 Define common prefix of names used for new BGP instances spawned when
2249 dynamic BGP behavior is active. Actual names also contain numeric
2250 index to distinguish individual instances. Default: "dynbgp".
2251
2252 <tag><label id="bgp-dynamic-name">dynamic name digits <m/number/</tag>
2253 Define minimum number of digits for index in names of spawned dynamic
2254 BGP instances. E.g., if set to 2, then the first name would be
2255 "dynbgp01". Default: 0.
2256
2257 <tag><label id="bgp-strict-bind">strict bind <m/switch/</tag>
2258 Specify whether BGP listening socket should be bound to a specific local
2259 address (the same as the <cf/source address/) and associated interface,
2260 or to all addresses. Binding to a specific address could be useful in
2261 cases like running multiple BIRD instances on a machine, each using its
2262 IP address. Note that listening sockets bound to a specific address and
2263 to all addresses collide, therefore either all BGP protocols (of the
2264 same address family and using the same local port) should have set
2265 <cf/strict bind/, or none of them. Default: disabled.
2266
2267 <tag><label id="bgp-check-link">check link <M>switch</M></tag>
2268 BGP could use hardware link state into consideration. If enabled,
2269 BIRD tracks the link state of the associated interface and when link
2270 disappears (e.g. an ethernet cable is unplugged), the BGP session is
2271 immediately shut down. Note that this option cannot be used with
2272 multihop BGP. Default: enabled for direct BGP, disabled otherwise.
2273
2274 <tag><label id="bgp-bfd">bfd <M>switch</M>|graceful</tag>
2275 BGP could use BFD protocol as an advisory mechanism for neighbor
2276 liveness and failure detection. If enabled, BIRD setups a BFD session
2277 for the BGP neighbor and tracks its liveness by it. This has an
2278 advantage of an order of magnitude lower detection times in case of
2279 failure. When a neighbor failure is detected, the BGP session is
2280 restarted. Optionally, it can be configured (by <cf/graceful/ argument)
2281 to trigger graceful restart instead of regular restart. Note that BFD
2282 protocol also has to be configured, see <ref id="bfd" name="BFD">
2283 section for details. Default: disabled.
2284
2285 <tag><label id="bgp-ttl-security">ttl security <m/switch/</tag>
2286 Use GTSM (<rfc id="5082"> - the generalized TTL security mechanism). GTSM
2287 protects against spoofed packets by ignoring received packets with a
2288 smaller than expected TTL. To work properly, GTSM have to be enabled on
2289 both sides of a BGP session. If both <cf/ttl security/ and
2290 <cf/multihop/ options are enabled, <cf/multihop/ option should specify
2291 proper hop value to compute expected TTL. Kernel support required:
2292 Linux: 2.6.34+ (IPv4), 2.6.35+ (IPv6), BSD: since long ago, IPv4 only.
2293 Note that full (ICMP protection, for example) <rfc id="5082"> support is
2294 provided by Linux only. Default: disabled.
2295
2296 <tag><label id="bgp-password">password <m/string/</tag>
2297 Use this password for MD5 authentication of BGP sessions (<rfc id="2385">). When
2298 used on BSD systems, see also <cf/setkey/ option below. Default: no
2299 authentication.
2300
2301 <tag><label id="bgp-setkey">setkey <m/switch/</tag>
2302 On BSD systems, keys for TCP MD5 authentication are stored in the global
2303 SA/SP database, which can be accessed by external utilities (e.g.
2304 setkey(8)). BIRD configures security associations in the SA/SP database
2305 automatically based on <cf/password/ options (see above), this option
2306 allows to disable automatic updates by BIRD when manual configuration by
2307 external utilities is preferred. Note that automatic SA/SP database
2308 updates are currently implemented only for FreeBSD. Passwords have to be
2309 set manually by an external utility on NetBSD and OpenBSD. Default:
2310 enabled (ignored on non-FreeBSD).
2311
2312 <tag><label id="bgp-passive">passive <m/switch/</tag>
2313 Standard BGP behavior is both initiating outgoing connections and
2314 accepting incoming connections. In passive mode, outgoing connections
2315 are not initiated. Default: off.
2316
2317 <tag><label id="bgp-confederation">confederation <m/number/</tag>
2318 BGP confederations (<rfc id="5065">) are collections of autonomous
2319 systems that act as one entity to external systems, represented by one
2320 confederation identifier (instead of AS numbers). This option allows to
2321 enable BGP confederation behavior and to specify the local confederation
2322 identifier. When BGP confederations are used, all BGP speakers that are
2323 members of the BGP confederation should have the same confederation
2324 identifier configured. Default: 0 (no confederation).
2325
2326 <tag><label id="bgp-confederation-member">confederation member <m/switch/</tag>
2327 When BGP confederations are used, this option allows to specify whether
2328 the BGP neighbor is a member of the same confederation as the local BGP
2329 speaker. The option is unnecessary (and ignored) for IBGP sessions, as
2330 the same AS number implies the same confederation. Default: no.
2331
2332 <tag><label id="bgp-rr-client">rr client</tag>
2333 Be a route reflector and treat the neighbor as a route reflection
2334 client. Default: disabled.
2335
2336 <tag><label id="bgp-rr-cluster-id">rr cluster id <m/IPv4 address/</tag>
2337 Route reflectors use cluster id to avoid route reflection loops. When
2338 there is one route reflector in a cluster it usually uses its router id
2339 as a cluster id, but when there are more route reflectors in a cluster,
2340 these need to be configured (using this option) to use a common cluster
2341 id. Clients in a cluster need not know their cluster id and this option
2342 is not allowed for them. Default: the same as router id.
2343
2344 <tag><label id="bgp-rs-client">rs client</tag>
2345 Be a route server and treat the neighbor as a route server client.
2346 A route server is used as a replacement for full mesh EBGP routing in
2347 Internet exchange points in a similar way to route reflectors used in
2348 IBGP routing. BIRD does not implement obsoleted <rfc id="1863">, but
2349 uses ad-hoc implementation, which behaves like plain EBGP but reduces
2350 modifications to advertised route attributes to be transparent (for
2351 example does not prepend its AS number to AS PATH attribute and
2352 keeps MED attribute). Default: disabled.
2353
2354 <tag><label id="bgp-allow-local-pref">allow bgp_local_pref <m/switch/</tag>
2355 A standard BGP implementation do not send the Local Preference attribute
2356 to eBGP neighbors and ignore this attribute if received from eBGP
2357 neighbors, as per <rfc id="4271">. When this option is enabled on an
2358 eBGP session, this attribute will be sent to and accepted from the peer,
2359 which is useful for example if you have a setup like in <rfc id="7938">.
2360 The option does not affect iBGP sessions. Default: off.
2361
2362 <tag><label id="bgp-allow-local-as">allow local as [<m/number/]</tag>
2363 BGP prevents routing loops by rejecting received routes with the local
2364 AS number in the AS path. This option allows to loose or disable the
2365 check. Optional <cf/number/ argument can be used to specify the maximum
2366 number of local ASNs in the AS path that is allowed for received
2367 routes. When the option is used without the argument, the check is
2368 completely disabled and you should ensure loop-free behavior by some
2369 other means. Default: 0 (no local AS number allowed).
2370
2371 <tag><label id="bgp-enable-route-refresh">enable route refresh <m/switch/</tag>
2372 After the initial route exchange, BGP protocol uses incremental updates
2373 to keep BGP speakers synchronized. Sometimes (e.g., if BGP speaker
2374 changes its import filter, or if there is suspicion of inconsistency) it
2375 is necessary to do a new complete route exchange. BGP protocol extension
2376 Route Refresh (<rfc id="2918">) allows BGP speaker to request
2377 re-advertisement of all routes from its neighbor. BGP protocol
2378 extension Enhanced Route Refresh (<rfc id="7313">) specifies explicit
2379 begin and end for such exchanges, therefore the receiver can remove
2380 stale routes that were not advertised during the exchange. This option
2381 specifies whether BIRD advertises these capabilities and supports
2382 related procedures. Note that even when disabled, BIRD can send route
2383 refresh requests. Default: on.
2384
2385 <tag><label id="bgp-graceful-restart">graceful restart <m/switch/|aware</tag>
2386 When a BGP speaker restarts or crashes, neighbors will discard all
2387 received paths from the speaker, which disrupts packet forwarding even
2388 when the forwarding plane of the speaker remains intact. <rfc id="4724">
2389 specifies an optional graceful restart mechanism to alleviate this
2390 issue. This option controls the mechanism. It has three states:
2391 Disabled, when no support is provided. Aware, when the graceful restart
2392 support is announced and the support for restarting neighbors is
2393 provided, but no local graceful restart is allowed (i.e. receiving-only
2394 role). Enabled, when the full graceful restart support is provided
2395 (i.e. both restarting and receiving role). Restarting role could be also
2396 configured per-channel. Note that proper support for local graceful
2397 restart requires also configuration of other protocols. Default: aware.
2398
2399 <tag><label id="bgp-graceful-restart-time">graceful restart time <m/number/</tag>
2400 The restart time is announced in the BGP graceful restart capability
2401 and specifies how long the neighbor would wait for the BGP session to
2402 re-establish after a restart before deleting stale routes. Default:
2403 120 seconds.
2404
2405 <tag><label id="bgp-long-lived-graceful-restart">long lived graceful restart <m/switch/|aware</tag>
2406 The long-lived graceful restart is an extension of the traditional
2407 <ref id="bgp-graceful-restart" name="BGP graceful restart">, where stale
2408 routes are kept even after the <ref id="bgp-graceful-restart-time"
2409 name="restart time"> expires for additional long-lived stale time, but
2410 they are marked with the LLGR_STALE community, depreferenced, and
2411 withdrawn from routers not supporting LLGR. Like traditional BGP
2412 graceful restart, it has three states: disabled, aware (receiving-only),
2413 and enabled. Note that long-lived graceful restart requires at least
2414 aware level of traditional BGP graceful restart. Default: aware, unless
2415 graceful restart is disabled.
2416
2417 <tag><label id="bgp-long-lived-stale-time">long lived stale time <m/number/</tag>
2418 The long-lived stale time is announced in the BGP long-lived graceful
2419 restart capability and specifies how long the neighbor would keep stale
2420 routes depreferenced during long-lived graceful restart until either the
2421 session is re-stablished and synchronized or the stale time expires and
2422 routes are removed. Default: 3600 seconds.
2423
2424 <tag><label id="bgp-interpret-communities">interpret communities <m/switch/</tag>
2425 <rfc id="1997"> demands that BGP speaker should process well-known
2426 communities like no-export (65535, 65281) or no-advertise (65535,
2427 65282). For example, received route carrying a no-adverise community
2428 should not be advertised to any of its neighbors. If this option is
2429 enabled (which is by default), BIRD has such behavior automatically (it
2430 is evaluated when a route is exported to the BGP protocol just before
2431 the export filter). Otherwise, this integrated processing of
2432 well-known communities is disabled. In that case, similar behavior can
2433 be implemented in the export filter. Default: on.
2434
2435 <tag><label id="bgp-enable-as4">enable as4 <m/switch/</tag>
2436 BGP protocol was designed to use 2B AS numbers and was extended later to
2437 allow 4B AS number. BIRD supports 4B AS extension, but by disabling this
2438 option it can be persuaded not to advertise it and to maintain old-style
2439 sessions with its neighbors. This might be useful for circumventing bugs
2440 in neighbor's implementation of 4B AS extension. Even when disabled
2441 (off), BIRD behaves internally as AS4-aware BGP router. Default: on.
2442
2443 <tag><label id="bgp-enable-extended-messages">enable extended messages <m/switch/</tag>
2444 The BGP protocol uses maximum message length of 4096 bytes. This option
2445 provides an extension to allow extended messages with length up
2446 to 65535 bytes. Default: off.
2447
2448 <tag><label id="bgp-capabilities">capabilities <m/switch/</tag>
2449 Use capability advertisement to advertise optional capabilities. This is
2450 standard behavior for newer BGP implementations, but there might be some
2451 older BGP implementations that reject such connection attempts. When
2452 disabled (off), features that request it (4B AS support) are also
2453 disabled. Default: on, with automatic fallback to off when received
2454 capability-related error.
2455
2456 <tag><label id="bgp-advertise-ipv4">advertise ipv4 <m/switch/</tag>
2457 Advertise IPv4 multiprotocol capability. This is not a correct behavior
2458 according to the strict interpretation of <rfc id="4760">, but it is
2459 widespread and required by some BGP implementations (Cisco and Quagga).
2460 This option is relevant to IPv4 mode with enabled capability
2461 advertisement only. Default: on.
2462
2463 <tag><label id="bgp-disable-after-error">disable after error <m/switch/</tag>
2464 When an error is encountered (either locally or by the other side),
2465 disable the instance automatically and wait for an administrator to fix
2466 the problem manually. Default: off.
2467
2468 <tag><label id="bgp-disable-after-cease">disable after cease <m/switch/|<m/set-of-flags/</tag>
2469 When a Cease notification is received, disable the instance
2470 automatically and wait for an administrator to fix the problem manually.
2471 When used with <m/switch/ argument, it means handle every Cease subtype
2472 with the exception of <cf/connection collision/. Default: off.
2473
2474 The <m/set-of-flags/ allows to narrow down relevant Cease subtypes. The
2475 syntax is <cf>{<m/flag/ [, <m/.../] }</cf>, where flags are: <cf/cease/,
2476 <cf/prefix limit hit/, <cf/administrative shutdown/,
2477 <cf/peer deconfigured/, <cf/administrative reset/,
2478 <cf/connection rejected/, <cf/configuration change/,
2479 <cf/connection collision/, <cf/out of resources/.
2480
2481 <tag><label id="bgp-hold-time">hold time <m/number/</tag>
2482 Time in seconds to wait for a Keepalive message from the other side
2483 before considering the connection stale. Default: depends on agreement
2484 with the neighboring router, we prefer 240 seconds if the other side is
2485 willing to accept it.
2486
2487 <tag><label id="bgp-startup-hold-time">startup hold time <m/number/</tag>
2488 Value of the hold timer used before the routers have a chance to exchange
2489 open messages and agree on the real value. Default: 240 seconds.
2490
2491 <tag><label id="bgp-keepalive-time">keepalive time <m/number/</tag>
2492 Delay in seconds between sending of two consecutive Keepalive messages.
2493 Default: One third of the hold time.
2494
2495 <tag><label id="bgp-connect-delay-time">connect delay time <m/number/</tag>
2496 Delay in seconds between protocol startup and the first attempt to
2497 connect. Default: 5 seconds.
2498
2499 <tag><label id="bgp-connect-retry-time">connect retry time <m/number/</tag>
2500 Time in seconds to wait before retrying a failed attempt to connect.
2501 Default: 120 seconds.
2502
2503 <tag><label id="bgp-error-wait-time">error wait time <m/number/,<m/number/</tag>
2504 Minimum and maximum delay in seconds between a protocol failure (either
2505 local or reported by the peer) and automatic restart. Doesn't apply
2506 when <cf/disable after error/ is configured. If consecutive errors
2507 happen, the delay is increased exponentially until it reaches the
2508 maximum. Default: 60, 300.
2509
2510 <tag><label id="bgp-error-forget-time">error forget time <m/number/</tag>
2511 Maximum time in seconds between two protocol failures to treat them as a
2512 error sequence which makes <cf/error wait time/ increase exponentially.
2513 Default: 300 seconds.
2514
2515 <tag><label id="bgp-path-metric">path metric <m/switch/</tag>
2516 Enable comparison of path lengths when deciding which BGP route is the
2517 best one. Default: on.
2518
2519 <tag><label id="bgp-med-metric">med metric <m/switch/</tag>
2520 Enable comparison of MED attributes (during best route selection) even
2521 between routes received from different ASes. This may be useful if all
2522 MED attributes contain some consistent metric, perhaps enforced in
2523 import filters of AS boundary routers. If this option is disabled, MED
2524 attributes are compared only if routes are received from the same AS
2525 (which is the standard behavior). Default: off.
2526
2527 <tag><label id="bgp-deterministic-med">deterministic med <m/switch/</tag>
2528 BGP route selection algorithm is often viewed as a comparison between
2529 individual routes (e.g. if a new route appears and is better than the
2530 current best one, it is chosen as the new best one). But the proper
2531 route selection, as specified by <rfc id="4271">, cannot be fully
2532 implemented in that way. The problem is mainly in handling the MED
2533 attribute. BIRD, by default, uses an simplification based on individual
2534 route comparison, which in some cases may lead to temporally dependent
2535 behavior (i.e. the selection is dependent on the order in which routes
2536 appeared). This option enables a different (and slower) algorithm
2537 implementing proper <rfc id="4271"> route selection, which is
2538 deterministic. Alternative way how to get deterministic behavior is to
2539 use <cf/med metric/ option. This option is incompatible with <ref
2540 id="dsc-table-sorted" name="sorted tables">. Default: off.
2541
2542 <tag><label id="bgp-igp-metric">igp metric <m/switch/</tag>
2543 Enable comparison of internal distances to boundary routers during best
2544 route selection. Default: on.
2545
2546 <tag><label id="bgp-prefer-older">prefer older <m/switch/</tag>
2547 Standard route selection algorithm breaks ties by comparing router IDs.
2548 This changes the behavior to prefer older routes (when both are external
2549 and from different peer). For details, see <rfc id="5004">. Default: off.
2550
2551 <tag><label id="bgp-default-med">default bgp_med <m/number/</tag>
2552 Value of the Multiple Exit Discriminator to be used during route
2553 selection when the MED attribute is missing. Default: 0.
2554
2555 <tag><label id="bgp-default-local-pref">default bgp_local_pref <m/number/</tag>
2556 A default value for the Local Preference attribute. It is used when
2557 a new Local Preference attribute is attached to a route by the BGP
2558 protocol itself (for example, if a route is received through eBGP and
2559 therefore does not have such attribute). Default: 100 (0 in pre-1.2.0
2560 versions of BIRD).
2561 </descrip>
2562
2563 <sect1>Channel configuration
2564 <label id="bgp-channel-config">
2565
2566 <p>BGP supports several AFIs and SAFIs over one connection. Every AFI/SAFI
2567 announced to the peer corresponds to one channel. The table of supported AFI/SAFIs
2568 together with their appropriate channels follows.
2569
2570 <table loc="h">
2571 <tabular ca="l|l|l|r|r">
2572 <bf/Channel name/ | <bf/Table nettype/ | <bf/IGP table allowed/ | <bf/AFI/ | <bf/SAFI/
2573 @<hline>
2574 <cf/ipv4/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 1
2575 @ <cf/ipv6/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 1
2576 @ <cf/ipv4 multicast/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 2
2577 @ <cf/ipv6 multicast/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 2
2578 @ <cf/ipv4 mpls/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 4
2579 @ <cf/ipv6 mpls/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 4
2580 @ <cf/vpn4 mpls/ | <cf/vpn4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 128
2581 @ <cf/vpn6 mpls/ | <cf/vpn6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 128
2582 @ <cf/vpn4 multicast/ | <cf/vpn4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 129
2583 @ <cf/vpn6 multicast/ | <cf/vpn6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 129
2584 @ <cf/flow4/ | <cf/flow4/ | --- | 1 | 133
2585 @ <cf/flow6/ | <cf/flow6/ | --- | 2 | 133
2586 </tabular>
2587 </table>
2588
2589 <p>Due to <rfc id="8212">, external BGP protocol requires explicit configuration
2590 of import and export policies (in contrast to other protocols, where default
2591 policies of <cf/import all/ and <cf/export none/ are used in absence of explicit
2592 configuration). Note that blanket policies like <cf/all/ or <cf/none/ can still
2593 be used in explicit configuration.
2594
2595 <p>BGP channels have additional config options (together with the common ones):
2596
2597 <descrip>
2598 <tag><label id="bgp-mandatory">mandatory <m/switch/</tag>
2599 When local and neighbor sets of configured AFI/SAFI pairs differ,
2600 capability negotiation ensures that a common subset is used. For
2601 mandatory channels their associated AFI/SAFI must be negotiated
2602 (i.e., also announced by the neighbor), otherwise BGP session
2603 negotiation fails with <it/'Required capability missing'/ error.
2604 Regardless, at least one AFI/SAFI must be negotiated in order to BGP
2605 session be successfully established. Default: off.
2606
2607 <tag><label id="bgp-next-hop-keep">next hop keep <m/switch/|ibgp|ebgp</tag>
2608 Do not modify the Next Hop attribute and advertise the current one
2609 unchanged even in cases where our own local address should be used
2610 instead. This is necessary when the BGP speaker does not forward network
2611 traffic (route servers and some route reflectors) and also can be useful
2612 in some other cases (e.g. multihop EBGP sessions). Can be enabled for
2613 all routes, or just for routes received from IBGP / EBGP neighbors.
2614 Default: disabled for regular BGP, enabled for route servers,
2615 <cf/ibgp/ for route reflectors.
2616
2617 <tag><label id="bgp-next-hop-self">next hop self <m/switch/|ibgp|ebgp</tag>
2618 Always advertise our own local address as a next hop, even in cases
2619 where the current Next Hop attribute should be used unchanged. This is
2620 sometimes used for routes propagated from EBGP to IBGP when IGP routing
2621 does not cover inter-AS links, therefore IP addreses of EBGP neighbors
2622 are not resolvable through IGP. Can be enabled for all routes, or just
2623 for routes received from IBGP / EBGP neighbors. Default: disabled.
2624
2625 <tag><label id="bgp-next-hop-address">next hop address <m/ip/</tag>
2626 Specify which address to use when our own local address should be
2627 announced in the Next Hop attribute. Default: the source address of the
2628 BGP session (if acceptable), or the preferred address of an associated
2629 interface.
2630
2631 <tag><label id="bgp-missing-lladdr">missing lladdr self|drop|ignore</tag>
2632 Next Hop attribute in BGP-IPv6 sometimes contains just the global IPv6
2633 address, but sometimes it has to contain both global and link-local IPv6
2634 addresses. This option specifies what to do if BIRD have to send both
2635 addresses but does not know link-local address. This situation might
2636 happen when routes from other protocols are exported to BGP, or when
2637 improper updates are received from BGP peers. <cf/self/ means that BIRD
2638 advertises its own local address instead. <cf/drop/ means that BIRD
2639 skips that prefixes and logs error. <cf/ignore/ means that BIRD ignores
2640 the problem and sends just the global address (and therefore forms
2641 improper BGP update). Default: <cf/self/, unless BIRD is configured as a
2642 route server (option <cf/rs client/), in that case default is <cf/ignore/,
2643 because route servers usually do not forward packets themselves.
2644
2645 <tag><label id="bgp-gateway">gateway direct|recursive</tag>
2646 For received routes, their <cf/gw/ (immediate next hop) attribute is
2647 computed from received <cf/bgp_next_hop/ attribute. This option
2648 specifies how it is computed. Direct mode means that the IP address from
2649 <cf/bgp_next_hop/ is used if it is directly reachable, otherwise the
2650 neighbor IP address is used. Recursive mode means that the gateway is
2651 computed by an IGP routing table lookup for the IP address from
2652 <cf/bgp_next_hop/. Note that there is just one level of indirection in
2653 recursive mode - the route obtained by the lookup must not be recursive
2654 itself, to prevent mutually recursive routes.
2655
2656 Recursive mode is the behavior specified by the BGP
2657 standard. Direct mode is simpler, does not require any routes in a
2658 routing table, and was used in older versions of BIRD, but does not
2659 handle well nontrivial iBGP setups and multihop. Recursive mode is
2660 incompatible with <ref id="dsc-table-sorted" name="sorted tables">. Default:
2661 <cf/direct/ for direct sessions, <cf/recursive/ for multihop sessions.
2662
2663 <tag><label id="bgp-igp-table">igp table <m/name/</tag>
2664 Specifies a table that is used as an IGP routing table. The type of this
2665 table must be as allowed in the table above. This option is allowed once
2666 for every allowed table type. Default: the same as the main table
2667 the channel is connected to (if eligible).
2668
2669 <tag><label id="bgp-import-table">import table <m/switch/</tag>
2670 A BGP import table contains all received routes from given BGP neighbor,
2671 before application of import filters. It is also called <em/Adj-RIB-In/
2672 in BGP terminology. BIRD BGP by default operates without import tables,
2673 in which case received routes are just processed by import filters,
2674 accepted ones are stored in the master table, and the rest is forgotten.
2675 Enabling <cf/import table/ allows to store unprocessed routes, which can
2676 be examined later by <cf/show route/, and can be used to reconfigure
2677 import filters without full route refresh. Default: off.
2678
2679 <tag><label id="bgp-secondary">secondary <m/switch/</tag>
2680 Usually, if an export filter rejects a selected route, no other route is
2681 propagated for that network. This option allows to try the next route in
2682 order until one that is accepted is found or all routes for that network
2683 are rejected. This can be used for route servers that need to propagate
2684 different tables to each client but do not want to have these tables
2685 explicitly (to conserve memory). This option requires that the connected
2686 routing table is <ref id="dsc-table-sorted" name="sorted">. Default: off.
2687
2688 <tag><label id="bgp-extended-next-hop">extended next hop <m/switch/</tag>
2689 BGP expects that announced next hops have the same address family as
2690 associated network prefixes. This option provides an extension to use
2691 IPv4 next hops with IPv6 prefixes and vice versa. For IPv4 / VPNv4
2692 channels, the behavior is controlled by the Extended Next Hop Encoding
2693 capability, as described in <rfc id="5549">. For IPv6 / VPNv6 channels,
2694 just IPv4-mapped IPv6 addresses are used, as described in
2695 <rfc id="4798"> and <rfc id="4659">. Default: off.
2696
2697 <tag><label id="bgp-add-paths">add paths <m/switch/|rx|tx</tag>
2698 Standard BGP can propagate only one path (route) per destination network
2699 (usually the selected one). This option controls the add-path protocol
2700 extension, which allows to advertise any number of paths to a
2701 destination. Note that to be active, add-path has to be enabled on both
2702 sides of the BGP session, but it could be enabled separately for RX and
2703 TX direction. When active, all available routes accepted by the export
2704 filter are advertised to the neighbor. Default: off.
2705
2706 <tag><label id="bgp-graceful-restart-c">graceful restart <m/switch/</tag>
2707 Although BGP graceful restart is configured mainly by protocol-wide
2708 <ref id="bgp-graceful-restart" name="options">, it is possible to
2709 configure restarting role per AFI/SAFI pair by this channel option.
2710 The option is ignored if graceful restart is disabled by protocol-wide
2711 option. Default: off in aware mode, on in full mode.
2712
2713 <tag><label id="bgp-long-lived-graceful-restart-c">long lived graceful restart <m/switch/</tag>
2714 BGP long-lived graceful restart is configured mainly by protocol-wide
2715 <ref id="bgp-long-lived-graceful-restart" name="options">, but the
2716 restarting role can be set per AFI/SAFI pair by this channel option.
2717 The option is ignored if long-lived graceful restart is disabled by
2718 protocol-wide option. Default: off in aware mode, on in full mode.
2719
2720 <tag><label id="bgp-long-lived-stale-time-c">long lived stale time <m/number/</tag>
2721 Like previous graceful restart channel options, this option allows to
2722 set <ref id="bgp-long-lived-stale-time" name="long lived stale time">
2723 per AFI/SAFI pair instead of per protocol. Default: set by protocol-wide
2724 option.
2725 </descrip>
2726
2727 <sect1>Attributes
2728 <label id="bgp-attr">
2729
2730 <p>BGP defines several route attributes. Some of them (those marked with
2731 `<tt/I/' in the table below) are available on internal BGP connections only,
2732 some of them (marked with `<tt/O/') are optional.
2733
2734 <descrip>
2735 <tag><label id="rta-bgp-path">bgppath bgp_path</tag>
2736 Sequence of AS numbers describing the AS path the packet will travel
2737 through when forwarded according to the particular route. In case of
2738 internal BGP it doesn't contain the number of the local AS.
2739
2740 <tag><label id="rta-bgp-local-pref">int bgp_local_pref [I]</tag>
2741 Local preference value used for selection among multiple BGP routes (see
2742 the selection rules above). It's used as an additional metric which is
2743 propagated through the whole local AS.
2744
2745 <tag><label id="rta-bgp-med">int bgp_med [O]</tag>
2746 The Multiple Exit Discriminator of the route is an optional attribute
2747 which is used on external (inter-AS) links to convey to an adjacent AS
2748 the optimal entry point into the local AS. The received attribute is
2749 also propagated over internal BGP links. The attribute value is zeroed
2750 when a route is exported to an external BGP instance to ensure that the
2751 attribute received from a neighboring AS is not propagated to other
2752 neighboring ASes. A new value might be set in the export filter of an
2753 external BGP instance. See <rfc id="4451"> for further discussion of
2754 BGP MED attribute.
2755
2756 <tag><label id="rta-bgp-origin">enum bgp_origin</tag>
2757 Origin of the route: either <cf/ORIGIN_IGP/ if the route has originated
2758 in an interior routing protocol or <cf/ORIGIN_EGP/ if it's been imported
2759 from the <tt>EGP</tt> protocol (nowadays it seems to be obsolete) or
2760 <cf/ORIGIN_INCOMPLETE/ if the origin is unknown.
2761
2762 <tag><label id="rta-bgp-next-hop">ip bgp_next_hop</tag>
2763 Next hop to be used for forwarding of packets to this destination. On
2764 internal BGP connections, it's an address of the originating router if
2765 it's inside the local AS or a boundary router the packet will leave the
2766 AS through if it's an exterior route, so each BGP speaker within the AS
2767 has a chance to use the shortest interior path possible to this point.
2768
2769 <tag><label id="rta-bgp-atomic-aggr">void bgp_atomic_aggr [O]</tag>
2770 This is an optional attribute which carries no value, but the sole
2771 presence of which indicates that the route has been aggregated from
2772 multiple routes by some router on the path from the originator.
2773
2774 <!-- we don't handle aggregators right since they are of a very obscure type
2775 <tag>bgp_aggregator</tag>
2776 -->
2777 <tag><label id="rta-bgp-community">clist bgp_community [O]</tag>
2778 List of community values associated with the route. Each such value is a
2779 pair (represented as a <cf/pair/ data type inside the filters) of 16-bit
2780 integers, the first of them containing the number of the AS which
2781 defines the community and the second one being a per-AS identifier.
2782 There are lots of uses of the community mechanism, but generally they
2783 are used to carry policy information like "don't export to USA peers".
2784 As each AS can define its own routing policy, it also has a complete
2785 freedom about which community attributes it defines and what will their
2786 semantics be.
2787
2788 <tag><label id="rta-bgp-ext-community">eclist bgp_ext_community [O]</tag>
2789 List of extended community values associated with the route. Extended
2790 communities have similar usage as plain communities, but they have an
2791 extended range (to allow 4B ASNs) and a nontrivial structure with a type
2792 field. Individual community values are represented using an <cf/ec/ data
2793 type inside the filters.
2794
2795 <tag><label id="rta-bgp-large-community">lclist bgp_large_community [O]</tag>
2796 List of large community values associated with the route. Large BGP
2797 communities is another variant of communities, but contrary to extended
2798 communities they behave very much the same way as regular communities,
2799 just larger -- they are uniform untyped triplets of 32bit numbers.
2800 Individual community values are represented using an <cf/lc/ data type
2801 inside the filters.
2802
2803 <tag><label id="rta-bgp-originator-id">quad bgp_originator_id [I, O]</tag>
2804 This attribute is created by the route reflector when reflecting the
2805 route and contains the router ID of the originator of the route in the
2806 local AS.
2807
2808 <tag><label id="rta-bgp-cluster-list">clist bgp_cluster_list [I, O]</tag>
2809 This attribute contains a list of cluster IDs of route reflectors. Each
2810 route reflector prepends its cluster ID when reflecting the route.
2811 </descrip>
2812
2813 <sect1>Example
2814 <label id="bgp-exam">
2815
2816 <p><code>
2817 protocol bgp {
2818 local 198.51.100.14 as 65000; # Use a private AS number
2819 neighbor 198.51.100.130 as 64496; # Our neighbor ...
2820 multihop; # ... which is connected indirectly
2821 ipv4 {
2822 export filter { # We use non-trivial export rules
2823 if source = RTS_STATIC then { # Export only static routes
2824 # Assign our community
2825 bgp_community.add((65000,64501));
2826 # Artificially increase path length
2827 # by advertising local AS number twice
2828 if bgp_path ~ [= 65000 =] then
2829 bgp_path.prepend(65000);
2830 accept;
2831 }
2832 reject;
2833 };
2834 import all;
2835 next hop self; # advertise this router as next hop
2836 igp table myigptable4; # IGP table for routes with IPv4 nexthops
2837 igp table myigptable6; # IGP table for routes with IPv6 nexthops
2838 };
2839 ipv6 {
2840 export filter mylargefilter; # We use a named filter
2841 import all;
2842 missing lladdr self;
2843 igp table myigptable4; # IGP table for routes with IPv4 nexthops
2844 igp table myigptable6; # IGP table for routes with IPv6 nexthops
2845 };
2846 ipv4 multicast {
2847 import all;
2848 export filter someotherfilter;
2849 table mymulticasttable4; # Another IPv4 table, dedicated for multicast
2850 igp table myigptable4;
2851 };
2852 }
2853 </code>
2854
2855
2856 <sect>Device
2857 <label id="device">
2858
2859 <p>The Device protocol is not a real routing protocol. It doesn't generate any
2860 routes and it only serves as a module for getting information about network
2861 interfaces from the kernel. This protocol supports no channel.
2862
2863 <p>Except for very unusual circumstances, you probably should include this
2864 protocol in the configuration since almost all other protocols require network
2865 interfaces to be defined for them to work with.
2866
2867 <sect1>Configuration
2868 <label id="device-config">
2869
2870 <p><descrip>
2871 <tag><label id="device-scan-time">scan time <m/number/</tag>
2872 Time in seconds between two scans of the network interface list. On
2873 systems where we are notified about interface status changes
2874 asynchronously (such as newer versions of Linux), we need to scan the
2875 list only in order to avoid confusion by lost notification messages,
2876 so the default time is set to a large value.
2877
2878 <tag><label id="device-iface">interface <m/pattern/ [, <m/.../]</tag>
2879 By default, the Device protocol handles all interfaces without any
2880 configuration. Interface definitions allow to specify optional
2881 parameters for specific interfaces. See <ref id="proto-iface"
2882 name="interface"> common option for detailed description. Currently only
2883 one interface option is available:
2884
2885 <tag><label id="device-preferred">preferred <m/ip/</tag>
2886 If a network interface has more than one IP address, BIRD chooses one of
2887 them as a preferred one. Preferred IP address is used as source address
2888 for packets or announced next hop by routing protocols. Precisely, BIRD
2889 chooses one preferred IPv4 address, one preferred IPv6 address and one
2890 preferred link-local IPv6 address. By default, BIRD chooses the first
2891 found IP address as the preferred one.
2892
2893 This option allows to specify which IP address should be preferred. May
2894 be used multiple times for different address classes (IPv4, IPv6, IPv6
2895 link-local). In all cases, an address marked by operating system as
2896 secondary cannot be chosen as the primary one.
2897 </descrip>
2898
2899 <p>As the Device protocol doesn't generate any routes, it cannot have
2900 any attributes. Example configuration looks like this:
2901
2902 <p><code>
2903 protocol device {
2904 scan time 10; # Scan the interfaces often
2905 interface "eth0" {
2906 preferred 192.168.1.1;
2907 preferred 2001:db8:1:10::1;
2908 };
2909 }
2910 </code>
2911
2912
2913 <sect>Direct
2914 <label id="direct">
2915
2916 <p>The Direct protocol is a simple generator of device routes for all the
2917 directly connected networks according to the list of interfaces provided by the
2918 kernel via the Device protocol. The Direct protocol supports both IPv4 and IPv6
2919 channels; both can be configured simultaneously. It can also be configured with
2920 <ref id="ip-sadr-routes" name="IPv6 SADR"> channel instead of regular IPv6
2921 channel in order to be used together with SADR-enabled Babel protocol.
2922
2923 <p>The question is whether it is a good idea to have such device routes in BIRD
2924 routing table. OS kernel usually handles device routes for directly connected
2925 networks by itself so we don't need (and don't want) to export these routes to
2926 the kernel protocol. OSPF protocol creates device routes for its interfaces
2927 itself and BGP protocol is usually used for exporting aggregate routes. But the
2928 Direct protocol is necessary for distance-vector protocols like RIP or Babel to
2929 announce local networks.
2930
2931 <p>There are just few configuration options for the Direct protocol:
2932
2933 <p><descrip>
2934 <tag><label id="direct-iface">interface <m/pattern/ [, <m/.../]</tag>
2935 By default, the Direct protocol will generate device routes for all the
2936 interfaces available. If you want to restrict it to some subset of
2937 interfaces or addresses (e.g. if you're using multiple routing tables
2938 for policy routing and some of the policy domains don't contain all
2939 interfaces), just use this clause. See <ref id="proto-iface" name="interface">
2940 common option for detailed description. The Direct protocol uses
2941 extended interface clauses.
2942
2943 <tag><label id="direct-check-link">check link <m/switch/</tag>
2944 If enabled, a hardware link state (reported by OS) is taken into
2945 consideration. Routes for directly connected networks are generated only
2946 if link up is reported and they are withdrawn when link disappears
2947 (e.g., an ethernet cable is unplugged). Default value is no.
2948 </descrip>
2949
2950 <p>Direct device routes don't contain any specific attributes.
2951
2952 <p>Example config might look like this:
2953
2954 <p><code>
2955 protocol direct {
2956 ipv4;
2957 ipv6;
2958 interface "-arc*", "*"; # Exclude the ARCnets
2959 }
2960 </code>
2961
2962
2963 <sect>Kernel
2964 <label id="krt">
2965
2966 <p>The Kernel protocol is not a real routing protocol. Instead of communicating
2967 with other routers in the network, it performs synchronization of BIRD's routing
2968 tables with the OS kernel. Basically, it sends all routing table updates to the
2969 kernel and from time to time it scans the kernel tables to see whether some
2970 routes have disappeared (for example due to unnoticed up/down transition of an
2971 interface) or whether an `alien' route has been added by someone else (depending
2972 on the <cf/learn/ switch, such routes are either ignored or accepted to our
2973 table).
2974
2975 <p>Note that routes created by OS kernel itself, namely direct routes
2976 representing IP subnets of associated interfaces, are not imported even with
2977 <cf/learn/ enabled. You can use <ref id="direct" name="Direct protocol"> to
2978 generate these direct routes.
2979
2980 <p>If your OS supports only a single routing table, you can configure only one
2981 instance of the Kernel protocol. If it supports multiple tables (in order to
2982 allow policy routing; such an OS is for example Linux), you can run as many
2983 instances as you want, but each of them must be connected to a different BIRD
2984 routing table and to a different kernel table.
2985
2986 <p>Because the kernel protocol is partially integrated with the connected
2987 routing table, there are two limitations - it is not possible to connect more
2988 kernel protocols to the same routing table and changing route destination
2989 (gateway) in an export filter of a kernel protocol does not work. Both
2990 limitations can be overcome using another routing table and the pipe protocol.
2991
2992 <p>The Kernel protocol supports both IPv4 and IPv6 channels; only one channel
2993 can be configured in each protocol instance. On Linux, it also supports <ref
2994 id="ip-sadr-routes" name="IPv6 SADR"> and <ref id="mpls-routes" name="MPLS">
2995 channels.
2996
2997 <sect1>Configuration
2998 <label id="krt-config">
2999
3000 <p><descrip>
3001 <tag><label id="krt-persist">persist <m/switch/</tag>
3002 Tell BIRD to leave all its routes in the routing tables when it exits
3003 (instead of cleaning them up).
3004
3005 <tag><label id="krt-scan-time">scan time <m/number/</tag>
3006 Time in seconds between two consecutive scans of the kernel routing
3007 table.
3008
3009 <tag><label id="krt-learn">learn <m/switch/</tag>
3010 Enable learning of routes added to the kernel routing tables by other
3011 routing daemons or by the system administrator. This is possible only on
3012 systems which support identification of route authorship.
3013
3014 <tag><label id="krt-kernel-table">kernel table <m/number/</tag>
3015 Select which kernel table should this particular instance of the Kernel
3016 protocol work with. Available only on systems supporting multiple
3017 routing tables.
3018
3019 <tag><label id="krt-metric">metric <m/number/</tag> (Linux)
3020 Use specified value as a kernel metric (priority) for all routes sent to
3021 the kernel. When multiple routes for the same network are in the kernel
3022 routing table, the Linux kernel chooses one with lower metric. Also,
3023 routes with different metrics do not clash with each other, therefore
3024 using dedicated metric value is a reliable way to avoid overwriting
3025 routes from other sources (e.g. kernel device routes). Metric 0 has a
3026 special meaning of undefined metric, in which either OS default is used,
3027 or per-route metric can be set using <cf/krt_metric/ attribute. Default:
3028 32.
3029
3030 <tag><label id="krt-graceful-restart">graceful restart <m/switch/</tag>
3031 Participate in graceful restart recovery. If this option is enabled and
3032 a graceful restart recovery is active, the Kernel protocol will defer
3033 synchronization of routing tables until the end of the recovery. Note
3034 that import of kernel routes to BIRD is not affected.
3035
3036 <tag><label id="krt-merge-paths">merge paths <M>switch</M> [limit <M>number</M>]</tag>
3037 Usually, only best routes are exported to the kernel protocol. With path
3038 merging enabled, both best routes and equivalent non-best routes are
3039 merged during export to generate one ECMP (equal-cost multipath) route
3040 for each network. This is useful e.g. for BGP multipath. Note that best
3041 routes are still pivotal for route export (responsible for most
3042 properties of resulting ECMP routes), while exported non-best routes are
3043 responsible just for additional multipath next hops. This option also
3044 allows to specify a limit on maximal number of nexthops in one route. By
3045 default, multipath merging is disabled. If enabled, default value of the
3046 limit is 16.
3047 </descrip>
3048
3049 <sect1>Attributes
3050 <label id="krt-attr">
3051
3052 <p>The Kernel protocol defines several attributes. These attributes are
3053 translated to appropriate system (and OS-specific) route attributes. We support
3054 these attributes:
3055
3056 <descrip>
3057 <tag><label id="rta-krt-source">int krt_source</tag>
3058 The original source of the imported kernel route. The value is
3059 system-dependent. On Linux, it is a value of the protocol field of the
3060 route. See /etc/iproute2/rt_protos for common values. On BSD, it is
3061 based on STATIC and PROTOx flags. The attribute is read-only.
3062
3063 <tag><label id="rta-krt-metric">int krt_metric</tag> (Linux)
3064 The kernel metric of the route. When multiple same routes are in a
3065 kernel routing table, the Linux kernel chooses one with lower metric.
3066 Note that preferred way to set kernel metric is to use protocol option
3067 <cf/metric/, unless per-route metric values are needed.
3068
3069 <tag><label id="rta-krt-prefsrc">ip krt_prefsrc</tag> (Linux)
3070 The preferred source address. Used in source address selection for
3071 outgoing packets. Has to be one of the IP addresses of the router.
3072
3073 <tag><label id="rta-krt-realm">int krt_realm</tag> (Linux)
3074 The realm of the route. Can be used for traffic classification.
3075
3076 <tag><label id="rta-krt-scope">int krt_scope</tag> (Linux IPv4)
3077 The scope of the route. Valid values are 0-254, although Linux kernel
3078 may reject some values depending on route type and nexthop. It is
3079 supposed to represent `indirectness' of the route, where nexthops of
3080 routes are resolved through routes with a higher scope, but in current
3081 kernels anything below <it/link/ (253) is treated as <it/global/ (0).
3082 When not present, global scope is implied for all routes except device
3083 routes, where link scope is used by default.
3084 </descrip>
3085
3086 <p>In Linux, there is also a plenty of obscure route attributes mostly focused
3087 on tuning TCP performance of local connections. BIRD supports most of these
3088 attributes, see Linux or iproute2 documentation for their meaning. Attributes
3089 <cf/krt_lock_*/ and <cf/krt_feature_*/ have type bool, others have type int.
3090 Supported attributes are:
3091
3092 <cf/krt_mtu/, <cf/krt_lock_mtu/, <cf/krt_window/, <cf/krt_lock_window/,
3093 <cf/krt_rtt/, <cf/krt_lock_rtt/, <cf/krt_rttvar/, <cf/krt_lock_rttvar/,
3094 <cf/krt_sstresh/, <cf/krt_lock_sstresh/, <cf/krt_cwnd/, <cf/krt_lock_cwnd/,
3095 <cf/krt_advmss/, <cf/krt_lock_advmss/, <cf/krt_reordering/, <cf/krt_lock_reordering/,
3096 <cf/krt_hoplimit/, <cf/krt_lock_hoplimit/, <cf/krt_rto_min/, <cf/krt_lock_rto_min/,
3097 <cf/krt_initcwnd/, <cf/krt_initrwnd/, <cf/krt_quickack/,
3098 <cf/krt_feature_ecn/, <cf/krt_feature_allfrag/
3099
3100 <sect1>Example
3101 <label id="krt-exam">
3102
3103 <p>A simple configuration can look this way:
3104
3105 <p><code>
3106 protocol kernel {
3107 export all;
3108 }
3109 </code>
3110
3111 <p>Or for a system with two routing tables:
3112
3113 <p><code>
3114 protocol kernel { # Primary routing table
3115 learn; # Learn alien routes from the kernel
3116 persist; # Don't remove routes on bird shutdown
3117 scan time 10; # Scan kernel routing table every 10 seconds
3118 ipv4 {
3119 import all;
3120 export all;
3121 };
3122 }
3123
3124 protocol kernel { # Secondary routing table
3125 kernel table 100;
3126 ipv4 {
3127 table auxtable;
3128 export all;
3129 };
3130 }
3131 </code>
3132
3133
3134 <sect>MRT
3135 <label id="mrt">
3136
3137 <sect1>Introduction
3138 <label id="mrt-intro">
3139
3140 <p>The MRT protocol is a component responsible for handling the Multi-Threaded
3141 Routing Toolkit (MRT) routing information export format, which is mainly used
3142 for collecting and analyzing of routing information from BGP routers. The MRT
3143 protocol can be configured to do periodic dumps of routing tables, created MRT
3144 files can be analyzed later by other tools. Independent MRT table dumps can also
3145 be requested from BIRD client. There is also a feature to save incoming BGP
3146 messages in MRT files, but it is controlled by <ref id="proto-mrtdump"
3147 name="mrtdump"> options independently of MRT protocol, although that might
3148 change in the future.
3149
3150 BIRD implements the main MRT format specification as defined in <rfc id="6396">
3151 and the ADD_PATH extension (<rfc id="8050">).
3152
3153 <sect1>Configuration
3154 <label id="mrt-config">
3155
3156 <p>MRT configuration consists of several statements describing routing table
3157 dumps. Multiple independent periodic dumps can be done as multiple MRT protocol
3158 instances. The MRT protocol does not use channels. There are two mandatory
3159 statements: <cf/filename/ and <cf/period/.
3160
3161 The behavior can be modified by following configuration parameters:
3162
3163 <descrip>
3164 <tag><label id="mrt-table">table <m/name/ | "<m/pattern/"</tag>
3165 Specify a routing table (or a set of routing tables described by a
3166 wildcard pattern) that are to be dumped by the MRT protocol instance.
3167 Default: the master table.
3168
3169 <tag><label id="mrt-filter">filter { <m/filter commands/ }</tag>
3170 The MRT protocol allows to specify a filter that is applied to routes as
3171 they are dumped. Rejected routes are ignored and not saved to the MRT
3172 dump file. Default: no filter.
3173
3174 <tag><label id="mrt-where">where <m/filter expression/</tag>
3175 An alternative way to specify a filter for the MRT protocol.
3176
3177 <tag><label id="mrt-filename">filename "<m/filename/"</tag>
3178 Specify a filename for MRT dump files. The filename may contain time
3179 format sequences with <it/strftime(3)/ notation (see <it/man strftime/
3180 for details), there is also a sequence "%N" that is expanded to the name
3181 of dumped table. Therefore, each periodic dump of each table can be
3182 saved to a different file. Mandatory, see example below.
3183
3184 <tag><label id="mrt-period">period <m/number/</tag>
3185 Specify the time interval (in seconds) between periodic dumps.
3186 Mandatory.
3187
3188 <tag><label id="mrt-always-add-path">always add path <m/switch/</tag>
3189 The MRT format uses special records (specified in <rfc id="8050">) for
3190 routes received using BGP ADD_PATH extension to keep Path ID, while
3191 other routes use regular records. This has advantage of better
3192 compatibility with tools that do not know special records, but it loses
3193 information about which route is the best route. When this option is
3194 enabled, both ADD_PATH and non-ADD_PATH routes are stored in ADD_PATH
3195 records and order of routes for network is preserved. Default: disabled.
3196 </descrip>
3197
3198 <sect1>Example
3199 <label id="mrt-exam">
3200
3201 <p><code>
3202 protocol mrt {
3203 table "tab*";
3204 where source = RTS_BGP;
3205 filename "/var/log/bird/%N_%F_%T.mrt";
3206 period 300;
3207 }
3208 </code>
3209
3210
3211 <sect>OSPF
3212 <label id="ospf">
3213
3214 <sect1>Introduction
3215 <label id="ospf-intro">
3216
3217 <p>Open Shortest Path First (OSPF) is a quite complex interior gateway
3218 protocol. The current IPv4 version (OSPFv2) is defined in <rfc id="2328"> and
3219 the current IPv6 version (OSPFv3) is defined in <rfc id="5340"> It's a link
3220 state (a.k.a. shortest path first) protocol -- each router maintains a database
3221 describing the autonomous system's topology. Each participating router has an
3222 identical copy of the database and all routers run the same algorithm
3223 calculating a shortest path tree with themselves as a root. OSPF chooses the
3224 least cost path as the best path.
3225
3226 <p>In OSPF, the autonomous system can be split to several areas in order to
3227 reduce the amount of resources consumed for exchanging the routing information
3228 and to protect the other areas from incorrect routing data. Topology of the area
3229 is hidden to the rest of the autonomous system.
3230
3231 <p>Another very important feature of OSPF is that it can keep routing information
3232 from other protocols (like Static or BGP) in its link state database as external
3233 routes. Each external route can be tagged by the advertising router, making it
3234 possible to pass additional information between routers on the boundary of the
3235 autonomous system.
3236
3237 <p>OSPF quickly detects topological changes in the autonomous system (such as
3238 router interface failures) and calculates new loop-free routes after a short
3239 period of convergence. Only a minimal amount of routing traffic is involved.
3240
3241 <p>Each router participating in OSPF routing periodically sends Hello messages
3242 to all its interfaces. This allows neighbors to be discovered dynamically. Then
3243 the neighbors exchange theirs parts of the link state database and keep it
3244 identical by flooding updates. The flooding process is reliable and ensures that
3245 each router detects all changes.
3246
3247 <sect1>Configuration
3248 <label id="ospf-config">
3249
3250 <p>First, the desired OSPF version can be specified by using <cf/ospf v2/ or
3251 <cf/ospf v3/ as a protocol type. By default, OSPFv2 is used. In the main part of
3252 configuration, there can be multiple definitions of OSPF areas, each with a
3253 different id. These definitions includes many other switches and multiple
3254 definitions of interfaces. Definition of interface may contain many switches and
3255 constant definitions and list of neighbors on nonbroadcast networks.
3256
3257 <p>OSPFv2 needs one IPv4 channel. OSPFv3 needs either one IPv6 channel, or one
3258 IPv4 channel (<rfc id="5838">). Therefore, it is possible to use OSPFv3 for both
3259 IPv4 and Pv6 routing, but it is necessary to have two protocol instances anyway.
3260 If no channel is configured, appropriate channel is defined with default
3261 parameters.
3262
3263 <code>
3264 protocol ospf [v2|v3] &lt;name&gt; {
3265 rfc1583compat &lt;switch&gt;;
3266 rfc5838 &lt;switch&gt;;
3267 instance id &lt;num&gt;;
3268 stub router &lt;switch&gt;;
3269 tick &lt;num&gt;;
3270 ecmp &lt;switch&gt; [limit &lt;num&gt;];
3271 merge external &lt;switch&gt;;
3272 graceful restart &lt;switch&gt;|aware;
3273 graceful restart time &lt;num&gt;;
3274 area &lt;id&gt; {
3275 stub;
3276 nssa;
3277 summary &lt;switch&gt;;
3278 default nssa &lt;switch&gt;;
3279 default cost &lt;num&gt;;
3280 default cost2 &lt;num&gt;;
3281 translator &lt;switch&gt;;
3282 translator stability &lt;num&gt;;
3283
3284 networks {
3285 &lt;prefix&gt;;
3286 &lt;prefix&gt; hidden;
3287 }
3288 external {
3289 &lt;prefix&gt;;
3290 &lt;prefix&gt; hidden;
3291 &lt;prefix&gt; tag &lt;num&gt;;
3292 }
3293 stubnet &lt;prefix&gt;;
3294 stubnet &lt;prefix&gt; {
3295 hidden &lt;switch&gt;;
3296 summary &lt;switch&gt;;
3297 cost &lt;num&gt;;
3298 }
3299 interface &lt;interface pattern&gt; [instance &lt;num&gt;] {
3300 cost &lt;num&gt;;
3301 stub &lt;switch&gt;;
3302 hello &lt;num&gt;;
3303 poll &lt;num&gt;;
3304 retransmit &lt;num&gt;;
3305 priority &lt;num&gt;;
3306 wait &lt;num&gt;;
3307 dead count &lt;num&gt;;
3308 dead &lt;num&gt;;
3309 secondary &lt;switch&gt;;
3310 rx buffer [normal|large|&lt;num&gt;];
3311 tx length &lt;num&gt;;
3312 type [broadcast|bcast|pointopoint|ptp|
3313 nonbroadcast|nbma|pointomultipoint|ptmp];
3314 link lsa suppression &lt;switch&gt;;
3315 strict nonbroadcast &lt;switch&gt;;
3316 real broadcast &lt;switch&gt;;
3317 ptp netmask &lt;switch&gt;;
3318 check link &lt;switch&gt;;
3319 bfd &lt;switch&gt;;
3320 ecmp weight &lt;num&gt;;
3321 ttl security [&lt;switch&gt;; | tx only]
3322 tx class|dscp &lt;num&gt;;
3323 tx priority &lt;num&gt;;
3324 authentication none|simple|cryptographic;
3325 password "&lt;text&gt;";
3326 password "&lt;text&gt;" {
3327 id &lt;num&gt;;
3328 generate from "&lt;date&gt;";
3329 generate to "&lt;date&gt;";
3330 accept from "&lt;date&gt;";
3331 accept to "&lt;date&gt;";
3332 from "&lt;date&gt;";
3333 to "&lt;date&gt;";
3334 algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 );
3335 };
3336 neighbors {
3337 &lt;ip&gt;;
3338 &lt;ip&gt; eligible;
3339 };
3340 };
3341 virtual link &lt;id&gt; [instance &lt;num&gt;] {
3342 hello &lt;num&gt;;
3343 retransmit &lt;num&gt;;
3344 wait &lt;num&gt;;
3345 dead count &lt;num&gt;;
3346 dead &lt;num&gt;;
3347 authentication none|simple|cryptographic;
3348 password "&lt;text&gt;";
3349 password "&lt;text&gt;" {
3350 id &lt;num&gt;;
3351 generate from "&lt;date&gt;";
3352 generate to "&lt;date&gt;";
3353 accept from "&lt;date&gt;";
3354 accept to "&lt;date&gt;";
3355 from "&lt;date&gt;";
3356 to "&lt;date&gt;";
3357 algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 );
3358 };
3359 };
3360 };
3361 }
3362 </code>
3363
3364 <descrip>
3365 <tag><label id="ospf-rfc1583compat">rfc1583compat <M>switch</M></tag>
3366 This option controls compatibility of routing table calculation with
3367 <rfc id="1583">. Default value is no.
3368
3369 <tag><label id="ospf-rfc5838">rfc5838 <m/switch/</tag>
3370 Basic OSPFv3 is limited to IPv6 unicast routing. The <rfc id="5838">
3371 extension defines support for more address families (IPv4, IPv6, both
3372 unicast and multicast). The extension is enabled by default, but can be
3373 disabled if necessary, as it restricts the range of available instance
3374 IDs. Default value is yes.
3375
3376 <tag><label id="ospf-instance-id">instance id <m/num/</tag>
3377 When multiple OSPF protocol instances are active on the same links, they
3378 should use different instance IDs to distinguish their packets. Although
3379 it could be done on per-interface basis, it is often preferred to set
3380 one instance ID to whole OSPF domain/topology (e.g., when multiple
3381 instances are used to represent separate logical topologies on the same
3382 physical network). This option specifies the instance ID for all
3383 interfaces of the OSPF instance, but can be overridden by
3384 <cf/interface/ option. Default value is 0 unless OSPFv3-AF extended
3385 address families are used, see <rfc id="5838"> for that case.
3386
3387 <tag><label id="ospf-stub-router">stub router <M>switch</M></tag>
3388 This option configures the router to be a stub router, i.e., a router
3389 that participates in the OSPF topology but does not allow transit
3390 traffic. In OSPFv2, this is implemented by advertising maximum metric
3391 for outgoing links. In OSPFv3, the stub router behavior is announced by
3392 clearing the R-bit in the router LSA. See <rfc id="6987"> for details.
3393 Default value is no.
3394
3395 <tag><label id="ospf-tick">tick <M>num</M></tag>
3396 The routing table calculation and clean-up of areas' databases is not
3397 performed when a single link state change arrives. To lower the CPU
3398 utilization, it's processed later at periodical intervals of <m/num/
3399 seconds. The default value is 1.
3400
3401 <tag><label id="ospf-ecmp">ecmp <M>switch</M> [limit <M>number</M>]</tag>
3402 This option specifies whether OSPF is allowed to generate ECMP
3403 (equal-cost multipath) routes. Such routes are used when there are
3404 several directions to the destination, each with the same (computed)
3405 cost. This option also allows to specify a limit on maximum number of
3406 nexthops in one route. By default, ECMP is enabled if supported by
3407 Kernel. Default value of the limit is 16.
3408
3409 <tag><label id="ospf-merge-external">merge external <M>switch</M></tag>
3410 This option specifies whether OSPF should merge external routes from
3411 different routers/LSAs for the same destination. When enabled together
3412 with <cf/ecmp/, equal-cost external routes will be combined to multipath
3413 routes in the same way as regular routes. When disabled, external routes
3414 from different LSAs are treated as separate even if they represents the
3415 same destination. Default value is no.
3416
3417 <tag><label id="ospf-graceful-restart">graceful restart <m/switch/|aware</tag>
3418 When an OSPF instance is restarted, neighbors break adjacencies and
3419 recalculate their routing tables, which disrupts packet forwarding even
3420 when the forwarding plane of the restarting router remains intact.
3421 <rfc id="3623"> specifies a graceful restart mechanism to alleviate this
3422 issue. For OSPF graceful restart, restarting router originates
3423 Grace-LSAs, announcing intent to do graceful restart. Neighbors
3424 receiving these LSAs enter helper mode, in which they ignore breakdown
3425 of adjacencies, behave as if nothing is happening and keep old routes.
3426 When adjacencies are reestablished, the restarting router flushes
3427 Grace-LSAs and graceful restart is ended.
3428
3429 This option controls the graceful restart mechanism. It has three
3430 states: Disabled, when no support is provided. Aware, when graceful
3431 restart helper mode is supported, but no local graceful restart is
3432 allowed (i.e. helper-only role). Enabled, when the full graceful restart
3433 support is provided (i.e. both restarting and helper role). Note that
3434 proper support for local graceful restart requires also configuration of
3435 other protocols. Default: aware.
3436
3437 <tag><label id="ospf-graceful-restart-time">graceful restart time <m/num/</tag>
3438 The restart time is announced in the Grace-LSA and specifies how long
3439 neighbors should wait for proper end of the graceful restart before
3440 exiting helper mode prematurely. Default: 120 seconds.
3441
3442 <tag><label id="ospf-area">area <M>id</M></tag>
3443 This defines an OSPF area with given area ID (an integer or an IPv4
3444 address, similarly to a router ID). The most important area is the
3445 backbone (ID 0) to which every other area must be connected.
3446
3447 <tag><label id="ospf-stub">stub</tag>
3448 This option configures the area to be a stub area. External routes are
3449 not flooded into stub areas. Also summary LSAs can be limited in stub
3450 areas (see option <cf/summary/). By default, the area is not a stub
3451 area.
3452
3453 <tag><label id="ospf-nssa">nssa</tag>
3454 This option configures the area to be a NSSA (Not-So-Stubby Area). NSSA
3455 is a variant of a stub area which allows a limited way of external route
3456 propagation. Global external routes are not propagated into a NSSA, but
3457 an external route can be imported into NSSA as a (area-wide) NSSA-LSA
3458 (and possibly translated and/or aggregated on area boundary). By
3459 default, the area is not NSSA.
3460
3461 <tag><label id="ospf-summary">summary <M>switch</M></tag>
3462 This option controls propagation of summary LSAs into stub or NSSA
3463 areas. If enabled, summary LSAs are propagated as usual, otherwise just
3464 the default summary route (0.0.0.0/0) is propagated (this is sometimes
3465 called totally stubby area). If a stub area has more area boundary
3466 routers, propagating summary LSAs could lead to more efficient routing
3467 at the cost of larger link state database. Default value is no.
3468
3469 <tag><label id="ospf-default-nssa">default nssa <M>switch</M></tag>
3470 When <cf/summary/ option is enabled, default summary route is no longer
3471 propagated to the NSSA. In that case, this option allows to originate
3472 default route as NSSA-LSA to the NSSA. Default value is no.
3473
3474 <tag><label id="ospf-default-cost">default cost <M>num</M></tag>
3475 This option controls the cost of a default route propagated to stub and
3476 NSSA areas. Default value is 1000.
3477
3478 <tag><label id="ospf-default-cost2">default cost2 <M>num</M></tag>
3479 When a default route is originated as NSSA-LSA, its cost can use either
3480 type 1 or type 2 metric. This option allows to specify the cost of a
3481 default route in type 2 metric. By default, type 1 metric (option
3482 <cf/default cost/) is used.
3483
3484 <tag><label id="ospf-translator">translator <M>switch</M></tag>
3485 This option controls translation of NSSA-LSAs into external LSAs. By
3486 default, one translator per NSSA is automatically elected from area
3487 boundary routers. If enabled, this area boundary router would
3488 unconditionally translate all NSSA-LSAs regardless of translator
3489 election. Default value is no.
3490
3491 <tag><label id="ospf-translator-stability">translator stability <M>num</M></tag>
3492 This option controls the translator stability interval (in seconds).
3493 When the new translator is elected, the old one keeps translating until
3494 the interval is over. Default value is 40.
3495
3496 <tag><label id="ospf-networks">networks { <m/set/ }</tag>
3497 Definition of area IP ranges. This is used in summary LSA origination.
3498 Hidden networks are not propagated into other areas.
3499
3500 <tag><label id="ospf-external">external { <m/set/ }</tag>
3501 Definition of external area IP ranges for NSSAs. This is used for
3502 NSSA-LSA translation. Hidden networks are not translated into external
3503 LSAs. Networks can have configured route tag.
3504
3505 <tag><label id="ospf-stubnet">stubnet <m/prefix/ { <m/options/ }</tag>
3506 Stub networks are networks that are not transit networks between OSPF
3507 routers. They are also propagated through an OSPF area as a part of a
3508 link state database. By default, BIRD generates a stub network record
3509 for each primary network address on each OSPF interface that does not
3510 have any OSPF neighbors, and also for each non-primary network address
3511 on each OSPF interface. This option allows to alter a set of stub
3512 networks propagated by this router.
3513
3514 Each instance of this option adds a stub network with given network
3515 prefix to the set of propagated stub network, unless option <cf/hidden/
3516 is used. It also suppresses default stub networks for given network
3517 prefix. When option <cf/summary/ is used, also default stub networks
3518 that are subnetworks of given stub network are suppressed. This might be
3519 used, for example, to aggregate generated stub networks.
3520
3521 <tag><label id="ospf-iface">interface <M>pattern</M> [instance <m/num/]</tag>
3522 Defines that the specified interfaces belong to the area being defined.
3523 See <ref id="proto-iface" name="interface"> common option for detailed
3524 description. In OSPFv2, extended interface clauses are used, because
3525 each network prefix is handled as a separate virtual interface.
3526
3527 You can specify alternative instance ID for the interface definition,
3528 therefore it is possible to have several instances of that interface
3529 with different options or even in different areas. For OSPFv2, instance
3530 ID support is an extension (<rfc id="6549">) and is supposed to be set
3531 per-protocol. For OSPFv3, it is an integral feature.
3532
3533 <tag><label id="ospf-virtual-link">virtual link <M>id</M> [instance <m/num/]</tag>
3534 Virtual link to router with the router id. Virtual link acts as a
3535 point-to-point interface belonging to backbone. The actual area is used
3536 as a transport area. This item cannot be in the backbone. Like with
3537 <cf/interface/ option, you could also use several virtual links to one
3538 destination with different instance IDs.
3539
3540 <tag><label id="ospf-cost">cost <M>num</M></tag>
3541 Specifies output cost (metric) of an interface. Default value is 10.
3542
3543 <tag><label id="ospf-stub-iface">stub <M>switch</M></tag>
3544 If set to interface it does not listen to any packet and does not send
3545 any hello. Default value is no.
3546
3547 <tag><label id="ospf-hello">hello <M>num</M></tag>
3548 Specifies interval in seconds between sending of Hello messages. Beware,
3549 all routers on the same network need to have the same hello interval.
3550 Default value is 10.
3551
3552 <tag><label id="ospf-poll">poll <M>num</M></tag>
3553 Specifies interval in seconds between sending of Hello messages for some
3554 neighbors on NBMA network. Default value is 20.
3555
3556 <tag><label id="ospf-retransmit">retransmit <M>num</M></tag>
3557 Specifies interval in seconds between retransmissions of unacknowledged
3558 updates. Default value is 5.
3559
3560 <tag><label id="ospf-transmit-delay">transmit delay <M>num</M></tag>
3561 Specifies estimated transmission delay of link state updates send over
3562 the interface. The value is added to LSA age of LSAs propagated through
3563 it. Default value is 1.
3564
3565 <tag><label id="ospf-priority">priority <M>num</M></tag>
3566 On every multiple access network (e.g., the Ethernet) Designated Router
3567 and Backup Designated router are elected. These routers have some special
3568 functions in the flooding process. Higher priority increases preferences
3569 in this election. Routers with priority 0 are not eligible. Default
3570 value is 1.
3571
3572 <tag><label id="ospf-wait">wait <M>num</M></tag>
3573 After start, router waits for the specified number of seconds between
3574 starting election and building adjacency. Default value is 4*<m/hello/.
3575
3576 <tag><label id="ospf-dead-count">dead count <M>num</M></tag>
3577 When the router does not receive any messages from a neighbor in
3578 <m/dead count/*<m/hello/ seconds, it will consider the neighbor down.
3579
3580 <tag><label id="ospf-dead">dead <M>num</M></tag>
3581 When the router does not receive any messages from a neighbor in
3582 <m/dead/ seconds, it will consider the neighbor down. If both directives
3583 <cf/dead count/ and <cf/dead/ are used, <cf/dead/ has precedence.
3584
3585 <tag><label id="ospf-rx-buffer">rx buffer <M>num</M></tag>
3586 This option allows to specify the size of buffers used for packet
3587 processing. The buffer size should be bigger than maximal size of any
3588 packets. By default, buffers are dynamically resized as needed, but a
3589 fixed value could be specified. Value <cf/large/ means maximal allowed
3590 packet size - 65535.
3591
3592 <tag><label id="ospf-tx-length">tx length <M>num</M></tag>
3593 Transmitted OSPF messages that contain large amount of information are
3594 segmented to separate OSPF packets to avoid IP fragmentation. This
3595 option specifies the soft ceiling for the length of generated OSPF
3596 packets. Default value is the MTU of the network interface. Note that
3597 larger OSPF packets may still be generated if underlying OSPF messages
3598 cannot be splitted (e.g. when one large LSA is propagated).
3599
3600 <tag><label id="ospf-type-bcast">type broadcast|bcast</tag>
3601 BIRD detects a type of a connected network automatically, but sometimes
3602 it's convenient to force use of a different type manually. On broadcast
3603 networks (like ethernet), flooding and Hello messages are sent using
3604 multicasts (a single packet for all the neighbors). A designated router
3605 is elected and it is responsible for synchronizing the link-state
3606 databases and originating network LSAs. This network type cannot be used
3607 on physically NBMA networks and on unnumbered networks (networks without
3608 proper IP prefix).
3609
3610 <tag><label id="ospf-type-ptp">type pointopoint|ptp</tag>
3611 Point-to-point networks connect just 2 routers together. No election is
3612 performed and no network LSA is originated, which makes it simpler and
3613 faster to establish. This network type is useful not only for physically
3614 PtP ifaces (like PPP or tunnels), but also for broadcast networks used
3615 as PtP links. This network type cannot be used on physically NBMA
3616 networks.
3617
3618 <tag><label id="ospf-type-nbma">type nonbroadcast|nbma</tag>
3619 On NBMA networks, the packets are sent to each neighbor separately
3620 because of lack of multicast capabilities. Like on broadcast networks,
3621 a designated router is elected, which plays a central role in propagation
3622 of LSAs. This network type cannot be used on unnumbered networks.
3623
3624 <tag><label id="ospf-type-ptmp">type pointomultipoint|ptmp</tag>
3625 This is another network type designed to handle NBMA networks. In this
3626 case the NBMA network is treated as a collection of PtP links. This is
3627 useful if not every pair of routers on the NBMA network has direct
3628 communication, or if the NBMA network is used as an (possibly
3629 unnumbered) PtP link.
3630
3631 <tag><label id="ospf-link-lsa-suppression">link lsa suppression <m/switch/</tag>
3632 In OSPFv3, link LSAs are generated for each link, announcing link-local
3633 IPv6 address of the router to its local neighbors. These are useless on
3634 PtP or PtMP networks and this option allows to suppress the link LSA
3635 origination for such interfaces. The option is ignored on other than PtP
3636 or PtMP interfaces. Default value is no.
3637
3638 <tag><label id="ospf-strict-nonbroadcast">strict nonbroadcast <m/switch/</tag>
3639 If set, don't send hello to any undefined neighbor. This switch is
3640 ignored on other than NBMA or PtMP interfaces. Default value is no.
3641
3642 <tag><label id="ospf-real-broadcast">real broadcast <m/switch/</tag>
3643 In <cf/type broadcast/ or <cf/type ptp/ network configuration, OSPF
3644 packets are sent as IP multicast packets. This option changes the
3645 behavior to using old-fashioned IP broadcast packets. This may be useful
3646 as a workaround if IP multicast for some reason does not work or does
3647 not work reliably. This is a non-standard option and probably is not
3648 interoperable with other OSPF implementations. Default value is no.
3649
3650 <tag><label id="ospf-ptp-netmask">ptp netmask <m/switch/</tag>
3651 In <cf/type ptp/ network configurations, OSPFv2 implementations should
3652 ignore received netmask field in hello packets and should send hello
3653 packets with zero netmask field on unnumbered PtP links. But some OSPFv2
3654 implementations perform netmask checking even for PtP links. This option
3655 specifies whether real netmask will be used in hello packets on <cf/type
3656 ptp/ interfaces. You should ignore this option unless you meet some
3657 compatibility problems related to this issue. Default value is no for
3658 unnumbered PtP links, yes otherwise.
3659
3660 <tag><label id="ospf-check-link">check link <M>switch</M></tag>
3661 If set, a hardware link state (reported by OS) is taken into consideration.
3662 When a link disappears (e.g. an ethernet cable is unplugged), neighbors
3663 are immediately considered unreachable and only the address of the iface
3664 (instead of whole network prefix) is propagated. It is possible that
3665 some hardware drivers or platforms do not implement this feature.
3666 Default value is yes.
3667
3668 <tag><label id="ospf-bfd">bfd <M>switch</M></tag>
3669 OSPF could use BFD protocol as an advisory mechanism for neighbor
3670 liveness and failure detection. If enabled, BIRD setups a BFD session
3671 for each OSPF neighbor and tracks its liveness by it. This has an
3672 advantage of an order of magnitude lower detection times in case of
3673 failure. Note that BFD protocol also has to be configured, see
3674 <ref id="bfd" name="BFD"> section for details. Default value is no.
3675
3676 <tag><label id="ospf-ttl-security">ttl security [<m/switch/ | tx only]</tag>
3677 TTL security is a feature that protects routing protocols from remote
3678 spoofed packets by using TTL 255 instead of TTL 1 for protocol packets
3679 destined to neighbors. Because TTL is decremented when packets are
3680 forwarded, it is non-trivial to spoof packets with TTL 255 from remote
3681 locations. Note that this option would interfere with OSPF virtual
3682 links.
3683
3684 If this option is enabled, the router will send OSPF packets with TTL
3685 255 and drop received packets with TTL less than 255. If this option si
3686 set to <cf/tx only/, TTL 255 is used for sent packets, but is not
3687 checked for received packets. Default value is no.
3688
3689 <tag><label id="ospf-tx-class">tx class|dscp|priority <m/num/</tag>
3690 These options specify the ToS/DiffServ/Traffic class/Priority of the
3691 outgoing OSPF packets. See <ref id="proto-tx-class" name="tx class"> common
3692 option for detailed description.
3693
3694 <tag><label id="ospf-ecmp-weight">ecmp weight <M>num</M></tag>
3695 When ECMP (multipath) routes are allowed, this value specifies a
3696 relative weight used for nexthops going through the iface. Allowed
3697 values are 1-256. Default value is 1.
3698
3699 <tag><label id="ospf-auth-none">authentication none</tag>
3700 No passwords are sent in OSPF packets. This is the default value.
3701
3702 <tag><label id="ospf-auth-simple">authentication simple</tag>
3703 Every packet carries 8 bytes of password. Received packets lacking this
3704 password are ignored. This authentication mechanism is very weak.
3705 This option is not available in OSPFv3.
3706
3707 <tag><label id="ospf-auth-cryptographic">authentication cryptographic</tag>
3708 An authentication code is appended to every packet. The specific
3709 cryptographic algorithm is selected by option <cf/algorithm/ for each
3710 key. The default cryptographic algorithm for OSPFv2 keys is Keyed-MD5
3711 and for OSPFv3 keys is HMAC-SHA-256. Passwords are not sent open via
3712 network, so this mechanism is quite secure. Packets can still be read by
3713 an attacker.
3714
3715 <tag><label id="ospf-pass">password "<M>text</M>"</tag>
3716 Specifies a password used for authentication. See
3717 <ref id="proto-pass" name="password"> common option for detailed
3718 description.
3719
3720 <tag><label id="ospf-neighbors">neighbors { <m/set/ } </tag>
3721 A set of neighbors to which Hello messages on NBMA or PtMP networks are
3722 to be sent. For NBMA networks, some of them could be marked as eligible.
3723 In OSPFv3, link-local addresses should be used, using global ones is
3724 possible, but it is nonstandard and might be problematic. And definitely,
3725 link-local and global addresses should not be mixed.
3726 </descrip>
3727
3728 <sect1>Attributes
3729 <label id="ospf-attr">
3730
3731 <p>OSPF defines four route attributes. Each internal route has a <cf/metric/.
3732
3733 <p>Metric is ranging from 1 to infinity (65535). External routes use
3734 <cf/metric type 1/ or <cf/metric type 2/. A <cf/metric of type 1/ is comparable
3735 with internal <cf/metric/, a <cf/metric of type 2/ is always longer than any
3736 <cf/metric of type 1/ or any <cf/internal metric/. <cf/Internal metric/ or
3737 <cf/metric of type 1/ is stored in attribute <cf/ospf_metric1/, <cf/metric type
3738 2/ is stored in attribute <cf/ospf_metric2/.
3739
3740 When both metrics are specified then <cf/metric of type 2/ is used. This is
3741 relevant e.g. when a type 2 external route is propagated from one OSPF domain to
3742 another and <cf/ospf_metric1/ is an internal distance to the original ASBR,
3743 while <cf/ospf_metric2/ stores the type 2 metric. Note that in such cases if
3744 <cf/ospf_metric1/ is non-zero then <cf/ospf_metric2/ is increased by one to
3745 ensure monotonicity of metric, as internal distance is reset to zero when an
3746 external route is announced.
3747
3748 <p>Each external route can also carry attribute <cf/ospf_tag/ which is a 32-bit
3749 integer which is used when exporting routes to other protocols; otherwise, it
3750 doesn't affect routing inside the OSPF domain at all. The fourth attribute
3751 <cf/ospf_router_id/ is a router ID of the router advertising that route /
3752 network. This attribute is read-only. Default is <cf/ospf_metric2 = 10000/ and
3753 <cf/ospf_tag = 0/.
3754
3755 <sect1>Example
3756 <label id="ospf-exam">
3757
3758 <p><code>
3759 protocol ospf MyOSPF {
3760 ipv4 {
3761 export filter {
3762 if source = RTS_BGP then {
3763 ospf_metric1 = 100;
3764 accept;
3765 }
3766 reject;
3767 };
3768 };
3769 area 0.0.0.0 {
3770 interface "eth*" {
3771 cost 11;
3772 hello 15;
3773 priority 100;
3774 retransmit 7;
3775 authentication simple;
3776 password "aaa";
3777 };
3778 interface "ppp*" {
3779 cost 100;
3780 authentication cryptographic;
3781 password "abc" {
3782 id 1;
3783 generate to "22-04-2003 11:00:06";
3784 accept from "17-01-2001 12:01:05";
3785 algorithm hmac sha384;
3786 };
3787 password "def" {
3788 id 2;
3789 generate to "22-07-2005 17:03:21";
3790 accept from "22-02-2001 11:34:06";
3791 algorithm hmac sha512;
3792 };
3793 };
3794 interface "arc0" {
3795 cost 10;
3796 stub yes;
3797 };
3798 interface "arc1";
3799 };
3800 area 120 {
3801 stub yes;
3802 networks {
3803 172.16.1.0/24;
3804 172.16.2.0/24 hidden;
3805 }
3806 interface "-arc0" , "arc*" {
3807 type nonbroadcast;
3808 authentication none;
3809 strict nonbroadcast yes;
3810 wait 120;
3811 poll 40;
3812 dead count 8;
3813 neighbors {
3814 192.168.120.1 eligible;
3815 192.168.120.2;
3816 192.168.120.10;
3817 };
3818 };
3819 };
3820 }
3821 </code>
3822
3823 <sect>Perf
3824 <label id="perf">
3825
3826 <sect1>Introduction
3827 <label id="perf-intro">
3828
3829 <p>The Perf protocol is a generator of fake routes together with a time measurement
3830 framework. Its purpose is to check BIRD performance and to benchmark filters.
3831
3832 <p>Import mode of this protocol runs in several steps. In each step, it generates 2^x routes,
3833 imports them into the appropriate table and withdraws them. The exponent x is configurable.
3834 It runs the benchmark several times for the same x, then it increases x by one
3835 until it gets too high, then it stops.
3836
3837 <p>Export mode of this protocol repeats route refresh from table and measures how long it takes.
3838
3839 <p>Output data is logged on info level. There is a Perl script <cf>proto/perf/parse.pl</cf>
3840 which may be handy to parse the data and draw some plots.
3841
3842 <p>Implementation of this protocol is experimental. Use with caution and do not keep
3843 any instance of Perf in production configs for long time. The config interface is also unstable
3844 and may change in future versions without warning.
3845
3846 <sect1>Configuration
3847 <label id="perf-config">
3848
3849 <p><descrip>
3850 <tag><label id="perf-mode">mode import|export</tag>
3851 Set perf mode. Default: import
3852
3853 <tag><label id="perf-repeat">repeat <m/number/</tag>
3854 Run this amount of iterations of the benchmark for every amount step. Default: 4
3855
3856 <tag><label id="perf-from">exp from <m/number/</tag>
3857 Begin benchmarking on this exponent for number of generated routes in one step.
3858 Default: 10
3859
3860 <tag><label id="perf-to">exp to <m/number/</tag>
3861 Stop benchmarking on this exponent. Default: 20
3862
3863 <tag><label id="perf-threshold-min">threshold min <m/time/</tag>
3864 If a run for the given exponent took less than this time for route import,
3865 increase the exponent immediately. Default: 1 ms
3866
3867 <tag><label id="perf-threshold-max">threshold max <m/time/</tag>
3868 If every run for the given exponent took at least this time for route import,
3869 stop benchmarking. Default: 500 ms
3870 </descrip>
3871
3872 <sect>Pipe
3873 <label id="pipe">
3874
3875 <sect1>Introduction
3876 <label id="pipe-intro">
3877
3878 <p>The Pipe protocol serves as a link between two routing tables, allowing
3879 routes to be passed from a table declared as primary (i.e., the one the pipe is
3880 connected to using the <cf/table/ configuration keyword) to the secondary one
3881 (declared using <cf/peer table/) and vice versa, depending on what's allowed by
3882 the filters. Export filters control export of routes from the primary table to
3883 the secondary one, import filters control the opposite direction. Both tables
3884 must be of the same nettype.
3885
3886 <p>The Pipe protocol retransmits all routes from one table to the other table,
3887 retaining their original source and attributes. If import and export filters
3888 are set to accept, then both tables would have the same content.
3889
3890 <p>The primary use of multiple routing tables and the Pipe protocol is for
3891 policy routing, where handling of a single packet doesn't depend only on its
3892 destination address, but also on its source address, source interface, protocol
3893 type and other similar parameters. In many systems (Linux being a good example),
3894 the kernel allows to enforce routing policies by defining routing rules which
3895 choose one of several routing tables to be used for a packet according to its
3896 parameters. Setting of these rules is outside the scope of BIRD's work (on
3897 Linux, you can use the <tt/ip/ command), but you can create several routing
3898 tables in BIRD, connect them to the kernel ones, use filters to control which
3899 routes appear in which tables and also you can employ the Pipe protocol for
3900 exporting a selected subset of one table to another one.
3901
3902 <sect1>Configuration
3903 <label id="pipe-config">
3904
3905 <p>Essentially, the Pipe protocol is just a channel connected to a table on both
3906 sides. Therefore, the configuration block for <cf/protocol pipe/ shall directly
3907 include standard channel config options; see the example below.
3908
3909 <p><descrip>
3910 <tag><label id="pipe-peer-table">peer table <m/table/</tag>
3911 Defines secondary routing table to connect to. The primary one is
3912 selected by the <cf/table/ keyword.
3913 </descrip>
3914
3915 <sect1>Attributes
3916 <label id="pipe-attr">
3917
3918 <p>The Pipe protocol doesn't define any route attributes.
3919
3920 <sect1>Example
3921 <label id="pipe-exam">
3922
3923 <p>Let's consider a router which serves as a boundary router of two different
3924 autonomous systems, each of them connected to a subset of interfaces of the
3925 router, having its own exterior connectivity and wishing to use the other AS as
3926 a backup connectivity in case of outage of its own exterior line.
3927
3928 <p>Probably the simplest solution to this situation is to use two routing tables
3929 (we'll call them <cf/as1/ and <cf/as2/) and set up kernel routing rules, so that
3930 packets having arrived from interfaces belonging to the first AS will be routed
3931 according to <cf/as1/ and similarly for the second AS. Thus we have split our
3932 router to two logical routers, each one acting on its own routing table, having
3933 its own routing protocols on its own interfaces. In order to use the other AS's
3934 routes for backup purposes, we can pass the routes between the tables through a
3935 Pipe protocol while decreasing their preferences and correcting their BGP paths
3936 to reflect the AS boundary crossing.
3937
3938 <code>
3939 ipv4 table as1; # Define the tables
3940 ipv4 table as2;
3941
3942 protocol kernel kern1 { # Synchronize them with the kernel
3943 ipv4 { table as1; export all; };
3944 kernel table 1;
3945 }
3946
3947 protocol kernel kern2 {
3948 ipv4 { table as2; export all; };
3949 kernel table 2;
3950 }
3951
3952 protocol bgp bgp1 { # The outside connections
3953 ipv4 { table as1; import all; export all; };
3954 local as 1;
3955 neighbor 192.168.0.1 as 1001;
3956 }
3957
3958 protocol bgp bgp2 {
3959 ipv4 { table as2; import all; export all; };
3960 local as 2;
3961 neighbor 10.0.0.1 as 1002;
3962 }
3963
3964 protocol pipe { # The Pipe
3965 table as1;
3966 peer table as2;
3967 export filter {
3968 if net ~ [ 1.0.0.0/8+] then { # Only AS1 networks
3969 if preference>10 then preference = preference-10;
3970 if source=RTS_BGP then bgp_path.prepend(1);
3971 accept;
3972 }
3973 reject;
3974 };
3975 import filter {
3976 if net ~ [ 2.0.0.0/8+] then { # Only AS2 networks
3977 if preference>10 then preference = preference-10;
3978 if source=RTS_BGP then bgp_path.prepend(2);
3979 accept;
3980 }
3981 reject;
3982 };
3983 }
3984 </code>
3985
3986
3987 <sect>RAdv
3988 <label id="radv">
3989
3990 <sect1>Introduction
3991 <label id="radv-intro">
3992
3993 <p>The RAdv protocol is an implementation of Router Advertisements, which are
3994 used in the IPv6 stateless autoconfiguration. IPv6 routers send (in irregular
3995 time intervals or as an answer to a request) advertisement packets to connected
3996 networks. These packets contain basic information about a local network (e.g. a
3997 list of network prefixes), which allows network hosts to autoconfigure network
3998 addresses and choose a default route. BIRD implements router behavior as defined
3999 in <rfc id="4861">, router preferences and specific routes (<rfc id="4191">),
4000 and DNS extensions (<rfc id="6106">).
4001
4002 <p>The RAdv protocols supports just IPv6 channel.
4003
4004 <sect1>Configuration
4005 <label id="radv-config">
4006
4007 <p>There are several classes of definitions in RAdv configuration -- interface
4008 definitions, prefix definitions and DNS definitions:
4009
4010 <descrip>
4011 <tag><label id="radv-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag>
4012 Interface definitions specify a set of interfaces on which the
4013 protocol is activated and contain interface specific options.
4014 See <ref id="proto-iface" name="interface"> common options for
4015 detailed description.
4016
4017 <tag><label id="radv-prefix">prefix <m/prefix/ { <m/options/ }</tag>
4018 Prefix definitions allow to modify a list of advertised prefixes. By
4019 default, the advertised prefixes are the same as the network prefixes
4020 assigned to the interface. For each network prefix, the matching prefix
4021 definition is found and its options are used. If no matching prefix
4022 definition is found, the prefix is used with default options.
4023
4024 Prefix definitions can be either global or interface-specific. The
4025 second ones are part of interface options. The prefix definition
4026 matching is done in the first-match style, when interface-specific
4027 definitions are processed before global definitions. As expected, the
4028 prefix definition is matching if the network prefix is a subnet of the
4029 prefix in prefix definition.
4030
4031 <tag><label id="radv-rdnss">rdnss { <m/options/ }</tag>
4032 RDNSS definitions allow to specify a list of advertised recursive DNS
4033 servers together with their options. As options are seldom necessary,
4034 there is also a short variant <cf>rdnss <m/address/</cf> that just
4035 specifies one DNS server. Multiple definitions are cumulative. RDNSS
4036 definitions may also be interface-specific when used inside interface
4037 options. By default, interface uses both global and interface-specific
4038 options, but that can be changed by <cf/rdnss local/ option.
4039
4040 <tag><label id="radv-dnssl">dnssl { <m/options/ }</tag>
4041 DNSSL definitions allow to specify a list of advertised DNS search
4042 domains together with their options. Like <cf/rdnss/ above, multiple
4043 definitions are cumulative, they can be used also as interface-specific
4044 options and there is a short variant <cf>dnssl <m/domain/</cf> that just
4045 specifies one DNS search domain.
4046
4047 <tag><label id="radv-trigger">trigger <m/prefix/</tag>
4048 RAdv protocol could be configured to change its behavior based on
4049 availability of routes. When this option is used, the protocol waits in
4050 suppressed state until a <it/trigger route/ (for the specified network)
4051 is exported to the protocol, the protocol also returns to suppressed
4052 state if the <it/trigger route/ disappears. Note that route export
4053 depends on specified export filter, as usual. This option could be used,
4054 e.g., for handling failover in multihoming scenarios.
4055
4056 During suppressed state, router advertisements are generated, but with
4057 some fields zeroed. Exact behavior depends on which fields are zeroed,
4058 this can be configured by <cf/sensitive/ option for appropriate
4059 fields. By default, just <cf/default lifetime/ (also called <cf/router
4060 lifetime/) is zeroed, which means hosts cannot use the router as a
4061 default router. <cf/preferred lifetime/ and <cf/valid lifetime/ could
4062 also be configured as <cf/sensitive/ for a prefix, which would cause
4063 autoconfigured IPs to be deprecated or even removed.
4064
4065 <tag><label id="radv-propagate-routes">propagate routes <m/switch/</tag>
4066 This option controls propagation of more specific routes, as defined in
4067 <rfc id="4191">. If enabled, all routes exported to the RAdv protocol,
4068 with the exception of the trigger prefix, are added to advertisments as
4069 additional options. The lifetime and preference of advertised routes can
4070 be set individually by <cf/ra_lifetime/ and <cf/ra_preference/ route
4071 attributes, or per interface by <cf/route lifetime/ and
4072 <cf/route preference/ options. Default: disabled.
4073
4074 Note that the RFC discourages from sending more than 17 routes and
4075 recommends the routes to be configured manually.
4076 </descrip>
4077
4078 <p>Interface specific options:
4079
4080 <descrip>
4081 <tag><label id="radv-iface-max-ra-interval">max ra interval <m/expr/</tag>
4082 Unsolicited router advertisements are sent in irregular time intervals.
4083 This option specifies the maximum length of these intervals, in seconds.
4084 Valid values are 4-1800. Default: 600
4085
4086 <tag><label id="radv-iface-min-ra-interval">min ra interval <m/expr/</tag>
4087 This option specifies the minimum length of that intervals, in seconds.
4088 Must be at least 3 and at most 3/4 * <cf/max ra interval/. Default:
4089 about 1/3 * <cf/max ra interval/.
4090
4091 <tag><label id="radv-iface-min-delay">min delay <m/expr/</tag>
4092 The minimum delay between two consecutive router advertisements, in
4093 seconds. Default: 3
4094
4095 <tag><label id="radv-iface-managed">managed <m/switch/</tag>
4096 This option specifies whether hosts should use DHCPv6 for IP address
4097 configuration. Default: no
4098
4099 <tag><label id="radv-iface-other-config">other config <m/switch/</tag>
4100 This option specifies whether hosts should use DHCPv6 to receive other
4101 configuration information. Default: no
4102
4103 <tag><label id="radv-iface-link-mtu">link mtu <m/expr/</tag>
4104 This option specifies which value of MTU should be used by hosts. 0
4105 means unspecified. Default: 0
4106
4107 <tag><label id="radv-iface-reachable-time">reachable time <m/expr/</tag>
4108 This option specifies the time (in milliseconds) how long hosts should
4109 assume a neighbor is reachable (from the last confirmation). Maximum is
4110 3600000, 0 means unspecified. Default 0.
4111
4112 <tag><label id="radv-iface-retrans-timer">retrans timer <m/expr/</tag>
4113 This option specifies the time (in milliseconds) how long hosts should
4114 wait before retransmitting Neighbor Solicitation messages. 0 means
4115 unspecified. Default 0.
4116
4117 <tag><label id="radv-iface-current-hop-limit">current hop limit <m/expr/</tag>
4118 This option specifies which value of Hop Limit should be used by
4119 hosts. Valid values are 0-255, 0 means unspecified. Default: 64
4120
4121 <tag><label id="radv-iface-default-lifetime">default lifetime <m/expr/ [sensitive <m/switch/]</tag>
4122 This option specifies the time (in seconds) how long (since the receipt
4123 of RA) hosts may use the router as a default router. 0 means do not use
4124 as a default router. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
4125 Default: 3 * <cf/max ra interval/, <cf/sensitive/ yes.
4126
4127 <tag><label id="radv-iface-default-preference">default preference low|medium|high</tag>
4128 This option specifies the Default Router Preference value to advertise
4129 to hosts. Default: medium.
4130
4131 <tag><label id="radv-iface-route-lifetime">route lifetime <m/expr/ [sensitive <m/switch/]</tag>
4132 This option specifies the default value of advertised lifetime for
4133 specific routes; i.e., the time (in seconds) for how long (since the
4134 receipt of RA) hosts should consider these routes valid. A special value
4135 0xffffffff represents infinity. The lifetime can be overriden on a per
4136 route basis by the <ref id="rta-ra-lifetime" name="ra_lifetime"> route
4137 attribute. Default: 3 * <cf/max ra interval/, <cf/sensitive/ no.
4138
4139 For the <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
4140 If <cf/sensitive/ is enabled, even the routes with the <cf/ra_lifetime/
4141 attribute become sensitive to the trigger.
4142
4143 <tag><label id="radv-iface-route-preference">route preference low|medium|high</tag>
4144 This option specifies the default value of advertised route preference
4145 for specific routes. The value can be overriden on a per route basis by
4146 the <ref id="rta-ra-preference" name="ra_preference"> route attribute.
4147 Default: medium.
4148
4149 <tag><label id="radv-prefix-linger-time">prefix linger time <m/expr/</tag>
4150 When a prefix or a route disappears, it is advertised for some time with
4151 zero lifetime, to inform clients it is no longer valid. This option
4152 specifies the time (in seconds) for how long prefixes are advertised
4153 that way. Default: 3 * <cf/max ra interval/.
4154
4155 <tag><label id="radv-route-linger-time">route linger time <m/expr/</tag>
4156 When a prefix or a route disappears, it is advertised for some time with
4157 zero lifetime, to inform clients it is no longer valid. This option
4158 specifies the time (in seconds) for how long routes are advertised
4159 that way. Default: 3 * <cf/max ra interval/.
4160
4161 <tag><label id="radv-iface-rdnss-local">rdnss local <m/switch/</tag>
4162 Use only local (interface-specific) RDNSS definitions for this
4163 interface. Otherwise, both global and local definitions are used. Could
4164 also be used to disable RDNSS for given interface if no local definitons
4165 are specified. Default: no.
4166
4167 <tag><label id="radv-iface-dnssl-local">dnssl local <m/switch/</tag>
4168 Use only local DNSSL definitions for this interface. See <cf/rdnss local/
4169 option above. Default: no.
4170 </descrip>
4171
4172 <p>Prefix specific options
4173
4174 <descrip>
4175 <tag><label id="radv-prefix-skip">skip <m/switch/</tag>
4176 This option allows to specify that given prefix should not be
4177 advertised. This is useful for making exceptions from a default policy
4178 of advertising all prefixes. Note that for withdrawing an already
4179 advertised prefix it is more useful to advertise it with zero valid
4180 lifetime. Default: no
4181
4182 <tag><label id="radv-prefix-onlink">onlink <m/switch/</tag>
4183 This option specifies whether hosts may use the advertised prefix for
4184 onlink determination. Default: yes
4185
4186 <tag><label id="radv-prefix-autonomous">autonomous <m/switch/</tag>
4187 This option specifies whether hosts may use the advertised prefix for
4188 stateless autoconfiguration. Default: yes
4189
4190 <tag><label id="radv-prefix-valid-lifetime">valid lifetime <m/expr/ [sensitive <m/switch/]</tag>
4191 This option specifies the time (in seconds) how long (after the
4192 receipt of RA) the prefix information is valid, i.e., autoconfigured
4193 IP addresses can be assigned and hosts with that IP addresses are
4194 considered directly reachable. 0 means the prefix is no longer
4195 valid. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
4196 Default: 86400 (1 day), <cf/sensitive/ no.
4197
4198 <tag><label id="radv-prefix-preferred-lifetime">preferred lifetime <m/expr/ [sensitive <m/switch/]</tag>
4199 This option specifies the time (in seconds) how long (after the
4200 receipt of RA) IP addresses generated from the prefix using stateless
4201 autoconfiguration remain preferred. For <cf/sensitive/ option,
4202 see <ref id="radv-trigger" name="trigger">. Default: 14400 (4 hours),
4203 <cf/sensitive/ no.
4204 </descrip>
4205
4206 <p>RDNSS specific options:
4207
4208 <descrip>
4209 <tag><label id="radv-rdnss-ns">ns <m/address/</tag>
4210 This option specifies one recursive DNS server. Can be used multiple
4211 times for multiple servers. It is mandatory to have at least one
4212 <cf/ns/ option in <cf/rdnss/ definition.
4213
4214 <tag><label id="radv-rdnss-lifetime">lifetime [mult] <m/expr/</tag>
4215 This option specifies the time how long the RDNSS information may be
4216 used by clients after the receipt of RA. It is expressed either in
4217 seconds or (when <cf/mult/ is used) in multiples of <cf/max ra
4218 interval/. Note that RDNSS information is also invalidated when
4219 <cf/default lifetime/ expires. 0 means these addresses are no longer
4220 valid DNS servers. Default: 3 * <cf/max ra interval/.
4221 </descrip>
4222
4223 <p>DNSSL specific options:
4224
4225 <descrip>
4226 <tag><label id="radv-dnssl-domain">domain <m/address/</tag>
4227 This option specifies one DNS search domain. Can be used multiple times
4228 for multiple domains. It is mandatory to have at least one <cf/domain/
4229 option in <cf/dnssl/ definition.
4230
4231 <tag><label id="radv-dnssl-lifetime">lifetime [mult] <m/expr/</tag>
4232 This option specifies the time how long the DNSSL information may be
4233 used by clients after the receipt of RA. Details are the same as for
4234 RDNSS <cf/lifetime/ option above. Default: 3 * <cf/max ra interval/.
4235 </descrip>
4236
4237 <sect1>Attributes
4238 <label id="radv-attr">
4239
4240 <p>RAdv defines two route attributes:
4241
4242 <descrip>
4243 <tag><label id="rta-ra-preference">enum ra_preference</tag>
4244 The preference of the route. The value can be <it/RA_PREF_LOW/,
4245 <it/RA_PREF_MEDIUM/ or <it/RA_PREF_HIGH/. If the attribute is not set,
4246 the <ref id="radv-iface-route-preference" name="route preference">
4247 option is used.
4248
4249 <tag><label id="rta-ra-lifetime">int ra_lifetime</tag>
4250 The advertised lifetime of the route, in seconds. The special value of
4251 0xffffffff represents infinity. If the attribute is not set, the
4252 <ref id="radv-iface-route-lifetime" name="route lifetime">
4253 option is used.
4254 </descrip>
4255
4256 <sect1>Example
4257 <label id="radv-exam">
4258
4259 <p><code>
4260 ipv6 table radv_routes; # Manually configured routes go here
4261
4262 protocol static {
4263 ipv6 { table radv_routes; };
4264
4265 route 2001:0DB8:4000::/48 unreachable;
4266 route 2001:0DB8:4010::/48 unreachable;
4267
4268 route 2001:0DB8:4020::/48 unreachable {
4269 ra_preference = RA_PREF_HIGH;
4270 ra_lifetime = 3600;
4271 };
4272 }
4273
4274 protocol radv {
4275 propagate routes yes; # Propagate the routes from the radv_routes table
4276 ipv6 { table radv_routes; export all; };
4277
4278 interface "eth2" {
4279 max ra interval 5; # Fast failover with more routers
4280 managed yes; # Using DHCPv6 on eth2
4281 prefix ::/0 {
4282 autonomous off; # So do not autoconfigure any IP
4283 };
4284 };
4285
4286 interface "eth*"; # No need for any other options
4287
4288 prefix 2001:0DB8:1234::/48 {
4289 preferred lifetime 0; # Deprecated address range
4290 };
4291
4292 prefix 2001:0DB8:2000::/48 {
4293 autonomous off; # Do not autoconfigure
4294 };
4295
4296 rdnss 2001:0DB8:1234::10; # Short form of RDNSS
4297
4298 rdnss {
4299 lifetime mult 10;
4300 ns 2001:0DB8:1234::11;
4301 ns 2001:0DB8:1234::12;
4302 };
4303
4304 dnssl {
4305 lifetime 3600;
4306 domain "abc.com";
4307 domain "xyz.com";
4308 };
4309 }
4310 </code>
4311
4312
4313 <sect>RIP
4314 <label id="rip">
4315
4316 <sect1>Introduction
4317 <label id="rip-intro">
4318
4319 <p>The RIP protocol (also sometimes called Rest In Pieces) is a simple protocol,
4320 where each router broadcasts (to all its neighbors) distances to all networks it
4321 can reach. When a router hears distance to another network, it increments it and
4322 broadcasts it back. Broadcasts are done in regular intervals. Therefore, if some
4323 network goes unreachable, routers keep telling each other that its distance is
4324 the original distance plus 1 (actually, plus interface metric, which is usually
4325 one). After some time, the distance reaches infinity (that's 15 in RIP) and all
4326 routers know that network is unreachable. RIP tries to minimize situations where
4327 counting to infinity is necessary, because it is slow. Due to infinity being 16,
4328 you can't use RIP on networks where maximal distance is higher than 15
4329 hosts.
4330
4331 <p>BIRD supports RIPv1 (<rfc id="1058">), RIPv2 (<rfc id="2453">), RIPng (<rfc
4332 id="2080">), and RIP cryptographic authentication (<rfc id="4822">).
4333
4334 <p>RIP is a very simple protocol, and it has a lot of shortcomings. Slow
4335 convergence, big network load and inability to handle larger networks makes it
4336 pretty much obsolete. It is still usable on very small networks.
4337
4338 <sect1>Configuration
4339 <label id="rip-config">
4340
4341 <p>RIP configuration consists mainly of common protocol options and interface
4342 definitions, most RIP options are interface specific. RIPng (RIP for IPv6)
4343 protocol instance can be configured by using <cf/rip ng/ instead of just
4344 <cf/rip/ as a protocol type.
4345
4346 <p>RIP needs one IPv4 channel. RIPng needs one IPv6 channel. If no channel is
4347 configured, appropriate channel is defined with default parameters.
4348
4349 <code>
4350 protocol rip [ng] [&lt;name&gt;] {
4351 infinity &lt;number&gt;;
4352 ecmp &lt;switch&gt; [limit &lt;number&gt;];
4353 interface &lt;interface pattern&gt; {
4354 metric &lt;number&gt;;
4355 mode multicast|broadcast;
4356 passive &lt;switch&gt;;
4357 address &lt;ip&gt;;
4358 port &lt;number&gt;;
4359 version 1|2;
4360 split horizon &lt;switch&gt;;
4361 poison reverse &lt;switch&gt;;
4362 check zero &lt;switch&gt;;
4363 update time &lt;number&gt;;
4364 timeout time &lt;number&gt;;
4365 garbage time &lt;number&gt;;
4366 ecmp weight &lt;number&gt;;
4367 ttl security &lt;switch&gt;; | tx only;
4368 tx class|dscp &lt;number&gt;;
4369 tx priority &lt;number&gt;;
4370 rx buffer &lt;number&gt;;
4371 tx length &lt;number&gt;;
4372 check link &lt;switch&gt;;
4373 authentication none|plaintext|cryptographic;
4374 password "&lt;text&gt;";
4375 password "&lt;text&gt;" {
4376 id &lt;num&gt;;
4377 generate from "&lt;date&gt;";
4378 generate to "&lt;date&gt;";
4379 accept from "&lt;date&gt;";
4380 accept to "&lt;date&gt;";
4381 from "&lt;date&gt;";
4382 to "&lt;date&gt;";
4383 algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 );
4384 };
4385 };
4386 }
4387 </code>
4388
4389 <descrip>
4390 <tag><label id="rip-infinity">infinity <M>number</M></tag>
4391 Selects the distance of infinity. Bigger values will make
4392 protocol convergence even slower. The default value is 16.
4393
4394 <tag><label id="rip-ecmp">ecmp <M>switch</M> [limit <M>number</M>]</tag>
4395 This option specifies whether RIP is allowed to generate ECMP
4396 (equal-cost multipath) routes. Such routes are used when there are
4397 several directions to the destination, each with the same (computed)
4398 cost. This option also allows to specify a limit on maximum number of
4399 nexthops in one route. By default, ECMP is enabled if supported by
4400 Kernel. Default value of the limit is 16.
4401
4402 <tag><label id="rip-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag>
4403 Interface definitions specify a set of interfaces on which the
4404 protocol is activated and contain interface specific options.
4405 See <ref id="proto-iface" name="interface"> common options for
4406 detailed description.
4407 </descrip>
4408
4409 <p>Interface specific options:
4410
4411 <descrip>
4412 <tag><label id="rip-iface-metric">metric <m/num/</tag>
4413 This option specifies the metric of the interface. When a route is
4414 received from the interface, its metric is increased by this value
4415 before further processing. Valid values are 1-255, but values higher
4416 than infinity has no further meaning. Default: 1.
4417
4418 <tag><label id="rip-iface-mode">mode multicast|broadcast</tag>
4419 This option selects the mode for RIP to use on the interface. The
4420 default is multicast mode for RIPv2 and broadcast mode for RIPv1.
4421 RIPng always uses the multicast mode.
4422
4423 <tag><label id="rip-iface-passive">passive <m/switch/</tag>
4424 Passive interfaces receive routing updates but do not transmit any
4425 messages. Default: no.
4426
4427 <tag><label id="rip-iface-address">address <m/ip/</tag>
4428 This option specifies a destination address used for multicast or
4429 broadcast messages, the default is the official RIP (224.0.0.9) or RIPng
4430 (ff02::9) multicast address, or an appropriate broadcast address in the
4431 broadcast mode.
4432
4433 <tag><label id="rip-iface-port">port <m/number/</tag>
4434 This option selects an UDP port to operate on, the default is the
4435 official RIP (520) or RIPng (521) port.
4436
4437 <tag><label id="rip-iface-version">version 1|2</tag>
4438 This option selects the version of RIP used on the interface. For RIPv1,
4439 automatic subnet aggregation is not implemented, only classful network
4440 routes and host routes are propagated. Note that BIRD allows RIPv1 to be
4441 configured with features that are defined for RIPv2 only, like
4442 authentication or using multicast sockets. The default is RIPv2 for IPv4
4443 RIP, the option is not supported for RIPng, as no further versions are
4444 defined.
4445
4446 <tag><label id="rip-iface-version-only">version only <m/switch/</tag>
4447 Regardless of RIP version configured for the interface, BIRD accepts
4448 incoming packets of any RIP version. This option restrict accepted
4449 packets to the configured version. Default: no.
4450
4451 <tag><label id="rip-iface-split-horizon">split horizon <m/switch/</tag>
4452 Split horizon is a scheme for preventing routing loops. When split
4453 horizon is active, routes are not regularly propagated back to the
4454 interface from which they were received. They are either not propagated
4455 back at all (plain split horizon) or propagated back with an infinity
4456 metric (split horizon with poisoned reverse). Therefore, other routers
4457 on the interface will not consider the router as a part of an
4458 independent path to the destination of the route. Default: yes.
4459
4460 <tag><label id="rip-iface-poison-reverse">poison reverse <m/switch/</tag>
4461 When split horizon is active, this option specifies whether the poisoned
4462 reverse variant (propagating routes back with an infinity metric) is
4463 used. The poisoned reverse has some advantages in faster convergence,
4464 but uses more network traffic. Default: yes.
4465
4466 <tag><label id="rip-iface-check-zero">check zero <m/switch/</tag>
4467 Received RIPv1 packets with non-zero values in reserved fields should
4468 be discarded. This option specifies whether the check is performed or
4469 such packets are just processed as usual. Default: yes.
4470
4471 <tag><label id="rip-iface-update-time">update time <m/number/</tag>
4472 Specifies the number of seconds between periodic updates. A lower number
4473 will mean faster convergence but bigger network load. Default: 30.
4474
4475 <tag><label id="rip-iface-timeout-time">timeout time <m/number/</tag>
4476 Specifies the time interval (in seconds) between the last received route
4477 announcement and the route expiration. After that, the network is
4478 considered unreachable, but still is propagated with infinity distance.
4479 Default: 180.
4480
4481 <tag><label id="rip-iface-garbage-time">garbage time <m/number/</tag>
4482 Specifies the time interval (in seconds) between the route expiration
4483 and the removal of the unreachable network entry. The garbage interval,
4484 when a route with infinity metric is propagated, is used for both
4485 internal (after expiration) and external (after withdrawal) routes.
4486 Default: 120.
4487
4488 <tag><label id="rip-iface-ecmp-weight">ecmp weight <m/number/</tag>
4489 When ECMP (multipath) routes are allowed, this value specifies a
4490 relative weight used for nexthops going through the iface. Valid
4491 values are 1-256. Default value is 1.
4492
4493 <tag><label id="rip-iface-auth">authentication none|plaintext|cryptographic</tag>
4494 Selects authentication method to be used. <cf/none/ means that packets
4495 are not authenticated at all, <cf/plaintext/ means that a plaintext
4496 password is embedded into each packet, and <cf/cryptographic/ means that
4497 packets are authenticated using some cryptographic hash function
4498 selected by option <cf/algorithm/ for each key. The default
4499 cryptographic algorithm for RIP keys is Keyed-MD5. If you set
4500 authentication to not-none, it is a good idea to add <cf>password</cf>
4501 section. Default: none.
4502
4503 <tag><label id="rip-iface-pass">password "<m/text/"</tag>
4504 Specifies a password used for authentication. See <ref id="proto-pass"
4505 name="password"> common option for detailed description.
4506
4507 <tag><label id="rip-iface-ttl-security">ttl security [<m/switch/ | tx only]</tag>
4508 TTL security is a feature that protects routing protocols from remote
4509 spoofed packets by using TTL 255 instead of TTL 1 for protocol packets
4510 destined to neighbors. Because TTL is decremented when packets are
4511 forwarded, it is non-trivial to spoof packets with TTL 255 from remote
4512 locations.
4513
4514 If this option is enabled, the router will send RIP packets with TTL 255
4515 and drop received packets with TTL less than 255. If this option si set
4516 to <cf/tx only/, TTL 255 is used for sent packets, but is not checked
4517 for received packets. Such setting does not offer protection, but offers
4518 compatibility with neighbors regardless of whether they use ttl
4519 security.
4520
4521 For RIPng, TTL security is a standard behavior (required by <rfc
4522 id="2080">) and therefore default value is yes. For IPv4 RIP, default
4523 value is no.
4524
4525 <tag><label id="rip-iface-tx-class">tx class|dscp|priority <m/number/</tag>
4526 These options specify the ToS/DiffServ/Traffic class/Priority of the
4527 outgoing RIP packets. See <ref id="proto-tx-class" name="tx class"> common
4528 option for detailed description.
4529
4530 <tag><label id="rip-iface-rx-buffer">rx buffer <m/number/</tag>
4531 This option specifies the size of buffers used for packet processing.
4532 The buffer size should be bigger than maximal size of received packets.
4533 The default value is 532 for IPv4 RIP and interface MTU value for RIPng.
4534
4535 <tag><label id="rip-iface-tx-length">tx length <m/number/</tag>
4536 This option specifies the maximum length of generated RIP packets. To
4537 avoid IP fragmentation, it should not exceed the interface MTU value.
4538 The default value is 532 for IPv4 RIP and interface MTU value for RIPng.
4539
4540 <tag><label id="rip-iface-check-link">check link <m/switch/</tag>
4541 If set, the hardware link state (as reported by OS) is taken into
4542 consideration. When the link disappears (e.g. an ethernet cable is
4543 unplugged), neighbors are immediately considered unreachable and all
4544 routes received from them are withdrawn. It is possible that some
4545 hardware drivers or platforms do not implement this feature.
4546 Default: yes.
4547 </descrip>
4548
4549 <sect1>Attributes
4550 <label id="rip-attr">
4551
4552 <p>RIP defines two route attributes:
4553
4554 <descrip>
4555 <tag><label id="rta-rip-metric">int rip_metric</tag>
4556 RIP metric of the route (ranging from 0 to <cf/infinity/). When routes
4557 from different RIP instances are available and all of them have the same
4558 preference, BIRD prefers the route with lowest <cf/rip_metric/. When a
4559 non-RIP route is exported to RIP, the default metric is 1.
4560
4561 <tag><label id="rta-rip-tag">int rip_tag</tag>
4562 RIP route tag: a 16-bit number which can be used to carry additional
4563 information with the route (for example, an originating AS number in
4564 case of external routes). When a non-RIP route is exported to RIP, the
4565 default tag is 0.
4566 </descrip>
4567
4568 <sect1>Example
4569 <label id="rip-exam">
4570
4571 <p><code>
4572 protocol rip {
4573 ipv4 {
4574 import all;
4575 export all;
4576 };
4577 interface "eth*" {
4578 metric 2;
4579 port 1520;
4580 mode multicast;
4581 update time 12;
4582 timeout time 60;
4583 authentication cryptographic;
4584 password "secret" { algorithm hmac sha256; };
4585 };
4586 }
4587 </code>
4588
4589
4590 <sect>RPKI
4591 <label id="rpki">
4592
4593 <sect1>Introduction
4594
4595 <p>The Resource Public Key Infrastructure (RPKI) is mechanism for origin
4596 validation of BGP routes (RFC 6480). BIRD supports only so-called RPKI-based
4597 origin validation. There is implemented RPKI to Router (RPKI-RTR) protocol (RFC
4598 6810). It uses some of the RPKI data to allow a router to verify that the
4599 autonomous system announcing an IP address prefix is in fact authorized to do
4600 so. This is not crypto checked so can be violated. But it should prevent the
4601 vast majority of accidental hijackings on the Internet today, e.g. the famous
4602 Pakastani accidental announcement of YouTube's address space.
4603
4604 <p>The RPKI-RTR protocol receives and maintains a set of ROAs from a cache
4605 server (also called validator). You can validate routes (RFC 6483) using
4606 function <cf/roa_check()/ in filter and set it as import filter at the BGP
4607 protocol. BIRD should re-validate all of affected routes after RPKI update by
4608 RFC 6811, but we don't support it yet! You can use a BIRD's client command
4609 <cf>reload in <m/bgp_protocol_name/</cf> for manual call of revalidation of all
4610 routes.
4611
4612 <sect1>Supported transports
4613 <p>
4614 <itemize>
4615 <item>Unprotected transport over TCP uses a port 323. The cache server
4616 and BIRD router should be on the same trusted and controlled network
4617 for security reasons.
4618 <item>SSHv2 encrypted transport connection uses the normal SSH port
4619 22.
4620 </itemize>
4621
4622 <sect1>Configuration
4623
4624 <p>We currently support just one cache server per protocol. However you can
4625 define more RPKI protocols generally.
4626
4627 <code>
4628 protocol rpki [&lt;name&gt;] {
4629 roa4 { table &lt;tab&gt;; };
4630 roa6 { table &lt;tab&gt;; };
4631 remote &lt;ip&gt; | "&lt;domain&gt;" [port &lt;num&gt;];
4632 port &lt;num&gt;;
4633 refresh [keep] &lt;num&gt;;
4634 retry [keep] &lt;num&gt;;
4635 expire [keep] &lt;num&gt;;
4636 transport tcp;
4637 transport ssh {
4638 bird private key "&lt;/path/to/id_rsa&gt;";
4639 remote public key "&lt;/path/to/known_host&gt;";
4640 user "&lt;name&gt;";
4641 };
4642 }
4643 </code>
4644
4645 <p>Alse note that you have to specify the ROA channel. If you want to import
4646 only IPv4 prefixes you have to specify only roa4 channel. Similarly with IPv6
4647 prefixes only. If you want to fetch both IPv4 and even IPv6 ROAs you have to
4648 specify both channels.
4649
4650 <sect2>RPKI protocol options
4651 <p>
4652 <descrip>
4653 <tag>remote <m/ip/ | "<m/hostname/" [port <m/num/]</tag> Specifies
4654 a destination address of the cache server. Can be specified by an IP
4655 address or by full domain name string. Only one cache can be specified
4656 per protocol. This option is required.
4657
4658 <tag>port <m/num/</tag> Specifies the port number. The default port
4659 number is 323 for transport without any encryption and 22 for transport
4660 with SSH encryption.
4661
4662 <tag>refresh [keep] <m/num/</tag> Time period in seconds. Tells how
4663 long to wait before next attempting to poll the cache using a Serial
4664 Query or a Reset Query packet. Must be lower than 86400 seconds (one
4665 day). Too low value can caused a false positive detection of
4666 network connection problems. A keyword <cf/keep/ suppresses updating
4667 this value by a cache server.
4668 Default: 3600 seconds
4669
4670 <tag>retry [keep] <m/num/</tag> Time period in seconds between a failed
4671 Serial/Reset Query and a next attempt. Maximum allowed value is 7200
4672 seconds (two hours). Too low value can caused a false positive
4673 detection of network connection problems. A keyword <cf/keep/
4674 suppresses updating this value by a cache server.
4675 Default: 600 seconds
4676
4677 <tag>expire [keep] <m/num/</tag> Time period in seconds. Received
4678 records are deleted if the client was unable to successfully refresh
4679 data for this time period. Must be in range from 600 seconds (ten
4680 minutes) to 172800 seconds (two days). A keyword <cf/keep/
4681 suppresses updating this value by a cache server.
4682 Default: 7200 seconds
4683
4684 <tag>transport tcp</tag> Unprotected transport over TCP. It's a default
4685 transport. Should be used only on secure private networks.
4686 Default: tcp
4687
4688 <tag>transport ssh { <m/SSH transport options.../ }</tag> It enables a
4689 SSHv2 transport encryption. Cannot be combined with a TCP transport.
4690 Default: off
4691 </descrip>
4692
4693 <sect3>SSH transport options
4694 <p>
4695 <descrip>
4696 <tag>bird private key "<m>/path/to/id_rsa</m>"</tag>
4697 A path to the BIRD's private SSH key for authentication.
4698 It can be a <cf><m>id_rsa</m></cf> file.
4699
4700 <tag>remote public key "<m>/path/to/known_host</m>"</tag>
4701 A path to the cache's public SSH key for verification identity
4702 of the cache server. It could be a path to <cf><m>known_host</m></cf> file.
4703
4704 <tag>user "<m/name/"</tag>
4705 A SSH user name for authentication. This option is a required.
4706 </descrip>
4707
4708 <sect1>Examples
4709 <sect2>BGP origin validation
4710 <p>Policy: Don't import <cf/ROA_INVALID/ routes.
4711 <code>
4712 roa4 table r4;
4713 roa6 table r6;
4714
4715 protocol rpki {
4716 debug all;
4717
4718 roa4 { table r4; };
4719 roa6 { table r6; };
4720
4721 # Please, do not use rpki-validator.realmv6.org in production
4722 remote "rpki-validator.realmv6.org" port 8282;
4723
4724 retry keep 5;
4725 refresh keep 30;
4726 expire 600;
4727 }
4728
4729 filter peer_in_v4 {
4730 if (roa_check(r4, net, bgp_path.last) = ROA_INVALID) then
4731 {
4732 print "Ignore invalid ROA ", net, " for ASN ", bgp_path.last;
4733 reject;
4734 }
4735 accept;
4736 }
4737
4738 protocol bgp {
4739 debug all;
4740 local as 65000;
4741 neighbor 192.168.2.1 as 65001;
4742 ipv4 {
4743 import filter peer_in_v4;
4744 export none;
4745 };
4746 }
4747 </code>
4748
4749 <sect2>SSHv2 transport encryption
4750 <p>
4751 <code>
4752 roa4 table r4;
4753 roa6 table r6;
4754
4755 protocol rpki {
4756 debug all;
4757
4758 roa4 { table r4; };
4759 roa6 { table r6; };
4760
4761 remote 127.0.0.1 port 2345;
4762 transport ssh {
4763 bird private key "/home/birdgeek/.ssh/id_rsa";
4764 remote public key "/home/birdgeek/.ssh/known_hosts";
4765 user "birdgeek";
4766 };
4767
4768 # Default interval values
4769 }
4770 </code>
4771
4772
4773 <sect>Static
4774 <label id="static">
4775
4776 <p>The Static protocol doesn't communicate with other routers in the network,
4777 but instead it allows you to define routes manually. This is often used for
4778 specifying how to forward packets to parts of the network which don't use
4779 dynamic routing at all and also for defining sink routes (i.e., those telling to
4780 return packets as undeliverable if they are in your IP block, you don't have any
4781 specific destination for them and you don't want to send them out through the
4782 default route to prevent routing loops).
4783
4784 <p>There are three classes of definitions in Static protocol configuration --
4785 global options, static route definitions, and per-route options. Usually, the
4786 definition of the protocol contains mainly a list of static routes.
4787 Static routes have no specific attributes.
4788
4789 <p>Global options:
4790
4791 <descrip>
4792 <tag><label id="static-check-link">check link <m/switch/</tag>
4793 If set, hardware link states of network interfaces are taken into
4794 consideration. When link disappears (e.g. ethernet cable is unplugged),
4795 static routes directing to that interface are removed. It is possible
4796 that some hardware drivers or platforms do not implement this feature.
4797 Default: off.
4798
4799 <tag><label id="static-igp-table">igp table <m/name/</tag>
4800 Specifies a table that is used for route table lookups of recursive
4801 routes. Default: the same table as the protocol is connected to.
4802 </descrip>
4803
4804 <p>Route definitions (each may also contain a block of per-route options):
4805
4806 <sect1>Regular routes; MPLS switching rules
4807
4808 <p>There exist several types of routes; keep in mind that <m/prefix/ syntax is
4809 <ref id="type-prefix" name="dependent on network type">.
4810
4811 <descrip>
4812 <tag>route <m/prefix/ via <m/ip/|<m/"interface"/ [mpls <m/num/[/<m/num/[/<m/num/[...]]]]</tag>
4813 Next hop routes may bear one or more <ref id="route-next-hop" name="next hops">.
4814 Every next hop is preceded by <cf/via/ and configured as shown.
4815
4816 <tag>route <m/prefix/ recursive <m/ip/ [mpls <m/num/[/<m/num/[/<m/num/[...]]]]</tag>
4817 Recursive nexthop resolves the given IP in the configured IGP table and
4818 uses that route's next hop. The MPLS stacks are concatenated; on top is
4819 the IGP's nexthop stack and on bottom is this route's stack.
4820
4821 <tag>route <m/prefix/ blackhole|unreachable|prohibit</tag>
4822 Special routes specifying to silently drop the packet, return it as
4823 unreachable or return it as administratively prohibited. First two
4824 targets are also known as <cf/drop/ and <cf/reject/.
4825 </descrip>
4826
4827 <p>When the particular destination is not available (the interface is down or
4828 the next hop of the route is not a neighbor at the moment), Static just
4829 uninstalls the route from the table it is connected to and adds it again as soon
4830 as the destination becomes adjacent again.
4831
4832 <sect1>Route Origin Authorization
4833
4834 <p>The ROA config is just <cf>route <m/prefix/ max <m/int/ as <m/int/</cf> with no nexthop.
4835
4836 <sect1>Flowspec
4837 <label id="flowspec-network-type">
4838
4839 <p>The flow specification are rules for routers and firewalls for filtering
4840 purpose. It is described by <rfc id="5575">. There are 3 types of arguments:
4841 <m/inet4/ or <m/inet6/ prefixes, bitmasks matching expressions and numbers
4842 matching expressions.
4843
4844 Bitmasks matching is written using <m/value/<cf>/</cf><m/mask/ or
4845 <cf/!/<m/value/<cf>/</cf><m/mask/ pairs. It means that <cf/(/<m/data/ <cf/&/
4846 <m/mask/<cf/)/ is or is not equal to <m/value/.
4847
4848 Numbers matching is a matching sequence of numbers and ranges separeted by a
4849 commas (<cf/,/) (e.g. <cf/10,20,30/). Ranges can be written using double dots
4850 <cf/../ notation (e.g. <cf/80..90,120..124/). An alternative notation are
4851 sequence of one or more pairs of relational operators and values separated by
4852 logical operators <cf/&&/ or <cf/||/. Allowed relational operators are <cf/=/,
4853 <cf/!=/, <cf/</, <cf/<=/, <cf/>/, <cf/>=/, <cf/true/ and <cf/false/.
4854
4855 <sect2>IPv4 Flowspec
4856
4857 <p><descrip>
4858 <tag><label id="flow-dst">dst <m/inet4/</tag>
4859 Set a matching destination prefix (e.g. <cf>dst 192.168.0.0/16</cf>).
4860 Only this option is mandatory in IPv4 Flowspec.
4861
4862 <tag><label id="flow-src">src <m/inet4/</tag>
4863 Set a matching source prefix (e.g. <cf>src 10.0.0.0/8</cf>).
4864
4865 <tag><label id="flow-proto">proto <m/numbers-match/</tag>
4866 Set a matching IP protocol numbers (e.g. <cf/proto 6/).
4867
4868 <tag><label id="flow-port">port <m/numbers-match/</tag>
4869 Set a matching source or destination TCP/UDP port numbers (e.g.
4870 <cf>port 1..1023,1194,3306</cf>).
4871
4872 <tag><label id="flow-dport">dport <m/numbers-match/</tag>
4873 Set a mating destination port numbers (e.g. <cf>dport 49151</cf>).
4874
4875 <tag><label id="flow-sport">sport <m/numbers-match/</tag>
4876 Set a matching source port numbers (e.g. <cf>sport = 0</cf>).
4877
4878 <tag><label id="flow-icmp-type">icmp type <m/numbers-match/</tag>
4879 Set a matching type field number of an ICMP packet (e.g. <cf>icmp type
4880 3</cf>)
4881
4882 <tag><label id="flow-icmp-code">icmp code <m/numbers-match/</tag>
4883 Set a matching code field number of an ICMP packet (e.g. <cf>icmp code
4884 1</cf>)
4885
4886 <tag><label id="flow-tcp-flags">tcp flags <m/bitmask-match/</tag>
4887 Set a matching bitmask for TCP header flags (aka control bits) (e.g.
4888 <cf>tcp flags 0x03/0x0f;</cf>). The maximum length of mask is 12 bits
4889 (0xfff).
4890
4891 <tag><label id="flow-length">length <m/numbers-match/</tag>
4892 Set a matching packet length (e.g. <cf>length > 1500;</cf>)
4893
4894 <tag><label id="flow-dscp">dscp <m/numbers-match/</tag>
4895 Set a matching DiffServ Code Point number (e.g. <cf>length > 1500;</cf>).
4896
4897 <tag><label id="flow-fragment">fragment <m/fragmentation-type/</tag>
4898 Set a matching type of packet fragmentation. Allowed fragmentation
4899 types are <cf/dont_fragment/, <cf/is_fragment/, <cf/first_fragment/,
4900 <cf/last_fragment/ (e.g. <cf>fragment is_fragment &&
4901 !dont_fragment</cf>).
4902 </descrip>
4903
4904 <p><code>
4905 protocol static {
4906 flow4;
4907
4908 route flow4 {
4909 dst 10.0.0.0/8;
4910 port > 24 && < 30 || 40..50,60..70,80 && >= 90;
4911 tcp flags 0x03/0x0f;
4912 length > 1024;
4913 dscp = 63;
4914 fragment dont_fragment, is_fragment || !first_fragment;
4915 };
4916 }
4917 </code>
4918
4919 <sect2>Differences for IPv6 Flowspec
4920
4921 <p>Flowspec IPv6 are same as Flowspec IPv4 with a few exceptions.
4922 <itemize>
4923 <item>Prefixes <m/inet6/ can be specified not only with prefix length,
4924 but with prefix <cf/offset/ <m/num/ too (e.g.
4925 <cf>::1234:5678:9800:0000/101 offset 64</cf>). Offset means to don't
4926 care of <m/num/ first bits.
4927 <item>IPv6 Flowspec hasn't mandatory any flowspec component.
4928 <item>In IPv6 packets, there is a matching the last next header value
4929 for a matching IP protocol number (e.g. <cf>next header 6</cf>).
4930 <item>It is not possible to set <cf>dont_fragment</cf> as a type of
4931 packet fragmentation.
4932 </itemize>
4933
4934 <p><descrip>
4935 <tag><label id="flow6-dst">dst <m/inet6/ [offset <m/num/]</tag>
4936 Set a matching destination IPv6 prefix (e.g. <cf>dst
4937 ::1c77:3769:27ad:a11a/128 offset 64</cf>).
4938
4939 <tag><label id="flow6-src">src <m/inet6/ [offset <m/num/]</tag>
4940 Set a matching source IPv6 prefix (e.g. <cf>src fe80::/64</cf>).
4941
4942 <tag><label id="flow6-next-header">next header <m/numbers-match/</tag>
4943 Set a matching IP protocol numbers (e.g. <cf>next header != 6</cf>).
4944
4945 <tag><label id="flow6-label">label <m/bitmask-match/</tag>
4946 Set a 20-bit bitmask for matching Flow Label field in IPv6 packets
4947 (e.g. <cf>label 0x8e5/0x8e5</cf>).
4948 </descrip>
4949
4950 <p><code>
4951 protocol static {
4952 flow6 { table myflow6; };
4953
4954 route flow6 {
4955 dst fec0:1122:3344:5566:7788:99aa:bbcc:ddee/128;
4956 src 0000:0000:0000:0001:1234:5678:9800:0000/101 offset 63;
4957 next header = 23;
4958 sport > 24 && < 30 || = 40 || 50,60,70..80;
4959 dport = 50;
4960 tcp flags 0x03/0x0f, !0/0xff || 0x33/0x33;
4961 fragment !is_fragment || !first_fragment;
4962 label 0xaaaa/0xaaaa && 0x33/0x33;
4963 };
4964 }
4965 </code>
4966
4967 <sect1>Per-route options
4968 <p>
4969 <descrip>
4970 <tag><label id="static-route-bfd">bfd <m/switch/</tag>
4971 The Static protocol could use BFD protocol for next hop liveness
4972 detection. If enabled, a BFD session to the route next hop is created
4973 and the static route is BFD-controlled -- the static route is announced
4974 only if the next hop liveness is confirmed by BFD. If the BFD session
4975 fails, the static route is removed. Note that this is a bit different
4976 compared to other protocols, which may use BFD as an advisory mechanism
4977 for fast failure detection but ignores it if a BFD session is not even
4978 established.
4979
4980 This option can be used for static routes with a direct next hop, or
4981 also for for individual next hops in a static multipath route (see
4982 above). Note that BFD protocol also has to be configured, see
4983 <ref id="bfd" name="BFD"> section for details. Default value is no.
4984
4985 <tag><label id="static-route-filter"><m/filter expression/</tag>
4986 This is a special option that allows filter expressions to be configured
4987 on per-route basis. Can be used multiple times. These expressions are
4988 evaluated when the route is originated, similarly to the import filter
4989 of the static protocol. This is especially useful for configuring route
4990 attributes, e.g., <cf/ospf_metric1 = 100;/ for a route that will be
4991 exported to the OSPF protocol.
4992 </descrip>
4993
4994 <sect1>Example static config
4995
4996 <p><code>
4997 protocol static {
4998 ipv4 { table testable; }; # Connect to a non-default routing table
4999 check link; # Advertise routes only if link is up
5000 route 0.0.0.0/0 via 198.51.100.130; # Default route
5001 route 10.0.0.0/8 # Multipath route
5002 via 198.51.100.10 weight 2
5003 via 198.51.100.20 bfd # BFD-controlled next hop
5004 via 192.0.2.1;
5005 route 203.0.113.0/24 unreachable; # Sink route
5006 route 10.2.0.0/24 via "arc0"; # Secondary network
5007 route 192.168.10.0/24 via 198.51.100.100 {
5008 ospf_metric1 = 20; # Set extended attribute
5009 }
5010 route 192.168.10.0/24 via 198.51.100.100 {
5011 ospf_metric2 = 100; # Set extended attribute
5012 ospf_tag = 2; # Set extended attribute
5013 bfd; # BFD-controlled route
5014 }
5015 }
5016 </code>
5017
5018
5019 <chapt>Conclusions
5020 <label id="conclusion">
5021
5022 <sect>Future work
5023 <label id="future-work">
5024
5025 <p>Although BIRD supports all the commonly used routing protocols, there are
5026 still some features which would surely deserve to be implemented in future
5027 versions of BIRD:
5028
5029 <itemize>
5030 <item>Opaque LSA's
5031 <item>Route aggregation and flap dampening
5032 <item>Multicast routing protocols
5033 <item>Ports to other systems
5034 </itemize>
5035
5036
5037 <sect>Getting more help
5038 <label id="help">
5039
5040 <p>If you use BIRD, you're welcome to join the bird-users mailing list
5041 (<HTMLURL URL="mailto:bird-users@network.cz" name="bird-users@network.cz">)
5042 where you can share your experiences with the other users and consult
5043 your problems with the authors. To subscribe to the list, visit
5044 <HTMLURL URL="http://bird.network.cz/?m_list" name="http://bird.network.cz/?m_list">.
5045 The home page of BIRD can be found at <HTMLURL URL="http://bird.network.cz/" name="http://bird.network.cz/">.
5046
5047 <p>BIRD is a relatively young system and it probably contains some bugs. You can
5048 report any problems to the bird-users list and the authors will be glad to solve
5049 them, but before you do so, please make sure you have read the available
5050 documentation and that you are running the latest version (available at
5051 <HTMLURL URL="ftp://bird.network.cz/pub/bird" name="bird.network.cz:/pub/bird">).
5052 (Of course, a patch which fixes the bug is always welcome as an attachment.)
5053
5054 <p>If you want to understand what is going inside, Internet standards are a good
5055 and interesting reading. You can get them from
5056 <HTMLURL URL="ftp://ftp.rfc-editor.org/" name="ftp.rfc-editor.org"> (or a
5057 nicely sorted version from <HTMLURL URL="ftp://atrey.karlin.mff.cuni.cz/pub/rfc"
5058 name="atrey.karlin.mff.cuni.cz:/pub/rfc">).
5059
5060 <p><it/Good luck!/
5061
5062 </book>
5063
5064 <!--
5065 LocalWords: GPL IPv GateD BGPv RIPv OSPFv Linux sgml html dvi sgmltools Pavel
5066 LocalWords: linuxdoc dtd descrip config conf syslog stderr auth ospf bgp Mbps
5067 LocalWords: router's eval expr num birdc ctl UNIX if's enums bool int ip GCC
5068 LocalWords: len ipaddress pxlen netmask enum bgppath bgpmask clist gw md eth
5069 LocalWords: RTS printn quitbird iBGP AS'es eBGP RFC multiprotocol IGP Machek
5070 LocalWords: EGP misconfigurations keepalive pref aggr aggregator BIRD's RTC
5071 LocalWords: OS'es AS's multicast nolisten misconfigured UID blackhole MRTD MTU
5072 LocalWords: uninstalls ethernets IP binutils ANYCAST anycast dest RTD ICMP rfc
5073 LocalWords: compat multicasts nonbroadcast pointopoint loopback sym stats
5074 LocalWords: Perl SIGHUP dd mm yy HH MM SS EXT IA UNICAST multihop Discriminator txt
5075 LocalWords: proto wildcard Ondrej Filip
5076 -->