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