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