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