]> git.ipfire.org Git - thirdparty/bird.git/blame - doc/bird.sgml
Doc: Change debug to { flag1|flag2|flag3 [, ...] } style
[thirdparty/bird.git] / doc / bird.sgml
CommitLineData
04a22949 1<!doctype birddoc system>
d37f899b
PM
2
3<!--
d150c637 4 BIRD 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
aa185265 23<title>BIRD 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
OF
27Martin Mares <it/&lt;mj@ucw.cz&gt;/,
28Ondrej Zajicek <it/&lt;santiago@crfreenet.org&gt;/
aa185265 29</author>
d37f899b 30
d37f899b 31<abstract>
aa185265 32This document contains user documentation for the BIRD Internet Routing Daemon project.
d37f899b
PM
33</abstract>
34
35<!-- Table of contents -->
36<toc>
37
38<!-- Begin the document -->
39
dad92c30 40
371adba6 41<chapt>Introduction
b9864aa8 42<label id="intro">
d37f899b 43
371adba6 44<sect>What is BIRD
b9864aa8 45<label id="what-is-bird">
d37f899b 46
b9864aa8 47<p>The name `BIRD' is actually an acronym standing for `BIRD Internet Routing
dad92c30
OZ
48Daemon'. Let's take a closer look at the meaning of the name:
49
50<p><em/BIRD/: Well, we think we have already explained that. It's an acronym
51standing for `BIRD Internet Routing Daemon', you remember, don't you? :-)
52
53<p><em/Internet Routing/: It's a program (well, a daemon, as you are going to
54discover in a moment) which works as a dynamic router in an Internet type
55network (that is, in a network running either the IPv4 or the IPv6 protocol).
56Routers are devices which forward packets between interconnected networks in
57order to allow hosts not connected directly to the same local area network to
58communicate with each other. They also communicate with the other routers in the
59Internet to discover the topology of the network which allows them to find
60optimal (in terms of some metric) rules for forwarding of packets (which are
61called routing tables) and to adapt themselves to the changing conditions such
62as outages of network links, building of new connections and so on. Most of
63these routers are costly dedicated devices running obscure firmware which is
64hard to configure and not open to any changes (on the other hand, their special
65hardware design allows them to keep up with lots of high-speed network
66interfaces, better than general-purpose computer does). Fortunately, most
67operating systems of the UNIX family allow an ordinary computer to act as a
68router and forward packets belonging to the other hosts, but only according to a
69statically configured table.
70
71<p>A <em/Routing Daemon/ is in UNIX terminology a non-interactive program
72running on background which does the dynamic part of Internet routing, that is
73it communicates with the other routers, calculates routing tables and sends them
74to the OS kernel which does the actual packet forwarding. There already exist
75other such routing daemons: routed (RIP only), GateD (non-free),
7935b9d2
PT
76<HTMLURL URL="http://www.zebra.org" name="Zebra"> and
77<HTMLURL URL="http://sourceforge.net/projects/mrt" name="MRTD">,
dad92c30
OZ
78but their capabilities are limited and they are relatively hard to configure
79and maintain.
897cd7aa
MM
80
81<p>BIRD is an Internet Routing Daemon designed to avoid all of these shortcomings,
dad92c30
OZ
82to support all the routing technology used in the today's Internet or planned to
83be used in near future and to have a clean extensible architecture allowing new
84routing protocols to be incorporated easily. Among other features, BIRD
85supports:
897cd7aa
MM
86
87<itemize>
88 <item>both IPv4 and IPv6 protocols
89 <item>multiple routing tables
90 <item>the Border Gateway Protocol (BGPv4)
96264d4d 91 <item>the Routing Information Protocol (RIPv2)
0c75411b 92 <item>the Open Shortest Path First protocol (OSPFv2, OSPFv3)
6bcef225 93 <item>the Router Advertisements for IPv6 hosts
dad92c30
OZ
94 <item>a virtual protocol for exchange of routes between different
95 routing tables on a single host
897cd7aa
MM
96 <item>a command-line interface allowing on-line control and inspection
97 of status of the daemon
dad92c30
OZ
98 <item>soft reconfiguration (no need to use complex online commands to
99 change the configuration, just edit the configuration file and
100 notify BIRD to re-read it and it will smoothly switch itself to
101 the new configuration, not disturbing routing protocols unless
102 they are affected by the configuration changes)
02357f96 103 <item>a powerful language for route filtering
897cd7aa
MM
104</itemize>
105
dad92c30
OZ
106<p>BIRD has been developed at the Faculty of Math and Physics, Charles
107University, Prague, Czech Republic as a student project. It can be freely
108distributed under the terms of the GNU General Public License.
109
110<p>BIRD has been designed to work on all UNIX-like systems. It has been
111developed and tested under Linux 2.0 to 2.6, and then ported to FreeBSD, NetBSD
112and OpenBSD, porting to other systems (even non-UNIX ones) should be relatively
113easy due to its highly modular architecture.
897cd7aa 114
dad92c30
OZ
115<p>BIRD supports either IPv4 or IPv6 protocol, but have to be compiled separately
116for each one. Therefore, a dualstack router would run two instances of BIRD (one
117for IPv4 and one for IPv6), with completely separate setups (configuration
118files, tools ...).
5adc02a6 119
d37f899b 120
371adba6 121<sect>Installing BIRD
b9864aa8 122<label id="install">
440439e3 123
dad92c30
OZ
124<p>On a recent UNIX system with GNU development tools (GCC, binutils, m4, make)
125and Perl, installing BIRD should be as easy as:
440439e3
PM
126
127<code>
dad92c30
OZ
128 ./configure
129 make
130 make install
131 vi /usr/local/etc/bird.conf
c184d9d0 132 bird
440439e3
PM
133</code>
134
02357f96 135<p>You can use <tt>./configure --help</tt> to get a list of configure
dad92c30
OZ
136options. The most important ones are: <tt/--enable-ipv6/ which enables building
137of an IPv6 version of BIRD, <tt/--with-protocols=/ to produce a slightly smaller
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>
02357f96 152 enable debug messages and run bird in foreground.
c184d9d0 153
b9864aa8 154 <tag><label id="argv-log-file">-D <m/filename of debug log/</tag>
a4644ed6
OZ
155 log debugging information to given file instead of stderr.
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
a852c139 220<chapt>About routing tables
b9864aa8 221<label id="routing-tables">
a852c139 222
dad92c30
OZ
223<p>BIRD has one or more routing tables which may or may not be synchronized with
224OS kernel and which may or may not be synchronized with each other (see the Pipe
225protocol). Each routing table contains a list of known routes. Each route
226consists of:
a852c139
PM
227
228<itemize>
dad92c30
OZ
229 <item>network prefix this route is for (network address and prefix
230 length -- the number of bits forming the network part of the
231 address; also known as a netmask)
96264d4d
PM
232 <item>preference of this route
233 <item>IP address of router which told us about this route
dad92c30
OZ
234 <item>IP address of router we should forward the packets to using this
235 route
a852c139 236 <item>other attributes common to all routes
dad92c30
OZ
237 <item>dynamic attributes defined by protocols which may or may not be
238 present (typically protocol metrics)
a852c139
PM
239</itemize>
240
dad92c30
OZ
241Routing table maintains multiple entries for a network, but at most one entry
242for one network and one protocol. The entry with the highest preference is used
243for routing (we will call such an entry the <it/selected route/). If there are
244more entries with the same preference and they are from the same protocol, the
245protocol decides (typically according to metrics). If they aren't, an internal
246ordering is used to break the tie. You can get the list of route attributes in
247the Route attributes section.
248
249<p>Each protocol is connected to a routing table through two filters which can
250accept, reject and modify the routes. An <it/export/ filter checks routes passed
251from the routing table to the protocol, an <it/import/ filter checks routes in
252the opposite direction. When the routing table gets a route from a protocol, it
253recalculates the selected route and broadcasts it to all protocols connected to
254the table. The protocols typically send the update to other routers in the
255network. Note that although most protocols are interested in receiving just
256selected routes, some protocols (e.g. the <cf/Pipe/ protocol) receive and
257process all entries in routing tables (accepted by filters).
258
b9864aa8 259<p><label id="dsc-table-sorted">Usually, a routing table just chooses a selected route
dad92c30
OZ
260from a list of entries for one network. But if the <cf/sorted/ option is
261activated, these lists of entries are kept completely sorted (according to
262preference or some protocol-dependent metric). This is needed for some features
263of some protocols (e.g. <cf/secondary/ option of BGP protocol, which allows to
264accept not just a selected route, but the first route (in the sorted list) that
265is accepted by filters), but it is incompatible with some other features (e.g.
266<cf/deterministic med/ option of BGP protocol, which activates a way of choosing
267selected route that cannot be described using comparison and ordering). Minor
268advantage is that routes are shown sorted in <cf/show route/, minor disadvantage
269is that it is slightly more computationally expensive.
270
48cf5e84 271
6eda3f13 272<sect>Graceful restart
b9864aa8 273<label id="graceful-restart">
6eda3f13
OZ
274
275<p>When BIRD is started after restart or crash, it repopulates routing tables in
276an uncoordinated manner, like after clean start. This may be impractical in some
277cases, because if the forwarding plane (i.e. kernel routing tables) remains
278intact, then its synchronization with BIRD would temporarily disrupt packet
279forwarding until protocols converge. Graceful restart is a mechanism that could
280help with this issue. Generally, it works by starting protocols and letting them
281repopulate routing tables while deferring route propagation until protocols
282acknowledge their convergence. Note that graceful restart behavior have to be
283configured for all relevant protocols and requires protocol-specific support
284(currently implemented for Kernel and BGP protocols), it is activated for
285particular boot by option <cf/-R/.
286
a852c139 287
371adba6 288<chapt>Configuration
b9864aa8 289<label id="config">
af0b25d2 290
371adba6 291<sect>Introduction
b9864aa8 292<label id="config-intro">
d37f899b 293
dad92c30
OZ
294<p>BIRD is configured using a text configuration file. Upon startup, BIRD reads
295<it/prefix/<file>/etc/bird.conf</file> (unless the <tt/-c/ command line option
296is given). Configuration may be changed at user's request: if you modify the
297config file and then signal BIRD with <tt/SIGHUP/, it will adjust to the new
298config. Then there's the client which allows you to talk with BIRD in an
299extensive way.
300
301<p>In the config, everything on a line after <cf/#/ or inside <cf>/* */</cf> is
302a comment, whitespace characters are treated as a single space. If there's a
303variable number of options, they are grouped using the <cf/{ }/ brackets. Each
304option is terminated by a <cf/;/. Configuration is case sensitive. There are two
fff7498d 305ways how to name symbols (like protocol names, filter names, constants etc.). You
dad92c30
OZ
306can either use a simple string starting with a letter followed by any
307combination of letters and numbers (e.g. "R123", "myfilter", "bgp5") or you can
308enclose the name into apostrophes (<cf/'/) and than you can use any combination
309of numbers, letters. hyphens, dots and colons (e.g. "'1:strange-name'",
310"'-NAME-'", "'cool::name'").
311
312<p>Here is an example of a simple config file. It enables synchronization of
313routing tables with OS kernel, scans for new network interfaces every 10 seconds
314and runs RIP on all network interfaces found.
d37f899b 315
a0dd1c74 316<code>
d37f899b 317protocol kernel {
d150c637 318 persist; # Don't remove routes on BIRD shutdown
d37f899b
PM
319 scan time 20; # Scan kernel routing table every 20 seconds
320 export all; # Default is export none
321}
322
323protocol device {
324 scan time 10; # Scan interfaces every 10 seconds
325}
326
327protocol rip {
328 export all;
329 import all;
f434d191 330 interface "*";
d37f899b 331}
a0dd1c74 332</code>
d37f899b 333
326e33f5 334
371adba6 335<sect>Global options
b9864aa8 336<label id="global-opts">
af0b25d2 337
a0dd1c74 338<p><descrip>
b9864aa8 339 <tag><label id="opt-include">include "<m/filename/"</tag>
4a5eb284 340 This statement causes inclusion of a new file. <m/Filename/ could also
0a505706
OZ
341 be a wildcard, in that case matching files are included in alphabetic
342 order. The maximal depth is 8. Note that this statement could be used
343 anywhere in the config file, not just as a top-level option.
48ec367a 344
b9864aa8 345 <tag><label id="opt-log">log "<m/filename/"|syslog [name <m/name/]|stderr all|{ <m/list of classes/ }</tag>
dad92c30 346 Set logging of messages having the given class (either <cf/all/ or
9df52a98 347 <cf/{ error|trace [, <m/.../] }/ etc.) into selected destination (a file specified
dad92c30
OZ
348 as a filename string, syslog with optional name argument, or the stderr
349 output). Classes are:
1632f1fe 350 <cf/info/, <cf/warning/, <cf/error/ and <cf/fatal/ for messages about local problems,
523f020b
OZ
351 <cf/debug/ for debugging messages,
352 <cf/trace/ when you want to know what happens in the network,
353 <cf/remote/ for messages about misbehavior of remote machines,
02357f96 354 <cf/auth/ about authentication failures,
dad92c30
OZ
355 <cf/bug/ for internal BIRD bugs.
356 You may specify more than one <cf/log/ line to establish logging to
357 multiple destinations. Default: log everything to the system log.
02357f96 358
9df52a98 359 <tag><label id="opt-debug-protocols">debug protocols all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag>
dad92c30
OZ
360 Set global defaults of protocol debugging options. See <cf/debug/ in the
361 following section. Default: off.
5a203dac 362
b9864aa8 363 <tag><label id="opt-debug-commands">debug commands <m/number/</tag>
dad92c30
OZ
364 Control logging of client connections (0 for no logging, 1 for logging
365 of connects and disconnects, 2 and higher for logging of all client
366 commands). Default: 0.
249d238c 367
b9864aa8 368 <tag><label id="opt-debug-latency">debug latency <m/switch/</tag>
8bcb5fb1
OZ
369 Activate tracking of elapsed time for internal events. Recent events
370 could be examined using <cf/dump events/ command. Default: off.
371
b9864aa8 372 <tag><label id="opt-debug-latency-limit">debug latency limit <m/time/</tag>
8bcb5fb1
OZ
373 If <cf/debug latency/ is enabled, this option allows to specify a limit
374 for elapsed time. Events exceeding the limit are logged. Default: 1 s.
375
b9864aa8 376 <tag><label id="opt-watchdog-warn">watchdog warning <m/time/</tag>
8bcb5fb1
OZ
377 Set time limit for I/O loop cycle. If one iteration took more time to
378 complete, a warning is logged. Default: 5 s.
379
b9864aa8 380 <tag><label id="opt-watchdog-timeout">watchdog timeout <m/time/</tag>
8bcb5fb1
OZ
381 Set time limit for I/O loop cycle. If the limit is breached, BIRD is
382 killed by abort signal. The timeout has effective granularity of
383 seconds, zero means disabled. Default: disabled (0).
384
b9864aa8 385 <tag><label id="opt-mrtdump">mrtdump "<m/filename/"</tag>
dad92c30
OZ
386 Set MRTdump file name. This option must be specified to allow MRTdump
387 feature. Default: no dump file.
cf31112f 388
9df52a98 389 <tag><label id="opt-mrtdump-protocols">mrtdump protocols all|off|{ states|messages [, <m/.../] }</tag>
dad92c30
OZ
390 Set global defaults of MRTdump options. See <cf/mrtdump/ in the
391 following section. Default: off.
cf31112f 392
b9864aa8 393 <tag><label id="opt-filter">filter <m/name local variables/{ <m/commands/ }</tag>
dad92c30
OZ
394 Define a filter. You can learn more about filters in the following
395 chapter.
326e33f5 396
b9864aa8 397 <tag><label id="opt-function">function <m/name/ (<m/parameters/) <m/local variables/ { <m/commands/ }</tag>
dad92c30 398 Define a function. You can learn more about functions in the following chapter.
523f020b 399
9df52a98 400 <tag><label id="opt-protocol">protocol rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag>
dad92c30
OZ
401 Define a protocol instance called <cf><m/name/</cf> (or with a name like
402 "rip5" generated automatically if you don't specify any
403 <cf><m/name/</cf>). You can learn more about configuring protocols in
404 their own chapters. When <cf>from <m/name2/</cf> expression is used,
405 initial protocol options are taken from protocol or template
406 <cf><m/name2/</cf> You can run more than one instance of most protocols
407 (like RIP or BGP). By default, no instances are configured.
a7f23f58 408
9df52a98 409 <tag><label id="opt-template">template rip|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag>
dad92c30
OZ
410 Define a protocol template instance called <m/name/ (or with a name like
411 "bgp1" generated automatically if you don't specify any <m/name/).
412 Protocol templates can be used to group common options when many
413 similarly configured protocol instances are to be defined. Protocol
414 instances (and other templates) can use templates by using <cf/from/
415 expression and the name of the template. At the moment templates (and
416 <cf/from/ expression) are not implemented for OSPF protocol.
249d238c 417
b9864aa8 418 <tag><label id="opt-define">define <m/constant/ = <m/expression/</tag>
dad92c30
OZ
419 Define a constant. You can use it later in every place you could use a
420 value of the same type. Besides, there are some predefined numeric
421 constants based on /etc/iproute2/rt_* files. A list of defined constants
422 can be seen (together with other symbols) using 'show symbols' command.
249d238c 423
b9864aa8
PT
424 <tag><label id="opt-router-id">router id <m/IPv4 address/</tag>
425 Set BIRD's router ID. It's a world-wide unique identification of your
dad92c30
OZ
426 router, usually one of router's IPv4 addresses. Default: in IPv4
427 version, the lowest IP address of a non-loopback interface. In IPv6
428 version, this option is mandatory.
79b4e12e 429
9df52a98 430 <tag><label id="opt-router-id-from">router id from [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../]</tag>
dad92c30
OZ
431 Set BIRD's router ID based on an IP address of an interface specified by
432 an interface pattern. The option is applicable for IPv4 version only.
b9864aa8 433 See <ref id="proto-iface" name="interface"> section for detailed
d7c06285 434 description of interface patterns with extended clauses.
249d238c 435
b9864aa8 436 <tag><label id="opt-listen-bgp">listen bgp [address <m/address/] [port <m/port/] [dual]</tag>
dad92c30
OZ
437 This option allows to specify address and port where BGP protocol should
438 listen. It is global option as listening socket is common to all BGP
439 instances. Default is to listen on all addresses (0.0.0.0) and port 179.
440 In IPv6 mode, option <cf/dual/ can be used to specify that BGP socket
441 should accept both IPv4 and IPv6 connections (but even in that case,
442 BIRD would accept IPv6 routes only). Such behavior was default in older
443 versions of BIRD.
27579857 444
b9864aa8 445 <tag><label id="opt-graceful-restart">graceful restart wait <m/number/</tag>
6eda3f13
OZ
446 During graceful restart recovery, BIRD waits for convergence of routing
447 protocols. This option allows to specify a timeout for the recovery to
448 prevent waiting indefinitely if some protocols cannot converge. Default:
449 240 seconds.
450
b9864aa8 451 <tag><label id="opt-timeformat">timeformat route|protocol|base|log "<m/format1/" [<m/limit/ "<m/format2/"]</tag>
dad92c30
OZ
452 This option allows to specify a format of date/time used by BIRD. The
453 first argument specifies for which purpose such format is used.
454 <cf/route/ is a format used in 'show route' command output,
455 <cf/protocol/ is used in 'show protocols' command output, <cf/base/ is
456 used for other commands and <cf/log/ is used in a log file.
457
458 "<m/format1/" is a format string using <it/strftime(3)/ notation (see
459 <it/man strftime/ for details). <m/limit> and "<m/format2/" allow to
460 specify the second format string for times in past deeper than <m/limit/
461 seconds. There are few shorthands: <cf/iso long/ is a ISO 8601 date/time
462 format (YYYY-MM-DD hh:mm:ss) that can be also specified using <cf/"%F %T"/.
463 <cf/iso short/ is a variant of ISO 8601 that uses just the time format
464 (hh:mm:ss) for near times (up to 20 hours in the past) and the date
465 format (YYYY-MM-DD) for far times. This is a shorthand for
466 <cf/"%T" 72000 "%F"/.
c37e7851 467
90eb5e7a
OZ
468 By default, BIRD uses the <cf/iso short/ format for <cf/route/ and
469 <cf/protocol/ times, and the <cf/iso long/ format for <cf/base/ and
470 <cf/log/ times.
471
dad92c30
OZ
472 In pre-1.4.0 versions, BIRD used an short, ad-hoc format for <cf/route/
473 and <cf/protocol/ times, and a <cf/iso long/ similar format (DD-MM-YYYY
474 hh:mm:ss) for <cf/base/ and <cf/log/. These timeformats could be set by
475 <cf/old short/ and <cf/old long/ compatibility shorthands.
c37e7851 476
b9864aa8 477 <tag><label id="opt-table">table <m/name/ [sorted]</tag>
dad92c30
OZ
478 Create a new routing table. The default routing table is created
479 implicitly, other routing tables have to be added by this command.
480 Option <cf/sorted/ can be used to enable sorting of routes, see
b9864aa8 481 <ref id="dsc-table-sorted" name="sorted table"> description for details.
af0b25d2 482
9df52a98 483 <tag><label id="opt-roa-table">roa table <m/name/ [ { <m/roa table options .../ } ]</tag>
dad92c30
OZ
484 Create a new ROA (Route Origin Authorization) table. ROA tables can be
485 used to validate route origination of BGP routes. A ROA table contains
486 ROA entries, each consist of a network prefix, a max prefix length and
487 an AS number. A ROA entry specifies prefixes which could be originated
7935b9d2
PT
488 by that AS number. ROA tables could be filled with data from RPKI (<rfc
489 id="6480">) or from public databases like Whois. ROA tables are
490 examined by <cf/roa_check()/ operator in filters.
dad92c30
OZ
491
492 Currently, there is just one option, <cf>roa <m/prefix/ max <m/num/ as
493 <m/num/</cf>, which can be used to populate the ROA table with static
494 ROA entries. The option may be used multiple times. Other entries can be
495 added dynamically by <cf/add roa/ command.
af582c48 496
b9864aa8 497 <tag><label id="opt-eval">eval <m/expr/</tag>
f8e8fcfa 498 Evaluates given filter expression. It is used by us for testing of filters.
249d238c
PM
499</descrip>
500
dad92c30 501
371adba6 502<sect>Protocol options
b9864aa8 503<label id="protocol-opts">
bfd71178 504
dad92c30
OZ
505<p>For each protocol instance, you can configure a bunch of options. Some of
506them (those described in this section) are generic, some are specific to the
507protocol (see sections talking about the protocols).
7581b81b 508
dad92c30
OZ
509<p>Several options use a <m/switch/ argument. It can be either <cf/on/,
510<cf/yes/ or a numeric expression with a non-zero value for the option to be
511enabled or <cf/off/, <cf/no/ or a numeric expression evaluating to zero to
512disable it. An empty <m/switch/ is equivalent to <cf/on/ ("silence means
513agreement").
7581b81b 514
5a203dac 515<descrip>
b9864aa8 516 <tag><label id="proto-preference">preference <m/expr/</tag>
dad92c30
OZ
517 Sets the preference of routes generated by this protocol. Default:
518 protocol dependent.
5a203dac 519
b9864aa8 520 <tag><label id="proto-disabled">disabled <m/switch/</tag>
dad92c30
OZ
521 Disables the protocol. You can change the disable/enable status from the
522 command line interface without needing to touch the configuration.
523 Disabled protocols are not activated. Default: protocol is enabled.
5a203dac 524
9df52a98 525 <tag><label id="proto-debug">debug all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag>
5a203dac
PM
526 Set protocol debugging options. If asked, each protocol is capable of
527 writing trace messages about its work to the log (with category
528 <cf/trace/). You can either request printing of <cf/all/ trace messages
529 or only of the types selected: <cf/states/ for protocol state changes
dad92c30
OZ
530 (protocol going up, down, starting, stopping etc.), <cf/routes/ for
531 routes exchanged with the routing table, <cf/filters/ for details on
532 route filtering, <cf/interfaces/ for interface change events sent to the
533 protocol, <cf/events/ for events internal to the protocol and <cf/packets/
534 for packets sent and received by the protocol. Default: off.
5a203dac 535
9df52a98 536 <tag><label id="proto-mrtdump">mrtdump all|off|{ states|messages [, <m/.../] }</tag>
dad92c30
OZ
537 Set protocol MRTdump flags. MRTdump is a standard binary format for
538 logging information from routing protocols and daemons. These flags
539 control what kind of information is logged from the protocol to the
540 MRTdump file (which must be specified by global <cf/mrtdump/ option, see
541 the previous section). Although these flags are similar to flags of
542 <cf/debug/ option, their meaning is different and protocol-specific. For
543 BGP protocol, <cf/states/ logs BGP state changes and <cf/messages/ logs
544 received BGP messages. Other protocols does not support MRTdump yet.
cf31112f 545
b9864aa8 546 <tag><label id="proto-router-id">router id <m/IPv4 address/</tag>
dad92c30
OZ
547 This option can be used to override global router id for a given
548 protocol. Default: uses global router id.
4cdd0784 549
b9864aa8 550 <tag><label id="proto-import">import all | none | filter <m/name/ | filter { <m/filter commands/ } | where <m/filter expression/</tag>
dad92c30
OZ
551 Specify a filter to be used for filtering routes coming from the
552 protocol to the routing table. <cf/all/ is shorthand for <cf/where true/
553 and <cf/none/ is shorthand for <cf/where false/. Default: <cf/all/.
bfd71178 554
b9864aa8 555 <tag><label id="proto-export">export <m/filter/</tag>
dad92c30
OZ
556 This is similar to the <cf>import</cf> keyword, except that it works in
557 the direction from the routing table to the protocol. Default: <cf/none/.
af0b25d2 558
b9864aa8 559 <tag><label id="proto-import-keep-filtered">import keep filtered <m/switch/</tag>
dad92c30
OZ
560 Usually, if an import filter rejects a route, the route is forgotten.
561 When this option is active, these routes are kept in the routing table,
562 but they are hidden and not propagated to other protocols. But it is
563 possible to show them using <cf/show route filtered/. Note that this
564 option does not work for the pipe protocol. Default: off.
cf98be7b 565
b9864aa8 566 <tag><label id="proto-import-limit">import limit [<m/number/ | off ] [action warn | block | restart | disable]</tag>
dad92c30
OZ
567 Specify an import route limit (a maximum number of routes imported from
568 the protocol) and optionally the action to be taken when the limit is
569 hit. Warn action just prints warning log message. Block action discards
570 new routes coming from the protocol. Restart and disable actions shut
571 the protocol down like appropriate commands. Disable is the default
572 action if an action is not explicitly specified. Note that limits are
573 reset during protocol reconfigure, reload or restart. Default: <cf/off/.
b662290f 574
b9864aa8 575 <tag><label id="proto-receive-limit">receive limit [<m/number/ | off ] [action warn | block | restart | disable]</tag>
dad92c30
OZ
576 Specify an receive route limit (a maximum number of routes received from
577 the protocol and remembered). It works almost identically to <cf>import
578 limit</cf> option, the only difference is that if <cf/import keep
579 filtered/ option is active, filtered routes are counted towards the
580 limit and blocked routes are forgotten, as the main purpose of the
581 receive limit is to protect routing tables from overflow. Import limit,
582 on the contrary, counts accepted routes only and routes blocked by the
583 limit are handled like filtered routes. Default: <cf/off/.
d9b77cc2 584
b9864aa8 585 <tag><label id="proto-export-limit">export limit [ <m/number/ | off ] [action warn | block | restart | disable]</tag>
dad92c30
OZ
586 Specify an export route limit, works similarly to the <cf>import
587 limit</cf> option, but for the routes exported to the protocol. This
588 option is experimental, there are some problems in details of its
589 behavior -- the number of exported routes can temporarily exceed the
590 limit without triggering it during protocol reload, exported routes
591 counter ignores route blocking and block action also blocks route
592 updates of already accepted routes -- and these details will probably
593 change in the future. Default: <cf/off/.
ebecb6f6 594
b9864aa8 595 <tag><label id="proto-description">description "<m/text/"</tag>
dad92c30
OZ
596 This is an optional description of the protocol. It is displayed as a
597 part of the output of 'show route all' command.
62aa96ca 598
b9864aa8 599 <tag><label id="proto-table">table <m/name/</tag>
fd6cbe90 600 Connect this protocol to a non-default routing table.
7581b81b
PM
601</descrip>
602
a7c9f7c0 603<p>There are several options that give sense only with certain protocols:
7581b81b
PM
604
605<descrip>
9df52a98 606 <tag><label id="proto-iface">interface [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../] [ { <m/option/; [<m/.../] } ]</tag>
f434d191
OZ
607 Specifies a set of interfaces on which the protocol is activated with
608 given interface-specific options. A set of interfaces specified by one
dad92c30
OZ
609 interface option is described using an interface pattern. The interface
610 pattern consists of a sequence of clauses (separated by commas), each
d7c06285
OZ
611 clause is a mask specified as a shell-like pattern. Interfaces are
612 matched by their name.
dad92c30
OZ
613
614 An interface matches the pattern if it matches any of its clauses. If
615 the clause begins with <cf/-/, matching interfaces are excluded. Patterns
d7c06285 616 are processed left-to-right, thus <cf/interface "eth0", -"eth*", "*";/
dad92c30
OZ
617 means eth0 and all non-ethernets.
618
d7c06285
OZ
619 Some protocols (namely OSPFv2 and Direct) support extended clauses that
620 may contain a mask, a prefix, or both of them. An interface matches such
621 clause if its name matches the mask (if specified) and its address
622 matches the prefix (if specified). Extended clauses are used when the
623 protocol handles multiple addresses on an interface independently.
624
dad92c30
OZ
625 An interface option can be used more times with different interface-specific
626 options, in that case for given interface the first matching interface
627 option is used.
523f020b 628
12640c14
OZ
629 This option is allowed in Babel, BFD, Direct, OSPF, RAdv and RIP
630 protocols, but in OSPF protocol it is used in the <cf/area/ subsection.
f434d191
OZ
631
632 Default: none.
633
634 Examples:
635
dad92c30
OZ
636 <cf>interface "*" { type broadcast; };</cf> - start the protocol on all
637 interfaces with <cf>type broadcast</cf> option.
f434d191 638
dad92c30
OZ
639 <cf>interface "eth1", "eth4", "eth5" { type ptp; };</cf> - start the
640 protocol on enumerated interfaces with <cf>type ptp</cf> option.
523f020b 641
dad92c30
OZ
642 <cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol
643 on all interfaces that have address from 192.168.0.0/16, but not from
644 192.168.1.0/24.
f434d191 645
dad92c30
OZ
646 <cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol
647 on all interfaces that have address from 192.168.0.0/16, but not from
648 192.168.1.0/24.
f434d191
OZ
649
650 <cf>interface "eth*" 192.168.1.0/24;</cf> - start the protocol on all
651 ethernet interfaces that have address from 192.168.1.0/24.
652
b9864aa8 653 <tag><label id="proto-tx-class">tx class|dscp <m/num/</tag>
dad92c30
OZ
654 This option specifies the value of ToS/DS/Class field in IP headers of
655 the outgoing protocol packets. This may affect how the protocol packets
656 are processed by the network relative to the other network traffic. With
657 <cf/class/ keyword, the value (0-255) is used for the whole ToS/Class
658 octet (but two bits reserved for ECN are ignored). With <cf/dscp/
659 keyword, the value (0-63) is used just for the DS field in the octet.
660 Default value is 0xc0 (DSCP 0x30 - CS6).
ef4a50be 661
b9864aa8 662 <tag><label id="proto-tx-priority">tx priority <m/num/</tag>
dad92c30
OZ
663 This option specifies the local packet priority. This may affect how the
664 protocol packets are processed in the local TX queues. This option is
665 Linux specific. Default value is 7 (highest priority, privileged traffic).
ef4a50be 666
b9864aa8 667 <tag><label id="proto-pass">password "<m/password/" [ { id <m/num/; generate from <m/time/; generate to <m/time/; accept from <m/time/; accept to <m/time/; } ]</tag>
dad92c30
OZ
668 Specifies a password that can be used by the protocol. Password option
669 can be used more times to specify more passwords. If more passwords are
f434d191 670 specified, it is a protocol-dependent decision which one is really
dad92c30
OZ
671 used. Specifying passwords does not mean that authentication is enabled,
672 authentication can be enabled by separate, protocol-dependent
f434d191 673 <cf/authentication/ option.
523f020b 674
f434d191
OZ
675 This option is allowed in OSPF and RIP protocols. BGP has also
676 <cf/password/ option, but it is slightly different and described
677 separately.
f434d191
OZ
678 Default: none.
679</descrip>
680
681<p>Password option can contain section with some (not necessary all) password sub-options:
682
683<descrip>
b9864aa8 684 <tag><label id="proto-pass-id">id <M>num</M></tag>
0a21c211 685 ID of the password, (1-255). If it is not used, BIRD will choose ID based
dad92c30
OZ
686 on an order of the password item in the interface. For example, second
687 password item in one interface will have default ID 2. ID is used by
688 some routing protocols to identify which password was used to
689 authenticate protocol packets.
f434d191 690
b9864aa8 691 <tag><label id="proto-pass-gen-from">generate from "<m/time/"</tag>
dad92c30
OZ
692 The start time of the usage of the password for packet signing.
693 The format of <cf><m/time/</cf> is <tt>dd-mm-yyyy HH:MM:SS</tt>.
f434d191 694
b9864aa8 695 <tag><label id="proto-pass-gen-to">generate to "<m/time/"</tag>
dad92c30 696 The last time of the usage of the password for packet signing.
f434d191 697
b9864aa8 698 <tag><label id="proto-pass-accept-from">accept from "<m/time/"</tag>
dad92c30 699 The start time of the usage of the password for packet verification.
5a203dac 700
b9864aa8 701 <tag><label id="proto-pass-accept-to">accept to "<m/time/"</tag>
dad92c30 702 The last time of the usage of the password for packet verification.
7581b81b 703</descrip>
d37f899b 704
5a203dac 705<chapt>Remote control
b9864aa8 706<label id="remote-control">
36032ded 707
dad92c30
OZ
708<p>You can use the command-line client <file>birdc</file> to talk with a running
709BIRD. Communication is done using a <file/bird.ctl/ UNIX domain socket (unless
710changed with the <tt/-s/ option given to both the server and the client). The
711commands can perform simple actions such as enabling/disabling of protocols,
712telling BIRD to show various information, telling it to show routing table
713filtered by filter, or asking BIRD to reconfigure. Press <tt/?/ at any time to
714get online help. Option <tt/-r/ can be used to enable a restricted mode of BIRD
715client, which allows just read-only commands (<cf/show .../). Option <tt/-v/ can
716be passed to the client, to make it dump numeric return codes along with the
717messages. You do not necessarily need to use <file/birdc/ to talk to BIRD, your
718own applications could do that, too -- the format of communication between BIRD
719and <file/birdc/ is stable (see the programmer's documentation).
720
721<p>There is also lightweight variant of BIRD client called <file/birdcl/, which
722does not support command line editing and history and has minimal dependencies.
723This is useful for running BIRD in resource constrained environments, where
724Readline library (required for regular BIRD client) is not available.
a5e9f3d2
OZ
725
726<p>Many commands have the <m/name/ of the protocol instance as an argument.
f434d191
OZ
727This argument can be omitted if there exists only a single instance.
728
5a203dac 729<p>Here is a brief list of supported functions:
64722c98
PM
730
731<descrip>
b9864aa8 732 <tag><label id="cli-show-status">show status</tag>
dad92c30
OZ
733 Show router status, that is BIRD version, uptime and time from last
734 reconfiguration.
5a203dac 735
b9864aa8 736 <tag><label id="cli-show-interfaces">show interfaces [summary]</tag>
43fc6bb0
OZ
737 Show the list of interfaces. For each interface, print its type, state,
738 MTU and addresses assigned.
739
b9864aa8 740 <tag><label id="cli-show-protocols">show protocols [all]</tag>
dad92c30
OZ
741 Show list of protocol instances along with tables they are connected to
742 and protocol status, possibly giving verbose information, if <cf/all/ is
743 specified.
64722c98 744
b9864aa8 745 <tag><label id="cli-show-ospf-iface">show ospf interface [<m/name/] ["<m/interface/"]</tag>
f434d191
OZ
746 Show detailed information about OSPF interfaces.
747
b9864aa8 748 <tag><label id="cli-show-ospf-neighbors">show ospf neighbors [<m/name/] ["<m/interface/"]</tag>
f434d191
OZ
749 Show a list of OSPF neighbors and a state of adjacency to them.
750
b9864aa8 751 <tag><label id="cli-show-ospf-state">show ospf state [all] [<m/name/]</tag>
dad92c30
OZ
752 Show detailed information about OSPF areas based on a content of the
753 link-state database. It shows network topology, stub networks,
754 aggregated networks and routers from other areas and external routes.
755 The command shows information about reachable network nodes, use option
756 <cf/all/ to show information about all network nodes in the link-state
757 database.
0ea8fb4a 758
b9864aa8 759 <tag><label id="cli-show-ospf-topology">show ospf topology [all] [<m/name/]</tag>
dad92c30
OZ
760 Show a topology of OSPF areas based on a content of the link-state
761 database. It is just a stripped-down version of 'show ospf state'.
64722c98 762
b9864aa8 763 <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
764 Show contents of an OSPF LSA database. Options could be used to filter
765 entries.
20ab192b 766
b9864aa8 767 <tag><label id="cli-show-rip-interfaces">show rip interfaces [<m/name/] ["<m/interface/"]</tag>
43fc6bb0
OZ
768 Show detailed information about RIP interfaces.
769
b9864aa8 770 <tag><label id="cli-show-rip-neighbors">show rip neighbors [<m/name/] ["<m/interface/"]</tag>
43fc6bb0
OZ
771 Show a list of RIP neighbors and associated state.
772
b9864aa8 773 <tag><label id="cli-show-static">show static [<m/name/]</tag>
f434d191
OZ
774 Show detailed information about static routes.
775
b9864aa8 776 <tag><label id="cli-show-bfd-sessions">show bfd sessions [<m/name/]</tag>
12201fd8
OZ
777 Show information about BFD sessions.
778
b9864aa8 779 <tag><label id="cli-show-symbols">show symbols [table|filter|function|protocol|template|roa|<m/symbol/]</tag>
dad92c30
OZ
780 Show the list of symbols defined in the configuration (names of
781 protocols, routing tables etc.).
5a203dac 782
f9bd11c3 783 <tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table <m/t/] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [<m/options/]</tag>
dad92c30
OZ
784 Show contents of a routing table (by default of the main one or the
785 table attached to a respective protocol), that is routes, their metrics
786 and (in case the <cf/all/ switch is given) all their attributes.
5a203dac
PM
787
788 <p>You can specify a <m/prefix/ if you want to print routes for a
789 specific network. If you use <cf>for <m/prefix or IP/</cf>, you'll get
790 the entry which will be used for forwarding of packets to the given
791 destination. By default, all routes for each network are printed with
792 the selected one at the top, unless <cf/primary/ is given in which case
793 only the selected route is shown.
794
795 <p>You can also ask for printing only routes processed and accepted by
796 a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ }
797 </cf> or matching a given condition (<cf>where <m/condition/</cf>).
7aa80901
OZ
798
799 The <cf/export/, <cf/preexport/ and <cf/noexport/ switches ask for
800 printing of routes that are exported to the specified protocol.
801 With <cf/preexport/, the export filter of the protocol is skipped.
802 With <cf/noexport/, routes rejected by the export filter are printed
803 instead. Note that routes not exported to the protocol for other reasons
804 (e.g. secondary routes or routes imported from that protocol) are not
805 printed even with <cf/noexport/.
5a203dac 806
4d176e14
OF
807 <p>You can also select just routes added by a specific protocol.
808 <cf>protocol <m/p/</cf>.
809
dad92c30
OZ
810 <p>If BIRD is configured to keep filtered routes (see <cf/import keep
811 filtered/ option), you can show them instead of routes by using
812 <cf/filtered/ switch.
cf98be7b 813
5a203dac
PM
814 <p>The <cf/stats/ switch requests showing of route statistics (the
815 number of networks, number of routes before and after filtering). If
816 you use <cf/count/ instead, only the statistics will be printed.
817
74d76f6c 818 <tag><label id="cli-show-roa">show roa [<m/prefix/ | in <m/prefix/ | for <m/prefix/] [as <m/num/] [table <m/t/]</tag>
dad92c30
OZ
819 Show contents of a ROA table (by default of the first one). You can
820 specify a <m/prefix/ to print ROA entries for a specific network. If you
821 use <cf>for <m/prefix/</cf>, you'll get all entries relevant for route
822 validation of the network prefix; i.e., ROA entries whose prefixes cover
823 the network prefix. Or you can use <cf>in <m/prefix/</cf> to get ROA
824 entries covered by the network prefix. You could also use <cf/as/ option
af582c48
OZ
825 to show just entries for given AS.
826
74d76f6c 827 <tag><label id="cli-add-roa">add roa <m/prefix/ max <m/num/ as <m/num/ [table <m/t/]</tag>
dad92c30
OZ
828 Add a new ROA entry to a ROA table. Such entry is called <it/dynamic/
829 compared to <it/static/ entries specified in the config file. These
830 dynamic entries survive reconfiguration.
af582c48 831
74d76f6c 832 <tag><label id="cli-delete-roa">delete roa <m/prefix/ max <m/num/ as <m/num/ [table <m/t/]</tag>
dad92c30
OZ
833 Delete the specified ROA entry from a ROA table. Only dynamic ROA
834 entries (i.e., the ones added by <cf/add roa/ command) can be deleted.
af582c48 835
74d76f6c 836 <tag><label id="cli-flush-roa">flush roa [table <m/t/]</tag>
af582c48
OZ
837 Remove all dynamic ROA entries from a ROA table.
838
b9864aa8 839 <tag><label id="cli-configure">configure [soft] ["<m/config file/"] [timeout [<m/num/]]</tag>
dad92c30
OZ
840 Reload configuration from a given file. BIRD will smoothly switch itself
841 to the new configuration, protocols are reconfigured if possible,
842 restarted otherwise. Changes in filters usually lead to restart of
843 affected protocols.
844
845 If <cf/soft/ option is used, changes in filters does not cause BIRD to
846 restart affected protocols, therefore already accepted routes (according
847 to old filters) would be still propagated, but new routes would be
848 processed according to the new filters.
849
850 If <cf/timeout/ option is used, config timer is activated. The new
851 configuration could be either confirmed using <cf/configure confirm/
852 command, or it will be reverted to the old one when the config timer
853 expires. This is useful for cases when reconfiguration breaks current
fff7498d 854 routing and a router becomes inaccessible for an administrator. The
dad92c30
OZ
855 config timeout expiration is equivalent to <cf/configure undo/
856 command. The timeout duration could be specified, default is 300 s.
a92cf57d 857
b9864aa8 858 <tag><label id="cli-configure-confirm">configure confirm</tag>
a92cf57d
OZ
859 Deactivate the config undo timer and therefore confirm the current
860 configuration.
861
b9864aa8 862 <tag><label id="cli-configure-undo">configure undo</tag>
dad92c30
OZ
863 Undo the last configuration change and smoothly switch back to the
864 previous (stored) configuration. If the last configuration change was
865 soft, the undo change is also soft. There is only one level of undo, but
866 in some specific cases when several reconfiguration requests are given
867 immediately in a row and the intermediate ones are skipped then the undo
868 also skips them back.
a92cf57d 869
b9864aa8 870 <tag><label id="cli-configure-check">configure check ["<m/config file/"]</tag>
dad92c30
OZ
871 Read and parse given config file, but do not use it. useful for checking
872 syntactic and some semantic validity of an config file.
a92cf57d 873
b9864aa8 874 <tag><label id="cli-enable-disable-restart">enable|disable|restart <m/name/|"<m/pattern/"|all</tag>
dad92c30
OZ
875 Enable, disable or restart a given protocol instance, instances matching
876 the <cf><m/pattern/</cf> or <cf/all/ instances.
bf47fe4b 877
b9864aa8 878 <tag><label id="cli-reload">reload [in|out] <m/name/|"<m/pattern/"|all</tag>
dad92c30
OZ
879 Reload a given protocol instance, that means re-import routes from the
880 protocol instance and re-export preferred routes to the instance. If
881 <cf/in/ or <cf/out/ options are used, the command is restricted to one
882 direction (re-import or re-export).
883
884 This command is useful if appropriate filters have changed but the
885 protocol instance was not restarted (or reloaded), therefore it still
886 propagates the old set of routes. For example when <cf/configure soft/
887 command was used to change filters.
888
889 Re-export always succeeds, but re-import is protocol-dependent and might
890 fail (for example, if BGP neighbor does not support route-refresh
891 extension). In that case, re-export is also skipped. Note that for the
892 pipe protocol, both directions are always reloaded together (<cf/in/ or
893 <cf/out/ options are ignored in that case).
8a7fb885 894
b9864aa8 895 <tag><label id="cli-down">down</tag>
5a203dac 896 Shut BIRD down.
64722c98 897
9df52a98 898 <tag><label id="cli-debug">debug <m/protocol/|<m/pattern/|all all|off|{ states|routes|filters|events|packets [, <m/.../] }</tag>
64722c98 899 Control protocol debugging.
508d9360 900
b9864aa8 901 <tag><label id="cli-dump">dump resources|sockets|interfaces|neighbors|attributes|routes|protocols</tag>
508d9360
OZ
902 Dump contents of internal data structures to the debugging output.
903
b9864aa8 904 <tag><label id="cli-echo">echo all|off|{ <m/list of log classes/ } [ <m/buffer-size/ ]</tag>
508d9360 905 Control echoing of log messages to the command-line output.
b9864aa8 906 See <ref id="opt-log" name="log option"> for a list of log classes.
508d9360 907
b9864aa8 908 <tag><label id="cli-eval">eval <m/expr/</tag>
508d9360 909 Evaluate given expression.
64722c98 910</descrip>
36032ded 911
dad92c30 912
371adba6 913<chapt>Filters
b9864aa8 914<label id="filters">
d37f899b 915
371adba6 916<sect>Introduction
b9864aa8 917<label id="filters-intro">
d37f899b 918
dad92c30
OZ
919<p>BIRD contains a simple programming language. (No, it can't yet read mail :-).
920There are two objects in this language: filters and functions. Filters are
921interpreted by BIRD core when a route is being passed between protocols and
922routing tables. The filter language contains control structures such as if's and
923switches, but it allows no loops. An example of a filter using many features can
924be found in <file>filter/test.conf</file>.
d37f899b 925
dad92c30
OZ
926<p>Filter gets the route, looks at its attributes and modifies some of them if
927it wishes. At the end, it decides whether to pass the changed route through
928(using <cf/accept/) or whether to <cf/reject/ it. A simple filter looks like
929this:
d37f899b 930
a0dd1c74 931<code>
d37f899b
PM
932filter not_too_far
933int var;
934{
935 if defined( rip_metric ) then
936 var = rip_metric;
937 else {
938 var = 1;
939 rip_metric = 1;
940 }
941 if rip_metric &gt; 10 then
942 reject "RIP metric is too big";
943 else
944 accept "ok";
945}
a0dd1c74 946</code>
d37f899b 947
dad92c30
OZ
948<p>As you can see, a filter has a header, a list of local variables, and a body.
949The header consists of the <cf/filter/ keyword followed by a (unique) name of
950filter. The list of local variables consists of <cf><M>type name</M>;</cf>
951pairs where each pair defines one local variable. The body consists of <cf>
952{ <M>statements</M> }</cf>. Each <m/statement/ is terminated by a <cf/;/. You
953can group several statements to a single compound statement by using braces
954(<cf>{ <M>statements</M> }</cf>) which is useful if you want to make a bigger
955block of code conditional.
1632f1fe 956
dad92c30
OZ
957<p>BIRD supports functions, so that you don't have to repeat the same blocks of
958code over and over. Functions can have zero or more parameters and they can have
959local variables. Recursion is not allowed. Function definitions look like this:
0e5373fd
PM
960
961<code>
962function name ()
963int local_variable;
964{
965 local_variable = 5;
966}
967
968function with_parameters (int parameter)
969{
970 print parameter;
971}
972</code>
973
dad92c30
OZ
974<p>Unlike in C, variables are declared after the <cf/function/ line, but before
975the first <cf/{/. You can't declare variables in nested blocks. Functions are
976called like in C: <cf>name(); with_parameters(5);</cf>. Function may return
977values using the <cf>return <m/[expr]/</cf> command. Returning a value exits
978from current function (this is similar to C).
0e5373fd 979
dad92c30
OZ
980<p>Filters are declared in a way similar to functions except they can't have
981explicit parameters. They get a route table entry as an implicit parameter, it
982is also passed automatically to any functions called. The filter must terminate
983with either <cf/accept/ or <cf/reject/ statement. If there's a runtime error in
984filter, the route is rejected.
0e5373fd 985
dad92c30
OZ
986<p>A nice trick to debug filters is to use <cf>show route filter <m/name/</cf>
987from the command line client. An example session might look like:
c184d9d0
PM
988
989<code>
990pavel@bug:~/bird$ ./birdc -s bird.ctl
991BIRD 0.0.0 ready.
c184d9d0
PM
992bird> show route
99310.0.0.0/8 dev eth0 [direct1 23:21] (240)
994195.113.30.2/32 dev tunl1 [direct1 23:21] (240)
995127.0.0.0/8 dev lo [direct1 23:21] (240)
996bird> show route ?
1632f1fe 997show route [<prefix>] [table <t>] [filter <f>] [all] [primary]...
66701947 998bird> show route filter { if 127.0.0.5 &tilde; net then accept; }
c184d9d0
PM
999127.0.0.0/8 dev lo [direct1 23:21] (240)
1000bird>
1001</code>
1002
dad92c30 1003
371adba6 1004<sect>Data types
b9864aa8 1005<label id="data-types">
d37f899b 1006
dad92c30
OZ
1007<p>Each variable and each value has certain type. Booleans, integers and enums
1008are incompatible with each other (that is to prevent you from shooting in the
1009foot).
d37f899b
PM
1010
1011<descrip>
b9864aa8 1012 <tag><label id="type-bool">bool</tag>
dad92c30
OZ
1013 This is a boolean type, it can have only two values, <cf/true/ and
1014 <cf/false/. Boolean is the only type you can use in <cf/if/ statements.
1015
b9864aa8 1016 <tag><label id="type-int">int</tag>
dad92c30
OZ
1017 This is a general integer type. It is an unsigned 32bit type; i.e., you
1018 can expect it to store values from 0 to 4294967295. Overflows are not
1019 checked. You can use <cf/0x1234/ syntax to write hexadecimal values.
1020
b9864aa8 1021 <tag><label id="type-pair">pair</tag>
dad92c30
OZ
1022 This is a pair of two short integers. Each component can have values
1023 from 0 to 65535. Literals of this type are written as <cf/(1234,5678)/.
1024 The same syntax can also be used to construct a pair from two arbitrary
1025 integer expressions (for example <cf/(1+2,a)/).
1026
b9864aa8 1027 <tag><label id="type-quad">quad</tag>
dad92c30
OZ
1028 This is a dotted quad of numbers used to represent router IDs (and
1029 others). Each component can have a value from 0 to 255. Literals of
1030 this type are written like IPv4 addresses.
1031
b9864aa8 1032 <tag><label id="type-string">string</tag>
dad92c30
OZ
1033 This is a string of characters. There are no ways to modify strings in
1034 filters. You can pass them between functions, assign them to variables
1035 of type <cf/string/, print such variables, use standard string
1036 comparison operations (e.g. <cf/=, !=, &lt;, &gt;, &lt;=, &gt;=/), but
1037 you can't concatenate two strings. String literals are written as
768d5e10
PT
1038 <cf/"This is a string constant"/. Additionally matching (<cf/&tilde;,
1039 !&tilde;/) operators could be used to match a string value against
1040 a shell pattern (represented also as a string).
dad92c30 1041
b9864aa8 1042 <tag><label id="type-ip">ip</tag>
dad92c30
OZ
1043 This type can hold a single IP address. Depending on the compile-time
1044 configuration of BIRD you are using, it is either an IPv4 or IPv6
1045 address. IP addresses are written in the standard notation
1046 (<cf/10.20.30.40/ or <cf/fec0:3:4::1/). You can apply special operator
1047 <cf>.mask(<M>num</M>)</cf> on values of type ip. It masks out all but
1048 first <cf><M>num</M></cf> bits from the IP address. So
1049 <cf/1.2.3.4.mask(8) = 1.0.0.0/ is true.
1050
b9864aa8 1051 <tag><label id="type-prefix">prefix</tag>
dad92c30
OZ
1052 This type can hold a network prefix consisting of IP address and prefix
1053 length. Prefix literals are written as <cf><m/ipaddress//<m/pxlen/</cf>,
1054 or <cf><m>ipaddress</m>/<m>netmask</m></cf>. There are two special
1055 operators on prefixes: <cf/.ip/ which extracts the IP address from the
1056 pair, and <cf/.len/, which separates prefix length from the pair.
90dc0f08 1057 So <cf>1.2.0.0/16.len = 16</cf> is true.
dad92c30 1058
b9864aa8 1059 <tag><label id="type-ec">ec</tag>
dad92c30
OZ
1060 This is a specialized type used to represent BGP extended community
1061 values. It is essentially a 64bit value, literals of this type are
1062 usually written as <cf>(<m/kind/, <m/key/, <m/value/)</cf>, where
1063 <cf/kind/ is a kind of extended community (e.g. <cf/rt/ / <cf/ro/ for a
1064 route target / route origin communities), the format and possible values
1065 of <cf/key/ and <cf/value/ are usually integers, but it depends on the
1066 used kind. Similarly to pairs, ECs can be constructed using expressions
1067 for <cf/key/ and <cf/value/ parts, (e.g. <cf/(ro, myas, 3*10)/, where
1068 <cf/myas/ is an integer variable).
dcde7ae5 1069
b9864aa8 1070 <tag><label id="type-lc">lc</tag>
cec4a73c
OZ
1071 This is a specialized type used to represent BGP large community
1072 values. It is essentially a triplet of 32bit values, where the first
1073 value is reserved for the AS number of the issuer, while meaning of
1074 remaining parts is defined by the issuer. Literals of this type are
1075 written as <cf/(123, 456, 789)/, with any integer values. Similarly to
1076 pairs, LCs can be constructed using expressions for its parts, (e.g.
1077 <cf/(myas, 10+20, 3*10)/, where <cf/myas/ is an integer variable).
1078
b9864aa8 1079 <tag><label id="type-set">int|pair|quad|ip|prefix|ec|lc|enum set</tag>
dad92c30
OZ
1080 Filters recognize four types of sets. Sets are similar to strings: you
1081 can pass them around but you can't modify them. Literals of type <cf>int
1082 set</cf> look like <cf> [ 1, 2, 5..7 ]</cf>. As you can see, both simple
1083 values and ranges are permitted in sets.
1084
1085 For pair sets, expressions like <cf/(123,*)/ can be used to denote
1086 ranges (in that case <cf/(123,0)..(123,65535)/). You can also use
1087 <cf/(123,5..100)/ for range <cf/(123,5)..(123,100)/. You can also use
1088 <cf/*/ and <cf/a..b/ expressions in the first part of a pair, note that
1089 such expressions are translated to a set of intervals, which may be
1090 memory intensive. E.g. <cf/(*,4..20)/ is translated to <cf/(0,4..20),
1091 (1,4..20), (2,4..20), ... (65535, 4..20)/.
1092
1093 EC sets use similar expressions like pair sets, e.g. <cf/(rt, 123,
1094 10..20)/ or <cf/(ro, 123, *)/. Expressions requiring the translation
1095 (like <cf/(rt, *, 3)/) are not allowed (as they usually have 4B range
1096 for ASNs).
1097
cec4a73c
OZ
1098 Also LC sets use similar expressions like pair sets. You can use ranges
1099 and wildcards, but if one field uses that, more specific (later) fields
1100 must be wildcards. E.g., <cf/(10, 20..30, *)/ or <cf/(10, 20, 30..40)/
1101 is valid, while <cf/(10, *, 20..30)/ or <cf/(10, 20..30, 40)/ is not
1102 valid.
1103
1104 You can also use expressions for int, pair, EC and LC set values.
1105 However, it must be possible to evaluate these expressions before daemon
1106 boots. So you can use only constants inside them. E.g.
dad92c30 1107
946dc15c
OF
1108 <code>
1109 define one=1;
8815d846 1110 define myas=64500;
946dc15c
OF
1111 int set odds;
1112 pair set ps;
8815d846 1113 ec set es;
946dc15c 1114
8815d846 1115 odds = [ one, 2+1, 6-one, 2*2*2-1, 9, 11 ];
b54ad333 1116 ps = [ (1,one+one), (3,4)..(4,8), (5,*), (6,3..6), (7..9,*) ];
8815d846 1117 es = [ (rt, myas, 3*10), (rt, myas+one, 0..16*16*16-1), (ro, myas+2, *) ];
946dc15c 1118 </code>
b1a597e0 1119
dad92c30
OZ
1120 Sets of prefixes are special: their literals does not allow ranges, but
1121 allows prefix patterns that are written
1122 as <cf><M>ipaddress</M>/<M>pxlen</M>{<M>low</M>,<M>high</M>}</cf>.
1123 Prefix <cf><m>ip1</m>/<m>len1</m></cf> matches prefix
1124 pattern <cf><m>ip2</m>/<m>len2</m>{<m>l</m>,<m>h</m>}</cf> if the
1125 first <cf>min(len1, len2)</cf> bits of <cf/ip1/ and <cf/ip2/ are
1126 identical and <cf>len1 &lt;= ip1 &lt;= len2</cf>. A valid prefix pattern
1127 has to satisfy <cf>low &lt;= high</cf>, but <cf/pxlen/ is not
1128 constrained by <cf/low/ or <cf/high/. Obviously, a prefix matches a
1129 prefix set literal if it matches any prefix pattern in the prefix set
1130 literal.
1131
1132 There are also two shorthands for prefix patterns: <cf><m/address//<m/len/+</cf>
1133 is a shorthand for <cf><m/address//<m/len/{<m/len/,<m/maxlen/}</cf>
1134 (where <cf><m/maxlen/</cf> is 32 for IPv4 and 128 for IPv6), that means
1135 network prefix <cf><m/address//<m/len/</cf> and all its subnets.
1136 <cf><m/address//<m/len/-</cf> is a shorthand for
1137 <cf><m/address//<m/len/{0,<m/len/}</cf>, that means network prefix
1138 <cf><m/address//<m/len/</cf> and all its supernets (network prefixes
1139 that contain it).
1140
1141 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}
1142 ]</cf> matches prefix <cf>1.0.0.0/8</cf>, all subprefixes of
1143 <cf>2.0.0.0/8</cf>, all superprefixes of <cf>3.0.0.0/8</cf> and prefixes
1144 <cf/4.X.X.X/ whose prefix length is 16 to 24. <cf>[ 0.0.0.0/0{20,24} ]</cf>
1145 matches all prefixes (regardless of IP address) whose prefix length is
1146 20 to 24, <cf>[ 1.2.3.4/32- ]</cf> matches any prefix that contains IP
1147 address <cf>1.2.3.4</cf>. <cf>1.2.0.0/16 &tilde; [ 1.0.0.0/8{15,17} ]</cf>
1148 is true, but <cf>1.0.0.0/16 &tilde; [ 1.0.0.0/8- ]</cf> is false.
1149
1150 Cisco-style patterns like <cf>10.0.0.0/8 ge 16 le 24</cf> can be expressed
523f020b 1151 in BIRD as <cf>10.0.0.0/8{16,24}</cf>, <cf>192.168.0.0/16 le 24</cf> as
dad92c30
OZ
1152 <cf>192.168.0.0/16{16,24}</cf> and <cf>192.168.0.0/16 ge 24</cf> as
1153 <cf>192.168.0.0/16{24,32}</cf>.
d37f899b 1154
b9864aa8 1155 <tag><label id="type-enum">enum</tag>
dad92c30
OZ
1156 Enumeration types are fixed sets of possibilities. You can't define your
1157 own variables of such type, but some route attributes are of enumeration
1158 type. Enumeration types are incompatible with each other.
0e5373fd 1159
b9864aa8 1160 <tag><label id="type-bgppath">bgppath</tag>
dad92c30
OZ
1161 BGP path is a list of autonomous system numbers. You can't write
1162 literals of this type. There are several special operators on bgppaths:
4cdd0784 1163
dad92c30 1164 <cf><m/P/.first</cf> returns the first ASN (the neighbor ASN) in path <m/P/.
4cdd0784 1165
dad92c30 1166 <cf><m/P/.last</cf> returns the last ASN (the source ASN) in path <m/P/.
4cdd0784 1167
9c9cc35c
OZ
1168 <cf><m/P/.last_nonaggregated</cf> returns the last ASN in the non-aggregated part of the path <m/P/.
1169
dad92c30
OZ
1170 Both <cf/first/ and <cf/last/ return zero if there is no appropriate
1171 ASN, for example if the path contains an AS set element as the first (or
9c9cc35c
OZ
1172 the last) part. If the path ends with an AS set, <cf/last_nonaggregated/
1173 may be used to get last ASN before any AS set.
4cdd0784 1174
dad92c30 1175 <cf><m/P/.len</cf> returns the length of path <m/P/.
4cdd0784 1176
dad92c30
OZ
1177 <cf>prepend(<m/P/,<m/A/)</cf> prepends ASN <m/A/ to path <m/P/ and
1178 returns the result.
bff9ce51 1179
dad92c30
OZ
1180 <cf>delete(<m/P/,<m/A/)</cf> deletes all instances of ASN <m/A/ from
1181 from path <m/P/ and returns the result. <m/A/ may also be an integer
1182 set, in that case the operator deletes all ASNs from path <m/P/ that are
1183 also members of set <m/A/.
bff9ce51 1184
dad92c30
OZ
1185 <cf>filter(<m/P/,<m/A/)</cf> deletes all ASNs from path <m/P/ that are
1186 not members of integer set <m/A/. I.e., <cf/filter/ do the same as
1187 <cf/delete/ with inverted set <m/A/.
bff9ce51 1188
dad92c30
OZ
1189 Statement <cf><m/P/ = prepend(<m/P/, <m/A/);</cf> can be shortened to
1190 <cf><m/P/.prepend(<m/A/);</cf> if <m/P/ is appropriate route attribute
1191 (for example <cf/bgp_path/). Similarly for <cf/delete/ and <cf/filter/.
4a5bb2bf 1192
b9864aa8 1193 <tag><label id="type-bgpmask">bgpmask</tag>
dad92c30
OZ
1194 BGP masks are patterns used for BGP path matching (using <cf>path
1195 &tilde; [= 2 3 5 * =]</cf> syntax). The masks resemble wildcard patterns
1196 as used by UNIX shells. Autonomous system numbers match themselves,
1197 <cf/*/ matches any (even empty) sequence of arbitrary AS numbers and
523f020b 1198 <cf/?/ matches one arbitrary AS number. For example, if <cf>bgp_path</cf>
dad92c30
OZ
1199 is 4 3 2 1, then: <tt>bgp_path &tilde; [= * 4 3 * =]</tt> is true,
1200 but <tt>bgp_path &tilde; [= * 4 5 * =]</tt> is false. BGP mask
1201 expressions can also contain integer expressions enclosed in parenthesis
a0fe1944
OF
1202 and integer variables, for example <tt>[= * 4 (1+2) a =]</tt>. You can
1203 also use ranges, for example <tt>[= * 3..5 2 100..200 * =]</tt>.
1204 There is also old (deprecated) syntax that uses / .. / instead of [= .. =]
1205 and ? instead of *.
4cdd0784 1206
b9864aa8 1207 <tag><label id="type-clist">clist</tag>
dad92c30
OZ
1208 Clist is similar to a set, except that unlike other sets, it can be
1209 modified. The type is used for community list (a set of pairs) and for
1210 cluster list (a set of quads). There exist no literals of this type.
1211 There are three special operators on clists:
1212
1213 <cf><m/C/.len</cf> returns the length of clist <m/C/.
1214
1215 <cf>add(<m/C/,<m/P/)</cf> adds pair (or quad) <m/P/ to clist <m/C/ and
1216 returns the result. If item <m/P/ is already in clist <m/C/, it does
1217 nothing. <m/P/ may also be a clist, in that case all its members are
1218 added; i.e., it works as clist union.
1219
1220 <cf>delete(<m/C/,<m/P/)</cf> deletes pair (or quad) <m/P/ from clist
1221 <m/C/ and returns the result. If clist <m/C/ does not contain item
1222 <m/P/, it does nothing. <m/P/ may also be a pair (or quad) set, in that
1223 case the operator deletes all items from clist <m/C/ that are also
1224 members of set <m/P/. Moreover, <m/P/ may also be a clist, which works
1225 analogously; i.e., it works as clist difference.
1226
1227 <cf>filter(<m/C/,<m/P/)</cf> deletes all items from clist <m/C/ that are
1228 not members of pair (or quad) set <m/P/. I.e., <cf/filter/ do the same
1229 as <cf/delete/ with inverted set <m/P/. <m/P/ may also be a clist, which
1230 works analogously; i.e., it works as clist intersection.
1231
1232 Statement <cf><m/C/ = add(<m/C/, <m/P/);</cf> can be shortened to
1233 <cf><m/C/.add(<m/P/);</cf> if <m/C/ is appropriate route attribute (for
1234 example <cf/bgp_community/). Similarly for <cf/delete/ and <cf/filter/.
8815d846 1235
b9864aa8 1236 <tag><label id="type-eclist">eclist</tag>
dad92c30
OZ
1237 Eclist is a data type used for BGP extended community lists. Eclists
1238 are very similar to clists, but they are sets of ECs instead of pairs.
768d5e10
PT
1239 The same operations (like <cf/add/, <cf/delete/ or <cf/&tilde;/ and
1240 <cf/!&tilde;/ membership operators) can be used to modify or test
1241 eclists, with ECs instead of pairs as arguments.
cec4a73c
OZ
1242
1243 <tag/lclist/
1244 Lclist is a data type used for BGP large community lists. Like eclists,
1245 lclists are very similar to clists, but they are sets of LCs instead of
1246 pairs. The same operations (like <cf/add/, <cf/delete/ or <cf/&tilde;/
1247 and <cf/!&tilde;/ membership operators) can be used to modify or test
1248 lclists, with LCs instead of pairs as arguments.
d37f899b
PM
1249</descrip>
1250
dad92c30 1251
a7c9f7c0 1252<sect>Operators
b9864aa8 1253<label id="operators">
d37f899b 1254
dad92c30
OZ
1255<p>The filter language supports common integer operators <cf>(+,-,*,/)</cf>,
1256parentheses <cf/(a*(b+c))/, comparison <cf/(a=b, a!=b, a&lt;b, a&gt;=b)/.
1257Logical operations include unary not (<cf/!/), and (<cf/&amp;&amp;/) and or
768d5e10
PT
1258(<cf/&verbar;&verbar;/). Special operators include (<cf/&tilde;/,
1259<cf/!&tilde;/) for "is (not) element of a set" operation - it can be used on
1260element and set of elements of the same type (returning true if element is
1261contained in the given set), or on two strings (returning true if first string
1262matches a shell-like pattern stored in second string) or on IP and prefix
1263(returning true if IP is within the range defined by that prefix), or on prefix
1264and prefix (returning true if first prefix is more specific than second one) or
1265on bgppath and bgpmask (returning true if the path matches the mask) or on
1266number and bgppath (returning true if the number is in the path) or on bgppath
1267and int (number) set (returning true if any ASN from the path is in the set) or
1268on pair/quad and clist (returning true if the pair/quad is element of the
1269clist) or on clist and pair/quad set (returning true if there is an element of
1270the clist that is also a member of the pair/quad set).
dad92c30
OZ
1271
1272<p>There is one operator related to ROA infrastructure - <cf/roa_check()/. It
7935b9d2
PT
1273examines a ROA table and does <rfc id="6483"> route origin validation for a
1274given network prefix. The basic usage is <cf>roa_check(<m/table/)</cf>, which
1275checks current route (which should be from BGP to have AS_PATH argument) in the
dad92c30
OZ
1276specified ROA table and returns ROA_UNKNOWN if there is no relevant ROA,
1277ROA_VALID if there is a matching ROA, or ROA_INVALID if there are some relevant
af582c48 1278ROAs but none of them match. There is also an extended variant
dad92c30
OZ
1279<cf>roa_check(<m/table/, <m/prefix/, <m/asn/)</cf>, which allows to specify a
1280prefix and an ASN as arguments.
af582c48 1281
d37f899b 1282
371adba6 1283<sect>Control structures
b9864aa8 1284<label id="control-structures">
d37f899b 1285
523f020b 1286<p>Filters support two control structures: conditions and case switches.
a7c9f7c0 1287
dad92c30
OZ
1288<p>Syntax of a condition is: <cf>if <M>boolean expression</M> then <m/command1/;
1289else <m/command2/;</cf> and you can use <cf>{ <m/command_1/; <m/command_2/;
1290<M>...</M> }</cf> instead of either command. The <cf>else</cf> clause may be
1291omitted. If the <cf><m>boolean expression</m></cf> is true, <m/command1/ is
1292executed, otherwise <m/command2/ is executed.
1293
1294<p>The <cf>case</cf> is similar to case from Pascal. Syntax is <cf>case
1295<m/expr/ { else: | <m/num_or_prefix [ .. num_or_prefix]/: <m/statement/ ; [
1296... ] }</cf>. The expression after <cf>case</cf> can be of any type which can be
1297on the left side of the &tilde; operator and anything that could be a member of
1298a set is allowed before <cf/:/. Multiple commands are allowed without <cf/{}/
1299grouping. If <cf><m/expr/</cf> matches one of the <cf/:/ clauses, statements
1300between it and next <cf/:/ statement are executed. If <cf><m/expr/</cf> matches
1301neither of the <cf/:/ clauses, the statements after <cf/else:/ are executed.
d37f899b 1302
a7c9f7c0 1303<p>Here is example that uses <cf/if/ and <cf/case/ structures:
af0b25d2
PM
1304
1305<code>
1306case arg1 {
1307 2: print "two"; print "I can do more commands without {}";
1308 3 .. 5: print "three to five";
1309 else: print "something else";
a7c9f7c0 1310}
af0b25d2 1311
523f020b
OZ
1312if 1234 = i then printn "."; else {
1313 print "not 1234";
1314 print "You need {} around multiple commands";
8798c811 1315}
af0b25d2
PM
1316</code>
1317
dad92c30 1318
371adba6 1319<sect>Route attributes
b9864aa8 1320<label id="route-attributes">
0e5373fd 1321
dad92c30
OZ
1322<p>A filter is implicitly passed a route, and it can access its attributes just
1323like it accesses variables. Attempts to access undefined attribute result in a
1324runtime error; you can check if an attribute is defined by using the
1325<cf>defined( <m>attribute</m> )</cf> operator. One notable exception to this
1326rule are attributes of clist type, where undefined value is regarded as empty
1327clist for most purposes.
a7c9f7c0 1328
36032ded 1329<descrip>
b9864aa8 1330 <tag><label id="rta-net"><m/prefix/ net</tag>
dad92c30
OZ
1331 Network the route is talking about. Read-only. (See the chapter about
1332 routing tables.)
a7c9f7c0 1333
b9864aa8 1334 <tag><label id="rta-scope"><m/enum/ scope</tag>
dad92c30
OZ
1335 The scope of the route. Possible values: <cf/SCOPE_HOST/ for routes
1336 local to this host, <cf/SCOPE_LINK/ for those specific for a physical
1337 link, <cf/SCOPE_SITE/ and <cf/SCOPE_ORGANIZATION/ for private routes and
1338 <cf/SCOPE_UNIVERSE/ for globally visible routes. This attribute is not
1339 interpreted by BIRD and can be used to mark routes in filters. The
1340 default value for new routes is <cf/SCOPE_UNIVERSE/.
0e5373fd 1341
b9864aa8 1342 <tag><label id="rta-preference"><m/int/ preference</tag>
dad92c30
OZ
1343 Preference of the route. Valid values are 0-65535. (See the chapter
1344 about routing tables.)
c184d9d0 1345
b9864aa8 1346 <tag><label id="rta-from"><m/ip/ from</tag>
00192d5a 1347 The router which the route has originated from.
523f020b 1348
b9864aa8 1349 <tag><label id="rta-gw"><m/ip/ gw</tag>
a7c9f7c0 1350 Next hop packets routed using this route should be forwarded to.
0e5373fd 1351
b9864aa8 1352 <tag><label id="rta-proto"><m/string/ proto</tag>
dad92c30
OZ
1353 The name of the protocol which the route has been imported from.
1354 Read-only.
e29fa06e 1355
b9864aa8 1356 <tag><label id="rta-source"><m/enum/ source</tag>
dad92c30
OZ
1357 what protocol has told me about this route. Possible values:
1358 <cf/RTS_DUMMY/, <cf/RTS_STATIC/, <cf/RTS_INHERIT/, <cf/RTS_DEVICE/,
1359 <cf/RTS_STATIC_DEVICE/, <cf/RTS_REDIRECT/, <cf/RTS_RIP/, <cf/RTS_OSPF/,
1360 <cf/RTS_OSPF_IA/, <cf/RTS_OSPF_EXT1/, <cf/RTS_OSPF_EXT2/, <cf/RTS_BGP/,
12640c14 1361 <cf/RTS_PIPE/, <cf/RTS_BABEL/.
c184d9d0 1362
b9864aa8 1363 <tag><label id="rta-cast"><m/enum/ cast</tag>
ff2857b0 1364 Route type (Currently <cf/RTC_UNICAST/ for normal routes,
dad92c30
OZ
1365 <cf/RTC_BROADCAST/, <cf/RTC_MULTICAST/, <cf/RTC_ANYCAST/ will be used in
1366 the future for broadcast, multicast and anycast routes). Read-only.
c184d9d0 1367
b9864aa8 1368 <tag><label id="rta-dest"><m/enum/ dest</tag>
182a7895
OZ
1369 Type of destination the packets should be sent to
1370 (<cf/RTD_ROUTER/ for forwarding to a neighboring router,
1371 <cf/RTD_DEVICE/ for routing to a directly-connected network,
1372 <cf/RTD_MULTIPATH/ for multipath destinations,
1373 <cf/RTD_BLACKHOLE/ for packets to be silently discarded,
dad92c30
OZ
1374 <cf/RTD_UNREACHABLE/, <cf/RTD_PROHIBIT/ for packets that should be
1375 returned with ICMP host unreachable / ICMP administratively prohibited
1376 messages). Can be changed, but only to <cf/RTD_BLACKHOLE/,
1377 <cf/RTD_UNREACHABLE/ or <cf/RTD_PROHIBIT/.
b74f45f8 1378
b9864aa8 1379 <tag><label id="rta-ifname"><m/string/ ifname</tag>
dad92c30
OZ
1380 Name of the outgoing interface. Sink routes (like blackhole, unreachable
1381 or prohibit) and multipath routes have no interface associated with
1382 them, so <cf/ifname/ returns an empty string for such routes. Read-only.
a5fc5958 1383
b9864aa8 1384 <tag><label id="rta-ifindex"><m/int/ ifindex</tag>
dad92c30
OZ
1385 Index of the outgoing interface. System wide index of the interface. May
1386 be used for interface matching, however indexes might change on interface
1387 creation/removal. Zero is returned for routes with undefined outgoing
a5fc5958
OZ
1388 interfaces. Read-only.
1389
b9864aa8 1390 <tag><label id="rta-igp-metric"><m/int/ igp_metric</tag>
dad92c30
OZ
1391 The optional attribute that can be used to specify a distance to the
1392 network for routes that do not have a native protocol metric attribute
1393 (like <cf/ospf_metric1/ for OSPF routes). It is used mainly by BGP to
1394 compare internal distances to boundary routers (see below). It is also
1395 used when the route is exported to OSPF as a default value for OSPF type
1396 1 metric.
ba1dda49 1397</descrip>
0e5373fd 1398
dad92c30
OZ
1399<p>There also exist some protocol-specific attributes which are described in the
1400corresponding protocol sections.
1401
0e5373fd 1402
1632f1fe 1403<sect>Other statements
b9864aa8 1404<label id="other-statements">
69477cad 1405
a7c9f7c0 1406<p>The following statements are available:
69477cad
PM
1407
1408<descrip>
b9864aa8 1409 <tag><label id="assignment"><m/variable/ = <m/expr/</tag>
dad92c30 1410 Set variable to a given value.
326e33f5 1411
b9864aa8 1412 <tag><label id="filter-accept-reject">accept|reject [ <m/expr/ ]</tag>
dad92c30 1413 Accept or reject the route, possibly printing <cf><m>expr</m></cf>.
326e33f5 1414
b9864aa8 1415 <tag><label id="return">return <m/expr/</tag>
dad92c30
OZ
1416 Return <cf><m>expr</m></cf> from the current function, the function ends
1417 at this point.
326e33f5 1418
b9864aa8 1419 <tag><label id="print">print|printn <m/expr/ [<m/, expr.../]</tag>
dad92c30
OZ
1420 Prints given expressions; useful mainly while debugging filters. The
1421 <cf/printn/ variant does not terminate the line.
69477cad 1422
b9864aa8 1423 <tag><label id="quitbird">quitbird</tag>
1632f1fe 1424 Terminates BIRD. Useful when debugging the filter interpreter.
69477cad
PM
1425</descrip>
1426
dad92c30 1427
371adba6 1428<chapt>Protocols
b9864aa8 1429<label id="protocols">
d37f899b 1430
937e75d8 1431<sect>Babel
b9864aa8 1432<label id="babel">
937e75d8
OZ
1433
1434<sect1>Introduction
b9864aa8 1435<label id="babel-intro">
937e75d8 1436
7935b9d2
PT
1437<p>The Babel protocol
1438(<rfc id="6126">) is a loop-avoiding distance-vector routing protocol that is
1439robust and efficient both in ordinary wired networks and in wireless mesh
1440networks. Babel is conceptually very simple in its operation and "just works"
1441in its default configuration, though some configuration is possible and in some
1442cases desirable.
937e75d8
OZ
1443
1444<p>While the Babel protocol is dual stack (i.e., can carry both IPv4 and IPv6
1445routes over the same IPv6 transport), BIRD presently implements only the IPv6
1446subset of the protocol. No Babel extensions are implemented, but the BIRD
1447implementation can coexist with implementations using the extensions (and will
1448just ignore extension messages).
1449
1450<p>The Babel protocol implementation in BIRD is currently in alpha stage.
1451
1452<sect1>Configuration
b9864aa8 1453<label id="babel-config">
937e75d8
OZ
1454
1455<p>Babel supports no global configuration options apart from those common to all
1456other protocols, but supports the following per-interface configuration options:
1457
1458<code>
1459protocol babel [<name>] {
1460 interface <interface pattern> {
1461 type <wired|wireless>;
1462 rxcost <number>;
1463 hello interval <number>;
1464 update interval <number>;
1465 port <number>;
1466 tx class|dscp <number>;
1467 tx priority <number>;
1468 rx buffer <number>;
1469 tx length <number>;
1470 check link <switch>;
1471 };
1472}
1473</code>
1474
1475<descrip>
b9864aa8 1476 <tag><label id="babel-type">type wired|wireless </tag>
937e75d8
OZ
1477 This option specifies the interface type: Wired or wireless. Wired
1478 interfaces are considered more reliable, and so the default hello
1479 interval is higher, and a neighbour is considered unreachable after only
1480 a small number of "hello" packets are lost. On wireless interfaces,
1481 hello packets are sent more often, and the ETX link quality estimation
1482 technique is used to compute the metrics of routes discovered over this
1483 interface. This technique will gradually degrade the metric of routes
1484 when packets are lost rather than the more binary up/down mechanism of
1485 wired type links. Default: <cf/wired/.
1486
b9864aa8 1487 <tag><label id="babel-rxcost">rxcost <m/num/</tag>
937e75d8
OZ
1488 This specifies the RX cost of the interface. The route metrics will be
1489 computed from this value with a mechanism determined by the interface
1490 <cf/type/. Default: 96 for wired interfaces, 256 for wireless.
1491
b9864aa8 1492 <tag><label id="babel-hello">hello interval <m/num/</tag>
937e75d8
OZ
1493 Interval at which periodic "hello" messages are sent on this interface,
1494 in seconds. Default: 4 seconds.
1495
b9864aa8 1496 <tag><label id="babel-update">update interval <m/num/</tag>
937e75d8
OZ
1497 Interval at which periodic (full) updates are sent. Default: 4 times the
1498 hello interval.
1499
b9864aa8 1500 <tag><label id="babel-port">port <m/number/</tag>
937e75d8
OZ
1501 This option selects an UDP port to operate on. The default is to operate
1502 on port 6696 as specified in the Babel RFC.
1503
b9864aa8 1504 <tag><label id="babel-tx-class">tx class|dscp|priority <m/number/</tag>
937e75d8 1505 These options specify the ToS/DiffServ/Traffic class/Priority of the
b9864aa8 1506 outgoing Babel packets. See <ref id="proto-tx-class" name="tx class"> common
937e75d8
OZ
1507 option for detailed description.
1508
b9864aa8 1509 <tag><label id="babel-rx-buffer">rx buffer <m/number/</tag>
937e75d8
OZ
1510 This option specifies the size of buffers used for packet processing.
1511 The buffer size should be bigger than maximal size of received packets.
1512 The default value is the interface MTU, and the value will be clamped to a
1513 minimum of 512 bytes + IP packet overhead.
1514
b9864aa8 1515 <tag><label id="babel-tx-length">tx length <m/number/</tag>
937e75d8
OZ
1516 This option specifies the maximum length of generated Babel packets. To
1517 avoid IP fragmentation, it should not exceed the interface MTU value.
1518 The default value is the interface MTU value, and the value will be
1519 clamped to a minimum of 512 bytes + IP packet overhead.
1520
b9864aa8 1521 <tag><label id="babel-check-link">check link <m/switch/</tag>
937e75d8
OZ
1522 If set, the hardware link state (as reported by OS) is taken into
1523 consideration. When the link disappears (e.g. an ethernet cable is
1524 unplugged), neighbors are immediately considered unreachable and all
1525 routes received from them are withdrawn. It is possible that some
1526 hardware drivers or platforms do not implement this feature. Default:
1527 yes.
1528</descrip>
1529
12640c14 1530<sect1>Attributes
b9864aa8 1531<label id="babel-attr">
12640c14
OZ
1532
1533<p>Babel defines just one attribute: the internal babel metric of the route. It
1534is exposed as the <cf/babel_metric/ attribute and has range from 1 to infinity
1535(65535).
1536
1537<sect1>Example
b9864aa8 1538<label id="babel-exam">
12640c14
OZ
1539
1540<p><code>
1541protocol babel {
1542 interface "eth*" {
1543 type wired;
1544 };
1545 interface "wlan0", "wlan1" {
1546 type wireless;
1547 hello interval 1;
1548 rxcost 512;
1549 };
1550 interface "tap0";
1551
1552 # This matches the default of babeld: redistribute all addresses
1553 # configured on local interfaces, plus re-distribute all routes received
1554 # from other babel peers.
1555
1556 export where (source = RTS_DEVICE) || (source = RTS_BABEL);
1557}
1558</code>
1559
937e75d8 1560
5bf35a9a 1561<sect>BFD
b9864aa8 1562<label id="bfd">
1ec52253
OZ
1563
1564<sect1>Introduction
b9864aa8 1565<label id="bfd-intro">
1ec52253
OZ
1566
1567<p>Bidirectional Forwarding Detection (BFD) is not a routing protocol itself, it
1568is an independent tool providing liveness and failure detection. Routing
1569protocols like OSPF and BGP use integrated periodic "hello" messages to monitor
1570liveness of neighbors, but detection times of these mechanisms are high (e.g. 40
1571seconds by default in OSPF, could be set down to several seconds). BFD offers
1572universal, fast and low-overhead mechanism for failure detection, which could be
1573attached to any routing protocol in an advisory role.
1574
1575<p>BFD consists of mostly independent BFD sessions. Each session monitors an
1576unicast bidirectional path between two BFD-enabled routers. This is done by
1577periodically sending control packets in both directions. BFD does not handle
1578neighbor discovery, BFD sessions are created on demand by request of other
1579protocols (like OSPF or BGP), which supply appropriate information like IP
1580addresses and associated interfaces. When a session changes its state, these
1581protocols are notified and act accordingly (e.g. break an OSPF adjacency when
1582the BFD session went down).
1583
7935b9d2
PT
1584<p>BIRD implements basic BFD behavior as defined in <rfc id="5880"> (some
1585advanced features like the echo mode or authentication are not implemented), IP
1586transport for BFD as defined in <rfc id="5881"> and <rfc id="5883"> and
1587interaction with client protocols as defined in <rfc id="5882">.
1ec52253
OZ
1588
1589<p>Note that BFD implementation in BIRD is currently a new feature in
1590development, expect some rough edges and possible UI and configuration changes
1591in the future. Also note that we currently support at most one protocol instance.
1592
d96ec7f6
OZ
1593<p>BFD packets are sent with a dynamic source port number. Linux systems use by
1594default a bit different dynamic port range than the IANA approved one
1595(49152-65535). If you experience problems with compatibility, please adjust
1596<cf>/proc/sys/net/ipv4/ip_local_port_range</cf>
1597
1ec52253 1598<sect1>Configuration
b9864aa8 1599<label id="bfd-config">
1ec52253
OZ
1600
1601<p>BFD configuration consists mainly of multiple definitions of interfaces.
1602Most BFD config options are session specific. When a new session is requested
1603and dynamically created, it is configured from one of these definitions. For
1604sessions to directly connected neighbors, <cf/interface/ definitions are chosen
1605based on the interface associated with the session, while <cf/multihop/
1606definition is used for multihop sessions. If no definition is relevant, the
1607session is just created with the default configuration. Therefore, an empty BFD
1608configuration is often sufficient.
1609
1610<p>Note that to use BFD for other protocols like OSPF or BGP, these protocols
1611also have to be configured to request BFD sessions, usually by <cf/bfd/ option.
1612
1613<p>Some of BFD session options require <m/time/ value, which has to be specified
1614with the appropriate unit: <m/num/ <cf/s/|<cf/ms/|<cf/us/. Although microseconds
1615are allowed as units, practical minimum values are usually in order of tens of
1616milliseconds.
1617
1618<code>
1619protocol bfd [&lt;name&gt;] {
1620 interface &lt;interface pattern&gt; {
1621 interval &lt;time&gt;;
1622 min rx interval &lt;time&gt;;
1623 min tx interval &lt;time&gt;;
1624 idle tx interval &lt;time&gt;;
1625 multiplier &lt;num&gt;;
1626 passive &lt;switch&gt;;
1627 };
1628 multihop {
1629 interval &lt;time&gt;;
1630 min rx interval &lt;time&gt;;
1631 min tx interval &lt;time&gt;;
1632 idle tx interval &lt;time&gt;;
1633 multiplier &lt;num&gt;;
1634 passive &lt;switch&gt;;
1635 };
1636 neighbor &lt;ip&gt; [dev "&lt;interface&gt;"] [local &lt;ip&gt;] [multihop &lt;switch&gt;];
1637}
1638</code>
1639
1640<descrip>
9df52a98 1641 <tag><label id="bfd-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag>
1ec52253
OZ
1642 Interface definitions allow to specify options for sessions associated
1643 with such interfaces and also may contain interface specific options.
b9864aa8 1644 See <ref id="proto-iface" name="interface"> common option for a detailed
1ec52253
OZ
1645 description of interface patterns. Note that contrary to the behavior of
1646 <cf/interface/ definitions of other protocols, BFD protocol would accept
1647 sessions (in default configuration) even on interfaces not covered by
1648 such definitions.
1649
b9864aa8 1650 <tag><label id="bfd-multihop">multihop { <m/options/ }</tag>
1ec52253
OZ
1651 Multihop definitions allow to specify options for multihop BFD sessions,
1652 in the same manner as <cf/interface/ definitions are used for directly
1653 connected sessions. Currently only one such definition (for all multihop
1654 sessions) could be used.
1655
b9864aa8 1656 <tag><label id="bfd-neighbor">neighbor <m/ip/ [dev "<m/interface/"] [local <m/ip/] [multihop <m/switch/]</tag>
1ec52253
OZ
1657 BFD sessions are usually created on demand as requested by other
1658 protocols (like OSPF or BGP). This option allows to explicitly add
1659 a BFD session to the specified neighbor regardless of such requests.
523f020b 1660
1ec52253 1661 The session is identified by the IP address of the neighbor, with
dad92c30 1662 optional specification of used interface and local IP. By default
fff7498d 1663 the neighbor must be directly connected, unless the session is
1ec52253
OZ
1664 configured as multihop. Note that local IP must be specified for
1665 multihop sessions.
1666</descrip>
1667
1668<p>Session specific options (part of <cf/interface/ and <cf/multihop/ definitions):
1669
1670<descrip>
b9864aa8 1671 <tag><label id="bfd-interval">interval <m/time/</tag>
1ec52253
OZ
1672 BFD ensures availability of the forwarding path associated with the
1673 session by periodically sending BFD control packets in both
1674 directions. The rate of such packets is controlled by two options,
1675 <cf/min rx interval/ and <cf/min tx interval/ (see below). This option
1676 is just a shorthand to set both of these options together.
1677
b9864aa8 1678 <tag><label id="bfd-min-rx-interval">min rx interval <m/time/</tag>
1ec52253
OZ
1679 This option specifies the minimum RX interval, which is announced to the
1680 neighbor and used there to limit the neighbor's rate of generated BFD
1681 control packets. Default: 10 ms.
1682
b9864aa8 1683 <tag><label id="bfd-min-tx-interval">min tx interval <m/time/</tag>
1ec52253
OZ
1684 This option specifies the desired TX interval, which controls the rate
1685 of generated BFD control packets (together with <cf/min rx interval/
1686 announced by the neighbor). Note that this value is used only if the BFD
1687 session is up, otherwise the value of <cf/idle tx interval/ is used
1688 instead. Default: 100 ms.
1689
b9864aa8 1690 <tag><label id="bfd-idle-tx-interval">idle tx interval <m/time/</tag>
1ec52253
OZ
1691 In order to limit unnecessary traffic in cases where a neighbor is not
1692 available or not running BFD, the rate of generated BFD control packets
1693 is lower when the BFD session is not up. This option specifies the
1694 desired TX interval in such cases instead of <cf/min tx interval/.
1695 Default: 1 s.
1696
b9864aa8 1697 <tag><label id="bfd-multiplier">multiplier <m/num/</tag>
1ec52253
OZ
1698 Failure detection time for BFD sessions is based on established rate of
1699 BFD control packets (<cf>min rx/tx interval</cf>) multiplied by this
1700 multiplier, which is essentially (ignoring jitter) a number of missed
1701 packets after which the session is declared down. Note that rates and
1702 multipliers could be different in each direction of a BFD session.
1703 Default: 5.
1704
b9864aa8 1705 <tag><label id="bfd-passive">passive <m/switch/</tag>
fff7498d 1706 Generally, both BFD session endpoints try to establish the session by
1ec52253
OZ
1707 sending control packets to the other side. This option allows to enable
1708 passive mode, which means that the router does not send BFD packets
1709 until it has received one from the other side. Default: disabled.
1710</descrip>
1711
1712<sect1>Example
b9864aa8 1713<label id="bfd-exam">
1ec52253
OZ
1714
1715<p><code>
1716protocol bfd {
1717 interface "eth*" {
1718 min rx interval 20 ms;
1719 min tx interval 50 ms;
1720 idle tx interval 300 ms;
1721 };
1722 interface "gre*" {
1723 interval 200 ms;
1724 multiplier 10;
1725 passive;
1726 };
1727 multihop {
1728 interval 200 ms;
1729 multiplier 10;
1730 };
1731
1732 neighbor 192.168.1.10;
1733 neighbor 192.168.2.2 dev "eth2";
1734 neighbor 192.168.10.1 local 192.168.1.1 multihop;
1735}
1736</code>
1737
dad92c30 1738
371adba6 1739<sect>BGP
b9864aa8 1740<label id="bgp">
1b55b1a3 1741
dad92c30
OZ
1742<p>The Border Gateway Protocol is the routing protocol used for backbone level
1743routing in the today's Internet. Contrary to other protocols, its convergence
1744does not rely on all routers following the same rules for route selection,
1745making it possible to implement any routing policy at any router in the network,
1746the only restriction being that if a router advertises a route, it must accept
1747and forward packets according to it.
1748
1749<p>BGP works in terms of autonomous systems (often abbreviated as AS). Each AS
1750is a part of the network with common management and common routing policy. It is
1751identified by a unique 16-bit number (ASN). Routers within each AS usually
1752exchange AS-internal routing information with each other using an interior
1753gateway protocol (IGP, such as OSPF or RIP). Boundary routers at the border of
1754the AS communicate global (inter-AS) network reachability information with their
1755neighbors in the neighboring AS'es via exterior BGP (eBGP) and redistribute
1756received information to other routers in the AS via interior BGP (iBGP).
1757
1758<p>Each BGP router sends to its neighbors updates of the parts of its routing
1759table it wishes to export along with complete path information (a list of AS'es
1760the packet will travel through if it uses the particular route) in order to
1761avoid routing loops.
56ab03c7 1762
5459fac6 1763<p>BIRD supports all requirements of the BGP4 standard as defined in
7935b9d2
PT
1764<rfc id="4271"> It also supports the community attributes (<rfc id="1997">),
1765capability negotiation (<rfc id="5492">), MD5 password authentication (<rfc
1766id="2385">), extended communities (<rfc id="4360">), route reflectors (<rfc
1767id="4456">), graceful restart (<rfc id="4724">), multiprotocol extensions
1768(<rfc id="4760">), 4B AS numbers (<rfc id="4893">), and 4B AS numbers in
1769extended communities (<rfc id="5668">).
1adc17b4
OZ
1770
1771
5459fac6 1772For IPv6, it uses the standard multiprotocol extensions defined in
7935b9d2 1773<rfc id="4760"> and applied to IPv6 according to <rfc id="2545">.
5459fac6 1774
371adba6 1775<sect1>Route selection rules
b9864aa8 1776<label id="bgp-route-select-rules">
5459fac6
MM
1777
1778<p>BGP doesn't have any simple metric, so the rules for selection of an optimal
1779route among multiple BGP routes with the same preference are a bit more complex
dad92c30
OZ
1780and they are implemented according to the following algorithm. It starts the
1781first rule, if there are more "best" routes, then it uses the second rule to
1782choose among them and so on.
5459fac6
MM
1783
1784<itemize>
5a203dac 1785 <item>Prefer route with the highest Local Preference attribute.
5459fac6 1786 <item>Prefer route with the shortest AS path.
b74f45f8 1787 <item>Prefer IGP origin over EGP and EGP origin over incomplete.
5459fac6 1788 <item>Prefer the lowest value of the Multiple Exit Discriminator.
b74f45f8
OZ
1789 <item>Prefer routes received via eBGP over ones received via iBGP.
1790 <item>Prefer routes with lower internal distance to a boundary router.
5a203dac 1791 <item>Prefer the route with the lowest value of router ID of the
5459fac6
MM
1792 advertising router.
1793</itemize>
56ab03c7 1794
b74f45f8 1795<sect1>IGP routing table
b9864aa8 1796<label id="bgp-igp-routing-table">
b74f45f8 1797
dad92c30
OZ
1798<p>BGP is mainly concerned with global network reachability and with routes to
1799other autonomous systems. When such routes are redistributed to routers in the
1800AS via BGP, they contain IP addresses of a boundary routers (in route attribute
1801NEXT_HOP). BGP depends on existing IGP routing table with AS-internal routes to
1802determine immediate next hops for routes and to know their internal distances to
1803boundary routers for the purpose of BGP route selection. In BIRD, there is
1804usually one routing table used for both IGP routes and BGP routes.
b74f45f8 1805
371adba6 1806<sect1>Configuration
b9864aa8 1807<label id="bgp-config">
56ab03c7 1808
dad92c30
OZ
1809<p>Each instance of the BGP corresponds to one neighboring router. This allows
1810to set routing policy and all the other parameters differently for each neighbor
1811using the following configuration parameters:
5459fac6
MM
1812
1813<descrip>
b9864aa8 1814 <tag><label id="bgp-local">local [<m/ip/] as <m/number/</tag>
dad92c30
OZ
1815 Define which AS we are part of. (Note that contrary to other IP routers,
1816 BIRD is able to act as a router located in multiple AS'es simultaneously,
1817 but in such cases you need to tweak the BGP paths manually in the filters
1818 to get consistent behavior.) Optional <cf/ip/ argument specifies a source
1819 address, equivalent to the <cf/source address/ option (see below). This
f3e59178
OZ
1820 parameter is mandatory.
1821
b9864aa8 1822 <tag><label id="bgp-neighbor">neighbor [<m/ip/] [port <m/number/] [as <m/number/]</tag>
dad92c30 1823 Define neighboring router this instance will be talking to and what AS
a1beb8f3
OZ
1824 it is located in. In case the neighbor is in the same AS as we are, we
1825 automatically switch to iBGP. Optionally, the remote port may also be
1826 specified. The parameter may be used multiple times with different
1827 sub-options (e.g., both <cf/neighbor 10.0.0.1 as 65000;/ and
1828 <cf/neighbor 10.0.0.1; neighbor as 65000;/ are valid). This parameter is
1829 mandatory.
1830
b9864aa8 1831 <tag><label id="bgp-iface">interface <m/string/</tag>
a1beb8f3
OZ
1832 Define interface we should use for link-local BGP IPv6 sessions.
1833 Interface can also be specified as a part of <cf/neighbor address/
1834 (e.g., <cf/neighbor fe80::1234%eth0 as 65000;/). It is an error to use
1835 this parameter for non link-local sessions.
dad92c30 1836
b9864aa8 1837 <tag><label id="bgp-direct">direct</tag>
dad92c30
OZ
1838 Specify that the neighbor is directly connected. The IP address of the
1839 neighbor must be from a directly reachable IP range (i.e. associated
1840 with one of your router's interfaces), otherwise the BGP session
1841 wouldn't start but it would wait for such interface to appear. The
1842 alternative is the <cf/multihop/ option. Default: enabled for eBGP.
1843
b9864aa8 1844 <tag><label id="bgp-multihop">multihop [<m/number/]</tag>
dad92c30
OZ
1845 Configure multihop BGP session to a neighbor that isn't directly
1846 connected. Accurately, this option should be used if the configured
1847 neighbor IP address does not match with any local network subnets. Such
1848 IP address have to be reachable through system routing table. The
1849 alternative is the <cf/direct/ option. For multihop BGP it is
1850 recommended to explicitly configure the source address to have it
1851 stable. Optional <cf/number/ argument can be used to specify the number
1852 of hops (used for TTL). Note that the number of networks (edges) in a
1853 path is counted; i.e., if two BGP speakers are separated by one router,
1854 the number of hops is 2. Default: enabled for iBGP.
1855
b9864aa8 1856 <tag><label id="bgp-source-address">source address <m/ip/</tag>
dad92c30
OZ
1857 Define local address we should use for next hop calculation and as a
1858 source address for the BGP session. Default: the address of the local
9be9a264
OZ
1859 end of the interface our neighbor is connected to.
1860
b9864aa8 1861 <tag><label id="bgp-next-hop-self">next hop self</tag>
dad92c30
OZ
1862 Avoid calculation of the Next Hop attribute and always advertise our own
1863 source address as a next hop. This needs to be used only occasionally to
1864 circumvent misconfigurations of other routers. Default: disabled.
1865
b9864aa8 1866 <tag><label id="bgp-next-hop-keep">next hop keep</tag>
dad92c30
OZ
1867 Forward the received Next Hop attribute even in situations where the
1868 local address should be used instead, like when the route is sent to an
1869 interface with a different subnet. Default: disabled.
1870
b9864aa8 1871 <tag><label id="bgp-missing-lladdr">missing lladdr self|drop|ignore</tag>
dad92c30
OZ
1872 Next Hop attribute in BGP-IPv6 sometimes contains just the global IPv6
1873 address, but sometimes it has to contain both global and link-local IPv6
1874 addresses. This option specifies what to do if BIRD have to send both
1875 addresses but does not know link-local address. This situation might
1876 happen when routes from other protocols are exported to BGP, or when
1877 improper updates are received from BGP peers. <cf/self/ means that BIRD
1878 advertises its own local address instead. <cf/drop/ means that BIRD
1879 skips that prefixes and logs error. <cf/ignore/ means that BIRD ignores
1880 the problem and sends just the global address (and therefore forms
1881 improper BGP update). Default: <cf/self/, unless BIRD is configured as a
1882 route server (option <cf/rs client/), in that case default is <cf/ignore/,
1883 because route servers usually do not forward packets themselves.
1884
b9864aa8 1885 <tag><label id="bgp-gateway">gateway direct|recursive</tag>
dad92c30
OZ
1886 For received routes, their <cf/gw/ (immediate next hop) attribute is
1887 computed from received <cf/bgp_next_hop/ attribute. This option
1888 specifies how it is computed. Direct mode means that the IP address from
1889 <cf/bgp_next_hop/ is used if it is directly reachable, otherwise the
1890 neighbor IP address is used. Recursive mode means that the gateway is
1891 computed by an IGP routing table lookup for the IP address from
6683d42d
OZ
1892 <cf/bgp_next_hop/. Note that there is just one level of indirection in
1893 recursive mode - the route obtained by the lookup must not be recursive
1894 itself, to prevent mutually recursive routes.
1895
1896 Recursive mode is the behavior specified by the BGP
dad92c30
OZ
1897 standard. Direct mode is simpler, does not require any routes in a
1898 routing table, and was used in older versions of BIRD, but does not
1899 handle well nontrivial iBGP setups and multihop. Recursive mode is
b9864aa8 1900 incompatible with <ref id="dsc-table-sorted" name="sorted tables">. Default:
dad92c30
OZ
1901 <cf/direct/ for direct sessions, <cf/recursive/ for multihop sessions.
1902
b9864aa8 1903 <tag><label id="bgp-igp-table">igp table <m/name/</tag>
dad92c30
OZ
1904 Specifies a table that is used as an IGP routing table. Default: the
1905 same as the table BGP is connected to.
1ec52253 1906
b9864aa8 1907 <tag><label id="bgp-check-link">check link <M>switch</M></tag>
523f020b
OZ
1908 BGP could use hardware link state into consideration. If enabled,
1909 BIRD tracks the link state of the associated interface and when link
1910 disappears (e.g. an ethernet cable is unplugged), the BGP session is
1911 immediately shut down. Note that this option cannot be used with
1912 multihop BGP. Default: disabled.
1913
b9864aa8 1914 <tag><label id="bgp-bfd">bfd <M>switch</M></tag>
1ec52253
OZ
1915 BGP could use BFD protocol as an advisory mechanism for neighbor
1916 liveness and failure detection. If enabled, BIRD setups a BFD session
1917 for the BGP neighbor and tracks its liveness by it. This has an
1918 advantage of an order of magnitude lower detection times in case of
1919 failure. Note that BFD protocol also has to be configured, see
b9864aa8 1920 <ref id="bfd" name="BFD"> section for details. Default: disabled.
1ec52253 1921
b9864aa8 1922 <tag><label id="bgp-ttl-security">ttl security <m/switch/</tag>
7935b9d2
PT
1923 Use GTSM (<rfc id="5082"> - the generalized TTL security mechanism). GTSM
1924 protects against spoofed packets by ignoring received packets with a
dad92c30 1925 smaller than expected TTL. To work properly, GTSM have to be enabled on
7935b9d2
PT
1926 both sides of a BGP session. If both <cf/ttl security/ and
1927 <cf/multihop/ options are enabled, <cf/multihop/ option should specify
1928 proper hop value to compute expected TTL. Kernel support required:
1929 Linux: 2.6.34+ (IPv4), 2.6.35+ (IPv6), BSD: since long ago, IPv4 only.
1930 Note that full (ICMP protection, for example) <rfc id="5082"> support is
1931 provided by Linux only. Default: disabled.
523f020b 1932
b9864aa8 1933 <tag><label id="bgp-pass">password <m/string/</tag>
7935b9d2
PT
1934 Use this password for MD5 authentication of BGP sessions (<rfc id="2385">). When
1935 used on BSD systems, see also <cf/setkey/ option below. Default: no
1936 authentication.
a7baa098 1937
b9864aa8 1938 <tag><label id="bgp-setkey">setkey <m/switch/</tag>
a7baa098
OZ
1939 On BSD systems, keys for TCP MD5 authentication are stored in the global
1940 SA/SP database, which can be accessed by external utilities (e.g.
1941 setkey(8)). BIRD configures security associations in the SA/SP database
1942 automatically based on <cf/password/ options (see above), this option
1943 allows to disable automatic updates by BIRD when manual configuration by
1944 external utilities is preferred. Note that automatic SA/SP database
1945 updates are currently implemented only for FreeBSD. Passwords have to be
1946 set manually by an external utility on NetBSD and OpenBSD. Default:
1947 enabled (ignored on non-FreeBSD).
dad92c30 1948
b9864aa8 1949 <tag><label id="bgp-passive">passive <m/switch/</tag>
dad92c30 1950 Standard BGP behavior is both initiating outgoing connections and
7935b9d2 1951 accepting incoming connections. In passive mode, outgoing connections
dad92c30
OZ
1952 are not initiated. Default: off.
1953
b9864aa8 1954 <tag><label id="bgp-rr-client">rr client</tag>
dad92c30
OZ
1955 Be a route reflector and treat the neighbor as a route reflection
1956 client. Default: disabled.
1957
b9864aa8 1958 <tag><label id="bgp-rr-cluster-id">rr cluster id <m/IPv4 address/</tag>
dad92c30
OZ
1959 Route reflectors use cluster id to avoid route reflection loops. When
1960 there is one route reflector in a cluster it usually uses its router id
1961 as a cluster id, but when there are more route reflectors in a cluster,
1962 these need to be configured (using this option) to use a common cluster
1963 id. Clients in a cluster need not know their cluster id and this option
1964 is not allowed for them. Default: the same as router id.
1965
b9864aa8 1966 <tag><label id="bgp-rs-client">rs client</tag>
dad92c30
OZ
1967 Be a route server and treat the neighbor as a route server client.
1968 A route server is used as a replacement for full mesh EBGP routing in
1969 Internet exchange points in a similar way to route reflectors used in
7935b9d2
PT
1970 IBGP routing. BIRD does not implement obsoleted <rfc id="1863">, but
1971 uses ad-hoc implementation, which behaves like plain EBGP but reduces
dad92c30 1972 modifications to advertised route attributes to be transparent (for
7935b9d2
PT
1973 example does not prepend its AS number to AS PATH attribute and
1974 keeps MED attribute). Default: disabled.
dad92c30 1975
b9864aa8 1976 <tag><label id="bgp-secondary">secondary <m/switch/</tag>
dad92c30
OZ
1977 Usually, if an export filter rejects a selected route, no other route is
1978 propagated for that network. This option allows to try the next route in
1979 order until one that is accepted is found or all routes for that network
1980 are rejected. This can be used for route servers that need to propagate
1981 different tables to each client but do not want to have these tables
1982 explicitly (to conserve memory). This option requires that the connected
b9864aa8 1983 routing table is <ref id="dsc-table-sorted" name="sorted">. Default: off.
48cf5e84 1984
b9864aa8 1985 <tag><label id="bgp-add-paths">add paths <m/switch/|rx|tx</tag>
10115b1d
OZ
1986 Standard BGP can propagate only one path (route) per destination network
1987 (usually the selected one). This option controls the add-path protocol
1988 extension, which allows to advertise any number of paths to a
1989 destination. Note that to be active, add-path has to be enabled on both
1990 sides of the BGP session, but it could be enabled separately for RX and
1991 TX direction. When active, all available routes accepted by the export
1992 filter are advertised to the neighbor. Default: off.
1993
b9864aa8 1994 <tag><label id="bgp-allow-local-as">allow local as [<m/number/]</tag>
dad92c30
OZ
1995 BGP prevents routing loops by rejecting received routes with the local
1996 AS number in the AS path. This option allows to loose or disable the
1997 check. Optional <cf/number/ argument can be used to specify the maximum
1998 number of local ASNs in the AS path that is allowed for received
1999 routes. When the option is used without the argument, the check is
2000 completely disabled and you should ensure loop-free behavior by some
2001 other means. Default: 0 (no local AS number allowed).
2002
b9864aa8 2003 <tag><label id="bgp-enable-route-refresh">enable route refresh <m/switch/</tag>
9aed29e6
OZ
2004 After the initial route exchange, BGP protocol uses incremental updates
2005 to keep BGP speakers synchronized. Sometimes (e.g., if BGP speaker
2006 changes its import filter, or if there is suspicion of inconsistency) it
2007 is necessary to do a new complete route exchange. BGP protocol extension
7935b9d2
PT
2008 Route Refresh (<rfc id="2918">) allows BGP speaker to request
2009 re-advertisement of all routes from its neighbor. BGP protocol
2010 extension Enhanced Route Refresh (<rfc id="7313">) specifies explicit
2011 begin and end for such exchanges, therefore the receiver can remove
2012 stale routes that were not advertised during the exchange. This option
2013 specifies whether BIRD advertises these capabilities and supports
2014 related procedures. Note that even when disabled, BIRD can send route
2015 refresh requests. Default: on.
bf47fe4b 2016
b9864aa8 2017 <tag><label id="bgp-graceful-restart">graceful restart <m/switch/|aware</tag>
6eda3f13
OZ
2018 When a BGP speaker restarts or crashes, neighbors will discard all
2019 received paths from the speaker, which disrupts packet forwarding even
7935b9d2
PT
2020 when the forwarding plane of the speaker remains intact. <rfc
2021 id="4724"> specifies an optional graceful restart mechanism to
2022 alleviate this issue. This option controls the mechanism. It has three
2023 states: Disabled, when no support is provided. Aware, when the graceful
2024 restart support is announced and the support for restarting neighbors
2025 is provided, but no local graceful restart is allowed (i.e.
2026 receiving-only role). Enabled, when the full graceful restart
2027 support is provided (i.e. both restarting and receiving role). Note
2028 that proper support for local graceful restart requires also
2029 configuration of other protocols. Default: aware.
6eda3f13 2030
b9864aa8 2031 <tag><label id="bgp-graceful-restart-time">graceful restart time <m/number/</tag>
6eda3f13
OZ
2032 The restart time is announced in the BGP graceful restart capability
2033 and specifies how long the neighbor would wait for the BGP session to
2034 re-establish after a restart before deleting stale routes. Default:
2035 120 seconds.
2036
b9864aa8 2037 <tag><label id="bgp-interpret-communities">interpret communities <m/switch/</tag>
7935b9d2
PT
2038 <rfc id="1997"> demands that BGP speaker should process well-known
2039 communities like no-export (65535, 65281) or no-advertise (65535,
2040 65282). For example, received route carrying a no-adverise community
2041 should not be advertised to any of its neighbors. If this option is
2042 enabled (which is by default), BIRD has such behavior automatically (it
2043 is evaluated when a route is exported to the BGP protocol just before
2044 the export filter). Otherwise, this integrated processing of
2045 well-known communities is disabled. In that case, similar behavior can
2046 be implemented in the export filter. Default: on.
dad92c30 2047
b9864aa8 2048 <tag><label id="bgp-enable-as4">enable as4 <m/switch/</tag>
dad92c30
OZ
2049 BGP protocol was designed to use 2B AS numbers and was extended later to
2050 allow 4B AS number. BIRD supports 4B AS extension, but by disabling this
2051 option it can be persuaded not to advertise it and to maintain old-style
2052 sessions with its neighbors. This might be useful for circumventing bugs
2053 in neighbor's implementation of 4B AS extension. Even when disabled
2054 (off), BIRD behaves internally as AS4-aware BGP router. Default: on.
2055
b9864aa8 2056 <tag><label id="bgp-enable-extended-messages">enable extended messages <m/switch/</tag>
79a4f74a
PT
2057 The BGP protocol uses maximum message length of 4096 bytes. This option
2058 provides an extension to allow extended messages with length up
2059 to 65535 bytes. Default: off.
2060
b9864aa8 2061 <tag><label id="bgp-capabilities">capabilities <m/switch/</tag>
dad92c30
OZ
2062 Use capability advertisement to advertise optional capabilities. This is
2063 standard behavior for newer BGP implementations, but there might be some
2064 older BGP implementations that reject such connection attempts. When
2065 disabled (off), features that request it (4B AS support) are also
2066 disabled. Default: on, with automatic fallback to off when received
2067 capability-related error.
2068
b9864aa8 2069 <tag><label id="bgp-advertise-ipv4">advertise ipv4 <m/switch/</tag>
dad92c30 2070 Advertise IPv4 multiprotocol capability. This is not a correct behavior
7935b9d2
PT
2071 according to the strict interpretation of <rfc id="4760">, but it is
2072 widespread and required by some BGP implementations (Cisco and Quagga).
2073 This option is relevant to IPv4 mode with enabled capability
2074 advertisement only. Default: on.
dad92c30 2075
b9864aa8 2076 <tag><label id="bgp-route-limit">route limit <m/number/</tag>
dad92c30
OZ
2077 The maximal number of routes that may be imported from the protocol. If
2078 the route limit is exceeded, the connection is closed with an error.
2079 Limit is currently implemented as <cf>import limit <m/number/ action
2080 restart</cf>. This option is obsolete and it is replaced by
7935b9d2 2081 <ref id="proto-import-limit" name="import limit option">. Default: no limit.
dad92c30 2082
b9864aa8 2083 <tag><label id="bgp-disable-after-error">disable after error <m/switch/</tag>
dad92c30
OZ
2084 When an error is encountered (either locally or by the other side),
2085 disable the instance automatically and wait for an administrator to fix
2086 the problem manually. Default: off.
2087
b9864aa8 2088 <tag><label id="bgp-hold-time">hold time <m/number/</tag>
dad92c30
OZ
2089 Time in seconds to wait for a Keepalive message from the other side
2090 before considering the connection stale. Default: depends on agreement
2091 with the neighboring router, we prefer 240 seconds if the other side is
2092 willing to accept it.
2093
b9864aa8 2094 <tag><label id="bgp-startup-hold-time">startup hold time <m/number/</tag>
dad92c30
OZ
2095 Value of the hold timer used before the routers have a chance to exchange
2096 open messages and agree on the real value. Default: 240 seconds.
2097
b9864aa8 2098 <tag><label id="bgp-keepalive-time">keepalive time <m/number/</tag>
dad92c30
OZ
2099 Delay in seconds between sending of two consecutive Keepalive messages.
2100 Default: One third of the hold time.
2101
b9864aa8 2102 <tag><label id="bgp-connect-delay-time">connect delay time <m/number/</tag>
6cf72d7a
OZ
2103 Delay in seconds between protocol startup and the first attempt to
2104 connect. Default: 5 seconds.
2105
b9864aa8 2106 <tag><label id="bgp-connect-retry-time">connect retry time <m/number/</tag>
dad92c30
OZ
2107 Time in seconds to wait before retrying a failed attempt to connect.
2108 Default: 120 seconds.
2109
b9864aa8 2110 <tag><label id="bgp-error-wait-time">error wait time <m/number/,<m/number/</tag>
dad92c30
OZ
2111 Minimum and maximum delay in seconds between a protocol failure (either
2112 local or reported by the peer) and automatic restart. Doesn't apply
2113 when <cf/disable after error/ is configured. If consecutive errors
2114 happen, the delay is increased exponentially until it reaches the
2115 maximum. Default: 60, 300.
2116
b9864aa8 2117 <tag><label id="bgp-error-forget-time">error forget time <m/number/</tag>
dad92c30
OZ
2118 Maximum time in seconds between two protocol failures to treat them as a
2119 error sequence which makes <cf/error wait time/ increase exponentially.
2120 Default: 300 seconds.
2121
b9864aa8 2122 <tag><label id="bgp-path-metric">path metric <m/switch/</tag>
dad92c30
OZ
2123 Enable comparison of path lengths when deciding which BGP route is the
2124 best one. Default: on.
2125
b9864aa8 2126 <tag><label id="bgp-med-metric">med metric <m/switch/</tag>
dad92c30
OZ
2127 Enable comparison of MED attributes (during best route selection) even
2128 between routes received from different ASes. This may be useful if all
2129 MED attributes contain some consistent metric, perhaps enforced in
2130 import filters of AS boundary routers. If this option is disabled, MED
2131 attributes are compared only if routes are received from the same AS
2132 (which is the standard behavior). Default: off.
2133
b9864aa8 2134 <tag><label id="bgp-deterministic-med">deterministic med <m/switch/</tag>
dad92c30
OZ
2135 BGP route selection algorithm is often viewed as a comparison between
2136 individual routes (e.g. if a new route appears and is better than the
2137 current best one, it is chosen as the new best one). But the proper
7935b9d2
PT
2138 route selection, as specified by <rfc id="4271">, cannot be fully
2139 implemented in that way. The problem is mainly in handling the MED
2140 attribute. BIRD, by default, uses an simplification based on individual
2141 route comparison, which in some cases may lead to temporally dependent
2142 behavior (i.e. the selection is dependent on the order in which routes
2143 appeared). This option enables a different (and slower) algorithm
2144 implementing proper <rfc id="4271"> route selection, which is
2145 deterministic. Alternative way how to get deterministic behavior is to
2146 use <cf/med metric/ option. This option is incompatible with <ref
2147 id="dsc-table-sorted" name="sorted tables">. Default: off.
be4cd99a 2148
b9864aa8 2149 <tag><label id="bgp-igp-metric">igp metric <m/switch/</tag>
dad92c30
OZ
2150 Enable comparison of internal distances to boundary routers during best
2151 route selection. Default: on.
2152
b9864aa8 2153 <tag><label id="bgp-prefer-older">prefer older <m/switch/</tag>
dad92c30
OZ
2154 Standard route selection algorithm breaks ties by comparing router IDs.
2155 This changes the behavior to prefer older routes (when both are external
7935b9d2 2156 and from different peer). For details, see <rfc id="5004">. Default: off.
dad92c30 2157
b9864aa8 2158 <tag><label id="bgp-default-med">default bgp_med <m/number/</tag>
dad92c30
OZ
2159 Value of the Multiple Exit Discriminator to be used during route
2160 selection when the MED attribute is missing. Default: 0.
2161
b9864aa8 2162 <tag><label id="bgp-default-local-pref">default bgp_local_pref <m/number/</tag>
dad92c30
OZ
2163 A default value for the Local Preference attribute. It is used when
2164 a new Local Preference attribute is attached to a route by the BGP
2165 protocol itself (for example, if a route is received through eBGP and
2166 therefore does not have such attribute). Default: 100 (0 in pre-1.2.0
2167 versions of BIRD).
5459fac6
MM
2168</descrip>
2169
371adba6 2170<sect1>Attributes
b9864aa8 2171<label id="bgp-attr">
56ab03c7 2172
dad92c30
OZ
2173<p>BGP defines several route attributes. Some of them (those marked with
2174`<tt/I/' in the table below) are available on internal BGP connections only,
2175some of them (marked with `<tt/O/') are optional.
5459fac6
MM
2176
2177<descrip>
b9864aa8 2178 <tag><label id="rta-bgp-path">bgppath bgp_path/</tag>
dad92c30
OZ
2179 Sequence of AS numbers describing the AS path the packet will travel
2180 through when forwarded according to the particular route. In case of
2181 internal BGP it doesn't contain the number of the local AS.
2182
b9864aa8 2183 <tag><label id="rta-bgp-local-pref">int bgp_local_pref/ [I]</tag>
dad92c30
OZ
2184 Local preference value used for selection among multiple BGP routes (see
2185 the selection rules above). It's used as an additional metric which is
2186 propagated through the whole local AS.
2187
b9864aa8 2188 <tag><label id="rta-bgp-med">int bgp_med/ [O]</tag>
dad92c30
OZ
2189 The Multiple Exit Discriminator of the route is an optional attribute
2190 which is used on external (inter-AS) links to convey to an adjacent AS
2191 the optimal entry point into the local AS. The received attribute is
2192 also propagated over internal BGP links. The attribute value is zeroed
2193 when a route is exported to an external BGP instance to ensure that the
2194 attribute received from a neighboring AS is not propagated to other
2195 neighboring ASes. A new value might be set in the export filter of an
7935b9d2
PT
2196 external BGP instance. See <rfc id="4451"> for further discussion of
2197 BGP MED attribute.
5a203dac 2198
b9864aa8 2199 <tag><label id="rta-bgp-origin">enum bgp_origin/</tag>
dad92c30
OZ
2200 Origin of the route: either <cf/ORIGIN_IGP/ if the route has originated
2201 in an interior routing protocol or <cf/ORIGIN_EGP/ if it's been imported
2202 from the <tt>EGP</tt> protocol (nowadays it seems to be obsolete) or
2203 <cf/ORIGIN_INCOMPLETE/ if the origin is unknown.
5a203dac 2204
b9864aa8 2205 <tag><label id="rta-bgp-next-hop">ip bgp_next_hop/</tag>
dad92c30
OZ
2206 Next hop to be used for forwarding of packets to this destination. On
2207 internal BGP connections, it's an address of the originating router if
2208 it's inside the local AS or a boundary router the packet will leave the
2209 AS through if it's an exterior route, so each BGP speaker within the AS
2210 has a chance to use the shortest interior path possible to this point.
5a203dac 2211
b9864aa8 2212 <tag><label id="rta-bgp-atomic-aggr">void bgp_atomic_aggr/ [O]</tag>
dad92c30
OZ
2213 This is an optional attribute which carries no value, but the sole
2214 presence of which indicates that the route has been aggregated from
2215 multiple routes by some router on the path from the originator.
5a203dac 2216
5459fac6
MM
2217<!-- we don't handle aggregators right since they are of a very obscure type
2218 <tag>bgp_aggregator</tag>
2219-->
b9864aa8 2220 <tag><label id="rta-bgp-community">clist bgp_community/ [O]</tag>
dad92c30
OZ
2221 List of community values associated with the route. Each such value is a
2222 pair (represented as a <cf/pair/ data type inside the filters) of 16-bit
2223 integers, the first of them containing the number of the AS which
2224 defines the community and the second one being a per-AS identifier.
2225 There are lots of uses of the community mechanism, but generally they
2226 are used to carry policy information like "don't export to USA peers".
2227 As each AS can define its own routing policy, it also has a complete
2228 freedom about which community attributes it defines and what will their
2229 semantics be.
2230
b9864aa8 2231 <tag><label id="rta-bgp-ext-community">eclist bgp_ext_community/ [O]</tag>
dad92c30
OZ
2232 List of extended community values associated with the route. Extended
2233 communities have similar usage as plain communities, but they have an
2234 extended range (to allow 4B ASNs) and a nontrivial structure with a type
2235 field. Individual community values are represented using an <cf/ec/ data
2236 type inside the filters.
2237
b9864aa8 2238 <tag><label id="rta-bgp-large-community">lclist <cf/bgp_large_community/ [O]</tag>
cec4a73c
OZ
2239 List of large community values associated with the route. Large BGP
2240 communities is another variant of communities, but contrary to extended
2241 communities they behave very much the same way as regular communities,
2242 just larger -- they are uniform untyped triplets of 32bit numbers.
2243 Individual community values are represented using an <cf/lc/ data type
2244 inside the filters.
2245
b9864aa8 2246 <tag><label id="rta-bgp-originator-id">quad bgp_originator_id/ [I, O]</tag>
dad92c30
OZ
2247 This attribute is created by the route reflector when reflecting the
2248 route and contains the router ID of the originator of the route in the
2249 local AS.
2250
b9864aa8 2251 <tag><label id="rta-bgp-cluster-list">clist bgp_cluster_list/ [I, O]</tag>
dad92c30
OZ
2252 This attribute contains a list of cluster IDs of route reflectors. Each
2253 route reflector prepends its cluster ID when reflecting the route.
5459fac6
MM
2254</descrip>
2255
371adba6 2256<sect1>Example
b9864aa8 2257<label id="bgp-exam">
56ab03c7 2258
5459fac6
MM
2259<p><code>
2260protocol bgp {
96264d4d 2261 local as 65000; # Use a private AS number
9491f9f5 2262 neighbor 198.51.100.130 as 64496; # Our neighbor ...
6bcef225 2263 multihop; # ... which is connected indirectly
96264d4d
PM
2264 export filter { # We use non-trivial export rules
2265 if source = RTS_STATIC then { # Export only static routes
79a4f74a 2266 # Assign our community
9491f9f5 2267 bgp_community.add((65000,64501));
a852c139 2268 # Artificially increase path length
5a203dac 2269 # by advertising local AS number twice
9491f9f5
OZ
2270 if bgp_path ~ [= 65000 =] then
2271 bgp_path.prepend(65000);
5459fac6
MM
2272 accept;
2273 }
2274 reject;
2275 };
2276 import all;
9491f9f5 2277 source address 198.51.100.14; # Use a non-standard source address
5459fac6
MM
2278}
2279</code>
2280
dad92c30 2281
371adba6 2282<sect>Device
b9864aa8 2283<label id="device">
1b55b1a3 2284
dad92c30
OZ
2285<p>The Device protocol is not a real routing protocol. It doesn't generate any
2286routes and it only serves as a module for getting information about network
79a2b697
MM
2287interfaces from the kernel.
2288
dad92c30
OZ
2289<p>Except for very unusual circumstances, you probably should include this
2290protocol in the configuration since almost all other protocols require network
2291interfaces to be defined for them to work with.
79a2b697 2292
6f5603ba 2293<sect1>Configuration
b9864aa8 2294<label id="device-config">
79a2b697
MM
2295
2296<p><descrip>
dad92c30 2297
b9864aa8 2298 <tag><label id="device-scan-time">scan time <m/number/</tag>
dad92c30
OZ
2299 Time in seconds between two scans of the network interface list. On
2300 systems where we are notified about interface status changes
2301 asynchronously (such as newer versions of Linux), we need to scan the
2302 list only in order to avoid confusion by lost notification messages,
2303 so the default time is set to a large value.
2304
b9864aa8 2305 <tag><label id="device-primary">primary [ "<m/mask/" ] <m/prefix/</tag>
dad92c30
OZ
2306 If a network interface has more than one network address, BIRD has to
2307 choose one of them as a primary one. By default, BIRD chooses the
2308 lexicographically smallest address as the primary one.
2309
2310 This option allows to specify which network address should be chosen as
2311 a primary one. Network addresses that match <m/prefix/ are preferred to
2312 non-matching addresses. If more <cf/primary/ options are used, the first
2313 one has the highest preference. If "<m/mask/" is specified, then such
2314 <cf/primary/ option is relevant only to matching network interfaces.
2315
2316 In all cases, an address marked by operating system as secondary cannot
2317 be chosen as the primary one.
79a2b697
MM
2318</descrip>
2319
79a2b697 2320<p>As the Device protocol doesn't generate any routes, it cannot have
6f5603ba 2321any attributes. Example configuration looks like this:
79a2b697
MM
2322
2323<p><code>
2324protocol device {
2325 scan time 10; # Scan the interfaces often
6f5603ba
OZ
2326 primary "eth0" 192.168.1.1;
2327 primary 192.168.0.0/16;
79a2b697
MM
2328}
2329</code>
2330
dad92c30 2331
371adba6 2332<sect>Direct
b9864aa8 2333<label id="direct">
1b55b1a3 2334
79a2b697 2335<p>The Direct protocol is a simple generator of device routes for all the
dad92c30
OZ
2336directly connected networks according to the list of interfaces provided by the
2337kernel via the Device protocol.
2338
2339<p>The question is whether it is a good idea to have such device routes in BIRD
2340routing table. OS kernel usually handles device routes for directly connected
2341networks by itself so we don't need (and don't want) to export these routes to
2342the kernel protocol. OSPF protocol creates device routes for its interfaces
2343itself and BGP protocol is usually used for exporting aggregate routes. Although
2344there are some use cases that use the direct protocol (like abusing eBGP as an
2345IGP routing protocol), in most cases it is not needed to have these device
c429d4a4 2346routes in BIRD routing table and to use the direct protocol.
79a2b697 2347
dad92c30
OZ
2348<p>There is one notable case when you definitely want to use the direct protocol
2349-- running BIRD on BSD systems. Having high priority device routes for directly
2350connected networks from the direct protocol protects kernel device routes from
2351being overwritten or removed by IGP routes during some transient network
2352conditions, because a lower priority IGP route for the same network is not
2353exported to the kernel routing table. This is an issue on BSD systems only, as
2354on Linux systems BIRD cannot change non-BIRD route in the kernel routing table.
cf3a704b 2355
e90dd656 2356<p>There are just few configuration options for the Direct protocol:
79a2b697
MM
2357
2358<p><descrip>
9df52a98 2359 <tag><label id="direct-iface">interface <m/pattern/ [, <m/.../]</tag>
dad92c30
OZ
2360 By default, the Direct protocol will generate device routes for all the
2361 interfaces available. If you want to restrict it to some subset of
d7c06285
OZ
2362 interfaces or addresses (e.g. if you're using multiple routing tables
2363 for policy routing and some of the policy domains don't contain all
b9864aa8 2364 interfaces), just use this clause. See <ref id="proto-iface" name="interface">
d7c06285
OZ
2365 common option for detailed description. The Direct protocol uses
2366 extended interface clauses.
e90dd656 2367
b9864aa8 2368 <tag><label id="direct-check-link">check link <m/switch/</tag>
e90dd656
OZ
2369 If enabled, a hardware link state (reported by OS) is taken into
2370 consideration. Routes for directly connected networks are generated only
2371 if link up is reported and they are withdrawn when link disappears
2372 (e.g., an ethernet cable is unplugged). Default value is no.
79a2b697
MM
2373</descrip>
2374
79a2b697
MM
2375<p>Direct device routes don't contain any specific attributes.
2376
4f88ac47 2377<p>Example config might look like this:
79a2b697
MM
2378
2379<p><code>
2380protocol direct {
2381 interface "-arc*", "*"; # Exclude the ARCnets
2382}
2383</code>
2384
dad92c30 2385
371adba6 2386<sect>Kernel
b9864aa8 2387<label id="krt">
1b55b1a3 2388
0e4789c2 2389<p>The Kernel protocol is not a real routing protocol. Instead of communicating
c429d4a4 2390with other routers in the network, it performs synchronization of BIRD's routing
dad92c30
OZ
2391tables with the OS kernel. Basically, it sends all routing table updates to the
2392kernel and from time to time it scans the kernel tables to see whether some
2393routes have disappeared (for example due to unnoticed up/down transition of an
2394interface) or whether an `alien' route has been added by someone else (depending
2395on the <cf/learn/ switch, such routes are either ignored or accepted to our
f8e2d916 2396table).
0e4789c2 2397
dad92c30
OZ
2398<p>Unfortunately, there is one thing that makes the routing table synchronization
2399a bit more complicated. In the kernel routing table there are also device routes
2400for directly connected networks. These routes are usually managed by OS itself
2401(as a part of IP address configuration) and we don't want to touch that. They
2402are completely ignored during the scan of the kernel tables and also the export
2403of device routes from BIRD tables to kernel routing tables is restricted to
2404prevent accidental interference. This restriction can be disabled using
c429d4a4
OZ
2405<cf/device routes/ switch.
2406
dad92c30
OZ
2407<p>If your OS supports only a single routing table, you can configure only one
2408instance of the Kernel protocol. If it supports multiple tables (in order to
2409allow policy routing; such an OS is for example Linux), you can run as many
2410instances as you want, but each of them must be connected to a different BIRD
2411routing table and to a different kernel table.
0e4789c2 2412
dad92c30
OZ
2413<p>Because the kernel protocol is partially integrated with the connected
2414routing table, there are two limitations - it is not possible to connect more
2415kernel protocols to the same routing table and changing route destination
2416(gateway) in an export filter of a kernel protocol does not work. Both
2417limitations can be overcome using another routing table and the pipe protocol.
71ca7716 2418
371adba6 2419<sect1>Configuration
b9864aa8 2420<label id="krt-config">
0e4789c2
MM
2421
2422<p><descrip>
b9864aa8 2423 <tag><label id="krt-persist">persist <m/switch/</tag>
6eda3f13
OZ
2424 Tell BIRD to leave all its routes in the routing tables when it exits
2425 (instead of cleaning them up).
2426
b9864aa8 2427 <tag><label id="krt-scan-time">scan time <m/number/</tag>
6eda3f13
OZ
2428 Time in seconds between two consecutive scans of the kernel routing
2429 table.
2430
b9864aa8 2431 <tag><label id="krt-learn">learn <m/switch/</tag>
6eda3f13
OZ
2432 Enable learning of routes added to the kernel routing tables by other
2433 routing daemons or by the system administrator. This is possible only on
2434 systems which support identification of route authorship.
2435
b9864aa8 2436 <tag><label id="krt-device-routes">device routes <m/switch/</tag>
6eda3f13
OZ
2437 Enable export of device routes to the kernel routing table. By default,
2438 such routes are rejected (with the exception of explicitly configured
2439 device routes from the static protocol) regardless of the export filter
2440 to protect device routes in kernel routing table (managed by OS itself)
2441 from accidental overwriting or erasing.
2442
b9864aa8 2443 <tag><label id="krt-kernel-table">kernel table <m/number/</tag>
6eda3f13
OZ
2444 Select which kernel table should this particular instance of the Kernel
2445 protocol work with. Available only on systems supporting multiple
2446 routing tables.
2447
b9864aa8 2448 <tag><label id="krt-metric">metric <m/number/</tag> (Linux)
4adcb9df
OZ
2449 Use specified value as a kernel metric (priority) for all routes sent to
2450 the kernel. When multiple routes for the same network are in the kernel
2451 routing table, the Linux kernel chooses one with lower metric. Also,
2452 routes with different metrics do not clash with each other, therefore
2453 using dedicated metric value is a reliable way to avoid overwriting
2454 routes from other sources (e.g. kernel device routes). Metric 0 has a
2455 special meaning of undefined metric, in which either OS default is used,
2456 or per-route metric can be set using <cf/krt_metric/ attribute. Default:
2457 0 (undefined).
2458
b9864aa8 2459 <tag><label id="krt-graceful-restart">graceful restart <m/switch/</tag>
6eda3f13
OZ
2460 Participate in graceful restart recovery. If this option is enabled and
2461 a graceful restart recovery is active, the Kernel protocol will defer
2462 synchronization of routing tables until the end of the recovery. Note
2463 that import of kernel routes to BIRD is not affected.
8d9eef17 2464
b9864aa8 2465 <tag><label id="krt-merge-paths">merge paths <M>switch</M> [limit <M>number</M>]</tag>
8d9eef17
OZ
2466 Usually, only best routes are exported to the kernel protocol. With path
2467 merging enabled, both best routes and equivalent non-best routes are
2468 merged during export to generate one ECMP (equal-cost multipath) route
2469 for each network. This is useful e.g. for BGP multipath. Note that best
2470 routes are still pivotal for route export (responsible for most
2471 properties of resulting ECMP routes), while exported non-best routes are
2472 responsible just for additional multipath next hops. This option also
2473 allows to specify a limit on maximal number of nexthops in one route. By
2474 default, multipath merging is disabled. If enabled, default value of the
2475 limit is 16.
0e4789c2
MM
2476</descrip>
2477
71ca7716 2478<sect1>Attributes
b9864aa8 2479<label id="krt-attr">
71ca7716 2480
dad92c30
OZ
2481<p>The Kernel protocol defines several attributes. These attributes are
2482translated to appropriate system (and OS-specific) route attributes. We support
2483these attributes:
71ca7716
OZ
2484
2485<descrip>
b9864aa8 2486 <tag><label id="rta-krt-source">int krt_source/</tag>
dad92c30
OZ
2487 The original source of the imported kernel route. The value is
2488 system-dependent. On Linux, it is a value of the protocol field of the
2489 route. See /etc/iproute2/rt_protos for common values. On BSD, it is
72aed1a0
OZ
2490 based on STATIC and PROTOx flags. The attribute is read-only.
2491
b9864aa8 2492 <tag><label id="rta-krt-metric">int krt_metric/</tag> (Linux)
dad92c30
OZ
2493 The kernel metric of the route. When multiple same routes are in a
2494 kernel routing table, the Linux kernel chooses one with lower metric.
4adcb9df
OZ
2495 Note that preferred way to set kernel metric is to use protocol option
2496 <cf/metric/, unless per-route metric values are needed.
9ba2798c 2497
b9864aa8 2498 <tag><label id="rta-krt-prefsrc">ip krt_prefsrc/</tag> (Linux)
dad92c30 2499 The preferred source address. Used in source address selection for
79a4f74a 2500 outgoing packets. Has to be one of the IP addresses of the router.
71ca7716 2501
b9864aa8 2502 <tag><label id="rta-krt-realm">int krt_realm/</tag> (Linux)
dad92c30 2503 The realm of the route. Can be used for traffic classification.
6e75d0d2 2504
b9864aa8 2505 <tag><label id="rta-krt-scope">int krt_scope/</tag> (Linux IPv4)
6e75d0d2
OZ
2506 The scope of the route. Valid values are 0-254, although Linux kernel
2507 may reject some values depending on route type and nexthop. It is
2508 supposed to represent `indirectness' of the route, where nexthops of
2509 routes are resolved through routes with a higher scope, but in current
2510 kernels anything below <it/link/ (253) is treated as <it/global/ (0).
2511 When not present, global scope is implied for all routes except device
2512 routes, where link scope is used by default.
71ca7716
OZ
2513</descrip>
2514
6683d42d
OZ
2515<p>In Linux, there is also a plenty of obscure route attributes mostly focused
2516on tuning TCP performance of local connections. BIRD supports most of these
2517attributes, see Linux or iproute2 documentation for their meaning. Attributes
2518<cf/krt_lock_*/ and <cf/krt_feature_*/ have type bool, others have type int.
2519Supported attributes are:
2520
2521<cf/krt_mtu/, <cf/krt_lock_mtu/, <cf/krt_window/, <cf/krt_lock_window/,
2522<cf/krt_rtt/, <cf/krt_lock_rtt/, <cf/krt_rttvar/, <cf/krt_lock_rttvar/,
2523<cf/krt_sstresh/, <cf/krt_lock_sstresh/, <cf/krt_cwnd/, <cf/krt_lock_cwnd/,
2524<cf/krt_advmss/, <cf/krt_lock_advmss/, <cf/krt_reordering/, <cf/krt_lock_reordering/,
2525<cf/krt_hoplimit/, <cf/krt_lock_hoplimit/, <cf/krt_rto_min/, <cf/krt_lock_rto_min/,
2526<cf/krt_initcwnd/, <cf/krt_initrwnd/, <cf/krt_quickack/,
2527<cf/krt_feature_ecn/, <cf/krt_feature_allfrag/
2528
71ca7716 2529<sect1>Example
b9864aa8 2530<label id="krt-exam">
71ca7716 2531
326e33f5 2532<p>A simple configuration can look this way:
0e4789c2
MM
2533
2534<p><code>
2535protocol kernel {
0e4789c2
MM
2536 export all;
2537}
2538</code>
2539
2540<p>Or for a system with two routing tables:
2541
2542<p><code>
2543protocol kernel { # Primary routing table
2544 learn; # Learn alien routes from the kernel
2545 persist; # Don't remove routes on bird shutdown
2546 scan time 10; # Scan kernel routing table every 10 seconds
2547 import all;
2548 export all;
2549}
2550
2551protocol kernel { # Secondary routing table
2552 table auxtable;
2553 kernel table 100;
2554 export all;
a2a3ced8 2555}
0e4789c2
MM
2556</code>
2557
dad92c30 2558
371adba6 2559<sect>OSPF
b9864aa8 2560<label id="ospf">
1b55b1a3 2561
8fd12e6b 2562<sect1>Introduction
b9864aa8 2563<label id="ospf-intro">
8fd12e6b 2564
3ca3e999 2565<p>Open Shortest Path First (OSPF) is a quite complex interior gateway
7935b9d2
PT
2566protocol. The current IPv4 version (OSPFv2) is defined in <rfc id="2328"> and
2567the current IPv6 version (OSPFv3) is defined in <rfc id="5340"> It's a link
2568state (a.k.a. shortest path first) protocol -- each router maintains a database
2569describing the autonomous system's topology. Each participating router has an
2570identical copy of the database and all routers run the same algorithm
2571calculating a shortest path tree with themselves as a root. OSPF chooses the
2572least cost path as the best path.
dad92c30
OZ
2573
2574<p>In OSPF, the autonomous system can be split to several areas in order to
2575reduce the amount of resources consumed for exchanging the routing information
2576and to protect the other areas from incorrect routing data. Topology of the area
2577is hidden to the rest of the autonomous system.
2578
2579<p>Another very important feature of OSPF is that it can keep routing information
2580from other protocols (like Static or BGP) in its link state database as external
2581routes. Each external route can be tagged by the advertising router, making it
2582possible to pass additional information between routers on the boundary of the
2583autonomous system.
2584
2585<p>OSPF quickly detects topological changes in the autonomous system (such as
2586router interface failures) and calculates new loop-free routes after a short
2587period of convergence. Only a minimal amount of routing traffic is involved.
8fd12e6b 2588
3ca3e999 2589<p>Each router participating in OSPF routing periodically sends Hello messages
dad92c30
OZ
2590to all its interfaces. This allows neighbors to be discovered dynamically. Then
2591the neighbors exchange theirs parts of the link state database and keep it
2592identical by flooding updates. The flooding process is reliable and ensures that
2593each router detects all changes.
8fd12e6b
OF
2594
2595<sect1>Configuration
b9864aa8 2596<label id="ospf-config">
8fd12e6b 2597
dad92c30
OZ
2598<p>In the main part of configuration, there can be multiple definitions of OSPF
2599areas, each with a different id. These definitions includes many other switches
2600and multiple definitions of interfaces. Definition of interface may contain many
2601switches and constant definitions and list of neighbors on nonbroadcast
2602networks.
8fd12e6b
OF
2603
2604<code>
088bc8ad 2605protocol ospf &lt;name&gt; {
1632f1fe 2606 rfc1583compat &lt;switch&gt;;
178a197a 2607 instance id &lt;num&gt;;
f623ab98 2608 stub router &lt;switch&gt;;
62eee823 2609 tick &lt;num&gt;;
e91f6960 2610 ecmp &lt;switch&gt; [limit &lt;num&gt;];
145368f5 2611 merge external &lt;switch&gt;;
088bc8ad 2612 area &lt;id&gt; {
2918e610
OZ
2613 stub;
2614 nssa;
bde872bb 2615 summary &lt;switch&gt;;
2918e610
OZ
2616 default nssa &lt;switch&gt;;
2617 default cost &lt;num&gt;;
2618 default cost2 &lt;num&gt;;
bde872bb
OZ
2619 translator &lt;switch&gt;;
2620 translator stability &lt;num&gt;;
2621
16319aeb
OF
2622 networks {
2623 &lt;prefix&gt;;
2624 &lt;prefix&gt; hidden;
2625 }
bde872bb
OZ
2626 external {
2627 &lt;prefix&gt;;
2628 &lt;prefix&gt; hidden;
2629 &lt;prefix&gt; tag &lt;num&gt;;
2630 }
38675202
OZ
2631 stubnet &lt;prefix&gt;;
2632 stubnet &lt;prefix&gt; {
2633 hidden &lt;switch&gt;;
2634 summary &lt;switch&gt;;
2635 cost &lt;num&gt;;
2636 }
0ec031f7 2637 interface &lt;interface pattern&gt; [instance &lt;num&gt;] {
088bc8ad 2638 cost &lt;num&gt;;
e3bc10fd 2639 stub &lt;switch&gt;;
088bc8ad 2640 hello &lt;num&gt;;
a190e720 2641 poll &lt;num&gt;;
088bc8ad
OF
2642 retransmit &lt;num&gt;;
2643 priority &lt;num&gt;;
2644 wait &lt;num&gt;;
2645 dead count &lt;num&gt;;
d8c7d9e8 2646 dead &lt;num&gt;;
48e5f32d 2647 secondary &lt;switch&gt;;
94c42054 2648 rx buffer [normal|large|&lt;num&gt;];
48e5f32d 2649 tx length &lt;num&gt;;
919f5411
OZ
2650 type [broadcast|bcast|pointopoint|ptp|
2651 nonbroadcast|nbma|pointomultipoint|ptmp];
70945cb6 2652 link lsa suppression &lt;switch&gt;;
a190e720 2653 strict nonbroadcast &lt;switch&gt;;
95127cbb 2654 real broadcast &lt;switch&gt;;
8df02847 2655 ptp netmask &lt;switch&gt;;
e91f6960 2656 check link &lt;switch&gt;;
1ec52253 2657 bfd &lt;switch&gt;;
e91f6960 2658 ecmp weight &lt;num&gt;;
6ac4f87a
OZ
2659 ttl security [&lt;switch&gt;; | tx only]
2660 tx class|dscp &lt;num&gt;;
2661 tx priority &lt;num&gt;;
3242ab43 2662 authentication [none|simple|cryptographic];
088bc8ad 2663 password "&lt;text&gt;";
b21f68b4
OZ
2664 password "&lt;text&gt;" {
2665 id &lt;num&gt;;
2666 generate from "&lt;date&gt;";
2667 generate to "&lt;date&gt;";
2668 accept from "&lt;date&gt;";
2669 accept to "&lt;date&gt;";
ea357b8b 2670 };
8fd12e6b 2671 neighbors {
088bc8ad 2672 &lt;ip&gt;;
a190e720 2673 &lt;ip&gt; eligible;
8fd12e6b
OF
2674 };
2675 };
0ec031f7 2676 virtual link &lt;id&gt; [instance &lt;num&gt;] {
98ac6176 2677 hello &lt;num&gt;;
98ac6176
OF
2678 retransmit &lt;num&gt;;
2679 wait &lt;num&gt;;
2680 dead count &lt;num&gt;;
d8c7d9e8 2681 dead &lt;num&gt;;
3242ab43 2682 authentication [none|simple|cryptographic];
98ac6176
OF
2683 password "&lt;text&gt;";
2684 };
8fd12e6b
OF
2685 };
2686}
2687</code>
2688
2689<descrip>
b9864aa8 2690 <tag><label id="ospf-rfc1583compat">rfc1583compat <M>switch</M></tag>
dad92c30 2691 This option controls compatibility of routing table calculation with
7935b9d2 2692 <rfc id="1583">. Default value is no.
e91f6960 2693
b9864aa8 2694 <tag><label id="ospf-instance-id">instance id <m/num/</tag>
178a197a
OZ
2695 When multiple OSPF protocol instances are active on the same links, they
2696 should use different instance IDs to distinguish their packets. Although
2697 it could be done on per-interface basis, it is often preferred to set
2698 one instance ID to whole OSPF domain/topology (e.g., when multiple
2699 instances are used to represent separate logical topologies on the same
2700 physical network). This option specifies the default instance ID for all
2701 interfaces of the OSPF instance. Note that this option, if used, must
2702 precede interface definitions. Default value is 0.
2703
b9864aa8 2704 <tag><label id="ospf-stub-router">stub router <M>switch</M></tag>
dad92c30
OZ
2705 This option configures the router to be a stub router, i.e., a router
2706 that participates in the OSPF topology but does not allow transit
2707 traffic. In OSPFv2, this is implemented by advertising maximum metric
178a197a 2708 for outgoing links. In OSPFv3, the stub router behavior is announced by
7935b9d2
PT
2709 clearing the R-bit in the router LSA. See <rfc id="6987"> for details.
2710 Default value is no.
f623ab98 2711
b9864aa8 2712 <tag><label id="ospf-tick">tick <M>num</M></tag>
dad92c30
OZ
2713 The routing table calculation and clean-up of areas' databases is not
2714 performed when a single link state change arrives. To lower the CPU
2715 utilization, it's processed later at periodical intervals of <m/num/
2716 seconds. The default value is 1.
e91f6960 2717
b9864aa8 2718 <tag><label id="ospf-ecmp">ecmp <M>switch</M> [limit <M>number</M>]</tag>
dad92c30
OZ
2719 This option specifies whether OSPF is allowed to generate ECMP
2720 (equal-cost multipath) routes. Such routes are used when there are
2721 several directions to the destination, each with the same (computed)
8465dccb 2722 cost. This option also allows to specify a limit on maximum number of
dad92c30
OZ
2723 nexthops in one route. By default, ECMP is disabled. If enabled,
2724 default value of the limit is 16.
e91f6960 2725
b9864aa8 2726 <tag><label id="ospf-merge-external">merge external <M>switch</M></tag>
145368f5
OZ
2727 This option specifies whether OSPF should merge external routes from
2728 different routers/LSAs for the same destination. When enabled together
2729 with <cf/ecmp/, equal-cost external routes will be combined to multipath
2730 routes in the same way as regular routes. When disabled, external routes
2731 from different LSAs are treated as separate even if they represents the
2732 same destination. Default value is no.
2733
b9864aa8 2734 <tag><label id="ospf-area">area <M>id</M></tag>
dad92c30
OZ
2735 This defines an OSPF area with given area ID (an integer or an IPv4
2736 address, similarly to a router ID). The most important area is the
2737 backbone (ID 0) to which every other area must be connected.
8fd12e6b 2738
b9864aa8 2739 <tag><label id="ospf-stub">stub</tag>
dad92c30
OZ
2740 This option configures the area to be a stub area. External routes are
2741 not flooded into stub areas. Also summary LSAs can be limited in stub
2742 areas (see option <cf/summary/). By default, the area is not a stub
2743 area.
bde872bb 2744
b9864aa8 2745 <tag><label id="ospf-nssa">nssa</tag>
dad92c30
OZ
2746 This option configures the area to be a NSSA (Not-So-Stubby Area). NSSA
2747 is a variant of a stub area which allows a limited way of external route
2748 propagation. Global external routes are not propagated into a NSSA, but
2749 an external route can be imported into NSSA as a (area-wide) NSSA-LSA
2750 (and possibly translated and/or aggregated on area boundary). By
2751 default, the area is not NSSA.
bde872bb 2752
b9864aa8 2753 <tag><label id="ospf-summary">summary <M>switch</M></tag>
dad92c30
OZ
2754 This option controls propagation of summary LSAs into stub or NSSA
2755 areas. If enabled, summary LSAs are propagated as usual, otherwise just
2756 the default summary route (0.0.0.0/0) is propagated (this is sometimes
2757 called totally stubby area). If a stub area has more area boundary
2758 routers, propagating summary LSAs could lead to more efficient routing
2759 at the cost of larger link state database. Default value is no.
bde872bb 2760
b9864aa8 2761 <tag><label id="ospf-default-nssa">default nssa <M>switch</M></tag>
dad92c30
OZ
2762 When <cf/summary/ option is enabled, default summary route is no longer
2763 propagated to the NSSA. In that case, this option allows to originate
2764 default route as NSSA-LSA to the NSSA. Default value is no.
2918e610 2765
b9864aa8 2766 <tag><label id="ospf-default-cost">default cost <M>num</M></tag>
dad92c30
OZ
2767 This option controls the cost of a default route propagated to stub and
2768 NSSA areas. Default value is 1000.
bde872bb 2769
b9864aa8 2770 <tag><label id="ospf-default-cost2">default cost2 <M>num</M></tag>
dad92c30
OZ
2771 When a default route is originated as NSSA-LSA, its cost can use either
2772 type 1 or type 2 metric. This option allows to specify the cost of a
2773 default route in type 2 metric. By default, type 1 metric (option
2774 <cf/default cost/) is used.
2918e610 2775
b9864aa8 2776 <tag><label id="ospf-translator">translator <M>switch</M></tag>
dad92c30
OZ
2777 This option controls translation of NSSA-LSAs into external LSAs. By
2778 default, one translator per NSSA is automatically elected from area
2779 boundary routers. If enabled, this area boundary router would
2780 unconditionally translate all NSSA-LSAs regardless of translator
2781 election. Default value is no.
bde872bb 2782
b9864aa8 2783 <tag><label id="ospf-translator-stability">translator stability <M>num</M></tag>
dad92c30
OZ
2784 This option controls the translator stability interval (in seconds).
2785 When the new translator is elected, the old one keeps translating until
2786 the interval is over. Default value is 40.
8fd12e6b 2787
b9864aa8 2788 <tag><label id="ospf-networks">networks { <m/set/ }</tag>
dad92c30
OZ
2789 Definition of area IP ranges. This is used in summary LSA origination.
2790 Hidden networks are not propagated into other areas.
16319aeb 2791
b9864aa8 2792 <tag><label id="ospf-external">external { <m/set/ }</tag>
dad92c30
OZ
2793 Definition of external area IP ranges for NSSAs. This is used for
2794 NSSA-LSA translation. Hidden networks are not translated into external
2795 LSAs. Networks can have configured route tag.
bde872bb 2796
b9864aa8 2797 <tag><label id="ospf-stubnet">stubnet <m/prefix/ { <m/options/ }</tag>
dad92c30
OZ
2798 Stub networks are networks that are not transit networks between OSPF
2799 routers. They are also propagated through an OSPF area as a part of a
2800 link state database. By default, BIRD generates a stub network record
2801 for each primary network address on each OSPF interface that does not
2802 have any OSPF neighbors, and also for each non-primary network address
2803 on each OSPF interface. This option allows to alter a set of stub
2804 networks propagated by this router.
2805
2806 Each instance of this option adds a stub network with given network
2807 prefix to the set of propagated stub network, unless option <cf/hidden/
2808 is used. It also suppresses default stub networks for given network
2809 prefix. When option <cf/summary/ is used, also default stub networks
2810 that are subnetworks of given stub network are suppressed. This might be
2811 used, for example, to aggregate generated stub networks.
178a197a 2812
b9864aa8 2813 <tag><label id="ospf-iface">interface <M>pattern</M> [instance <m/num/]</tag>
dad92c30 2814 Defines that the specified interfaces belong to the area being defined.
b9864aa8 2815 See <ref id="proto-iface" name="interface"> common option for detailed
d7c06285 2816 description. In OSPFv2, extended interface clauses are used, because
178a197a
OZ
2817 each network prefix is handled as a separate virtual interface.
2818
2819 You can specify alternative instance ID for the interface definition,
2820 therefore it is possible to have several instances of that interface
7935b9d2
PT
2821 with different options or even in different areas. For OSPFv2, instance
2822 ID support is an extension (<rfc id="6549">) and is supposed to be set
2823 per-protocol. For OSPFv3, it is an integral feature.
0ec031f7 2824
b9864aa8 2825 <tag><label id="ospf-virtual-link">virtual link <M>id</M> [instance <m/num/]</tag>
dad92c30
OZ
2826 Virtual link to router with the router id. Virtual link acts as a
2827 point-to-point interface belonging to backbone. The actual area is used
178a197a
OZ
2828 as a transport area. This item cannot be in the backbone. Like with
2829 <cf/interface/ option, you could also use several virtual links to one
2830 destination with different instance IDs.
98ac6176 2831
b9864aa8 2832 <tag><label id="ospf-cost">cost <M>num</M></tag>
dad92c30 2833 Specifies output cost (metric) of an interface. Default value is 10.
8fd12e6b 2834
b9864aa8 2835 <tag><label id="ospf-stub-iface">stub <M>switch</M></tag>
dad92c30
OZ
2836 If set to interface it does not listen to any packet and does not send
2837 any hello. Default value is no.
e3bc10fd 2838
b9864aa8 2839 <tag><label id="ospf-hello">hello <M>num</M></tag>
dad92c30
OZ
2840 Specifies interval in seconds between sending of Hello messages. Beware,
2841 all routers on the same network need to have the same hello interval.
2842 Default value is 10.
8fd12e6b 2843
b9864aa8 2844 <tag><label id="ospf-poll">poll <M>num</M></tag>
dad92c30
OZ
2845 Specifies interval in seconds between sending of Hello messages for some
2846 neighbors on NBMA network. Default value is 20.
a190e720 2847
b9864aa8 2848 <tag><label id="ospf-retransmit">retransmit <M>num</M></tag>
dad92c30
OZ
2849 Specifies interval in seconds between retransmissions of unacknowledged
2850 updates. Default value is 5.
8fd12e6b 2851
b9864aa8 2852 <tag><label id="ospf-priority">priority <M>num</M></tag>
0a505706
OZ
2853 On every multiple access network (e.g., the Ethernet) Designated Router
2854 and Backup Designated router are elected. These routers have some special
dad92c30
OZ
2855 functions in the flooding process. Higher priority increases preferences
2856 in this election. Routers with priority 0 are not eligible. Default
2857 value is 1.
8fd12e6b 2858
b9864aa8 2859 <tag><label id="ospf-wait">wait <M>num</M></tag>
dad92c30 2860 After start, router waits for the specified number of seconds between
178a197a
OZ
2861 starting election and building adjacency. Default value is 4*<m/hello/.
2862
b9864aa8 2863 <tag><label id="ospf-dead-count">dead count <M>num</M></tag>
dad92c30
OZ
2864 When the router does not receive any messages from a neighbor in
2865 <m/dead count/*<m/hello/ seconds, it will consider the neighbor down.
8fd12e6b 2866
b9864aa8 2867 <tag><label id="ospf-dead">dead <M>num</M></tag>
dad92c30
OZ
2868 When the router does not receive any messages from a neighbor in
2869 <m/dead/ seconds, it will consider the neighbor down. If both directives
fff7498d 2870 <cf/dead count/ and <cf/dead/ are used, <cf/dead/ has precedence.
48e5f32d 2871
b9864aa8 2872 <tag><label id="ospf-secondary">secondary <M>switch</M></tag>
48e5f32d
OZ
2873 On BSD systems, older versions of BIRD supported OSPFv2 only for the
2874 primary IP address of an interface, other IP ranges on the interface
2875 were handled as stub networks. Since v1.4.1, regular operation on
2876 secondary IP addresses is supported, but disabled by default for
2877 compatibility. This option allows to enable it. The option is a
2878 transitional measure, will be removed in the next major release as the
2879 behavior will be changed. On Linux systems, the option is irrelevant, as
2880 operation on non-primary addresses is already the regular behavior.
d8c7d9e8 2881
b9864aa8 2882 <tag><label id="ospf-rx-buffer">rx buffer <M>num</M></tag>
48e5f32d
OZ
2883 This option allows to specify the size of buffers used for packet
2884 processing. The buffer size should be bigger than maximal size of any
2885 packets. By default, buffers are dynamically resized as needed, but a
2886 fixed value could be specified. Value <cf/large/ means maximal allowed
2887 packet size - 65535.
2888
b9864aa8 2889 <tag><label id="ospf-tx-length">tx length <M>num</M></tag>
48e5f32d
OZ
2890 Transmitted OSPF messages that contain large amount of information are
2891 segmented to separate OSPF packets to avoid IP fragmentation. This
2892 option specifies the soft ceiling for the length of generated OSPF
2893 packets. Default value is the MTU of the network interface. Note that
2894 larger OSPF packets may still be generated if underlying OSPF messages
2895 cannot be splitted (e.g. when one large LSA is propagated).
94c42054 2896
b9864aa8 2897 <tag><label id="ospf-type-bcast">type broadcast|bcast</tag>
dad92c30
OZ
2898 BIRD detects a type of a connected network automatically, but sometimes
2899 it's convenient to force use of a different type manually. On broadcast
2900 networks (like ethernet), flooding and Hello messages are sent using
2901 multicasts (a single packet for all the neighbors). A designated router
2902 is elected and it is responsible for synchronizing the link-state
2903 databases and originating network LSAs. This network type cannot be used
2904 on physically NBMA networks and on unnumbered networks (networks without
2905 proper IP prefix).
919f5411 2906
b9864aa8 2907 <tag><label id="ospf-type-ptp">type pointopoint|ptp</tag>
dad92c30
OZ
2908 Point-to-point networks connect just 2 routers together. No election is
2909 performed and no network LSA is originated, which makes it simpler and
2910 faster to establish. This network type is useful not only for physically
2911 PtP ifaces (like PPP or tunnels), but also for broadcast networks used
2912 as PtP links. This network type cannot be used on physically NBMA
2913 networks.
919f5411 2914
b9864aa8 2915 <tag><label id="ospf-type-nbma">type nonbroadcast|nbma</tag>
dad92c30
OZ
2916 On NBMA networks, the packets are sent to each neighbor separately
2917 because of lack of multicast capabilities. Like on broadcast networks,
2918 a designated router is elected, which plays a central role in propagation
2919 of LSAs. This network type cannot be used on unnumbered networks.
919f5411 2920
b9864aa8 2921 <tag><label id="ospf-type-ptmp">type pointomultipoint|ptmp</tag>
dad92c30
OZ
2922 This is another network type designed to handle NBMA networks. In this
2923 case the NBMA network is treated as a collection of PtP links. This is
2924 useful if not every pair of routers on the NBMA network has direct
2925 communication, or if the NBMA network is used as an (possibly
2926 unnumbered) PtP link.
8fd12e6b 2927
b9864aa8 2928 <tag><label id="ospf-link-lsa-suppression">link lsa suppression <m/switch/</tag>
70945cb6
OZ
2929 In OSPFv3, link LSAs are generated for each link, announcing link-local
2930 IPv6 address of the router to its local neighbors. These are useless on
2931 PtP or PtMP networks and this option allows to suppress the link LSA
2932 origination for such interfaces. The option is ignored on other than PtP
2933 or PtMP interfaces. Default value is no.
2934
b9864aa8 2935 <tag><label id="ospf-strict-nonbroadcast">strict nonbroadcast <m/switch/</tag>
dad92c30 2936 If set, don't send hello to any undefined neighbor. This switch is
70945cb6 2937 ignored on other than NBMA or PtMP interfaces. Default value is no.
8fd12e6b 2938
b9864aa8 2939 <tag><label id="ospf-real-broadcast">real broadcast <m/switch/</tag>
dad92c30
OZ
2940 In <cf/type broadcast/ or <cf/type ptp/ network configuration, OSPF
2941 packets are sent as IP multicast packets. This option changes the
2942 behavior to using old-fashioned IP broadcast packets. This may be useful
2943 as a workaround if IP multicast for some reason does not work or does
2944 not work reliably. This is a non-standard option and probably is not
2945 interoperable with other OSPF implementations. Default value is no.
95127cbb 2946
b9864aa8 2947 <tag><label id="ospf-ptp-netmask">ptp netmask <m/switch/</tag>
dad92c30
OZ
2948 In <cf/type ptp/ network configurations, OSPFv2 implementations should
2949 ignore received netmask field in hello packets and should send hello
2950 packets with zero netmask field on unnumbered PtP links. But some OSPFv2
2951 implementations perform netmask checking even for PtP links. This option
2952 specifies whether real netmask will be used in hello packets on <cf/type
2953 ptp/ interfaces. You should ignore this option unless you meet some
2954 compatibility problems related to this issue. Default value is no for
2955 unnumbered PtP links, yes otherwise.
8df02847 2956
b9864aa8 2957 <tag><label id="ospf-check-link">check link <M>switch</M></tag>
dad92c30
OZ
2958 If set, a hardware link state (reported by OS) is taken into consideration.
2959 When a link disappears (e.g. an ethernet cable is unplugged), neighbors
2960 are immediately considered unreachable and only the address of the iface
2961 (instead of whole network prefix) is propagated. It is possible that
2962 some hardware drivers or platforms do not implement this feature.
2963 Default value is no.
e91f6960 2964
b9864aa8 2965 <tag><label id="ospf-bfd">bfd <M>switch</M></tag>
1ec52253
OZ
2966 OSPF could use BFD protocol as an advisory mechanism for neighbor
2967 liveness and failure detection. If enabled, BIRD setups a BFD session
2968 for each OSPF neighbor and tracks its liveness by it. This has an
2969 advantage of an order of magnitude lower detection times in case of
2970 failure. Note that BFD protocol also has to be configured, see
b9864aa8 2971 <ref id="bfd" name="BFD"> section for details. Default value is no.
1ec52253 2972
b9864aa8 2973 <tag><label id="ospf-ttl-security">ttl security [<m/switch/ | tx only]</tag>
dad92c30
OZ
2974 TTL security is a feature that protects routing protocols from remote
2975 spoofed packets by using TTL 255 instead of TTL 1 for protocol packets
2976 destined to neighbors. Because TTL is decremented when packets are
2977 forwarded, it is non-trivial to spoof packets with TTL 255 from remote
2978 locations. Note that this option would interfere with OSPF virtual
2979 links.
2980
2981 If this option is enabled, the router will send OSPF packets with TTL
2982 255 and drop received packets with TTL less than 255. If this option si
2983 set to <cf/tx only/, TTL 255 is used for sent packets, but is not
2984 checked for received packets. Default value is no.
6ac4f87a 2985
b9864aa8 2986 <tag><label id="ospf-tx-class">tx class|dscp|priority <m/num/</tag>
dad92c30 2987 These options specify the ToS/DiffServ/Traffic class/Priority of the
b9864aa8 2988 outgoing OSPF packets. See <ref id="proto-tx-class" name="tx class"> common
dad92c30 2989 option for detailed description.
ef4a50be 2990
b9864aa8 2991 <tag><label id="ospf-ecmp-weight">ecmp weight <M>num</M></tag>
dad92c30
OZ
2992 When ECMP (multipath) routes are allowed, this value specifies a
2993 relative weight used for nexthops going through the iface. Allowed
2994 values are 1-256. Default value is 1.
391931d4 2995
b9864aa8 2996 <tag><label id="ospf-auth-none">authentication none</tag>
dad92c30 2997 No passwords are sent in OSPF packets. This is the default value.
8fd12e6b 2998
b9864aa8 2999 <tag><label id="ospf-auth-simple">authentication simple</tag>
dad92c30
OZ
3000 Every packet carries 8 bytes of password. Received packets lacking this
3001 password are ignored. This authentication mechanism is very weak.
8fd12e6b 3002
b9864aa8 3003 <tag><label id="ospf-auth-cryptographic">authentication cryptographic</tag>
dad92c30
OZ
3004 16-byte long MD5 digest is appended to every packet. For the digest
3005 generation 16-byte long passwords are used. Those passwords are not sent
3006 via network, so this mechanism is quite secure. Packets can still be
3007 read by an attacker.
ea357b8b 3008
b9864aa8 3009 <tag><label id="ospf-pass">password "<M>text</M>"</tag>
dad92c30 3010 An 8-byte or 16-byte password used for authentication. See
b9864aa8 3011 <ref id="proto-pass" name="password"> common option for detailed
dad92c30 3012 description.
8fd12e6b 3013
b9864aa8 3014 <tag><label id="ospf-neighbors">neighbors { <m/set/ } </tag>
dad92c30
OZ
3015 A set of neighbors to which Hello messages on NBMA or PtMP networks are
3016 to be sent. For NBMA networks, some of them could be marked as eligible.
3017 In OSPFv3, link-local addresses should be used, using global ones is
3018 possible, but it is nonstandard and might be problematic. And definitely,
3019 link-local and global addresses should not be mixed.
8fd12e6b
OF
3020</descrip>
3021
3022<sect1>Attributes
b9864aa8 3023<label id="ospf-attr">
8fd12e6b 3024
c27b2449 3025<p>OSPF defines four route attributes. Each internal route has a <cf/metric/.
8fd12e6b 3026
dad92c30
OZ
3027<p>Metric is ranging from 1 to infinity (65535). External routes use
3028<cf/metric type 1/ or <cf/metric type 2/. A <cf/metric of type 1/ is comparable
3029with internal <cf/metric/, a <cf/metric of type 2/ is always longer than any
3030<cf/metric of type 1/ or any <cf/internal metric/. <cf/Internal metric/ or
3031<cf/metric of type 1/ is stored in attribute <cf/ospf_metric1/, <cf/metric type
30322/ is stored in attribute <cf/ospf_metric2/. If you specify both metrics only
3033metric1 is used.
3034
3035<p>Each external route can also carry attribute <cf/ospf_tag/ which is a 32-bit
3036integer which is used when exporting routes to other protocols; otherwise, it
3037doesn't affect routing inside the OSPF domain at all. The fourth attribute
3038<cf/ospf_router_id/ is a router ID of the router advertising that route /
3039network. This attribute is read-only. Default is <cf/ospf_metric2 = 10000/ and
3040<cf/ospf_tag = 0/.
8fd12e6b 3041
dad92c30 3042<sect1>Example
b9864aa8 3043<label id="ospf-exam">
8fd12e6b 3044
9637c7c0 3045<p><code>
8fd12e6b 3046protocol ospf MyOSPF {
dad92c30
OZ
3047 rfc1583compat yes;
3048 tick 2;
76c7efec
OF
3049 export filter {
3050 if source = RTS_BGP then {
3051 ospf_metric1 = 100;
3052 accept;
3053 }
98ac6176 3054 reject;
f434d191 3055 };
8fd12e6b 3056 area 0.0.0.0 {
8fd12e6b
OF
3057 interface "eth*" {
3058 cost 11;
3059 hello 15;
3060 priority 100;
3061 retransmit 7;
3062 authentication simple;
3063 password "aaa";
3064 };
3065 interface "ppp*" {
3066 cost 100;
3b16080c 3067 authentication cryptographic;
f434d191
OZ
3068 password "abc" {
3069 id 1;
3070 generate to "22-04-2003 11:00:06";
3071 accept from "17-01-2001 12:01:05";
3072 };
3073 password "def" {
3074 id 2;
3075 generate to "22-07-2005 17:03:21";
3076 accept from "22-02-2001 11:34:06";
3b16080c 3077 };
8fd12e6b 3078 };
e3bc10fd
OF
3079 interface "arc0" {
3080 cost 10;
3081 stub yes;
3082 };
3b16080c 3083 interface "arc1";
8fd12e6b
OF
3084 };
3085 area 120 {
3086 stub yes;
98ac6176
OF
3087 networks {
3088 172.16.1.0/24;
3089 172.16.2.0/24 hidden;
3090 }
8fd12e6b
OF
3091 interface "-arc0" , "arc*" {
3092 type nonbroadcast;
3093 authentication none;
e3bc10fd 3094 strict nonbroadcast yes;
a190e720
OF
3095 wait 120;
3096 poll 40;
3097 dead count 8;
8fd12e6b 3098 neighbors {
a190e720 3099 192.168.120.1 eligible;
8fd12e6b
OF
3100 192.168.120.2;
3101 192.168.120.10;
3102 };
3103 };
3104 };
3105}
3106</code>
3107
dad92c30 3108
371adba6 3109<sect>Pipe
b9864aa8 3110<label id="pipe">
1b55b1a3 3111
371adba6 3112<sect1>Introduction
b9864aa8 3113<label id="pipe-intro">
a2a3ced8 3114
dad92c30
OZ
3115<p>The Pipe protocol serves as a link between two routing tables, allowing
3116routes to be passed from a table declared as primary (i.e., the one the pipe is
3117connected to using the <cf/table/ configuration keyword) to the secondary one
3118(declared using <cf/peer table/) and vice versa, depending on what's allowed by
3119the filters. Export filters control export of routes from the primary table to
3120the secondary one, import filters control the opposite direction.
3121
3122<p>The Pipe protocol may work in the transparent mode mode or in the opaque
3123mode. In the transparent mode, the Pipe protocol retransmits all routes from
3124one table to the other table, retaining their original source and attributes.
3125If import and export filters are set to accept, then both tables would have
3126the same content. The transparent mode is the default mode.
3127
3128<p>In the opaque mode, the Pipe protocol retransmits optimal route from one
3129table to the other table in a similar way like other protocols send and receive
3130routes. Retransmitted route will have the source set to the Pipe protocol, which
3131may limit access to protocol specific route attributes. This mode is mainly for
3132compatibility, it is not suggested for new configs. The mode can be changed by
f98e2915
OZ
3133<tt/mode/ option.
3134
dad92c30
OZ
3135<p>The primary use of multiple routing tables and the Pipe protocol is for
3136policy routing, where handling of a single packet doesn't depend only on its
3137destination address, but also on its source address, source interface, protocol
3138type and other similar parameters. In many systems (Linux being a good example),
3139the kernel allows to enforce routing policies by defining routing rules which
3140choose one of several routing tables to be used for a packet according to its
3141parameters. Setting of these rules is outside the scope of BIRD's work (on
3142Linux, you can use the <tt/ip/ command), but you can create several routing
3143tables in BIRD, connect them to the kernel ones, use filters to control which
3144routes appear in which tables and also you can employ the Pipe protocol for
3145exporting a selected subset of one table to another one.
a2a3ced8 3146
371adba6 3147<sect1>Configuration
b9864aa8 3148<label id="pipe-config">
a2a3ced8
MM
3149
3150<p><descrip>
b9864aa8 3151 <tag><label id="pipe-peer-table">peer table <m/table/</tag>
dad92c30
OZ
3152 Defines secondary routing table to connect to. The primary one is
3153 selected by the <cf/table/ keyword.
f98e2915 3154
b9864aa8 3155 <tag><label id="pipe-mode">mode opaque|transparent</tag>
dad92c30 3156 Specifies the mode for the pipe to work in. Default is transparent.
a2a3ced8
MM
3157</descrip>
3158
371adba6 3159<sect1>Attributes
b9864aa8 3160<label id="pipe-attr">
a2a3ced8
MM
3161
3162<p>The Pipe protocol doesn't define any route attributes.
3163
371adba6 3164<sect1>Example
b9864aa8 3165<label id="pipe-exam">
a2a3ced8 3166
dad92c30
OZ
3167<p>Let's consider a router which serves as a boundary router of two different
3168autonomous systems, each of them connected to a subset of interfaces of the
3169router, having its own exterior connectivity and wishing to use the other AS as
3170a backup connectivity in case of outage of its own exterior line.
3171
3172<p>Probably the simplest solution to this situation is to use two routing tables
3173(we'll call them <cf/as1/ and <cf/as2/) and set up kernel routing rules, so that
3174packets having arrived from interfaces belonging to the first AS will be routed
3175according to <cf/as1/ and similarly for the second AS. Thus we have split our
3176router to two logical routers, each one acting on its own routing table, having
3177its own routing protocols on its own interfaces. In order to use the other AS's
3178routes for backup purposes, we can pass the routes between the tables through a
3179Pipe protocol while decreasing their preferences and correcting their BGP paths
3180to reflect the AS boundary crossing.
a2a3ced8
MM
3181
3182<code>
3183table as1; # Define the tables
3184table as2;
3185
3186protocol kernel kern1 { # Synchronize them with the kernel
3187 table as1;
3188 kernel table 1;
3189}
3190
3191protocol kernel kern2 {
3192 table as2;
3193 kernel table 2;
3194}
3195
3196protocol bgp bgp1 { # The outside connections
3197 table as1;
3198 local as 1;
3199 neighbor 192.168.0.1 as 1001;
3200 export all;
3201 import all;
3202}
3203
3204protocol bgp bgp2 {
3205 table as2;
3206 local as 2;
3207 neighbor 10.0.0.1 as 1002;
3208 export all;
3209 import all;
3210}
3211
3212protocol pipe { # The Pipe
3213 table as1;
3214 peer table as2;
3215 export filter {
3216 if net ~ [ 1.0.0.0/8+] then { # Only AS1 networks
3217 if preference>10 then preference = preference-10;
3218 if source=RTS_BGP then bgp_path.prepend(1);
3219 accept;
3220 }
3221 reject;
3222 };
3223 import filter {
3224 if net ~ [ 2.0.0.0/8+] then { # Only AS2 networks
3225 if preference>10 then preference = preference-10;
3226 if source=RTS_BGP then bgp_path.prepend(2);
3227 accept;
3228 }
3229 reject;
3230 };
3231}
3232</code>
3233
dad92c30 3234
6bcef225 3235<sect>RAdv
b9864aa8 3236<label id="radv">
6bcef225
OZ
3237
3238<sect1>Introduction
b9864aa8 3239<label id="radv-intro">
6bcef225 3240
dad92c30
OZ
3241<p>The RAdv protocol is an implementation of Router Advertisements, which are
3242used in the IPv6 stateless autoconfiguration. IPv6 routers send (in irregular
3243time intervals or as an answer to a request) advertisement packets to connected
3244networks. These packets contain basic information about a local network (e.g. a
3245list of network prefixes), which allows network hosts to autoconfigure network
3246addresses and choose a default route. BIRD implements router behavior as defined
7935b9d2 3247in <rfc id="4861"> and also the DNS extensions from <rfc id="6106">.
6bcef225
OZ
3248
3249<sect1>Configuration
b9864aa8 3250<label id="radv-config">
6bcef225 3251
dad92c30
OZ
3252<p>There are several classes of definitions in RAdv configuration -- interface
3253definitions, prefix definitions and DNS definitions:
6bcef225
OZ
3254
3255<descrip>
9df52a98 3256 <tag><label id="radv-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag>
6bcef225
OZ
3257 Interface definitions specify a set of interfaces on which the
3258 protocol is activated and contain interface specific options.
b9864aa8 3259 See <ref id="proto-iface" name="interface"> common options for
6bcef225
OZ
3260 detailed description.
3261
b9864aa8 3262 <tag><label id="radv-prefix">prefix <m/prefix/ { <m/options/ }</tag>
dad92c30
OZ
3263 Prefix definitions allow to modify a list of advertised prefixes. By
3264 default, the advertised prefixes are the same as the network prefixes
3265 assigned to the interface. For each network prefix, the matching prefix
3266 definition is found and its options are used. If no matching prefix
3267 definition is found, the prefix is used with default options.
3268
3269 Prefix definitions can be either global or interface-specific. The
3270 second ones are part of interface options. The prefix definition
3271 matching is done in the first-match style, when interface-specific
3272 definitions are processed before global definitions. As expected, the
3273 prefix definition is matching if the network prefix is a subnet of the
3274 prefix in prefix definition.
0e224d59 3275
b9864aa8 3276 <tag><label id="radv-rdnss">rdnss { <m/options/ }</tag>
dad92c30
OZ
3277 RDNSS definitions allow to specify a list of advertised recursive DNS
3278 servers together with their options. As options are seldom necessary,
3279 there is also a short variant <cf>rdnss <m/address/</cf> that just
3280 specifies one DNS server. Multiple definitions are cumulative. RDNSS
3281 definitions may also be interface-specific when used inside interface
3282 options. By default, interface uses both global and interface-specific
0e224d59 3283 options, but that can be changed by <cf/rdnss local/ option.
b9864aa8
PT
3284dsc-iface
3285 <tag><label id="radv-dnssl">dnssl { <m/options/ }</tag>
dad92c30
OZ
3286 DNSSL definitions allow to specify a list of advertised DNS search
3287 domains together with their options. Like <cf/rdnss/ above, multiple
3288 definitions are cumulative, they can be used also as interface-specific
3289 options and there is a short variant <cf>dnssl <m/domain/</cf> that just
3290 specifies one DNS search domain.
36da2857 3291
b9864aa8 3292 <tag><label id="radv-trigger">trigger <m/prefix/</tag>
dad92c30
OZ
3293 RAdv protocol could be configured to change its behavior based on
3294 availability of routes. When this option is used, the protocol waits in
3295 suppressed state until a <it/trigger route/ (for the specified network)
3296 is exported to the protocol, the protocol also returnsd to suppressed
3297 state if the <it/trigger route/ disappears. Note that route export
3298 depends on specified export filter, as usual. This option could be used,
3299 e.g., for handling failover in multihoming scenarios.
3300
3301 During suppressed state, router advertisements are generated, but with
3302 some fields zeroed. Exact behavior depends on which fields are zeroed,
3303 this can be configured by <cf/sensitive/ option for appropriate
3304 fields. By default, just <cf/default lifetime/ (also called <cf/router
3305 lifetime/) is zeroed, which means hosts cannot use the router as a
3306 default router. <cf/preferred lifetime/ and <cf/valid lifetime/ could
3307 also be configured as <cf/sensitive/ for a prefix, which would cause
3308 autoconfigured IPs to be deprecated or even removed.
6bcef225
OZ
3309</descrip>
3310
3311<p>Interface specific options:
3312
3313<descrip>
b9864aa8 3314 <tag><label id="radv-iface-max-ra-interval">max ra interval <m/expr/</tag>
dad92c30
OZ
3315 Unsolicited router advertisements are sent in irregular time intervals.
3316 This option specifies the maximum length of these intervals, in seconds.
3317 Valid values are 4-1800. Default: 600
6bcef225 3318
b9864aa8 3319 <tag><label id="radv-iface-min-ra-interval">min ra interval <m/expr/</tag>
dad92c30
OZ
3320 This option specifies the minimum length of that intervals, in seconds.
3321 Must be at least 3 and at most 3/4 * <cf/max ra interval/. Default:
3322 about 1/3 * <cf/max ra interval/.
6bcef225 3323
b9864aa8 3324 <tag><label id="radv-iface-min-delay">min delay <m/expr/</tag>
dad92c30
OZ
3325 The minimum delay between two consecutive router advertisements, in
3326 seconds. Default: 3
6bcef225 3327
b9864aa8 3328 <tag><label id="radv-iface-managed">managed <m/switch/</tag>
dad92c30
OZ
3329 This option specifies whether hosts should use DHCPv6 for IP address
3330 configuration. Default: no
6bcef225 3331
b9864aa8 3332 <tag><label id="radv-iface-other-config">other config <m/switch/</tag>
dad92c30
OZ
3333 This option specifies whether hosts should use DHCPv6 to receive other
3334 configuration information. Default: no
6bcef225 3335
b9864aa8 3336 <tag><label id="radv-iface-link-mtu">link mtu <m/expr/</tag>
dad92c30
OZ
3337 This option specifies which value of MTU should be used by hosts. 0
3338 means unspecified. Default: 0
6bcef225 3339
b9864aa8 3340 <tag><label id="radv-iface-reachable-time">reachable time <m/expr/</tag>
dad92c30
OZ
3341 This option specifies the time (in milliseconds) how long hosts should
3342 assume a neighbor is reachable (from the last confirmation). Maximum is
3343 3600000, 0 means unspecified. Default 0.
6bcef225 3344
b9864aa8 3345 <tag><label id="radv-iface-retrans-timer">retrans timer <m/expr/</tag>
dad92c30
OZ
3346 This option specifies the time (in milliseconds) how long hosts should
3347 wait before retransmitting Neighbor Solicitation messages. 0 means
3348 unspecified. Default 0.
6bcef225 3349
b9864aa8 3350 <tag><label id="radv-iface-current-hop-limit">current hop limit <m/expr/</tag>
dad92c30
OZ
3351 This option specifies which value of Hop Limit should be used by
3352 hosts. Valid values are 0-255, 0 means unspecified. Default: 64
6bcef225 3353
b9864aa8 3354 <tag><label id="radv-iface-default-lifetime">default lifetime <m/expr/ [sensitive <m/switch/]</tag>
dad92c30
OZ
3355 This option specifies the time (in seconds) how long (after the receipt
3356 of RA) hosts may use the router as a default router. 0 means do not use
b9864aa8 3357 as a default router. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
dad92c30 3358 Default: 3 * <cf/max ra interval/, <cf/sensitive/ yes.
0e224d59 3359
b9864aa8 3360 <tag><label id="radv-iface-default-preference-low">default preference low|medium|high</tag>
75148289
OZ
3361 This option specifies the Default Router Preference value to advertise
3362 to hosts. Default: medium.
3363
b9864aa8 3364 <tag><label id="radv-iface-rdnss-local">rdnss local <m/switch/</tag>
0e224d59 3365 Use only local (interface-specific) RDNSS definitions for this
dad92c30
OZ
3366 interface. Otherwise, both global and local definitions are used. Could
3367 also be used to disable RDNSS for given interface if no local definitons
3368 are specified. Default: no.
0e224d59 3369
b9864aa8 3370 <tag><label id="radv-iface-dnssl-local">dnssl local <m/switch/</tag>
dad92c30
OZ
3371 Use only local DNSSL definitions for this interface. See <cf/rdnss local/
3372 option above. Default: no.
6bcef225
OZ
3373</descrip>
3374
3375
b9864aa8 3376<p>Prefix specific options
6bcef225
OZ
3377
3378<descrip>
b9864aa8 3379 <tag><label id="radv-prefix-skip">skip <m/switch/</tag>
d214ae4f 3380 This option allows to specify that given prefix should not be
dad92c30
OZ
3381 advertised. This is useful for making exceptions from a default policy
3382 of advertising all prefixes. Note that for withdrawing an already
3383 advertised prefix it is more useful to advertise it with zero valid
3384 lifetime. Default: no
d214ae4f 3385
b9864aa8 3386 <tag><label id="radv-prefix-onlink">onlink <m/switch/</tag>
dad92c30
OZ
3387 This option specifies whether hosts may use the advertised prefix for
3388 onlink determination. Default: yes
6bcef225 3389
b9864aa8 3390 <tag><label id="radv-prefix-autonomous">autonomous <m/switch/</tag>
dad92c30
OZ
3391 This option specifies whether hosts may use the advertised prefix for
3392 stateless autoconfiguration. Default: yes
6bcef225 3393
b9864aa8 3394 <tag><label id="radv-prefix-valid-lifetime">valid lifetime <m/expr/ [sensitive <m/switch/]</tag>
dad92c30
OZ
3395 This option specifies the time (in seconds) how long (after the
3396 receipt of RA) the prefix information is valid, i.e., autoconfigured
3397 IP addresses can be assigned and hosts with that IP addresses are
3398 considered directly reachable. 0 means the prefix is no longer
b9864aa8 3399 valid. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
dad92c30 3400 Default: 86400 (1 day), <cf/sensitive/ no.
6bcef225 3401
b9864aa8 3402 <tag><label id="radv-prefix-preferred-lifetime">preferred lifetime <m/expr/ [sensitive <m/switch/]</tag>
dad92c30
OZ
3403 This option specifies the time (in seconds) how long (after the
3404 receipt of RA) IP addresses generated from the prefix using stateless
3405 autoconfiguration remain preferred. For <cf/sensitive/ option,
b9864aa8 3406 see <ref id="radv-trigger" name="trigger">. Default: 14400 (4 hours),
dad92c30 3407 <cf/sensitive/ no.
6bcef225
OZ
3408</descrip>
3409
0e224d59
OZ
3410
3411<p>RDNSS specific options:
3412
3413<descrip>
b9864aa8 3414 <tag><label id="radv-rdnss-ns">ns <m/address/</tag>
dad92c30
OZ
3415 This option specifies one recursive DNS server. Can be used multiple
3416 times for multiple servers. It is mandatory to have at least one
3417 <cf/ns/ option in <cf/rdnss/ definition.
0e224d59 3418
b9864aa8 3419 <tag><label id="radv-rdnss-lifetime">lifetime [mult] <m/expr/</tag>
dad92c30
OZ
3420 This option specifies the time how long the RDNSS information may be
3421 used by clients after the receipt of RA. It is expressed either in
3422 seconds or (when <cf/mult/ is used) in multiples of <cf/max ra
3423 interval/. Note that RDNSS information is also invalidated when
3424 <cf/default lifetime/ expires. 0 means these addresses are no longer
3425 valid DNS servers. Default: 3 * <cf/max ra interval/.
0e224d59
OZ
3426</descrip>
3427
3428
3429<p>DNSSL specific options:
3430
3431<descrip>
b9864aa8 3432 <tag><label id="radv-dnssl-domain">domain <m/address/</tag>
dad92c30
OZ
3433 This option specifies one DNS search domain. Can be used multiple times
3434 for multiple domains. It is mandatory to have at least one <cf/domain/
3435 option in <cf/dnssl/ definition.
0e224d59 3436
b9864aa8 3437 <tag><label id="radv-dnssl-lifetime">lifetime [mult] <m/expr/</tag>
dad92c30
OZ
3438 This option specifies the time how long the DNSSL information may be
3439 used by clients after the receipt of RA. Details are the same as for
3440 RDNSS <cf/lifetime/ option above. Default: 3 * <cf/max ra interval/.
0e224d59
OZ
3441</descrip>
3442
3443
6bcef225 3444<sect1>Example
b9864aa8 3445<label id="radv-exam">
6bcef225
OZ
3446
3447<p><code>
3448protocol radv {
3449 interface "eth2" {
3450 max ra interval 5; # Fast failover with more routers
3451 managed yes; # Using DHCPv6 on eth2
3452 prefix ::/0 {
3453 autonomous off; # So do not autoconfigure any IP
3454 };
3455 };
3456
3457 interface "eth*"; # No need for any other options
3458
3459 prefix 2001:0DB8:1234::/48 {
3460 preferred lifetime 0; # Deprecated address range
3461 };
3462
3463 prefix 2001:0DB8:2000::/48 {
3464 autonomous off; # Do not autoconfigure
3465 };
fc06fb62
OZ
3466
3467 rdnss 2001:0DB8:1234::10; # Short form of RDNSS
3468
3469 rdnss {
3470 lifetime mult 10;
3471 ns 2001:0DB8:1234::11;
3472 ns 2001:0DB8:1234::12;
3473 };
3474
3475 dnssl {
3476 lifetime 3600;
3477 domain "abc.com";
3478 domain "xyz.com";
3479 };
6bcef225
OZ
3480}
3481</code>
3482
dad92c30 3483
1532a244 3484<sect>RIP
b9864aa8 3485<label id="rip">
d37f899b 3486
371adba6 3487<sect1>Introduction
b9864aa8 3488<label id="rip-intro">
d37f899b 3489
dad92c30
OZ
3490<p>The RIP protocol (also sometimes called Rest In Pieces) is a simple protocol,
3491where each router broadcasts (to all its neighbors) distances to all networks it
3492can reach. When a router hears distance to another network, it increments it and
3493broadcasts it back. Broadcasts are done in regular intervals. Therefore, if some
3494network goes unreachable, routers keep telling each other that its distance is
3495the original distance plus 1 (actually, plus interface metric, which is usually
3496one). After some time, the distance reaches infinity (that's 15 in RIP) and all
3497routers know that network is unreachable. RIP tries to minimize situations where
3498counting to infinity is necessary, because it is slow. Due to infinity being 16,
3499you can't use RIP on networks where maximal distance is higher than 15
8465dccb
OZ
3500hosts.
3501
7935b9d2
PT
3502<p>BIRD supports RIPv1 (<rfc id="1058">), RIPv2 (<rfc id="2453">), RIPng (<rfc
3503id="2080">), and RIP cryptographic authentication (SHA-1 not implemented)
3504(<rfc id="4822">).
440439e3 3505
1532a244 3506<p>RIP is a very simple protocol, and it has a lot of shortcomings. Slow
dad92c30
OZ
3507convergence, big network load and inability to handle larger networks makes it
3508pretty much obsolete. It is still usable on very small networks.
d37f899b 3509
371adba6 3510<sect1>Configuration
b9864aa8 3511<label id="rip-config">
d37f899b 3512
8465dccb
OZ
3513<p>RIP configuration consists mainly of common protocol options and interface
3514definitions, most RIP options are interface specific.
3515
3516<code>
3517protocol rip [&lt;name&gt;] {
3518 infinity &lt;number&gt;;
3519 ecmp &lt;switch&gt; [limit &lt;number&gt;];
3520 interface &lt;interface pattern&gt; {
3521 metric &lt;number&gt;;
3522 mode multicast|broadcast;
3523 passive &lt;switch&gt;;
3524 address &lt;ip&gt;;
3525 port &lt;number&gt;;
3526 version 1|2;
3527 split horizon &lt;switch&gt;;
3528 poison reverse &lt;switch&gt;;
3529 check zero &lt;switch&gt;;
3530 update time &lt;number&gt;;
3531 timeout time &lt;number&gt;;
3532 garbage time &lt;number&gt;;
3533 ecmp weight &lt;number&gt;;
3534 ttl security &lt;switch&gt;; | tx only;
3535 tx class|dscp &lt;number&gt;;
3536 tx priority &lt;number&gt;;
3537 rx buffer &lt;number&gt;;
3538 tx length &lt;number&gt;;
3539 check link &lt;switch&gt;;
3540 authentication none|plaintext|cryptographic;
3541 password "&lt;text&gt;";
3542 password "&lt;text&gt;" {
3543 id &lt;num&gt;;
3544 generate from "&lt;date&gt;";
3545 generate to "&lt;date&gt;";
3546 accept from "&lt;date&gt;";
3547 accept to "&lt;date&gt;";
3548 };
3549 };
3550}
3551</code>
d37f899b
PM
3552
3553<descrip>
b9864aa8 3554 <tag><label id="rip-infinity">infinity <M>number</M></tag>
8465dccb
OZ
3555 Selects the distance of infinity. Bigger values will make
3556 protocol convergence even slower. The default value is 16.
dad92c30 3557
b9864aa8 3558 <tag><label id="rip-ecmp">ecmp <M>switch</M> [limit <M>number</M>]</tag>
8465dccb
OZ
3559 This option specifies whether RIP is allowed to generate ECMP
3560 (equal-cost multipath) routes. Such routes are used when there are
3561 several directions to the destination, each with the same (computed)
3562 cost. This option also allows to specify a limit on maximum number of
3563 nexthops in one route. By default, ECMP is disabled. If enabled,
3564 default value of the limit is 16.
3565
9df52a98 3566 <tag><label id="rip-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag>
8465dccb
OZ
3567 Interface definitions specify a set of interfaces on which the
3568 protocol is activated and contain interface specific options.
b9864aa8 3569 See <ref id="proto-iface" name="interface"> common options for
8465dccb 3570 detailed description.
d37f899b
PM
3571</descrip>
3572
8465dccb 3573<p>Interface specific options:
ef4a50be
OZ
3574
3575<descrip>
b9864aa8 3576 <tag><label id="rip-iface-metric">metric <m/num/</tag>
8465dccb
OZ
3577 This option specifies the metric of the interface. When a route is
3578 received from the interface, its metric is increased by this value
3579 before further processing. Valid values are 1-255, but values higher
3580 than infinity has no further meaning. Default: 1.
3581
b9864aa8 3582 <tag><label id="rip-iface-mode">mode multicast|broadcast</tag>
8465dccb
OZ
3583 This option selects the mode for RIP to use on the interface. The
3584 default is multicast mode for RIPv2 and broadcast mode for RIPv1.
3585 RIPng always uses the multicast mode.
3586
b9864aa8 3587 <tag><label id="rip-iface-passive">passive <m/switch/</tag>
8465dccb
OZ
3588 Passive interfaces receive routing updates but do not transmit any
3589 messages. Default: no.
3590
b9864aa8 3591 <tag><label id="rip-iface-address">address <m/ip/</tag>
8465dccb
OZ
3592 This option specifies a destination address used for multicast or
3593 broadcast messages, the default is the official RIP (224.0.0.9) or RIPng
3594 (ff02::9) multicast address, or an appropriate broadcast address in the
3595 broadcast mode.
3596
b9864aa8 3597 <tag><label id="rip-iface-port">port <m/number/</tag>
8465dccb
OZ
3598 This option selects an UDP port to operate on, the default is the
3599 official RIP (520) or RIPng (521) port.
3600
b9864aa8 3601 <tag><label id="rip-iface-version">version 1|2</tag>
8465dccb
OZ
3602 This option selects the version of RIP used on the interface. For RIPv1,
3603 automatic subnet aggregation is not implemented, only classful network
3604 routes and host routes are propagated. Note that BIRD allows RIPv1 to be
3605 configured with features that are defined for RIPv2 only, like
3606 authentication or using multicast sockets. The default is RIPv2 for IPv4
3607 RIP, the option is not supported for RIPng, as no further versions are
3608 defined.
3609
b9864aa8 3610 <tag><label id="rip-iface-version-only">version only <m/switch/</tag>
43fc6bb0
OZ
3611 Regardless of RIP version configured for the interface, BIRD accepts
3612 incoming packets of any RIP version. This option restrict accepted
3613 packets to the configured version. Default: no.
3614
b9864aa8 3615 <tag><label id="rip-iface-split-horizon">split horizon <m/switch/</tag>
8465dccb
OZ
3616 Split horizon is a scheme for preventing routing loops. When split
3617 horizon is active, routes are not regularly propagated back to the
3618 interface from which they were received. They are either not propagated
3619 back at all (plain split horizon) or propagated back with an infinity
3620 metric (split horizon with poisoned reverse). Therefore, other routers
3621 on the interface will not consider the router as a part of an
3622 independent path to the destination of the route. Default: yes.
3623
b9864aa8 3624 <tag><label id="rip-iface-poison-reverse">poison reverse <m/switch/</tag>
8465dccb
OZ
3625 When split horizon is active, this option specifies whether the poisoned
3626 reverse variant (propagating routes back with an infinity metric) is
3627 used. The poisoned reverse has some advantages in faster convergence,
3628 but uses more network traffic. Default: yes.
3629
b9864aa8 3630 <tag><label id="rip-iface-check-zero">check zero <m/switch/</tag>
8465dccb
OZ
3631 Received RIPv1 packets with non-zero values in reserved fields should
3632 be discarded. This option specifies whether the check is performed or
3633 such packets are just processed as usual. Default: yes.
3634
b9864aa8 3635 <tag><label id="rip-iface-update-time">update time <m/number/</tag>
8465dccb
OZ
3636 Specifies the number of seconds between periodic updates. A lower number
3637 will mean faster convergence but bigger network load. Default: 30.
3638
b9864aa8 3639 <tag><label id="rip-iface-timeout-time">timeout time <m/number/</tag>
8465dccb
OZ
3640 Specifies the time interval (in seconds) between the last received route
3641 announcement and the route expiration. After that, the network is
3642 considered unreachable, but still is propagated with infinity distance.
3643 Default: 180.
3644
b9864aa8 3645 <tag><label id="rip-iface-garbage-time">garbage time <m/number/</tag>
8465dccb
OZ
3646 Specifies the time interval (in seconds) between the route expiration
3647 and the removal of the unreachable network entry. The garbage interval,
3648 when a route with infinity metric is propagated, is used for both
3649 internal (after expiration) and external (after withdrawal) routes.
3650 Default: 120.
3651
b9864aa8 3652 <tag><label id="rip-iface-ecmp-weight">ecmp weight <m/number/</tag>
8465dccb
OZ
3653 When ECMP (multipath) routes are allowed, this value specifies a
3654 relative weight used for nexthops going through the iface. Valid
3655 values are 1-256. Default value is 1.
ef4a50be 3656
b9864aa8 3657 <tag><label id="rip-iface-auth">authentication none|plaintext|cryptographic</tag>
8465dccb
OZ
3658 Selects authentication method to be used. <cf/none/ means that packets
3659 are not authenticated at all, <cf/plaintext/ means that a plaintext
3660 password is embedded into each packet, and <cf/cryptographic/ means that
3661 packets are authenticated using a MD5 cryptographic hash. If you set
3662 authentication to not-none, it is a good idea to add <cf>password</cf>
3663 section. Default: none.
3664
b9864aa8
PT
3665 <tag><label id="rip-iface-pass">password "<m/text/"</tag>
3666 Specifies a password used for authentication. See <ref id="proto-pass"
8465dccb 3667 name="password"> common option for detailed description.
ef4a50be 3668
b9864aa8 3669 <tag><label id="rip-iface-ttl-security">ttl security [<m/switch/ | tx only]</tag>
dad92c30
OZ
3670 TTL security is a feature that protects routing protocols from remote
3671 spoofed packets by using TTL 255 instead of TTL 1 for protocol packets
3672 destined to neighbors. Because TTL is decremented when packets are
3673 forwarded, it is non-trivial to spoof packets with TTL 255 from remote
3674 locations.
3675
3676 If this option is enabled, the router will send RIP packets with TTL 255
3677 and drop received packets with TTL less than 255. If this option si set
3678 to <cf/tx only/, TTL 255 is used for sent packets, but is not checked
3679 for received packets. Such setting does not offer protection, but offers
3680 compatibility with neighbors regardless of whether they use ttl
3681 security.
3682
7935b9d2
PT
3683 For RIPng, TTL security is a standard behavior (required by <rfc
3684 id="2080">) and therefore default value is yes. For IPv4 RIP, default
3685 value is no.
6ac4f87a 3686
b9864aa8 3687 <tag><label id="rip-iface-tx-class">tx class|dscp|priority <m/number/</tag>
dad92c30 3688 These options specify the ToS/DiffServ/Traffic class/Priority of the
b9864aa8 3689 outgoing RIP packets. See <ref id="proto-tx-class" name="tx class"> common
dad92c30 3690 option for detailed description.
d37f899b 3691
b9864aa8 3692 <tag><label id="rip-iface-rx-buffer">rx buffer <m/number/</tag>
8465dccb
OZ
3693 This option specifies the size of buffers used for packet processing.
3694 The buffer size should be bigger than maximal size of received packets.
3695 The default value is 532 for IPv4 RIP and interface MTU value for RIPng.
3696
b9864aa8 3697 <tag><label id="rip-iface-tx-length">tx length <m/number/</tag>
8465dccb
OZ
3698 This option specifies the maximum length of generated RIP packets. To
3699 avoid IP fragmentation, it should not exceed the interface MTU value.
3700 The default value is 532 for IPv4 RIP and interface MTU value for RIPng.
3701
b9864aa8 3702 <tag><label id="rip-iface-check-link">check link <m/switch/</tag>
8465dccb
OZ
3703 If set, the hardware link state (as reported by OS) is taken into
3704 consideration. When the link disappears (e.g. an ethernet cable is
3705 unplugged), neighbors are immediately considered unreachable and all
3706 routes received from them are withdrawn. It is possible that some
3707 hardware drivers or platforms do not implement this feature. Default:
3708 no.
d37f899b
PM
3709</descrip>
3710
371adba6 3711<sect1>Attributes
b9864aa8 3712<label id="rip-attr">
d37f899b 3713
1b55b1a3
MM
3714<p>RIP defines two route attributes:
3715
3716<descrip>
b9864aa8 3717 <tag><label id="rta-rip-metric">int rip_metric/</tag>
dad92c30
OZ
3718 RIP metric of the route (ranging from 0 to <cf/infinity/). When routes
3719 from different RIP instances are available and all of them have the same
8465dccb
OZ
3720 preference, BIRD prefers the route with lowest <cf/rip_metric/. When a
3721 non-RIP route is exported to RIP, the default metric is 1.
dad92c30 3722
b9864aa8 3723 <tag><label id="rta-rip-tag">int rip_tag/</tag>
dad92c30
OZ
3724 RIP route tag: a 16-bit number which can be used to carry additional
3725 information with the route (for example, an originating AS number in
8465dccb
OZ
3726 case of external routes). When a non-RIP route is exported to RIP, the
3727 default tag is 0.
1b55b1a3
MM
3728</descrip>
3729
371adba6 3730<sect1>Example
b9864aa8 3731<label id="rip-exam">
1b55b1a3
MM
3732
3733<p><code>
8465dccb 3734protocol rip {
d37f899b
PM
3735 debug all;
3736 port 1520;
2bf59bf4 3737 period 12;
326e33f5 3738 garbage time 60;
f434d191
OZ
3739 interface "eth0" { metric 3; mode multicast; };
3740 interface "eth*" { metric 2; mode broadcast; };
d37f899b
PM
3741 authentication none;
3742 import filter { print "importing"; accept; };
3743 export filter { print "exporting"; accept; };
3744}
a0dd1c74 3745</code>
d37f899b 3746
dad92c30 3747
371adba6 3748<sect>Static
b9864aa8 3749<label id="static">
1b55b1a3 3750
0e4789c2 3751<p>The Static protocol doesn't communicate with other routers in the network,
f8e2d916 3752but instead it allows you to define routes manually. This is often used for
79a2b697 3753specifying how to forward packets to parts of the network which don't use
dad92c30
OZ
3754dynamic routing at all and also for defining sink routes (i.e., those telling to
3755return packets as undeliverable if they are in your IP block, you don't have any
3756specific destination for them and you don't want to send them out through the
3757default route to prevent routing loops).
3758
3759<p>There are five types of static routes: `classical' routes telling to forward
3760packets to a neighboring router, multipath routes specifying several (possibly
3761weighted) neighboring routers, device routes specifying forwarding to hosts on a
3762directly connected network, recursive routes computing their nexthops by doing
43fc6bb0 3763route table lookups for a given IP, and special routes (sink, blackhole etc.)
dad92c30 3764which specify a special action to be done instead of forwarding the packet.
79a2b697
MM
3765
3766<p>When the particular destination is not available (the interface is down or
3767the next hop of the route is not a neighbor at the moment), Static just
326e33f5 3768uninstalls the route from the table it is connected to and adds it again as soon
a00c7a18 3769as the destination becomes adjacent again.
79a2b697 3770
43fc6bb0
OZ
3771<p>There are three classes of definitions in Static protocol configuration --
3772global options, static route definitions, and per-route options. Usually, the
3773definition of the protocol contains mainly a list of static routes.
3774
3775<p>Global options:
3776
3777<descrip>
b9864aa8 3778 <tag><label id="static-check-link">check link <m/switch/</tag>
43fc6bb0
OZ
3779 If set, hardware link states of network interfaces are taken into
3780 consideration. When link disappears (e.g. ethernet cable is unplugged),
3781 static routes directing to that interface are removed. It is possible
3782 that some hardware drivers or platforms do not implement this feature.
3783 Default: off.
3784
b9864aa8 3785 <tag><label id="static-igp-table">igp table <m/name/</tag>
43fc6bb0
OZ
3786 Specifies a table that is used for route table lookups of recursive
3787 routes. Default: the same table as the protocol is connected to.
3788</descrip>
3789
3790<p>Route definitions (each may also contain a block of per-route options):
79a2b697
MM
3791
3792<descrip>
b9864aa8 3793 <tag><label id="static-route-via-ip">route <m/prefix/ via <m/ip/</tag>
6683d42d
OZ
3794 Static route through a neighboring router. For link-local next hops,
3795 interface can be specified as a part of the address (e.g.,
3796 <cf/via fe80::1234%eth0/).
dad92c30 3797
9df52a98 3798 <tag><label id="static-route-via-mpath">route <m/prefix/ multipath via <m/ip/ [weight <m/num/] [bfd <m/switch/] [via <m/.../]</tag>
e91f6960 3799 Static multipath route. Contains several nexthops (gateways), possibly
1e3810f9 3800 with their weights.
dad92c30 3801
b9864aa8 3802 <tag><label id="static-route-via-iface">route <m/prefix/ via <m/"interface"/</tag>
dad92c30
OZ
3803 Static device route through an interface to hosts on a directly
3804 connected network.
3805
b9864aa8 3806 <tag><label id="static-route-recursive">route <m/prefix/ recursive <m/ip/</tag>
dad92c30
OZ
3807 Static recursive route, its nexthop depends on a route table lookup for
3808 given IP address.
3809
b9864aa8 3810 <tag><label id="static-route-drop">route <m/prefix/ blackhole|unreachable|prohibit</tag>
dad92c30
OZ
3811 Special routes specifying to silently drop the packet, return it as
3812 unreachable or return it as administratively prohibited. First two
3813 targets are also known as <cf/drop/ and <cf/reject/.
43fc6bb0 3814</descrip>
391931d4 3815
43fc6bb0 3816<p>Per-route options:
dad92c30 3817
43fc6bb0 3818<descrip>
b9864aa8 3819 <tag><label id="static-route-bfd">bfd <m/switch/</tag>
43fc6bb0
OZ
3820 The Static protocol could use BFD protocol for next hop liveness
3821 detection. If enabled, a BFD session to the route next hop is created
3822 and the static route is BFD-controlled -- the static route is announced
3823 only if the next hop liveness is confirmed by BFD. If the BFD session
3824 fails, the static route is removed. Note that this is a bit different
3825 compared to other protocols, which may use BFD as an advisory mechanism
3826 for fast failure detection but ignores it if a BFD session is not even
3827 established.
3828
3829 This option can be used for static routes with a direct next hop, or
3830 also for for individual next hops in a static multipath route (see
3831 above). Note that BFD protocol also has to be configured, see
b9864aa8 3832 <ref id="bfd" name="BFD"> section for details. Default value is no.
43fc6bb0 3833
b9864aa8 3834 <tag><label id="static-route-filter"><m/filter expression/</tag>
43fc6bb0
OZ
3835 This is a special option that allows filter expressions to be configured
3836 on per-route basis. Can be used multiple times. These expressions are
3837 evaluated when the route is originated, similarly to the import filter
3838 of the static protocol. This is especially useful for configuring route
3839 attributes, e.g., <cf/ospf_metric1 = 100;/ for a route that will be
3840 exported to the OSPF protocol.
79a2b697
MM
3841</descrip>
3842
79a2b697
MM
3843<p>Static routes have no specific attributes.
3844
4f88ac47 3845<p>Example static config might look like this:
79a2b697
MM
3846
3847<p><code>
3848protocol static {
43fc6bb0
OZ
3849 table testable; # Connect to a non-default routing table
3850 check link; # Advertise routes only if link is up
9491f9f5 3851 route 0.0.0.0/0 via 198.51.100.130; # Default route
43fc6bb0 3852 route 10.0.0.0/8 multipath # Multipath route
9491f9f5 3853 via 198.51.100.10 weight 2
43fc6bb0 3854 via 198.51.100.20 bfd # BFD-controlled next hop
9491f9f5 3855 via 192.0.2.1;
80a9cadc 3856 route 203.0.113.0/24 unreachable; # Sink route
43fc6bb0
OZ
3857 route 10.2.0.0/24 via "arc0"; # Secondary network
3858 route 192.168.10.0/24 via 198.51.100.100 {
3859 ospf_metric1 = 20; # Set extended attribute
3860 }
3861 route 192.168.10.0/24 via 198.51.100.100 {
3862 ospf_metric2 = 100; # Set extended attribute
3863 ospf_tag = 2; # Set extended attribute
3864 bfd; # BFD-controlled route
3865 }
79a2b697
MM
3866}
3867</code>
3868
dad92c30 3869
96264d4d 3870<chapt>Conclusions
b9864aa8 3871<label id="conclusion">
96264d4d
PM
3872
3873<sect>Future work
b9864aa8 3874<label id="future-work">
96264d4d 3875
dad92c30
OZ
3876<p>Although BIRD supports all the commonly used routing protocols, there are
3877still some features which would surely deserve to be implemented in future
3878versions of BIRD:
96264d4d
PM
3879
3880<itemize>
55b58d8c 3881<item>Opaque LSA's
96264d4d 3882<item>Route aggregation and flap dampening
96264d4d
PM
3883<item>Multipath routes
3884<item>Multicast routing protocols
3885<item>Ports to other systems
3886</itemize>
3887
dad92c30 3888
96264d4d 3889<sect>Getting more help
b9864aa8 3890<label id="help">
96264d4d
PM
3891
3892<p>If you use BIRD, you're welcome to join the bird-users mailing list
d148d0af 3893(<HTMLURL URL="mailto:bird-users@network.cz" name="bird-users@network.cz">)
96264d4d 3894where you can share your experiences with the other users and consult
d148d0af
OF
3895your problems with the authors. To subscribe to the list, visit
3896<HTMLURL URL="http://bird.network.cz/?m_list" name="http://bird.network.cz/?m_list">.
96264d4d
PM
3897The home page of BIRD can be found at <HTMLURL URL="http://bird.network.cz/" name="http://bird.network.cz/">.
3898
dad92c30
OZ
3899<p>BIRD is a relatively young system and it probably contains some bugs. You can
3900report any problems to the bird-users list and the authors will be glad to solve
3901them, but before you do so, please make sure you have read the available
3902documentation and that you are running the latest version (available at
3903<HTMLURL URL="ftp://bird.network.cz/pub/bird" name="bird.network.cz:/pub/bird">).
3904(Of course, a patch which fixes the bug is always welcome as an attachment.)
3905
3906<p>If you want to understand what is going inside, Internet standards are a good
3907and interesting reading. You can get them from
3908<HTMLURL URL="ftp://ftp.rfc-editor.org/" name="ftp.rfc-editor.org"> (or a
3909nicely sorted version from <HTMLURL URL="ftp://atrey.karlin.mff.cuni.cz/pub/rfc"
3910name="atrey.karlin.mff.cuni.cz:/pub/rfc">).
69477cad 3911
c184d9d0 3912<p><it/Good luck!/
69477cad 3913
371adba6 3914</book>
7581b81b 3915
a0dd1c74 3916<!--
75317ab8
MM
3917LocalWords: GPL IPv GateD BGPv RIPv OSPFv Linux sgml html dvi sgmltools Pavel
3918LocalWords: linuxdoc dtd descrip config conf syslog stderr auth ospf bgp Mbps
5a203dac 3919LocalWords: router's eval expr num birdc ctl UNIX if's enums bool int ip GCC
75317ab8
MM
3920LocalWords: len ipaddress pxlen netmask enum bgppath bgpmask clist gw md eth
3921LocalWords: RTS printn quitbird iBGP AS'es eBGP RFC multiprotocol IGP Machek
4e8ec666 3922LocalWords: EGP misconfigurations keepalive pref aggr aggregator BIRD's RTC
5a203dac 3923LocalWords: OS'es AS's multicast nolisten misconfigured UID blackhole MRTD MTU
4e8ec666 3924LocalWords: uninstalls ethernets IP binutils ANYCAST anycast dest RTD ICMP rfc
5a203dac 3925LocalWords: compat multicasts nonbroadcast pointopoint loopback sym stats
64722c98 3926LocalWords: Perl SIGHUP dd mm yy HH MM SS EXT IA UNICAST multihop Discriminator txt
5adc02a6 3927LocalWords: proto wildcard Ondrej Filip
5a64ac70 3928-->