bird.sgml 80.7 KB
Newer Older
1
<!doctype birddoc system>
2 3

<!--
Pavel Machek's avatar
Pavel Machek committed
4
	BIRD documentation
5

6 7 8 9
This documentation can have 4 forms: sgml (this is master copy), html,
ASCII text and dvi/postscript (generated from sgml using
sgmltools). You should always edit master copy.

Martin Mareš's avatar
Martin Mareš committed
10
This is a slightly modified linuxdoc dtd.  Anything in <descrip> tags is considered definition of
11
configuration primitives, <cf> is fragment of configuration within normal text, <m> is
Martin Mareš's avatar
Martin Mareš committed
12
"meta" information within fragment of configuration - something in config which is not keyword.
13 14 15 16 17 18 19

    (set-fill-column 100)

    Copyright 1999,2000 Pavel Machek <pavel@ucw.cz>, distribute under GPL version 2 or later.

 -->

20
<book>
21

22
<title>BIRD User's Guide
23
<author>
24 25
Ondrej Filip <it/&lt;feela@network.cz&gt;/,
Pavel Machek <it/&lt;pavel@ucw.cz&gt;/,
26 27
Martin Mares <it/&lt;mj@ucw.cz&gt;/,
Ondrej Zajicek <it/&lt;santiago@crfreenet.org&gt;/
28
</author>
29 30

<abstract>
31
This document contains user documentation for the BIRD Internet Routing Daemon project.
32 33 34 35 36 37 38
</abstract>

<!-- Table of contents -->
<toc>

<!-- Begin the document -->

39
<chapt>Introduction
40

41
<sect>What is BIRD
42

43 44 45 46 47 48 49 50 51 52 53
<p><label id="intro">
The name `BIRD' is actually an acronym standing for `BIRD Internet Routing Daemon'.
Let's take a closer look at the meaning of the name:

<p><em/BIRD/: Well, we think we have already explained that. It's an acronym standing
for `BIRD Internet Routing Daemon', you remember, don't you? :-)

<p><em/Internet Routing/: It's a program (well, a daemon, as you are going to discover in a moment)
which works as a dynamic router in an Internet type network (that is, in a network running either
the IPv4 or the IPv6 protocol). Routers are devices which forward packets between interconnected
networks in order to allow hosts not connected directly to the same local area network to
54
communicate with each other. They also communicate with the other routers in the Internet to discover
55
the topology of the network which allows them to find optimal (in terms of some metric) rules for
56
forwarding of packets (which are called routing tables) and to adapt themselves to the
57 58
changing conditions such as outages of network links, building of new connections and so on. Most of
these routers are costly dedicated devices running obscure firmware which is hard to configure and
59
not open to any changes (on the other hand, their special hardware design allows them to keep up with lots of high-speed network interfaces, better than general-purpose computer does). Fortunately, most operating systems of the UNIX family allow an ordinary 
60 61 62 63 64 65
computer to act as a router and forward packets belonging to the other hosts, but only according to
a statically configured table.

<p>A <em/Routing Daemon/ is in UNIX terminology a non-interactive program running on
background which does the dynamic part of Internet routing, that is it communicates
with the other routers, calculates routing tables and sends them to the OS kernel
66 67 68 69
which does the actual packet forwarding. There already exist other such routing
daemons: routed (RIP only), GateD (non-free), Zebra<HTMLURL URL="http://www.zebra.org">
and MRTD<HTMLURL URL="http://sourceforge.net/projects/mrt">, but their capabilities are
limited and they are relatively hard to configure and maintain.
70 71

<p>BIRD is an Internet Routing Daemon designed to avoid all of these shortcomings,
Martin Mareš's avatar
Martin Mareš committed
72
to support all the routing technology used in the today's Internet or planned to be
73 74 75 76 77 78 79
used in near future and to have a clean extensible architecture allowing new routing
protocols to be incorporated easily. Among other features, BIRD supports:

<itemize>
	<item>both IPv4 and IPv6 protocols
	<item>multiple routing tables
	<item>the Border Gateway Protocol (BGPv4)
80
	<item>the Routing Information Protocol (RIPv2)
81
	<item>the Open Shortest Path First protocol (OSPFv2)
82
	<item>a virtual protocol for exchange of routes between different routing tables on a single host
83 84 85 86
	<item>a command-line interface allowing on-line control and inspection
		of status of the daemon
	<item>soft reconfiguration (no need to use complex online commands
		to change the configuration, just edit the configuration file
87
		and notify BIRD to re-read it and it will smoothly switch itself
88 89
		to the new configuration, not disturbing routing protocols
		unless they are affected by the configuration changes)
90
	<item>a powerful language for route filtering
91 92 93
</itemize>

<p>BIRD has been developed at the Faculty of Math and Physics, Charles University, Prague,
94
Czech Republic as a student project. It can be freely distributed under the terms of the GNU General
95 96 97
Public License.

<p>BIRD has been designed to work on all UNIX-like systems. It has been developed and
Ondřej Filip's avatar
Ondřej Filip committed
98 99
tested under Linux 2.0 to 2.4, and then ported to FreeBSD and NetBSD, porting to other
systems (even non-UNIX ones) should be relatively easy due to its highly modular architecture.
100

101
<sect>Installing BIRD
102

103
<p>On a recent UNIX system with GNU development tools (GCC, binutils, m4, make) and Perl, installing BIRD should be as easy as:
104 105 106 107 108 109

<code>
        ./configure
        make
        make install
        vi /usr/local/etc/bird.conf
Pavel Machek's avatar
Pavel Machek committed
110
	bird
111 112
</code>

113 114 115 116 117
<p>You can use <tt>./configure --help</tt> to get a list of configure
options. The most important ones are:
<tt/--enable-ipv6/ which enables building of an IPv6 version of BIRD,
<tt/--with-protocols=/ to produce a slightly smaller BIRD executable by configuring out routing protocols you don't use, and
<tt/--prefix=/ to install BIRD to a place different from.
118 119
<file>/usr/local</file>.

120
<sect>Running BIRD
121

Pavel Machek's avatar
Pavel Machek committed
122
<p>You can pass several command-line options to bird:
123

Pavel Machek's avatar
Pavel Machek committed
124 125
<descrip>
	<tag>-c <m/config name/</tag>
Martin Mareš's avatar
Martin Mareš committed
126
	use given configuration file instead of <it/prefix/<file>/etc/bird.conf</file>.
Pavel Machek's avatar
Pavel Machek committed
127 128

	<tag>-d</tag>
129
	enable debug messages and run bird in foreground.
Pavel Machek's avatar
Pavel Machek committed
130

131 132
	<tag>-D <m/filename of debug log/</tag>
	log debugging information to given file instead of stderr
Pavel Machek's avatar
Pavel Machek committed
133 134

	<tag>-s <m/name of communication socket/</tag>
Martin Mareš's avatar
Martin Mareš committed
135
	use given filename for a  socket for communications with the client, default is <it/prefix/<file>/var/run/bird.ctl</file>.
Pavel Machek's avatar
Pavel Machek committed
136
</descrip>
137

138 139
<p>BIRD writes messages about its work to log files or syslog (according to config).

140 141
<chapt>About routing tables

142 143 144
<p>BIRD has one or more routing tables which may or may not be
synchronized with OS kernel and which may or may not be synchronized with
each other (see the Pipe protocol). Each routing table contains a list of
145 146 147
known routes. Each route consists of:

<itemize>
148 149 150
	<item>network prefix this route is for (network address and prefix length -- the number of bits forming the network part of the address; also known as a netmask)
	<item>preference of this route
	<item>IP address of router which told us about this route
151
	<item>IP address of router we should forward the packets to
152 153
	using this route
	<item>other attributes common to all routes
154 155
	<item>dynamic attributes defined by protocols which may or
	may not be present (typically protocol metrics)
156 157
</itemize>

158 159 160 161
Routing table maintains multiple entries
for a network, but at most one entry for one network and one
protocol. The entry with the highest preference is used for routing (we
will call such an entry the <it/selected route/). If
162
there are more entries with the same preference and they are from the same
163 164 165 166 167 168 169 170 171 172 173 174
protocol, the protocol decides (typically according to metrics). If they aren't,
an internal ordering is used to break the tie. You can
get the list of route attributes in the Route attributes section.

<p>Each protocol is connected to a routing table through two filters
which can accept, reject and modify the routes. An <it/export/
filter checks routes passed from the routing table to the protocol,
an <it/import/ filter checks routes in the opposite direction.
When the routing table gets a route from a protocol, it recalculates
the selected route and broadcasts it to all protocols connected to
the table. The protocols typically send the update to other routers
in the network.
175

176
<chapt>Configuration
Pavel Machek's avatar
Pavel Machek committed
177

178
<sect>Introduction
179

Martin Mareš's avatar
Martin Mareš committed
180
<p>BIRD is configured using a text configuration file. Upon startup, BIRD reads <it/prefix/<file>/etc/bird.conf</file> (unless the
181 182 183 184
<tt/-c/ command line option is given). Configuration may be changed at user's request: if you modify
the config file and then signal BIRD with <tt/SIGHUP/, it will adjust to the new
config. Then there's the client
which allows you to talk with BIRD in an extensive way.
185 186 187 188

<p>In the config, everything on a line after <cf/#/ or inside <cf>/*
*/</cf> is a comment, whitespace characters are treated as a single space. If there's a variable number of options, they are grouped using
the <cf/{ }/ brackets. Each option is terminated by a <cf/;/. Configuration
189 190
is case sensitive.

191 192 193
<p>Here is an example of a simple config file. It enables
synchronization of routing tables with OS kernel, scans for 
new network interfaces every 10 seconds and runs RIP on all network interfaces found.
194

195

196
<code>
197
protocol kernel {
Pavel Machek's avatar
Pavel Machek committed
198
	persist;		# Don't remove routes on BIRD shutdown
199 200 201 202 203 204 205 206 207 208 209
	scan time 20;		# Scan kernel routing table every 20 seconds
	export all;		# Default is export none
}

protocol device {
	scan time 10;		# Scan interfaces every 10 seconds
}

protocol rip {
	export all;
	import all;
210
	interface "*";
211
}
212
</code>
213

214

215
<sect>Global options
Pavel Machek's avatar
Pavel Machek committed
216

217
<p><descrip>
218
	<tag>log "<m/filename/"|syslog|stderr all|{ <m/list of classes/ }</tag> 
219
	Set logging of messages having the given class (either <cf/all/ or <cf/{
220
	error, trace }/ etc.) into selected destination. Classes are:
221
	<cf/info/, <cf/warning/, <cf/error/ and <cf/fatal/ for messages about local problems,
222
	<cf/debug/ for debugging messages, 
223 224 225
	<cf/trace/ when you want to know what happens in the network, 
	<cf/remote/ for messages about misbehavior of remote machines, 
	<cf/auth/ about authentication failures,
Martin Mareš's avatar
Martin Mareš committed
226
	<cf/bug/ for internal BIRD bugs. You may specify more than one <cf/log/ line to establish logging to multiple
Pavel Machek's avatar
Pavel Machek committed
227
	destinations. Default: log everything to the system log.
228

229
	<tag>debug protocols all|off|{ states, routes, filters, interfaces, events, packets }</tag>
Pavel Machek's avatar
Pavel Machek committed
230 231 232 233 234 235
	Set global defaults of protocol debugging options. See <cf/debug/ in the following section. Default: off.

	<tag>debug commands <m/number/</tag>
	Control logging of client connections (0 for no logging, 1 for
	logging of connects and disconnects, 2 and higher for logging of
	all client commands). Default: 0.
236

237
	<tag>filter <m/name local variables/{ <m/commands/ }</tag> Define a filter. You can learn more about filters
Pavel Machek's avatar
Pavel Machek committed
238
	in the following chapter. 
239

240
	<tag>function <m/name/ (<m/parameters/) <m/local variables/ { <m/commands/ }</tag> Define a function. You can learn more
241
	about functions in the following chapter.
242
 
243
	<tag>protocol rip|ospf|bgp|... <m/[name]/ { <m>protocol options</m> }</tag> Define a protocol
244
	instance called <cf><m/name/</cf> (or with a name like "rip5" generated automatically if you don't specify any <cf><m/name/</cf>). You can learn more
Pavel Machek's avatar
Pavel Machek committed
245
	about configuring protocols in their own chapters. You can run more than one instance of
Pavel Machek's avatar
Pavel Machek committed
246
	most protocols (like RIP or BGP). By default, no instances are configured.
247

248
	<tag>define <m/constant/ = (<m/expression/)|<m/number/|<m/IP address/</tag> Define a constant. You can use it later in every place
249
	you could use a simple integer or an IP address.
250

Pavel Machek's avatar
Pavel Machek committed
251
	<tag>router id <m/IPv4 address/</tag> Set BIRD's router ID. It's a world-wide unique identification of your router, usually one of router's IPv4 addresses. Default: in IPv4 version, the lowest IP address of a non-loopback interface. In IPv6 version, this option is mandatory. 
252

253
	<tag>listen bgp [address <m/address/] [port <m/port/] [v6only]</tag>
Ondřej Zajíček's avatar
Ondřej Zajíček committed
254 255 256 257 258 259 260 261
	This option allows to specify address and port where BGP
	protocol should listen. It is global option as listening
	socket is common to all BGP instances. Default is to listen on
	all addresses (0.0.0.0) and port 179. In IPv6 mode, option
	<cf/v6only/ can be used to specify that BGP socket should
	listen to IPv6 connections only. This is needed if you want to
	run both bird and bird6 on the same port.

262
	<tag>table <m/name/</tag> Create a new routing table. The default
263 264
	routing table is created implicitly, other routing tables have
	to be added by this command.
Pavel Machek's avatar
Pavel Machek committed
265

266
	<tag>eval <m/expr/</tag> Evaluates given filter expression. It
267
	is used by us for testing of filters.
268 269
</descrip>

270
<sect>Protocol options
271

Pavel Machek's avatar
Pavel Machek committed
272 273 274
<p>For each protocol instance, you can configure a bunch of options.
Some of them (those described in this section) are generic, some are
specific to the protocol (see sections talking about the protocols).
275

Pavel Machek's avatar
Pavel Machek committed
276 277 278 279 280
<p>Several options use a <cf><m/switch/</cf> argument. It can be either
<cf/on/, <cf/yes/ or a numeric expression with a non-zero value for the
option to be enabled or <cf/off/, <cf/no/ or a numeric expression evaluating
to zero to disable it. An empty <cf><m/switch/</cf> is equivalent to <cf/on/
("silence means agreement").
281

Pavel Machek's avatar
Pavel Machek committed
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
<descrip>
	<tag>preference <m/expr/</tag> Sets the preference of routes generated by this protocol. Default: protocol dependent.

	<tag>disabled <m/switch/</tag> Disables the protocol. You can change the disable/enable status from the command
	line interface without needing to touch the configuration. Disabled protocols are not activated. Default: protocol is enabled.

	<tag>debug all|off|{ states, routes, filters, interfaces, events, packets }</tag>
	Set protocol debugging options. If asked, each protocol is capable of
	writing trace messages about its work to the log (with category
	<cf/trace/). You can either request printing of <cf/all/ trace messages
	or only of the types selected: <cf/states/ for protocol state changes
	(protocol going up, down, starting, stopping etc.),
	<cf/routes/ for routes exchanged with the routing table,
	<cf/filters/ for details on route filtering,
	<cf/interfaces/ for interface change events sent to the protocol,
	<cf/events/ for events internal to the protocol and
	<cf/packets/ for packets sent and received by the protocol. Default: off.

300
	<tag>router id <m/IPv4 address/</tag> This option can be used to override global
301
	router id for a given protocol. Default: uses global router id.
302

Pavel Machek's avatar
Pavel Machek committed
303
	<tag>import all | none | filter <m/name/ | filter { <m/filter commands/ } | where <m/filter expression/</tag> 
304
	Specify a filter to be used for filtering routes coming from the protocol to the routing table. <cf/all/ is shorthand for <cf/where true/ and <cf/none/ is shorthand for <cf/where false/. Default: <cf/all/.
305

306 307
	<tag>export <m/filter/</tag> This is similar to the <cf>import</cf> keyword, except that it
	works in the direction from the routing table to the protocol. Default: <cf/none/.
Pavel Machek's avatar
Pavel Machek committed
308

309
	<tag>table <m/name/</tag> Connect this protocol to a non-default routing table.
310 311
</descrip>

312
<p>There are several options that give sense only with certain protocols:
313 314

<descrip>
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
	<tag><label id="dsc-iface">interface [-] [ "<m/mask/" ] [ <m/prefix/ ] [, ...] [ { <m/option/ ; [...] } ]</tag>

	Specifies a set of interfaces on which the protocol is activated with
	given interface-specific options. A set of interfaces specified by one
	interface option is described using an interface pattern. The
	interface pattern consists of a sequence of clauses (separted by
	commas), each clause may contain a mask, a prefix, or both of them. An
	interface matches the clause if its name matches the mask (if
	specified) and its address matches the prefix (if specified). Mask is
	specified as shell-like pattern.

	An interface matches the pattern if it matches any of its
	clauses. If the clause begins with <cf/-/, matching interfaces are
	excluded. Patterns are parsed left-to-right, thus
	<cf/interface "eth0", -"eth*", "*";/ means eth0 and all
	non-ethernets.

	An interface option can be used more times with different
	interfaces-specific options, in that case for given interface
	the first matching interface option is used.
	
	This option is allowed in Direct, OSPF and RIP protocols,
	but in OSPF protocol it is used in <cf/area/ subsection.

	Default: none.

	Examples:

	<cf>interface "*" { type broadcast; };</cf> - start the protocol on all interfaces with
	<cf>type broadcast</cf> option.

	<cf>interface "eth1", "eth4", "eth5" { type pointopoint; };</cf> - start the protocol
	on enumerated interfaces with <cf>type pointopoint</cf> option.
	
	<cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol on all
	interfaces that have address from 192.168.0.0/16, but not
	from 192.168.1.0/24.

	<cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol on all
	interfaces that have address from 192.168.0.0/16, but not
	from 192.168.1.0/24.

	<cf>interface "eth*" 192.168.1.0/24;</cf> - start the protocol on all
	ethernet interfaces that have address from 192.168.1.0/24.

	<tag><label id="dsc-pass">password "<m/password/" [ { id <m/num/; generate from <m/time/; generate to <m/time/; accept from <m/time/; accept to <m/time/; } ]</tag>
	Specifies a password that can be used by the protocol. Password option can
	be used more times to specify more passwords. If more passwords are
	specified, it is a protocol-dependent decision which one is really
	used. Specifying passwords does not mean that authentication is
	enabled, authentication can be enabled by separate, protocol-dependent
	<cf/authentication/ option.
	
	This option is allowed in OSPF and RIP protocols. BGP has also
	<cf/password/ option, but it is slightly different and described
	separately.

	Default: none.
</descrip>

<p>Password option can contain section with some (not necessary all) password sub-options:

<descrip>
	<tag>id <M>num</M></tag>
	 ID of the password, (0-255). If it's not used, BIRD will choose
	 ID based on an order of the password item in the interface. For
	 example, second password item in one interface will have default
	 ID 2. ID is used by some routing protocols to identify which
	 password was used to authenticate protocol packets.

	<tag>generate from "<m/time/"</tag>
	 The start time of the usage of the password for packet signing.
	 The format of <cf><m/time/</cf> is <tt>dd-mm-yyyy HH:MM:SS</tt>.

	<tag>generate to "<m/time/"</tag>
	 The last time of the usage of the password for packet signing.

	<tag>accept from "<m/time/"</tag>
	 The start time of the usage of the password for packet verification.
Pavel Machek's avatar
Pavel Machek committed
394

395 396
	<tag>accept to "<m/time/"</tag>
	 The last time of the usage of the password for packet verification.
397
</descrip>
398

Pavel Machek's avatar
Pavel Machek committed
399
<chapt>Remote control
400

401
<p>You can use the command-line client <file>birdc</file> to talk with
402
a running BIRD. Communication is done using a <file/bird.ctl/ UNIX domain
403
socket (unless changed with the <tt/-s/ option given to both the server and
404 405 406
the client). The commands can perform simple actions such as enabling/disabling
of protocols, telling BIRD to show various information, telling it to
show routing table filtered by filter, or asking BIRD to
407
reconfigure. Press <tt/?/ at any time to get online help. Option
408
<tt/-v/ can be passed to the client, to make it dump numeric return
Martin Mareš's avatar
Martin Mareš committed
409
codes along with the messages. You do not necessarily need to use <file/birdc/ to talk to BIRD, your
410
own applications could do that, too -- the format of communication between
Martin Mareš's avatar
Martin Mareš committed
411
BIRD and <file/birdc/ is stable (see the programmer's documentation).
Pavel Machek's avatar
Pavel Machek committed
412

413 414 415
Many commands have the <m/name/ of the protocol instance as an argument.
This argument can be omitted if there exists only a single instance.

Pavel Machek's avatar
Pavel Machek committed
416
<p>Here is a brief list of supported functions:
417 418

<descrip>
Pavel Machek's avatar
Pavel Machek committed
419 420 421 422
	<tag>dump resources|sockets|interfaces|neighbors|attributes|routes|protocols</tag>
	Dump contents of internal data structures to the debugging output.

	<tag>show status</tag>
423
	Show router status, that is BIRD version, uptime and time from last reconfiguration.
Pavel Machek's avatar
Pavel Machek committed
424 425

	<tag>show protocols [all]</tag>
426
	Show list of protocol instances along with tables they are connected to and protocol status, possibly giving verbose information, if <cf/all/ is specified.
427

428 429 430 431 432 433 434 435 436 437 438 439 440
	<tag>show ospf interface [<m/name/] ["<m/interface/"]</tag>
	Show detailed information about OSPF interfaces.

	<tag>show ospf neighbors [<m/name/] ["<m/interface/"]</tag>
	Show a list of OSPF neighbors and a state of adjacency to them.

	<tag>show ospf state [<m/name/]</tag>
	Show detailed information about OSPF areas based on a content of link-state database.
	It shows network topology,  aggregated networks and routers from other areas and external routes.

	<tag>show ospf topology [<m/name/]</tag>
	Show a topology of OSPF areas based on a content of link-state database.
	It is just a stripped-down version of 'show ospf state'.
441

Pavel Machek's avatar
Pavel Machek committed
442
	<tag>show static [<m/name/]</tag>
443 444
	Show detailed information about static routes.

Pavel Machek's avatar
Pavel Machek committed
445
	<tag>show interfaces [summary]</tag>
446
	Show the list of interfaces. For each interface, print its type, state, MTU and addresses assigned. 
Pavel Machek's avatar
Pavel Machek committed
447 448

	<tag>show symbols</tag>
449
	Show the list of symbols defined in the configuration (names of protocols, routing tables etc.).
Pavel Machek's avatar
Pavel Machek committed
450

451
	<tag>show route [[for] <m/prefix/|<m/IP/] [table <m/sym/] [filter <m/f/|where <m/c/] [(export|preexport) <m/p/] [protocol <m/p/] [<m/options/]</tag>
Pavel Machek's avatar
Pavel Machek committed
452
	Show contents of a routing table (by default of the main one),
453
	that is routes, their metrics and (in case the <cf/all/ switch is given)
Pavel Machek's avatar
Pavel Machek committed
454 455 456 457 458 459 460 461 462 463 464 465
	all their attributes.

	<p>You can specify a <m/prefix/ if you want to print routes for a
	specific network. If you use <cf>for <m/prefix or IP/</cf>, you'll get
	the entry which will be used for forwarding of packets to the given
	destination. By default, all routes for each network are printed with
	the selected one at the top, unless <cf/primary/ is given in which case
	only the selected route is shown.

	<p>You can also ask for printing only routes processed and accepted by
	a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ }
	</cf> or matching a given condition (<cf>where <m/condition/</cf>).
466 467 468
	The <cf/export/ and <cf/preexport/ switches ask for printing of entries
	that are exported to the specified protocol. With <cf/preexport/, the
	export filter of the protocol is skipped.
Pavel Machek's avatar
Pavel Machek committed
469

470 471 472
	<p>You can also select just routes added by a specific protocol.
	<cf>protocol <m/p/</cf>.

Pavel Machek's avatar
Pavel Machek committed
473 474 475 476 477
	<p>The <cf/stats/ switch requests showing of route statistics (the
	number of networks, number of routes before and after filtering). If
	you use <cf/count/ instead, only the statistics will be printed.

	<tag>enable|disable|restart <m/name/|"<m/pattern/"|all</tag>
478
	Enable, disable or restart a given protocol instance, instances matching the <cf><m/pattern/</cf> or <cf/all/ instances.
Pavel Machek's avatar
Pavel Machek committed
479

Ondřej Zajíček's avatar
Ondřej Zajíček committed
480 481 482 483 484
	<tag>configure [soft] ["<m/config file/"]</tag>
	Reload configuration from a given file. BIRD will smoothly
	switch itself to the new configuration, protocols are
	reconfigured if possible, restarted otherwise. Changes in
	filters usualy lead to restart of affected protocols. If
485
	<cf/soft/ option is used, changes in filters does not cause
Ondřej Zajíček's avatar
Ondřej Zajíček committed
486 487 488 489
	BIRD to restart affected protocols, therefore already accepted
	routes (according to old filters) would be still propagated,
	but new routes would be processed according to the new
	filters.
Pavel Machek's avatar
Pavel Machek committed
490 491 492

	<tag/down/
	Shut BIRD down.
493

Pavel Machek's avatar
Pavel Machek committed
494
	<tag>debug <m/protocol/|<m/pattern/|all all|off|{ states | routes | filters | events | packets }</tag>
495 496
	Control protocol debugging.
</descrip>
497

498
<chapt>Filters
499

500
<sect>Introduction
501

502 503 504 505
<p>BIRD contains a simple programming language. (No, it can't yet read mail :-). There are
two objects in this language: filters and functions. Filters are interpreted by BIRD core when a route is
being passed between protocols and routing tables. The filter language contains control structures such
as if's and switches, but it allows no loops. An example of a filter using many features can be found in <file>filter/test.conf</file>. 
506

507 508
<p>Filter gets the route, looks at its attributes and
modifies some of them if it wishes. At the end, it decides whether to
509
pass the changed route through (using <cf/accept/) or whether to <cf/reject/ it. A simple filter looks
510
like this:
511

512
<code>
513 514 515 516 517 518 519 520 521 522 523 524 525 526
filter not_too_far
int var;
{
	if defined( rip_metric ) then
		var = rip_metric;
	else {
		var = 1;
		rip_metric = 1;
	}
	if rip_metric &gt; 10 then
		reject "RIP metric is too big";
	else
		accept "ok";
}
527
</code>
528

529
<p>As you can see, a filter has a header, a list of local variables, and a body. The header consists of
530 531 532 533 534 535 536 537
the <cf/filter/ keyword followed by a (unique) name of filter. The list of local variables consists of
<cf><M>type name</M>;</cf> pairs where each pair defines one local variable. The body consists of
<cf> { <M>statements</M> }</cf>. Each <m/statement/ is terminated by a <cf/;/. You can group
several statements to a single compound statement by using braces (<cf>{ <M>statements</M> }</cf>) which is useful if
you want to make a bigger block of code conditional.

<p>BIRD supports functions, so that you don't have to repeat the same blocks of code over and
over. Functions can have zero or more parameters and they can have local variables. Recursion is not allowed. Function definitions
538
look like this:
539 540 541 542 543 544 545 546 547 548 549 550 551 552

<code>
function name ()
int local_variable;
{
	local_variable = 5;
}

function with_parameters (int parameter)
{
	print parameter;
}
</code>

553
<p>Unlike in C, variables are declared after the <cf/function/ line, but before the first <cf/{/. You can't declare
554
variables in nested blocks. Functions are called like in C: <cf>name();
555
with_parameters(5);</cf>. Function may return values using the <cf>return <m/[expr]/</cf>
556
command. Returning a value exits from current function (this is similar to C).
557

558
<p>Filters are declared in a way similar to functions except they can't have explicit
559
parameters. They get a route table entry as an implicit parameter, it is also passed automatically 
560
to any functions called. The filter must terminate with either
561
<cf/accept/ or <cf/reject/ statement. If there's a runtime error in filter, the route
562
is rejected. 
563

564 565
<p>A nice trick to debug filters is to use <cf>show route filter
<m/name/</cf> from the command line client. An example session might look
Pavel Machek's avatar
Pavel Machek committed
566 567 568 569 570 571 572 573 574 575
like:

<code>
pavel@bug:~/bird$ ./birdc -s bird.ctl
BIRD 0.0.0 ready.
bird> show route
10.0.0.0/8         dev eth0 [direct1 23:21] (240)
195.113.30.2/32    dev tunl1 [direct1 23:21] (240)
127.0.0.0/8        dev lo [direct1 23:21] (240)
bird> show route ?
576
show route [<prefix>] [table <t>] [filter <f>] [all] [primary]...
Martin Mareš's avatar
Martin Mareš committed
577
bird> show route filter { if 127.0.0.5 &tilde; net then accept; }
Pavel Machek's avatar
Pavel Machek committed
578 579 580 581
127.0.0.0/8        dev lo [direct1 23:21] (240)
bird>
</code>

582
<sect>Data types
583

584
<p>Each variable and each value has certain type. Booleans, integers and enums are
585
incompatible with each other (that is to prevent you from shooting in the foot).
586 587

<descrip>
588
	<tag/bool/ This is a boolean type, it can have only two values, <cf/true/ and
589
	  <cf/false/. Boolean is the only type you can use in <cf/if/
590
	  statements.
591

592 593
	<tag/int/ This is a general integer type, you can expect it to store signed values from -2000000000
	  to +2000000000. Overflows are not checked. You can use <cf/0x1234/ syntax to write hexadecimal values.
594

595
	<tag/pair/ This is a pair of two short integers. Each component can have values from 0 to
596 597
	  65535. Literals of this type are written as <cf/(1234,5678)/. The same syntax can also be
	  used to construct a pair from two arbitrary integer expressions (for example <cf/(1+2,a)/).
598

599 600 601
	<tag/string/ This is a string of characters. There are no ways to modify strings in
	  filters. You can pass them between functions, assign them to variables of type <cf/string/, print
	  such variables, but you can't concatenate two strings. String literals
602
	  are written as <cf/"This is a string constant"/.
603

604
	<tag/ip/ This type can hold a single IP address. Depending on the compile-time configuration of BIRD you are using, it
Pavel Machek's avatar
Pavel Machek committed
605
	  is either an IPv4 or IPv6 address. IP addresses are written in the standard notation (<cf/10.20.30.40/ or <cf/fec0:3:4::1/). You can apply special operator <cf>.mask(<M>num</M>)</cf>
606
	  on values of type ip. It masks out all but first <cf><M>num</M></cf> bits from the IP
Pavel Machek's avatar
Pavel Machek committed
607
	  address. So <cf/1.2.3.4.mask(8) = 1.0.0.0/ is true.
608

609
	<tag/prefix/ This type can hold a network prefix consisting of IP address and prefix length. Prefix literals are written as
610
	  <cf><M>ipaddress</M>/<M>pxlen</M></cf>, or
611 612 613 614
	  <cf><m>ipaddress</m>/<m>netmask</m></cf>. There are two special
	  operators on prefixes:
	  <cf/.ip/ which extracts the IP address from the pair, and <cf/.len/, which separates prefix
	  length from the pair. So <cf>1.2.0.0/16.pxlen = 16</cf> is true.
615

616
	<tag/int|ip|prefix|pair|enum set/
617 618
	  Filters recognize four types of sets. Sets are similar to strings: you can pass them around
	  but you can't modify them. Literals of type <cf>set int</cf> look like <cf>
619
	  [ 1, 2, 5..7 ]</cf>. As you can see, both simple values and ranges are permitted in
620 621 622 623
	  sets.

	  Sets of prefixes are special: their literals does not allow ranges, but allows
	  prefix patterns that are written as <cf><M>ipaddress</M>/<M>pxlen</M>{<M>low</M>,<M>high</M>}</cf>.
624 625 626
	  Prefix <cf><m>ip1</m>/<m>len1</m></cf> matches prefix pattern <cf><m>ip2</m>/<m>len2</m>{<m>l</m>,<m>h</m>}</cf> iff 
	  the first <cf>min(len1, len2)</cf> bits of <cf/ip1/ and <cf/ip2/ are identical and <cf>len1 &lt;= ip1 &lt;= len2</cf>.
	  A valid prefix pattern has to satisfy <cf>low &lt;= high</cf>, but <cf/pxlen/ is not constrained by <cf/low/
627 628 629 630
	  or <cf/high/. Obviously, a prefix matches a prefix set literal iff it matches any prefix pattern in the
	  prefix set literal.

	  There are also two shorthands for prefix patterns: <cf><m>address</m>/<m/len/+</cf> is a shorthand for
631
	  <cf><m>address</m>/<m/len/{<m/len/,<m/maxlen/}</cf> (where <cf><m>maxlen</m></cf> is 32 for IPv4 and 128 for IPv6), 
Ondřej Zajíček's avatar
Ondřej Zajíček committed
632 633 634
	  that means network prefix <cf><m>address</m>/<m/len/</cf> and all its subnets. <cf><m>address</m>/<m/len/-</cf>
	  is a shorthand for <cf><m>address</m>/<m/len/{0,<m/len/}</cf>, that means network prefix <cf><m>address</m>/<m/len/</cf>
	  and all its supernets (network prefixes that contain it).
635 636 637 638 639

	  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} ]</cf> matches
	  prefix <cf>1.0.0.0/8</cf>, all subprefixes of <cf>2.0.0.0/8</cf>, all superprefixes of <cf>3.0.0.0/8</cf> and prefixes
	  <cf/4.X.X.X/ whose prefix length is 16 to 24. <cf>[ 0.0.0.0/0{20,24} ]</cf> matches all prefixes (regardless of
	  IP address) whose prefix length is 20 to 24, <cf>[ 1.2.3.4/32- ]</cf> matches any prefix that contains IP address
640
	  <cf>1.2.3.4</cf>. <cf>1.2.0.0/16 &tilde; [ 1.0.0.0/8{15,17} ]</cf> is true,
641 642 643 644 645 646
	  but <cf>1.0.0.0/16 &tilde; [ 1.0.0.0/8- ]</cf> is false.

	  Cisco-style patterns like <cf>10.0.0.0/8 ge 16 le 24</cf> can be expressed
	  in Bird as <cf>10.0.0.0/8{16,24}</cf>, <cf>192.168.0.0/16 le 24</cf> as 
	  <cf>192.168.0.0/16{16,24}</cf> and <cf>192.168.0.0/16 ge 24</cf> as
	  <cf>192.168.0.0/16{24,32}</cf>.
647 648

	<tag/enum/
Martin Mareš's avatar
Martin Mareš committed
649
	  Enumeration types are fixed sets of possibilities. You can't define your own
650
	  variables of such type, but some route attributes are of enumeration
651
	  type. Enumeration types are incompatible with each other.
652 653

	<tag/bgppath/
654
	  BGP path is a list of autonomous system numbers. You can't write literals of this type.
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
	  There are several special operators on bgppaths:

	  <cf><m/P/.first</cf> returns the first ASN (the neighbor ASN) in path <m/P/.

          <cf><m/P/.last</cf> returns the last ASN (the source ASN) in path <m/P/.

	  Both <cf/first/ and <cf/last/ return zero if there is no appropriate ASN,
          for example if the path contains an AS set element as the first (or the last) part.

          <cf><m/P/.len</cf> returns the length of path <m/P/.

          <cf>prepend(<m/P/,<m/A/)</cf> prepends ASN <m/A/ to path <m/P/ and returns the result.
          Statement <cf><m/P/ = prepend(<m/P/, <m/A/);</cf> can be shortened to
          <cf><m/P/.prepend(<m/A/);</cf> if <m/P/ is appropriate route attribute
          (for example <cf/bgp_path/).
670

Pavel Machek's avatar
Pavel Machek committed
671 672
	<tag/bgpmask/
	  BGP masks are patterns used for BGP path matching
673
	  (using <cf>path &tilde; [= 2 3 5 * =]</cf> syntax). The masks
Pavel Machek's avatar
Pavel Machek committed
674
	  resemble wildcard patterns as used by UNIX shells. Autonomous
Ondřej Zajíček's avatar
Ondřej Zajíček committed
675
	  system numbers match themselves, <cf/*/ matches any (even empty)
676 677
	  sequence of arbitrary AS numbers and <cf/?/ matches one arbitrary AS number.
	  For example, if <cf>bgp_path</cf> is 4 3 2 1, then:
678 679
	  <tt>bgp_path &tilde; [= * 4 3 * =]</tt> is true, but 
	  <tt>bgp_path &tilde; [= * 4 5 * =]</tt> is false.
680 681
	  BGP mask expressions can also contain integer expressions enclosed in parenthesis
	  and integer variables, for example <tt>[= * 4 (1+2) a =]</tt>.
682
	  There is also old syntax that uses / .. / instead of [= .. =] and ? instead of *.
683

684
	<tag/clist/ 
685
	  Community list is similar to set of pairs,
686
	  except that unlike other sets, it can be modified.
687
	  There exist no literals of this type.
688 689 690 691 692 693 694 695 696
	  There are two special operators on clists:

          <cf>add(<m/C/,<m/P/)</cf> adds pair <m/P/ to clist <m/C/ and returns the result.

          <cf>delete(<m/C/,<m/P/)</cf> deletes pair <m/P/ from clist <m/C/ and returns the result.

          Statement <cf><m/C/ = add(<m/C/, <m/P/);</cf> can be shortened to
          <cf><m/C/.add(<m/P/);</cf> if <m/C/ is appropriate route attribute
          (for example <cf/bgp_community/). Similarly for <cf/delete/.
697

698 699
</descrip>

700
<sect>Operators
701

702
<p>The filter language supports common integer operators <cf>(+,-,*,/)</cf>, parentheses <cf/(a*(b+c))/, comparison
Martin Mareš's avatar
Martin Mareš committed
703
<cf/(a=b, a!=b, a&lt;b, a&gt;=b)/. Logical operations include unary not (<cf/!/), and (<cf/&amp;&amp;/) and or (<cf/&verbar;&verbar;/). 
704
Special operators include <cf/&tilde;/ for "is element of a set" operation - it can be
705 706
used on element and set of elements of the same type (returning true if element is contained in the given set), or
on two strings (returning true if first string matches a shell-like pattern stored in second string) or on IP and prefix (returning true if IP is within the range defined by that prefix), or on
707
prefix and prefix (returning true if first prefix is more specific than second one) or on bgppath and bgpmask (returning true if the path matches the mask) or on pair and clist (returning true if the community is element of the community list).
708

709

710
<sect>Control structures
711

712 713
<p>Filters support two control structures: conditions and case switches. 

714
<p>Syntax of a condition is: <cf>if
715
<M>boolean expression</M> then <M>command1</M>; else <M>command2</M>;</cf> and you can use <cf>{
716 717
<M>command_1</M>; <M>command_2</M>; <M>...</M> }</cf> instead of either command. The <cf>else</cf>
clause may be omitted. If the <cf><m>boolean expression</m></cf> is true, <cf><m>command1</m></cf> is executed, otherwise <cf><m>command2</m></cf> is executed.
718

719 720 721 722 723
<p>The <cf>case</cf> is similar to case from Pascal. Syntax is <cf>case <m/expr/ { else |
<m/num_or_prefix [ .. num_or_prefix]/: <m/statement/ ; [ ... ] }</cf>. The expression after
<cf>case</cf> can be of any type which can be on the left side of the &tilde; operator and anything that could
be a member of a set is allowed before <cf/:/. Multiple commands are allowed without <cf/{}/ grouping.
If <cf><m/expr/</cf> matches one of the <cf/:/ clauses, statements between it and next <cf/:/ statement are executed. If <cf><m/expr/</cf> matches neither of the <cf/:/ clauses, the statements after <cf/else:/ are executed.
724

725
<p>Here is example that uses <cf/if/ and <cf/case/ structures:
Pavel Machek's avatar
Pavel Machek committed
726 727 728 729 730 731

<code>
case arg1 {
	2: print "two"; print "I can do more commands without {}";
	3 .. 5: print "three to five";
	else: print "something else";
732
}
Pavel Machek's avatar
Pavel Machek committed
733

Pavel Machek's avatar
Pavel Machek committed
734 735 736 737
if 1234 = i then printn "."; else { 
  print "not 1234"; 
  print "You need {} around multiple commands"; 
}
Pavel Machek's avatar
Pavel Machek committed
738 739
</code>

740
<sect>Route attributes
741

742 743
<p>A filter is implicitly passed a route, and it can access its
attributes just like it accesses variables. Attempts to access undefined
744
attribute result in a runtime error; you can check if an attribute is
745
defined by using the <cf>defined( <m>attribute</m> )</cf> operator.
746

747
<descrip>
Martin Mareš's avatar
Martin Mareš committed
748
	<tag><m/prefix/ net</tag>
749
	Network the route is talking about. Read-only. (See the chapter about routing tables.)
750 751

	<tag><m/enum/ scope</tag>
Pavel Machek's avatar
Pavel Machek committed
752
	Address scope of the network (<cf/SCOPE_HOST/ for addresses local to this host, <cf/SCOPE_LINK/ for those specific for a physical link, <cf/SCOPE_SITE/ and <cf/SCOPE_ORGANIZATION/ for private addresses, <cf/SCOPE_UNIVERSE/ for globally visible addresses).
753

Martin Mareš's avatar
Martin Mareš committed
754
	<tag><m/int/ preference</tag>
755
	Preference of the route. Valid values are 0-65535. (See the chapter about routing tables.)
Pavel Machek's avatar
Pavel Machek committed
756

Martin Mareš's avatar
Martin Mareš committed
757
	<tag><m/ip/ from</tag>
758
	The router which the route has originated from. Read-only.
759
	
Martin Mareš's avatar
Martin Mareš committed
760
	<tag><m/ip/ gw</tag>
761
	Next hop packets routed using this route should be forwarded to.
762

763 764 765
	<tag><m/string/ proto</tag>
	The name of the protocol which the route has been imported from. Read-only.

Martin Mareš's avatar
Martin Mareš committed
766
	<tag><m/enum/ source</tag>
767
	what protocol has told me about this route. Possible values: <cf/RTS_DUMMY/, <cf/RTS_STATIC/, <cf/RTS_INHERIT/, <cf/RTS_DEVICE/, <cf/RTS_STATIC_DEVICE/, <cf/RTS_REDIRECT/, <cf/RTS_RIP/, <cf/RTS_OSPF/, <cf/RTS_OSPF_IA/, <cf/RTS_OSPF_EXT/, <cf/RTS_BGP/, <cf/RTS_PIPE/.
Pavel Machek's avatar
Pavel Machek committed
768

Martin Mareš's avatar
Martin Mareš committed
769
	<tag><m/enum/ cast</tag>
770
	Route type (<cf/RTC_UNICAST/ for normal routes, <cf/RTC_BROADCAST/, <cf/RTC_MULTICAST/, <cf/RTC_ANYCAST/ for broadcast, multicast and anycast routes). Read-only.
Pavel Machek's avatar
Pavel Machek committed
771

Martin Mareš's avatar
Martin Mareš committed
772
	<tag><m/enum/ dest</tag>
Pavel Machek's avatar
Pavel Machek committed
773
	Type of destination the packets should be sent to (<cf/RTD_ROUTER/ for forwarding to a neighboring router, <cf/RTD_NETWORK/ for routing to a directly-connected network, <cf/RTD_BLACKHOLE/ for packets to be silently discarded, <cf/RTD_UNREACHABLE/, <cf/RTD_PROHIBIT/ for packets that should be returned with ICMP host unreachable / ICMP administratively prohibited messages). Read-only.
Pavel Machek's avatar
Pavel Machek committed
774
</descrip>
775

776
<p>There also exist some protocol-specific attributes which are described in the corresponding protocol sections.
777

778
<sect>Other statements
779

780
<p>The following statements are available:
781 782

<descrip>
783
	<tag><m/variable/ = <m/expr/</tag> Set variable to a given value.
784

785
	<tag>accept|reject [ <m/expr/ ]</tag> Accept or reject the route, possibly printing <cf><m>expr</m></cf>.
786

787
	<tag>return <m/expr/</tag> Return <cf><m>expr</m></cf> from the current function, the function ends at this point.
788

789 790 791
	<tag>print|printn <m/expr/ [<m/, expr.../]</tag>
	Prints given expressions; useful mainly while debugging
	filters. The <cf/printn/ variant does not terminate the line.
792 793

	<tag>quitbird</tag>
794
	Terminates BIRD. Useful when debugging the filter interpreter.
795 796
</descrip>

797
<chapt>Protocols
798

799
<sect>BGP
Martin Mareš's avatar
Martin Mareš committed
800

801
<p>The Border Gateway Protocol is the routing protocol used for backbone
Pavel Machek's avatar
Pavel Machek committed
802
level routing in the today's Internet. Contrary to the other protocols, its convergence
803 804 805 806 807 808
doesn't rely on all routers following the same rules for route selection,
making it possible to implement any routing policy at any router in the
network, the only restriction being that if a router advertises a route,
it must accept and forward packets according to it.

<p>BGP works in terms of autonomous systems (often abbreviated as AS). Each
Pavel Machek's avatar
Pavel Machek committed
809 810
AS is a part of the network with common management and common routing policy. It is identified by a unique 16-bit number.
Routers within each AS usually communicate with each other using either a interior routing
811 812 813 814 815
protocol (such as OSPF or RIP) or an interior variant of BGP (called iBGP).
Boundary routers at the border of the AS communicate with their peers
in the neighboring AS'es via exterior BGP (eBGP).

<p>Each BGP router sends to its neighbors updates of the parts of its
Pavel Machek's avatar
Pavel Machek committed
816 817
routing table it wishes to export along with complete path information
(a list of AS'es the packet will travel through if it uses the particular
818 819
route) in order to avoid routing loops.

Martin Mareš's avatar
Martin Mareš committed
820
<p>BIRD supports all requirements of the BGP4 standard as defined in
821 822 823 824 825 826 827 828 829
RFC 4271<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc4271.txt">
It also supports the community attributes
(RFC 1997<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc1997.txt">),
capability negotiation
(RFC 3392<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc3392.txt">),
MD5 password authentication
(RFC 2385<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc2385.txt">),
route reflectors 
(RFC 4456<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc4456.txt">),
830 831
multiprotocol extensions
(RFC 4760<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc4760.txt">),
832 833 834 835
and 4B AS numbers 
(RFC 4893<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc4893.txt">).


Martin Mareš's avatar
Martin Mareš committed
836 837 838
For IPv6, it uses the standard multiprotocol extensions defined in
RFC 2283<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc2283.txt">
including changes described in the
Pavel Machek's avatar
Pavel Machek committed
839
latest draft<htmlurl url="ftp://ftp.rfc-editor.org/internet-drafts/draft-ietf-idr-bgp4-multiprotocol-v2-05.txt">
Martin Mareš's avatar
Martin Mareš committed
840 841 842
and applied to IPv6 according to
RFC 2545<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc2545.txt">.

843
<sect1>Route selection rules
Martin Mareš's avatar
Martin Mareš committed
844 845 846

<p>BGP doesn't have any simple metric, so the rules for selection of an optimal
route among multiple BGP routes with the same preference are a bit more complex
Pavel Machek's avatar
Pavel Machek committed
847
and they are implemented according to the following algorithm. It starts the first
Martin Mareš's avatar
Martin Mareš committed
848 849 850 851
rule, if there are more "best" routes, then it uses the second rule to choose
among them and so on.

<itemize>
Pavel Machek's avatar
Pavel Machek committed
852
	<item>Prefer route with the highest Local Preference attribute.
Martin Mareš's avatar
Martin Mareš committed
853 854 855
	<item>Prefer route with the shortest AS path.
	<item>Prefer IGP origin over EGP and EGP over incomplete.
	<item>Prefer the lowest value of the Multiple Exit Discriminator.
Pavel Machek's avatar
Pavel Machek committed
856 857
	<item>Prefer internal routes over external ones.
	<item>Prefer the route with the lowest value of router ID of the
Martin Mareš's avatar
Martin Mareš committed
858 859
	advertising router.
</itemize>
860

861
<sect1>Configuration
862

Martin Mareš's avatar
Martin Mareš committed
863
<p>Each instance of the BGP corresponds to one neighboring router.
Pavel Machek's avatar
Pavel Machek committed
864 865
This allows to set routing policy and all the other parameters differently
for each neighbor using the following configuration parameters:
Martin Mareš's avatar
Martin Mareš committed
866 867 868 869 870 871 872

<descrip>
	<tag>local as <m/number/</tag> Define which AS we are part of. (Note that
	contrary to other IP routers, BIRD is able to act as a router located
	in multiple AS'es simultaneously, but in such cases you need to tweak
	the BGP paths manually in the filters to get consistent behavior.)
	This parameter is mandatory.
Pavel Machek's avatar
Pavel Machek committed
873

Martin Mareš's avatar
Martin Mareš committed
874 875 876
	<tag>neighbor <m/ip/ as <m/number/</tag> Define neighboring router
	this instance will be talking to and what AS it's located in. Unless
	you use the <cf/multihop/ clause, it must be directly connected to one
Martin Mareš's avatar
Martin Mareš committed
877 878
	of your router's interfaces. In case the neighbor is in the same AS
	as we are, we automatically switch to iBGP. This parameter is mandatory.
Pavel Machek's avatar
Pavel Machek committed
879

Martin Mareš's avatar
Martin Mareš committed
880 881 882 883
	<tag>multihop <m/number/ via <m/ip/</tag> Configure multihop BGP to a
	neighbor which is connected at most <m/number/ hops far and to which
	we should route via our direct neighbor with address <m/ip/.
	Default: switched off.
Pavel Machek's avatar
Pavel Machek committed
884

Martin Mareš's avatar
Martin Mareš committed
885 886 887 888 889
	<tag>next hop self</tag> Avoid calculation of the Next Hop attribute
	and always advertise our own source address (see below) as a next hop.
	This needs to be used only
	occasionally to circumvent misconfigurations of other routers.
	Default: disabled.
Pavel Machek's avatar
Pavel Machek committed
890

Martin Mareš's avatar
Martin Mareš committed
891 892 893
	<tag>source address <m/ip/</tag> Define local address we should use
	for next hop calculation. Default: the address of the local end
	of the interface our neighbor is connected to.
Pavel Machek's avatar
Pavel Machek committed
894

895
	<tag>password <m/string/</tag> Use this password for MD5 authentication
896 897
	of BGP sessions. Default: no authentication. Password has to be set by
	external utility (e.g. setkey(8)) on BSD systems.
898

Ondřej Zajíček's avatar
Ondřej Zajíček committed
899 900 901 902 903
	<tag>passive <m/switch/</tag> Standard BGP behavior is both
        initiating outgoing connections and accepting incoming
        connections. In passive mode, outgoing connections are not
        initiated. Default: off.

904 905
	<tag>rr client</tag> Be a route reflector and treat the neighbor as
	a route reflection client. Default: disabled.
906 907 908 909 910

	<tag>rr cluster id <m/IPv4 address/</tag> Route reflectors use cluster id
	to avoid route reflection loops. When there is one route reflector in a cluster
	it usually uses its router id as a cluster id, but when there are more route
	reflectors in a cluster, these need to be configured (using this option) to
Ondřej Zajíček's avatar
Ondřej Zajíček committed
911 912
	use a common cluster id. Clients in a cluster need not know their cluster
	id and this option is not allowed for them. Default: the same as router id.
913

914 915 916 917 918 919 920 921 922
	<tag>rs client</tag> Be a route server and treat the neighbor
	as a route server client. A route server is used as a
	replacement for full mesh EBGP routing in Internet exchange
	points in a similar way to route reflectors used in IBGP routing.
	Bird does not implement obsoleted RFC 1863, but uses ad-hoc implementation,
	which behaves like plain EBGP but reduces modifications to advertised route
	attributes to be transparent (for example does not prepend its AS number to
	AS PATH attribute and keep MED attribute). Default: disabled.

923 924 925 926 927 928 929 930
	<tag>enable as4 <m/switch/</tag> BGP protocol was designed to use 2B AS numbers
	and was extended later to allow 4B AS number. BIRD supports 4B AS extension,
	but by disabling this option it can be persuaded not to advertise it and
	to maintain old-style sessions with its neighbors. This might be useful for
	circumventing bugs in neighbor's implementation of 4B AS extension.
	Even when disabled (off), BIRD behaves internally as AS4-aware BGP router.
	Default: on.

931 932 933 934 935 936 937 938 939 940 941 942 943
	<tag>capabilities <m/switch/</tag> Use capability advertisement
	to advertise optional capabilities. This is standard behavior
	for newer BGP implementations, but there might be some older
	BGP implementations that reject such connection attempts.
	When disabled (off), features that request it (4B AS support)
	are also disabled. Default: on, with automatic fallback to
	off when received capability-related error.

	<tag>advertise ipv4 <m/switch/</tag> Advertise IPv4 multiprotocol capability.
	This is not a correct behavior according to the strict interpretation
	of RFC 4760, but it is widespread and required by some BGP
	implementations (Cisco and Quagga). This option is relevant
	to IPv4 mode with enabled capability advertisement only. Default: on.
944

945 946 947 948
	<tag>route limit <m/number/</tag> The maximal number of routes
	that may be imported from the protocol. If the route limit is
	exceeded, the connection is closed with error. Default: no limit.

Martin Mareš's avatar
Martin Mareš committed
949 950
	<tag>disable after error <m/switch/</tag> When an error is encountered (either
	locally or by the other side), disable the instance automatically
Pavel Machek's avatar
Pavel Machek committed
951 952 953
	and wait for an administrator to fix the problem manually. Default: off.

	<tag>hold time <m/number/</tag> Time in seconds to wait for a Keepalive
Martin Mareš's avatar
Martin Mareš committed
954 955 956
	message from the other side before considering the connection stale.
	Default: depends on agreement with the neighboring router, we prefer
	240 seconds if the other side is willing to accept it.
Pavel Machek's avatar
Pavel Machek committed
957

Martin Mareš's avatar
Martin Mareš committed
958
	<tag>startup hold time <m/number/</tag> Value of the hold timer used
Pavel Machek's avatar
Pavel Machek committed
959
	before the routers have a chance to exchange open messages and agree
Martin Mareš's avatar
Martin Mareš committed
960
	on the real value. Default: 240 seconds.
Pavel Machek's avatar
Pavel Machek committed
961

Martin Mareš's avatar
Martin Mareš committed
962
	<tag>keepalive time <m/number/</tag> Delay in seconds between sending
Pavel Machek's avatar
Pavel Machek committed
963 964
	of two consecutive Keepalive messages. Default: One third of the hold time.

Martin Mareš's avatar
Martin Mareš committed
965
	<tag>connect retry time <m/number/</tag> Time in seconds to wait before
Pavel Machek's avatar
Pavel Machek committed
966 967
	retrying a failed attempt to connect. Default: 120 seconds.

Martin Mareš's avatar
Martin Mareš committed
968
	<tag>start delay time <m/number/</tag> Delay in seconds between protocol
Pavel Machek's avatar
Pavel Machek committed
969 970 971 972
	startup and the first attempt to connect. Default: 5 seconds.

	<tag>error wait time <m/number/,<m/number/</tag> Minimum and maximum delay in seconds between a protocol
	failure (either local or reported by the peer) and automatic restart.
Martin Mareš's avatar
Martin Mareš committed
973 974
	Doesn't apply when <cf/disable after error/ is configured. If consecutive
	errors happen, the delay is increased exponentially until it reaches the maximum. Default: 60, 300.
Pavel Machek's avatar
Pavel Machek committed
975

Martin Mareš's avatar
Martin Mareš committed
976 977 978
	<tag>error forget time <m/number/</tag> Maximum time in seconds between two protocol
	failures to treat them as a error sequence which makes the <cf/error wait time/
	increase exponentially. Default: 300 seconds.
Pavel Machek's avatar
Pavel Machek committed
979

Martin Mareš's avatar
Martin Mareš committed
980 981
	<tag>path metric <m/switch/</tag> Enable comparison of path lengths
	when deciding which BGP route is the best one. Default: on.
Pavel Machek's avatar
Pavel Machek committed
982

Martin Mareš's avatar
Martin Mareš committed
983 984
	<tag>default bgp_med <m/number/</tag> Value of the Multiple Exit
	Discriminator to be used during route selection when the MED attribute
985
	is missing. Default: 0.
Pavel Machek's avatar
Pavel Machek committed
986

Martin Mareš's avatar
Martin Mareš committed
987 988 989 990 991
	<tag>default bgp_local_pref <m/number/</tag> Value of the Local Preference
	to be used during route selection when the Local Preference attribute
	is missing. Default: 0.
</descrip>

992
<sect1>Attributes
993

Pavel Machek's avatar
Pavel Machek committed
994
<p>BGP defines several route attributes. Some of them (those marked with `<tt/I/' in the
Martin Mareš's avatar
Martin Mareš committed
995
table below) are available on internal BGP connections only, some of them (marked
Pavel Machek's avatar
Pavel Machek committed
996
with `<tt/O/') are optional.
Martin Mareš's avatar
Martin Mareš committed
997 998

<descrip>
999
	<tag>bgppath <cf/bgp_path/</tag> Sequence of AS numbers describing the AS path
Pavel Machek's avatar
Pavel Machek committed
1000 1001 1002
	the packet will travel through when forwarded according to the particular route. In case of 
	internal BGP it doesn't contain the number of the local AS.

Martin Mareš's avatar
Martin Mareš committed
1003 1004 1005
	<tag>int <cf/bgp_local_pref/ [I]</tag> Local preference value used for
	selection among multiple BGP routes (see the selection rules above). It's
	used as an additional metric which is propagated through the whole local AS.
Pavel Machek's avatar
Pavel Machek committed
1006

1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
	<tag>int <cf/bgp_med/ [O]</tag> The Multiple Exit Discriminator of the route
	is an optional attribute which is used on on external (inter-AS) links to
	convey to an adjacent AS the optimal entry point into the local AS.
	The received attribute may be also propagated over internal BGP links
	(and this is default behavior). The attribute value is zeroed when a route
	is exported from a routing table to a BGP instance to ensure that the attribute
	received from a neighboring AS is not propagated to other neighboring ASes.
	A new value might be set in the export filter of a BGP instance.
	See RFC 4451<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc4451.txt">
	for further discussion of BGP MED attribute.
Pavel Machek's avatar
Pavel Machek committed
1017 1018 1019 1020 1021

	<tag>enum <cf/bgp_origin/</tag> Origin of the route: either <cf/ORIGIN_IGP/
	if the route has originated in an interior routing protocol or
	<cf/ORIGIN_EGP/ if it's been imported from the <tt>EGP</tt> protocol
	(nowadays it seems to be obsolete) or <cf/ORIGIN_INCOMPLETE/ if the origin
Martin Mareš's avatar
Martin Mareš committed
1022
	is unknown.
Pavel Machek's avatar
Pavel Machek committed
1023

Martin Mareš's avatar
Martin Mareš committed
1024 1025 1026 1027 1028 1029
	<tag>ip <cf/bgp_next_hop/</tag> Next hop to be used for forwarding of packets
	to this destination. On internal BGP connections, it's an address of the
	originating router if it's inside the local AS or a boundary router the
	packet will leave the AS through if it's an exterior route, so each BGP
	speaker within the AS has a chance to use the shortest interior path
	possible to this point.
Pavel Machek's avatar
Pavel Machek committed
1030

Martin Mareš's avatar
Martin Mareš committed
1031
	<tag>void <cf/bgp_atomic_aggr/ [O]</tag> This is an optional attribute
Pavel Machek's avatar
Pavel Machek committed
1032 1033
	which carries no value, but the sole presence of which indicates that the route
	has been aggregated from multiple routes by some router on the path from
Martin Mareš's avatar
Martin Mareš committed
1034
	the originator.
Pavel Machek's avatar
Pavel Machek committed
1035

Martin Mareš's avatar
Martin Mareš committed
1036 1037 1038 1039 1040
<!-- we don't handle aggregators right since they are of a very obscure type
	<tag>bgp_aggregator</tag>
-->
	<tag>clist <cf/bgp_community/ [O]</tag> List of community values associated
	with the route. Each such value is a pair (represented as a <cf/pair/ data
Pavel Machek's avatar
Pavel Machek committed
1041 1042
	type inside the filters) of 16-bit integers, the first of them containing the number of the AS which defines
	the community and the second one being a per-AS identifier. There are lots
Martin Mareš's avatar
Martin Mareš committed
1043 1044
	of uses of the community mechanism, but generally they are used to carry
	policy information like "don't export to USA peers". As each AS can define
1045
	its own routing policy, it also has a complete freedom about which community
Pavel Machek's avatar
Pavel Machek committed
1046
	attributes it defines and what will their semantics be.
Martin Mareš's avatar
Martin Mareš committed
1047 1048
</descrip>

1049
<sect1>Example
1050

Martin Mareš's avatar
Martin Mareš committed
1051 1052
<p><code>
protocol bgp {
1053 1054 1055 1056 1057
	local as 65000;			     # Use a private AS number
	neighbor 62.168.0.130 as 5588;	     # Our neighbor ...
	multihop 20 via 62.168.0.13;	     # ... which is connected indirectly
	export filter {			     # We use non-trivial export rules
		if source = RTS_STATIC then { # Export only static routes
1058 1059 1060
		        # Assign our community
			bgp_community.add((65000,5678));
			# Artificially increase path length
Pavel Machek's avatar
Pavel Machek committed
1061
			# by advertising local AS number twice
Ondřej Zajíček's avatar
Ondřej Zajíček committed
1062
			if bgp_path ~ [= 65000 =] then	  
1063
				bgp_path.prepend(65000);  
Martin Mareš's avatar
Martin Mareš committed
1064 1065 1066 1067 1068
			accept;
		}
		reject;
	};
	import all;
1069
	source address 62.168.0.1;	# Use a non-standard source address
Martin Mareš's avatar
Martin Mareš committed
1070 1071 1072
}
</code>

1073
<sect>Device
Martin Mareš's avatar
Martin Mareš committed
1074

Pavel Machek's avatar
Pavel Machek committed
1075 1076
<p>The Device protocol is not a real routing protocol.  It doesn't generate
any routes and it only serves as a module for getting information about network
1077 1078
interfaces from the kernel.

1079
<p>Except for very unusual circumstances, you probably should include
Pavel Machek's avatar
Pavel Machek committed
1080 1081
this protocol in the configuration since almost all other protocols
require network interfaces to be defined for them to work with.
1082

1083
<sect1>Configuration
1084 1085 1086 1087 1088

<p><descrip>
	<tag>scan time <m/number/</tag> Time in seconds between two scans
	of the network interface list. On systems where we are notified about
	interface status changes asynchronously (such as newer versions of
Pavel Machek's avatar
Pavel Machek committed
1089 1090
	Linux), we need to scan the list only in order to avoid confusion by lost
	notification messages, so the default time is set to a large value.
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108

	<tag>primary  [ "<m/mask/" ] <m/prefix/</tag>
	If a network interface has more than one network address,
	BIRD has to choose one of them as a primary one, because some
	routing protocols (for example OSPFv2) suppose there is only
	one network address per interface. By default, BIRD chooses
	the lexicographically smallest address as the primary one.

	This option allows to specify which network address should be
	chosen as a primary one. Network addresses that match
	<m/prefix/ are preferred to non-matching addresses. If more
	<cf/primary/ options are used, the first one has the highest
	preference. If "<m/mask/" is specified, then such
	<cf/primary/ option is relevant only to matching network
	interfaces.

	In all cases, an address marked by operating system as
	secondary cannot be chosen as the primary one. 
1109 1110 1111
</descrip>

<p>As the Device protocol doesn't generate any routes, it cannot have
1112
any attributes. Example configuration looks like this:
1113 1114 1115 1116

<p><code>
protocol device {
	scan time 10;		# Scan the interfaces often
1117 1118
	primary "eth0" 192.168.1.1;
	primary 192.168.0.0/16;
1119 1120 1121
}
</code>

1122
<sect>Direct
Martin Mareš's avatar
Martin Mareš committed
1123

1124 1125 1126 1127 1128 1129
<p>The Direct protocol is a simple generator of device routes for all the
directly connected networks according to the list of interfaces provided
by the kernel via the Device protocol.

<p>It's highly recommended to include this protocol in your configuration
unless you want to use BIRD as a route server or a route reflector, that is
Pavel Machek's avatar
Pavel Machek committed
1130
on a machine which doesn't forward packets itself and only participates in
1131 1132
distribution of routing information.

Pavel Machek's avatar
Pavel Machek committed
1133
<p>The only configurable thing about direct is what interfaces it watches:
1134 1135

<p><descrip>
1136
	<tag>interface <m/pattern [, ...]/</tag> By default, the Direct
1137 1138 1139 1140 1141 1142 1143 1144 1145
	protocol will generate device routes for all the interfaces
	available. If you want to restrict it to some subset of interfaces
	(for example if you're using multiple routing tables for policy
	routing and some of the policy domains don't contain all interfaces),
	just use this clause.
</descrip>

<p>Direct device routes don't contain any specific attributes.

1146
<p>Example config might look like this:
1147 1148 1149 1150 1151 1152 1153

<p><code>
protocol direct {
	interface "-arc*", "*";		# Exclude the ARCnets
}
</code>

1154
<sect>Kernel
Martin Mareš's avatar
Martin Mareš committed
1155

1156
<p>The Kernel protocol is not a real routing protocol. Instead of communicating
Pavel Machek's avatar
Pavel Machek committed
1157 1158
the with other routers in the network, it performs synchronization of BIRD's routing
tables with the OS kernel. Basically, it sends all routing table updates to the kernel
1159 1160
and from time to time it scans the kernel tables to see whether some routes have
disappeared (for example due to unnoticed up/down transition of an interface)
Martin Mareš's avatar
Martin Mareš committed
1161
or whether an `alien' route has been added by someone else (depending on the
Pavel Machek's avatar
Pavel Machek committed
1162
<cf/learn/ switch, such routes are either deleted or accepted to our
Martin Mareš's avatar
Martin Mareš committed
1163
table).
1164 1165 1166

<p>If your OS supports only a single routing table, you can configure only one
instance of the Kernel protocol. If it supports multiple tables (in order to
Pavel Machek's avatar
Pavel Machek committed
1167
allow policy routing; such an OS is for example Linux 2.2), you can run as many instances as you want, but each of
1168 1169 1170
them must be connected to a different BIRD routing table and to a different
kernel table.

1171
<sect1>Configuration
1172 1173 1174

<p><descrip>
	<tag>persist <m/switch/</tag> Tell BIRD to leave all its routes in the
1175
	routing tables when it exits (instead of cleaning them up).
Pavel Machek's avatar
Pavel Machek committed
1176
	<tag>scan time <m/number/</tag> Time in seconds between two consecutive scans of the
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186
	kernel routing table.
	<tag>learn <m/switch/</tag> Enable learning of routes added to the kernel
	routing tables by other routing daemons or by the system administrator.
	This is possible only on systems which support identification of route
	authorship.
	<tag>kernel table <m/number/</tag> Select which kernel table should
	this particular instance of the Kernel protocol work with. Available
	only on systems supporting multiple routing tables.
</descrip>

Pavel Machek's avatar
Pavel Machek committed
1187
<p>The Kernel protocol doesn't define any route attributes.
1188
<p>A simple configuration can look this way:
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211

<p><code>
protocol kernel {
	import all;
	export all;
}
</code>

<p>Or for a system with two routing tables:

<p><code>
protocol kernel {		# Primary routing table
	learn;			# Learn alien routes from the kernel
	persist;		# Don't remove routes on bird shutdown
	scan time 10;		# Scan kernel routing table every 10 seconds
	import all;
	export all;
}

protocol kernel {		# Secondary routing table
	table auxtable;
	kernel table 100;
	export all;
1212
}
1213 1214
</code>

1215
<sect>OSPF
Martin Mareš's avatar
Martin Mareš committed
1216

1217 1218
<sect1>Introduction

1219
<p>Open Shortest Path First (OSPF) is a quite complex interior gateway
1220 1221
protocol. The current IPv4 version (OSPFv2) is defined
in RFC 2328<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc2328.txt">. It's a link
1222
state (a.k.a. shortest path first) protocol -- each router maintains a database
1223 1224 1225
describing the autonomous system's topology. Each participating router
has an identical copy of the database and all routers run the same algorithm
calculating a shortest path tree with themselves as a root.
Martin Mareš's avatar
Martin Mareš committed
1226
OSPF chooses the least cost path as the best path.
1227
(OSPFv3 - OSPF for IPv6 is not supported yet.)
1228 1229 1230 1231 1232 1233 1234 1235 1236

<p>In OSPF, the autonomous system can be split to several areas in order
to reduce the amount of resources consumed for exchanging the routing
information and to protect the other areas from incorrect routing data.
Topology of the area is hidden to the rest of the autonomous system.

<p>Another very important feature of OSPF is that
it can keep routing information from other protocols (like Static or BGP)
in its link state database as external routes. Each external route can
1237
be tagged by the advertising router, making it possible to pass additional
1238 1239 1240
information between routers on the boundary of the autonomous system.

<p>OSPF quickly detects topological changes in the autonomous system (such
1241
as router interface failures) and calculates new loop-free routes after a short
Ondřej Filip's avatar
Ondřej Filip committed
1242
period of convergence. Only a minimal amount of 
1243
routing traffic is involved.
1244

1245 1246 1247 1248 1249
<p>Each router participating in OSPF routing periodically sends Hello messages
to all its interfaces. This allows neighbors to be discovered dynamically.
Then the neighbors exchange theirs parts of the link state database and keep it
identical by flooding updates. The flooding process is reliable and ensures
that each router detects all changes.
1250 1251 1252

<sect1>Configuration

1253 1254
<p>In the main part of configuration, there can be multiple definitions of
OSPF area witch different id included. These definitions includes many other
Ondřej Filip's avatar
Ondřej Filip committed
1255 1256
switches and multiple definitions of interfaces. Definition of interface
may contain many switches and constant definitions and list of neighbors
1257
on nonbroadcast networks.
1258 1259

<code>
Ondřej Filip's avatar
Ondřej Filip committed
1260
protocol ospf &lt;name&gt; {
1261
	rfc1583compat &lt;switch&gt;;
1262
	tick &lt;num&gt;;
Ondřej Filip's avatar
Ondřej Filip committed
1263
	area &lt;id&gt; {
1264
		stub cost &lt;num&gt;;
1265 1266 1267 1268
                networks {
			&lt;prefix&gt;;
			&lt;prefix&gt; hidden;
		}
1269 1270 1271 1272 1273 1274 1275
		stubnet &lt;prefix&gt;;
		stubnet &lt;prefix&gt; {
			hidden &lt;switch&gt;;
			summary &lt;switch&gt;;
			cost &lt;num&gt;;
		}
		interface &lt;interface pattern&gt; {
Ondřej Filip's avatar
Ondřej Filip committed
1276
			cost &lt;num&gt;;
1277
			stub &lt;switch&gt;;
Ondřej Filip's avatar
Ondřej Filip committed
1278
			hello &lt;num&gt;;
1279
			poll &lt;num&gt;;
Ondřej Filip's avatar
Ondřej Filip committed
1280 1281 1282 1283
			retransmit &lt;num&gt;;
			priority &lt;num&gt;;
			wait &lt;num&gt;;
			dead count &lt;num&gt;;
1284
			dead &lt;num&gt;;
1285
			rx buffer [normal|large|&lt;num&gt;];
1286
			type [broadcast|nonbroadcast|pointopoint];
1287
			strict nonbroadcast &lt;switch&gt;;
1288
			authentication [none|simple|cryptographics];
Ondřej Filip's avatar
Ondřej Filip committed
1289
			password "&lt;text&gt;";
1290 1291 1292 1293 1294 1295
			password "&lt;text&gt;" {
				id &lt;num&gt;;
				generate from "&lt;date&gt;";
				generate to "&lt;date&gt;";
				accept from "&lt;date&gt;";
				accept to "&lt;date&gt;";
1296
			};
1297
			neighbors {
Ondřej Filip's avatar
Ondřej Filip committed
1298
				&lt;ip&gt;;
1299
				&lt;ip&gt; eligible;
1300 1301
			};
		};
1302
		virtual link &lt;id&gt;	{
Ondřej Filip's avatar
Ondřej Filip committed
1303 1304 1305 1306
			hello &lt;num&gt;;
			retransmit &lt;num&gt;;
			wait &lt;num&gt;;
			dead count &lt;num&gt;;
1307
			dead &lt;num&gt;;
Ondřej Filip's avatar
Ondřej Filip committed
1308 1309 1310
			authentication [none|simple];
			password "&lt;text&gt;";
		};
1311 1312 1313 1314 1315
	};
}
</code>

<descrip>
1316
	<tag>rfc1583compat <M>switch</M></tag>
1317
	 This option controls compatibility of routing table
1318 1319 1320 1321 1322
	 calculation with RFC 1583<htmlurl
	 url="ftp://ftp.rfc-editor.org/in-notes/rfc1583.txt">. Default
	 value is no.
	
	<tag>area <M>id</M></tag>
1323 1324 1325 1326
	 This defines an OSPF area with given area ID (an integer or an IPv4
	 address, similarly to a router ID).
	 The most important area is
	 the backbone (ID 0) to which every other area must be connected.
1327

1328 1329 1330 1331
	<tag>stub cost <M>num</M></tag>
	 No external (except default) routes are flooded into stub areas.
         Setting this value marks area stub with defined cost of default route.
	 Default value is no. (Area is not stub.)
1332 1333

	<tag>tick <M>num</M></tag>
1334
	 The routing table calculation and clean-up of areas' databases
1335
         is not performed when a single link state
1336
	 change arrives. To lower the CPU utilization, it's processed later
1337
	 at periodical intervals of <m/num/ seconds. The default value is 1.
1338

1339 1340 1341 1342
	<tag>networks { <m/set/ }</tag>
         Definition of area IP ranges. This is used in summary lsa origination.
	 Hidden networks are not propagated into other areas.

1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360
	<tag>stubnet <m/prefix/ { <m/options/ }</tag>
	 Stub networks are networks that are not transit networks
	 between OSPF routers. They are also propagated through an
	 OSPF area as a part of a link state database. By default,
	 BIRD generates a stub network record for each primary network
	 address on each OSPF interface that does not have any OSPF
	 neighbors, and also for each non-primary network address on
	 each OSPF interface. This option allows to alter a set of
	 stub networks propagated by this router. 

	 Each instance of this option adds a stub network with given
	 network prefix to the set of propagated stub network, unless
	 option <cf/hidden/ is used. It also suppresses default stub
	 networks for given network prefix. When option
	 <cf/summary/ is used, also default stub networks that are
	 subnetworks of given stub network are suppressed. This might
	 be used, for example, to aggregate generated stub networks.
	 
1361 1362
	<tag>interface <M>pattern</M></tag>
	 Defines that the specified interfaces belong to the area being defined.
1363
	 See <ref id="dsc-iface" name="interface"> common option for detailed description.
1364