Statistics
| Branch: | Revision:

iof-bird-daemon / doc / bird.sgml @ 2d6627a7

History | View | Annotate | Download (38.5 KB)

1
<!doctype birddoc system>
2

    
3
<!--
4
	BIRD documentation
5

    
6
    Look for "about this documentation" section to learn more.
7

    
8
    (set-fill-column 100)
9

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

    
12
 -->
13

    
14
<article>
15

    
16
<title>BIRD
17
<author>
18
Pavel Machek <tt/pavel@ucw.cz/
19

    
20
<date>2000
21
<abstract>
22
This document contains documentation for BIRD Internet Routing Daemon
23
</abstract>
24

    
25
<!-- Table of contents -->
26
<toc>
27

    
28
<!-- Begin the document -->
29

    
30
<sect>Introduction
31

    
32
<sect1>What is BIRD
33

    
34
<p><label id="intro">
35
The name `BIRD' is actually an acronym standing for `BIRD Internet Routing Daemon'.
36
Let's take a closer look at the meaning of the name:
37

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

    
41
<p><em/Internet Routing/: It's a program (well, a daemon, as you are going to discover in a moment)
42
which works as a dynamic router in an Internet type network (that is, in a network running either
43
the IPv4 or the IPv6 protocol). Routers are devices which forward packets between interconnected
44
networks in order to allow hosts not connected directly to the same local area network to
45
communicate with each other. They also communicate with other routers in the Internet to discover
46
the topology of the network which allows them to find optimal (in terms of some metric) rules for
47
forwarding of packets (which will be called routes in the rest of this document) and to adapt to the
48
changing conditions such as outages of network links, building of new connections and so on. Most of
49
these routers are costly dedicated devices running obscure firmware which is hard to configure and
50
not open to any changes.  Fortunately, most operating systems of the UNIX family allow an ordinary
51
computer to act as a router and forward packets belonging to the other hosts, but only according to
52
a statically configured table.
53

    
54
<p>A <em/Routing Daemon/ is in UNIX terminology a non-interactive program running on
55
background which does the dynamic part of Internet routing, that is it communicates
56
with the other routers, calculates routing tables and sends them to the OS kernel
57
which does the actual packet forwarding.
58

    
59
<p>There already exist some such routing daemons (routed, GateD <HTMLURL URL="http://www.gated.org/">
60
and Zebra <HTMLURL URL="http://www.zebra.org">), but their capabilities are very limited and
61
they are very hard to configure and maintain.
62

    
63
<p>BIRD is an Internet Routing Daemon designed to avoid all of these shortcomings,
64
to support all the routing technology used in the today's Internet or planned to be
65
used in near future and to have a clean extensible architecture allowing new routing
66
protocols to be incorporated easily. Among other features, BIRD supports:
67

    
68
<itemize>
69
	<item>both IPv4 and IPv6 protocols
70
	<item>multiple routing tables
71
	<item>the Border Gateway Protocol (BGPv4)
72
	<item>the Routing Interchange Protocol (RIPv2)
73
	<item>the Open Shortest Path First protocol (OSPFv2)
74
	<item>a virtual protocol for exchange of routes between internal routing tables
75
	<item>a command-line interface allowing on-line control and inspection
76
		of status of the daemon
77
	<item>soft reconfiguration (no need to use complex online commands
78
		to change the configuration, just edit the configuration file
79
		and notify BIRD to re-read it and it will smoothly switch
80
		to the new configuration, not disturbing routing protocols
81
		unless they are affected by the configuration changes)
82
	<item>powerful language for route filtering
83
</itemize>
84

    
85
<p>BIRD has been developed at the Faculty of Math and Physics, Charles University, Prague,
86
Czech Republic as a student project. It's distributed under the terms of the GNU General
87
Public License.
88

    
89
<p>BIRD has been designed to work on all UNIX-like systems. It has been developed and
90
tested under Linux 2.0 to 2.3, but porting to other systems (even non-UNIX ones) should
91
be relatively easy due to its highly modular architecture).
92

    
93
<sect1>About this documentation
94

    
95
<p>This documentation can have 4 forms: sgml (this is master copy), html, ASCII text (generated from
96
html) and dvi/postscript (generated from sgml using sgmltools). You should always edit master copy,
97
it is slightly modified linuxdoc dtd.  Anything in &lt;descrip&gt; tags is considered definition of
98
configuration primitives, &lt;cf&gt; is fragment of configuration within normal text, &lt;m&gt; is
99
"meta" information within fragment of configuration -- something in config which is not keyword.
100

    
101
<sect1>Installing BIRD
102

    
103
<p>On UNIX system, installing BIRD should be as easy as:
104

    
105
<code>
106
        ./configure
107
        make
108
        make install
109
        vi /usr/local/etc/bird.conf
110
</code>
111

    
112
<sect1>About routing tables
113

    
114
<p>Bird has one or more routing tables. Each routing table contains
115
list of known routes. Each route has certain attributes, most
116
important is prefix of network this route is for. Routing table
117
maintains more than one entry for network, but at most one entry for
118
one network and one protocol. The entry with biggest preference is
119
used for routing. If there are more entries with same preference and
120
they are from same protocol, protocol decides (typically according to
121
metrics). You can get list of route attributes in "Route attributes"
122
section in filters.
123

    
124
<sect>Configuration
125

    
126
<sect1>Introduction
127

    
128
<p>BIRD is configured using text configuration file. At startup, BIRD reads <file/bird.conf/ (unless
129
-c command line parameter is given). Configuration may be changed on user request: if you modify
130
config file and then signal BIRD with SIGHUP, it will adjust to new config. There's BIRD client,
131
which allows you to talk with BIRD in more extensive way than just telling it to reconfigure. BIRD
132
writes messages about its work to log files or syslog (according to config).
133

    
134
<p>Bird is configured using text configuration file. At startup, bird
135
reads <file/bird.conf/ (unless -c command line parameter is
136
given). Everything on a line after <cf/#/ is a comment, whitespace is
137
ignored, C-style comments <cf>/* comment */</cf> are also
138
recognized. If there's variable number of options, it is grouped using
139
<cf/{ }/ brackets. Each option is terminated by <cf/;/.
140

    
141
<p>Really simple configuration file might look like this:
142

    
143
<code>
144
protocol kernel {
145
	persist;		# Don't remove routes on BIRD shutdown
146
	scan time 20;		# Scan kernel routing table every 20 seconds
147
	export all;		# Default is export none
148
}
149

    
150
protocol device {
151
	scan time 10;		# Scan interfaces every 10 seconds
152
}
153

    
154
protocol rip {
155
	export all;
156
	import all;
157
}
158
</code>
159

    
160
<sect1>Global options
161

    
162
<p><descrip>
163
	<tag>log "<m/filename/"|syslog|stderr all|{ <m/list of classes/ }</tag> 
164
	set logging of classes (either all or <cf/{
165
	error, trace }/ etc.) into selected destination. Classes are:
166
	<cf/info/, <cf/warning/, <cf/error/, <cf/fatal/ for messages about local problems
167
	<cf/debug/ for debugging messages, 
168
	<cf/trace/ when you want to know what happens on network, 
169
	<cf/remote/ for messages about misbehavior of remote side, 
170
	<cf/auth/ about authentication failures,  
171
	<cf/bug/ for internal bugs
172
	of BIRD. You may specify more than one <cf/log/ line to log to multiple
173
	destinations.
174
				  
175
	<tag>debug protocols all|off|{ states, routes, filters, interfaces, events, packets }</tag>
176
	sets global default of protocol debugging options.
177

    
178
	<tag>filter <m/name/{ <m/commands/ }</tag> define filter. You can learn more about filters
179
	in next chapter.
180
 
181
	<tag>protocol rip|ospf|bgp|... <m/[name]/ { <m>protocol options</m> }</tag> define protocol
182
	instance, called name (or called something like rip5 if you omit name). You can learn more
183
	about configuring protocols in their own chapters. You can run more than one instance of
184
	most protocols (like rip or bgp).
185

    
186
	<tag>define constant = expression</tag> define constant. You can use it later in every place
187
	you could use simple integer.
188

    
189
	<tag>router id <m/IPv4 address/</tag> set router id. Router id needs to be world-wide
190
	unique. It is usually one of router's IPv4 addresses.
191

    
192
	<tag>table <m/name/</tag> create new routing table.
193

    
194
	<tag>eval <m/expr/</tag> evaluates given filter expression. It is used for testing.
195
</descrip>
196

    
197
<sect1>Protocol options
198

    
199
<p>Several options are per-protocol, but all protocols support them. They are described here.
200

    
201
<descrip>
202
	<tag>preference <m/expr/</tag> sets preference of routes generated by this protocol.
203

    
204
	<tag>disabled</tag> disables given protocol. You can disable/enable protocol from command
205
	line interface without needing to touch config.
206

    
207
	<tag>debug <m/setting/</tag> this is similar to global debug setting, except that it only
208
	affects one protocol. Only messages in selected debugging categories will be written to
209
	logs.
210

    
211
	<tag>import <m/filter/</tag> filter can be either either <cf> { <m>filter commands</m>
212
	}</cf> or <cf>filter <m/name/</cf>. Import filter works in direction from protocol to main
213
	routing table.
214

    
215
	<tag>export <m/filter/</tag> This is similar to <cf>export</cf> keyword, except that it
216
	works in direction from main routing table to protocol.
217

    
218
	<tag>table <m/name/</tag> Connect this protocol to non-default table.
219
</descrip>
220

    
221
<p>There are per-protocol options that give sense only with certain protocols.
222

    
223
<descrip>
224
	<tag>passwords { password "<m/password/" from <m/time/ to <m/time/ passive <m/time/ id
225
	<m/num/ [...] }</tag> specifies passwords to be used with this protocol. Passive time is
226
	time from which password is not announced but is allowed. id is password id, as needed by
227
	certain protocols.
228

    
229
	<tag>interface "<m/mask/"|<m/prefix/ [ { <m/option/ ; [ ... ] } ]</tag> specifies, which
230
	interfaces this protocol is active at, and allows you to set options on
231
	interface-by-interface basis. Mask is specified in shell-like patters, thus <cf>interface
232
	"*" { mode broadcast; };</cf> will start given protocol on all interfaces, with <cf>mode
233
	broadcast;</cf> option.
234
						  
235
</descrip>
236

    
237
<sect>Filters
238

    
239
<sect1>Introduction
240

    
241
<p>BIRD contains rather simple programming language. (No, it can not yet read mail :-). There are
242
two objects in this language: filters and functions. Filters are called by BIRD core when route is
243
being passed between protocol and main routing table, and filters may call functions. Functions may
244
call other functions, but recursion is not allowed. Filter language contains control structures such
245
as if's and switches, but it allows no loops. Filters are
246
interpreted. Filter using many features can be found in <file>filter/test.conf</file>. 
247

    
248
<p>Filter basically gets the route, looks at its attributes and
249
modifies some of them if it wishes. At the end, it decides, whether to
250
pass change route through (using <cf/accept/), or whether to <cf/reject/ given route. It looks
251
like this:
252

    
253
<code>
254
filter not_too_far
255
int var;
256
{
257
	if defined( rip_metric ) then
258
		var = rip_metric;
259
	else {
260
		var = 1;
261
		rip_metric = 1;
262
	}
263
	if rip_metric &gt; 10 then
264
		reject "RIP metric is too big";
265
	else
266
		accept "ok";
267
}
268
</code>
269

    
270
<p>As you can see, filter has a header, list of local variables, and body. Header consists of
271
<cf/filter/ keyword, followed by (unique) name of filter. List of local variables consists of
272
pairs <cf><M>type name</M>;</cf>, where each pair defines one local variable. Body consists of
273
<cf> { <M>statements</M> }</cf>. Statements are terminated by <cf/;/. You can group
274
several statements into one by <cf>{ <M>statements</M> }</cf> construction, that is useful if
275
you want to make bigger block of code conditional.
276

    
277
<p>There are two special filters, <cf/all/ (which accepts all routes) and <cf/none/ (which rejects
278
all routes).
279

    
280

    
281
<p>Bird supports functions, so that you don't have to repeat same blocks of code over and
282
over. Functions can have zero or more parameters, and can have local variables. Function basically
283
looks like this:
284

    
285
<code>
286
function name ()
287
int local_variable;
288
{
289
	local_variable = 5;
290
}
291

    
292
function with_parameters (int parameter)
293
{
294
	print parameter;
295
}
296
</code>
297

    
298
<p>Unlike C, variables are declared after function line but before first {. You can not declare
299
variables in nested blocks. Functions are called like in C: <cf>name();
300
with_parameters(5);</cf>. Function may return value using <cf>return <m/[expr]/</cf>
301
syntax. Returning value exits from current function (this is similar to C).
302

    
303
<p>Filters are declared in similar way to functions, except they can not have explicit
304
parameters. They get route table entry as implicit parameter. Route table entry is passed implicitly
305
to any functions being called. Filter must terminate with either
306
accept or reject statement. If there's runtime error in filter, route
307
is rejected. 
308

    
309
<sect1>Data types
310

    
311
<p>Each variable and each value has certain type. Unlike C, filters distinguish between integers and
312
booleans (that is to prevent you from shooting in the foot).
313

    
314
<descrip>
315
	<tag/bool/ this is boolean type, it can have only two values, <cf/TRUE/ and
316
	  <cf/FALSE/. Boolean is not compatible with integer and is the only type you can use in if
317
	  statements.
318

    
319
	<tag/int/ this is common integer, you can expect it to store signed values from -2000000000
320
	  to +2000000000.
321

    
322
	<tag/pair/ this is pair of two short integers. Each component can have values from 0 to
323
	  65535. Constant of this type is written as <cf/(1234,5678)/.
324

    
325
	<tag/string/ this is string of characters. There are no ways to modify strings in
326
	  filters. You can pass them between functions, assign to variable of type string, print
327
	  such variables, but you can not concatenate two strings (for example). String constants
328
	  are written as <cf/"This is a string constant"/.
329

    
330
	<tag/ip/ this type can hold single ip address. Depending on version of BIRD you are using, it
331
	  can be IPv4 or IPv6 address. IPv4 addresses are written (as you would expect) as
332
	  <cf/1.2.3.4/. You can apply special operator <cf>.mask(<M>num</M>)</cf>
333
	  on values of type ip. It masks out all but first <cf><M>num</M></cf> bits from ip
334
	  address. So <cf/1.2.3.4.mask(8) = 1.0.0.0/ is true.
335

    
336
	<tag/prefix/ this type can hold ip address, prefix len pair. Prefixes are written as
337
	  <cf><M>ipaddress</M>/<M>pxlen</M></cf>, or
338
	  <cf><m>ipaddress</m>/<m>netmask</m></cf> There are two special
339
	  operators on prefix:
340
	  <cf/.ip/, which separates ip address from the pair, and <cf/.len/, which separates prefix
341
	  len from the pair.
342

    
343
	<tag/int|ip|prefix|pair set/
344
	  filters know four types of sets. Sets are similar to strings: you can pass them around
345
	  but you can not modify them. Constant of type <cf>set int</cf> looks like <cf>
346
	  [ 1, 2, 5..7 ]</cf>. As you can see, both simple values and ranges are permitted in
347
	  sets. Sets of prefixes are special: you can specify which prefixes should match them by
348
	  using <cf>[ 1.0.0.0/8+, 2.0.0.0/8-, 3.0.0.0/8{5,6} ]</cf>. 3.0.0.0/8{5,6} matches
349
	  prefixes 3.X.X.X, whose prefix length is 5 to 6. 3.0.0.0/8+ is shorthand for 3.0.0.0/{0,8},
350
	  3.0.0.0/8- is shorthand for 3.0.0.0/{0,7}.
351

    
352
	<tag/enum/
353
	  enumeration types are halfway-internal in the BIRD. You can not define your own
354
	  variable of enumeration type, but some predefined variables are of enumeration
355
	  type. Enumeration types are incompatible with each other, again, for your
356
	  protection.
357

    
358
	<tag/bgppath/
359
	  bgp path is list of autonomous systems.
360

    
361
	<tag/bgpmask/ 
362
	  bgp mask is mask used for matching bgp paths
363
	  (using <cf>path ~ / 2 3 5 ? / syntax </cf>). <cf/?/ is
364
	  really serving in "any number of autonomous systems", but we
365
	  did not want to use * because then it becomes too easy to
366
	  write <cf>/*</cf> which is start of comment.
367

    
368
	<tag/clist/ 
369
	  community list. This is similar to set of pairs,
370
	  except that unlike other sets, it can be modified.
371

    
372
	  
373
</descrip>
374

    
375
<sect1>Operations
376

    
377
<p>Filter language supports common integer operations <cf>(+,-,*,/)</cf>, parentheses <cf/(a*(b+c))/, comparison
378
<cf/(a=b, a!=b, a&lt;b, a&gt;=b)/. Special operators include <cf/&tilde;/ for "in" operation. In operation can be
379
used on element and set of that elements, or on ip and prefix, or on
380
prefix and prefix or on bgppath and bgpmask or on pair and clist. Its result
381
is true if element is in given set or if ip address is inside given prefix. Operator <cf/=/ is used to assign value
382
to variable.
383

    
384
<sect1>Control structures
385

    
386
<p>Filters support two control structures: if/then/else and case. Syntax of if/then/else is <cf>if
387
<M>expression</M> then <M>command</M>; else <M>command</M>;</cf> and you can use <cf>{
388
<M>command_1</M>; <M>command_2</M>; <M>...</M> }</cf> instead of one or both commands. <cf>else</cf>
389
clause may be omitted.
390

    
391
<p><cf>case</cf> is similar to case from Pascal. Syntax is <cf>case <m/expr/ { else |
392
<m/num_or_prefix [ .. num_or_prefix]/ : <m/statement/ ; [ ... ] }</cf>. Expression after
393
<cf>case</cf> can be of any type that can be on the left side of &tilde; operator, and anything that could
394
be member of set is allowed before :. Multiple commands are allowed without {} grouping. If argument
395
matches neither of : clauses, else: clause is used. (Case is actually implemented as set matching,
396
internally.)
397

    
398
<p>Here is example that uses if and case structures:
399

    
400
<code>
401
case arg1 {
402
	2: print "two"; print "I can do more commands without {}";
403
	3 .. 5: print "three to five";
404
	else: print "something else";
405
	}
406

    
407
if 1234 = i then printn "."; else { print "*** FAIL: if 1 else"; }
408
</code>
409

    
410
<sect1>Route attributes
411

    
412
<p>Filter is implicitly passed route, and it can access its attributes, just like it accesses variables.
413

    
414
<descrip>
415
	<tag>defined( <m>attribute</m> )</tag>
416
	returns TRUE if given attribute is defined. Access to undefined attribute results in runtime error.
417

    
418
	<tag/<m/prefix/ network/
419
	network this route is talking about.
420

    
421
	<tag/<m/ip/ from/
422
	who told me about this route.
423
	
424
	<tag/<m/ip/ gw/
425
	what is next hop packets routed using this route should be forwarded to.
426

    
427
	<tag/<m/enum/ source/
428
	what protocol told me about this route. This can have values such as <cf/RTS_RIP/ or <cf/RTS_OSPF_EXT/.
429
</descrip>
430

    
431
<p>Plus, there are protocol-specific attributes, which are described in protocol sections.
432

    
433
<sect1>Utility functions
434

    
435
<p>There are few functions you might find convenient to use:
436

    
437
<descrip>
438
	<tag>print|printn <m/expr/ [ <m/, expr .../ ]</tag>
439
	prints given expressions, useful mainly while debugging
440
	filters. Printn variant does not go to new line.
441

    
442
	<tag>quitbird</tag>
443
	terminates bird. Useful while debugging filter interpreter.
444
</descrip>
445

    
446
<sect>Protocols
447

    
448
<sect1>BGP
449

    
450
<p>The Border Gateway Protocol is the routing protocol used for backbone
451
level routing in the today's Internet. Contrary to other protocols, its convergence
452
doesn't rely on all routers following the same rules for route selection,
453
making it possible to implement any routing policy at any router in the
454
network, the only restriction being that if a router advertises a route,
455
it must accept and forward packets according to it.
456

    
457
<p>BGP works in terms of autonomous systems (often abbreviated as AS). Each
458
AS is a part of the network with common management and common routing policy.
459
Routers within each AS usually communicate using either a interior routing
460
protocol (such as OSPF or RIP) or an interior variant of BGP (called iBGP).
461
Boundary routers at the border of the AS communicate with their peers
462
in the neighboring AS'es via exterior BGP (eBGP).
463

    
464
<p>Each BGP router sends to its neighbors updates of the parts of its
465
routing table it wishes to export along with complete path information
466
(a list of AS'es the packet will travel through if it uses that particular
467
route) in order to avoid routing loops.
468

    
469
<p>BIRD supports all requirements of the BGP4 standard as defined in
470
RFC 1771<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc1771.txt">
471
including several enhancements from the
472
latest draft<htmlurl url="ftp://ftp.rfc-editor.org/internet-drafts/draft-ietf-idr-bgp4-09.txt">.
473
It also supports the community attributes as per
474
RFC 1997<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc1997.txt">,
475
capability negotiation draft<htmlurl url="ftp://ftp.rfc-editor.org/internet-drafts/draft-ietf-idr-bgp4-cap-neg-06.txt">.
476
For IPv6, it uses the standard multiprotocol extensions defined in
477
RFC 2283<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc2283.txt">
478
including changes described in the
479
latest draft <htmlurl url="ftp://ftp.rfc-editor.org/internet-drafts/draft-ietf-idr-bgp4-multiprotocol-v2-05.txt">
480
and applied to IPv6 according to
481
RFC 2545<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc2545.txt">.
482

    
483
<sect2>Route selection rules
484

    
485
<p>BGP doesn't have any simple metric, so the rules for selection of an optimal
486
route among multiple BGP routes with the same preference are a bit more complex
487
and are implemented according to the following algorithm. First it uses the first
488
rule, if there are more "best" routes, then it uses the second rule to choose
489
among them and so on.
490

    
491
<itemize>
492
	<item>Prefer route with the highest local preference attribute.
493
	<item>Prefer route with the shortest AS path.
494
	<item>Prefer IGP origin over EGP and EGP over incomplete.
495
	<item>Prefer the lowest value of the Multiple Exit Discriminator.
496
	<item>Prefer internal routes over external routes.
497
	<item>Prefer route with the lowest value of router ID of the
498
	advertising router.
499
</itemize>
500

    
501
<sect2>Configuration
502

    
503
<p>Each instance of the BGP corresponds to one neighboring router.
504
This allows to set routing policy and all other parameters differently
505
for each neighbor using the following protocol parameters:
506

    
507
<descrip>
508
	<tag>local as <m/number/</tag> Define which AS we are part of. (Note that
509
	contrary to other IP routers, BIRD is able to act as a router located
510
	in multiple AS'es simultaneously, but in such cases you need to tweak
511
	the BGP paths manually in the filters to get consistent behavior.)
512
	This parameter is mandatory.
513
	<tag>neighbor <m/ip/ as <m/number/</tag> Define neighboring router
514
	this instance will be talking to and what AS it's located in. Unless
515
	you use the <cf/multihop/ clause, it must be directly connected to one
516
	of your router's interfaces. This parameter is mandatory.
517
	<tag>multihop <m/number/ via <m/ip/</tag> Configure multihop BGP to a
518
	neighbor which is connected at most <m/number/ hops far and to which
519
	we should route via our direct neighbor with address <m/ip/.
520
	Default: switched off.
521
	<tag>next hop self</tag> Avoid calculation of the Next Hop attribute
522
	and always advertise our own source address (see below) as a next hop.
523
	This needs to be used only
524
	occasionally to circumvent misconfigurations of other routers.
525
	Default: disabled.
526
	<tag>source address <m/ip/</tag> Define local address we should use
527
	for next hop calculation. Default: the address of the local end
528
	of the interface our neighbor is connected to.
529
	<tag>disable after error <m/switch/</tag> When an error is encountered (either
530
	locally or by the other side), disable the instance automatically
531
	and wait for an administrator to solve the problem manually. Default: off.
532
	<tag>hold time <m/number/</tag> Time in seconds to wait for a keepalive
533
	message from the other side before considering the connection stale.
534
	Default: depends on agreement with the neighboring router, we prefer
535
	240 seconds if the other side is willing to accept it.
536
	<tag>startup hold time <m/number/</tag> Value of the hold timer used
537
	before the routers have a chance to exchange OPEN messages and agree
538
	on the real value. Default: 240 seconds.
539
	<tag>keepalive time <m/number/</tag> Delay in seconds between sending
540
	of two consecutive keepalive messages. Default: One third of the hold time.
541
	<tag>connect retry time <m/number/</tag> Time in seconds to wait before
542
	retrying a failed connect attempt. Default: 120 seconds.
543
	<tag>start delay time <m/number/</tag> Delay in seconds between protocol
544
	startup and first attempt to connect. Default: 5 seconds.
545
	<tag>error wait time <m/number/, <m/number/</tag> Minimum and maximum delay in seconds between protocol
546
	failure (either local or reported by the peer) and automatic startup.
547
	Doesn't apply when <cf/disable after error/ is configured. If consecutive
548
	errors happen, the delay is increased exponentially until it reaches the maximum. Default: 60, 300.
549
	<tag>error forget time <m/number/</tag> Maximum time in seconds between two protocol
550
	failures to treat them as a error sequence which makes the <cf/error wait time/
551
	increase exponentially. Default: 300 seconds.
552
	<tag>path metric <m/switch/</tag> Enable comparison of path lengths
553
	when deciding which BGP route is the best one. Default: on.
554
	<tag>default bgp_med <m/number/</tag> Value of the Multiple Exit
555
	Discriminator to be used during route selection when the MED attribute
556
	is missing. Default: infinite.
557
	<tag>default bgp_local_pref <m/number/</tag> Value of the Local Preference
558
	to be used during route selection when the Local Preference attribute
559
	is missing. Default: 0.
560
</descrip>
561

    
562
<sect2>Attributes
563

    
564
<p>BGP defines several route attributes. Some of them (those marked with `I' in the
565
table below) are available on internal BGP connections only, some of them (marked
566
with `O') are optional.
567

    
568
<descrip>
569
	<tag>path <cf/bgp_path/</tag> Sequence of AS numbers describing the AS path
570
	the packet will travel through when forwarded according to this route. On
571
	internal BGP connections it doesn't contain the number of the local AS.
572
	<tag>int <cf/bgp_local_pref/ [I]</tag> Local preference value used for
573
	selection among multiple BGP routes (see the selection rules above). It's
574
	used as an additional metric which is propagated through the whole local AS.
575
	<tag>int <cf/bgp_med/ [IO]</tag> The Multiple Exit Discriminator of the route
576
	which is an optional attribute which is often used within the local AS to
577
	reflect interior distances to various boundary routers. See the route selection
578
	rules above for exact semantics.
579
	<tag>enum <cf/bgp_origin/</tag> Origin of the route: either <cf/ORIGIN_IGP/
580
	if the route has originated in interior routing protocol of an AS or
581
	<cf/ORIGIN_EGP/ if it's been imported from the <tt>EGP</tt> protocol
582
	(nowadays it seems to be obsolete) or <cf/ORIGIN_INCOMPLETE/ if the origin
583
	is unknown.
584
	<tag>ip <cf/bgp_next_hop/</tag> Next hop to be used for forwarding of packets
585
	to this destination. On internal BGP connections, it's an address of the
586
	originating router if it's inside the local AS or a boundary router the
587
	packet will leave the AS through if it's an exterior route, so each BGP
588
	speaker within the AS has a chance to use the shortest interior path
589
	possible to this point.
590
	<tag>void <cf/bgp_atomic_aggr/ [O]</tag> This is an optional attribute
591
	which carries no value, but which sole presence indicates that the route
592
	has been aggregated from multiple routes by some AS on the path from
593
	the originator.
594
<!-- we don't handle aggregators right since they are of a very obscure type
595
	<tag>bgp_aggregator</tag>
596
-->
597
	<tag>clist <cf/bgp_community/ [O]</tag> List of community values associated
598
	with the route. Each such value is a pair (represented as a <cf/pair/ data
599
	type inside the filters) of 16-bit integers, the first of them containing a number of the AS which defines
600
	the community and the second one is a per-AS identifier. There are lots
601
	of uses of the community mechanism, but generally they are used to carry
602
	policy information like "don't export to USA peers". As each AS can define
603
	its own routing policy, it's also has a complete freedom about which community
604
	attributes it defines and what their semantics will be.
605
</descrip>
606

    
607
<sect2>Example
608

    
609
<p><code>
610
protocol bgp {
611
	local as 65000;				# Use a private AS number
612
	neighbor 62.168.0.130 as 5588;		# Our neighbor
613
	multihop 20 via 62.168.0.13;		# Which is connected indirectly
614
	export filter {				# We use non-trivial export rules
615
		if source = RTS_STATIC then {	# Export only static routes
616
			bgp_community.add((65000,5678));  # Assign our community
617
			if bgp_path ~ / 65000 / then	  # Artificially increase path length
618
				bgp_path.prepend(65000);  # by prepending local AS number twice
619
			accept;
620
		}
621
		reject;
622
	};
623
	import all;
624
	source address 62.168.0.1;		# Use non-standard source address
625
}
626
</code>
627

    
628
<sect1>Device
629

    
630
<p>The Device protocol is not a real routing protocol as it doesn't generate
631
any routes and only serves as a module for getting information about network
632
interfaces from the kernel.
633

    
634
<p>Except for very unusual circumstances, you probably should include
635
this protocol in the configuration since almost all other protocol
636
require network interfaces to be defined in order to work.
637

    
638
<p>The only configurable thing is interface scan time:
639

    
640
<p><descrip>
641
	<tag>scan time <m/number/</tag> Time in seconds between two scans
642
	of the network interface list. On systems where we are notified about
643
	interface status changes asynchronously (such as newer versions of
644
	Linux), we need to scan the list only to avoid confusion by lost
645
	notifications, so the default time is set to a large value.
646
</descrip>
647

    
648
<p>As the Device protocol doesn't generate any routes, it cannot have
649
any attributes. Example configuration looks really simple:
650

    
651
<p><code>
652
protocol device {
653
	scan time 10;		# Scan the interfaces often
654
}
655
</code>
656

    
657
<sect1>Direct
658

    
659
<p>The Direct protocol is a simple generator of device routes for all the
660
directly connected networks according to the list of interfaces provided
661
by the kernel via the Device protocol.
662

    
663
<p>It's highly recommended to include this protocol in your configuration
664
unless you want to use BIRD as a route server or a route reflector, that is
665
on a machine which doesn't forward packets and only participates in
666
distribution of routing information.
667

    
668
<p>Only configurable thing about direct is what interfaces it watches:
669

    
670
<p><descrip>
671
	<tag>interface <m/pattern [, ...]/</tag> By default, the Direct
672
	protocol will generate device routes for all the interfaces
673
	available. If you want to restrict it to some subset of interfaces
674
	(for example if you're using multiple routing tables for policy
675
	routing and some of the policy domains don't contain all interfaces),
676
	just use this clause.
677
</descrip>
678

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

    
681
<p>Example config might look like this:
682

    
683
<p><code>
684
protocol direct {
685
	interface "-arc*", "*";		# Exclude the ARCnets
686
}
687
</code>
688

    
689
<sect1>Kernel
690

    
691
<p>The Kernel protocol is not a real routing protocol. Instead of communicating
692
with other routers in the network, it performs synchronization of BIRD's routing
693
tables with OS kernel. Basically, it sends all routing table updates to the kernel
694
and from time to time it scans the kernel tables to see whether some routes have
695
disappeared (for example due to unnoticed up/down transition of an interface)
696
or whether an `alien' route has been added by someone else.
697

    
698
<p>If your OS supports only a single routing table, you can configure only one
699
instance of the Kernel protocol. If it supports multiple tables (in order to
700
allow policy routing), you can run as many instances as you want, but each of
701
them must be connected to a different BIRD routing table and to a different
702
kernel table.
703

    
704
<sect2>Configuration
705

    
706
<p><descrip>
707
	<tag>persist <m/switch/</tag> Tell BIRD to leave all its routes in the
708
	routing tables when it exits instead of cleaning them up.
709
	<tag>scan time <m/number/</tag> Time in seconds between two scans of the
710
	kernel routing table.
711
	<tag>learn <m/switch/</tag> Enable learning of routes added to the kernel
712
	routing tables by other routing daemons or by the system administrator.
713
	This is possible only on systems which support identification of route
714
	authorship.
715
	<tag>kernel table <m/number/</tag> Select which kernel table should
716
	this particular instance of the Kernel protocol work with. Available
717
	only on systems supporting multiple routing tables.
718
</descrip>
719

    
720
<p>A default simple configuration can look this way:
721

    
722
<p><code>
723
protocol kernel {
724
	import all;
725
	export all;
726
}
727
</code>
728

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

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

    
740
protocol kernel {		# Secondary routing table
741
	table auxtable;
742
	kernel table 100;
743
	export all;
744
</code>
745

    
746
<p>The Kernel protocol doesn't define any route attributes.
747

    
748
<sect1>OSPF
749

    
750
<sect1>Pipe
751

    
752
<sect1>Rip
753

    
754
<sect2>Introduction
755

    
756
<p>Rip protocol (sometimes called Rest In Pieces) is simple protocol, where each router broadcasts
757
distances to all networks he can reach. When router hears distance to other network, it increments
758
it and broadcasts it back. Broadcasts are done in regular intervals. Therefore, if some network goes
759
unreachable, routers keep telling each other that distance is old distance plus 1 (actually, plus
760
interface metric, which is usually one). After some time, distance reaches infinity (that's 15 in
761
rip) and all routers know that network is unreachable. Rip tries to minimize situations where
762
counting to infinity is necessary, because it is slow. Due to infinity being 16, you can not use
763
rip on networks where maximal distance is bigger than 15 hosts. You can read more about rip at <HTMLURL
764
URL="http://www.ietf.org/html.charters/rip-charter.html">. Both IPv4 and IPv6 versions of rip are supported by BIRD.
765

    
766
<p>Rip is very simple protocol, and it is not too good. Slow
767
convergence, big network load and inability to handle bigger networks
768
makes it pretty much obsolete in IPv4 world. (It is still usable on
769
very small networks, through.) It is widely used in IPv6 world,
770
because they are no good implementations of OSPFv3.
771

    
772
<sect2>Configuration
773

    
774
<p>In addition to options generic to other protocols, rip supports following options:
775

    
776
<descrip>
777
	<tag/authentication none|password|md5/ selects authentication method to use. None means that
778
	  packets are not authenticated at all, password means that plaintext password is embedded
779
	  into each packet, and md5 means that packets are authenticated using md5 cryptographic
780
	  hash. If you set authentication to non-none, it is good idea to add <cf>passwords { }</cf>
781
	  section.
782

    
783
	<tag>honor always|neighbor|never </tag>specifies, when should be requests for dumping routing table
784
	  honored. (Always, when sent from host on directly connected
785
	  network, or never.) Routing table updates are honored only from
786
	  neighbors, that is not configurable.
787
</descrip>
788

    
789
<p>There are two options that can be specified per-interface. First is <cf>metric</cf>, with
790
default one.  Second is <cf>mode multicast|broadcast|quiet|nolisten|version1</cf>, it selects mode for
791
rip to work in. If nothing is specified, rip runs in multicast mode. <cf>version1</cf> is
792
currently equivalent to <cf>broadcast</cf>, and it makes rip talk at broadcast address even
793
through multicast mode is possible. <cf>quiet</cf> option means that rip will not transmit
794
periodic messages onto this interface and <cf>nolisten</cf> means that rip will talk to this
795
interface but not listen on it.
796

    
797
<p>Following options generally override specified behavior from RFC. If you use any of these
798
options, BIRD will no longer be RFC-compatible, which means it will not be able to talk to anything
799
other than equally misconfigured BIRD. I warned you.
800

    
801
<descrip>
802
	<tag>port <M>number</M></tag>
803
	  selects IP port to operate on, default 520. (This is useful when testing BIRD, if you
804
	  set this to address &gt;1024, you will not need to run bird with UID==0).
805

    
806
	<tag>infinity <M>number</M></tag>
807
	  select value of infinity, default 16. Bigger values will make protocol convergence
808
	  even slower.
809

    
810
	<tag>period <M>number</M>
811
	  </tag>specifies number of seconds between periodic updates. Default is 30 seconds. Lower
812
	  number will mean faster convergence but bigger network load.
813

    
814
	<tag>timeouttime <M>number</M>
815
	  </tag>specifies how old route has to be to be considered unreachable. Default is 4*period.
816

    
817
	<tag>garbagetime <M>number</M>
818
	  </tag>specifies how old route has to be to be discarded. Default is 10*period.
819
</descrip>
820

    
821
<sect2>Attributes
822

    
823
<p>RIP defines two route attributes:
824

    
825
<descrip>
826
	<tag>int <cf/rip_metric/</tag> RIP metric of the route (ranging from 0 to <cf/infinity/).
827
	When routes from different RIP instances are available and all of them have the same
828
	preference, BIRD prefers the route with lowest <cf/rip_metric/.
829

    
830
	<tag>int <cf/rip_tag/</tag> RIP route tag: a 16-bit number which can be used
831
	to carry additional information with the route (for example, an originating AS number
832
	in case of external routes).
833
</descrip>
834

    
835
<sect2>Example
836

    
837
<p><code>
838
protocol rip MyRIP_test {
839
        debug all;
840
        port 1520;
841
        period 7;
842
        garbagetime 60;
843
        interface "eth0" { metric 3; mode multicast; } "eth1" { metric 2; mode broadcast; };
844
        honor neighbour;
845
        passwords { password "ahoj" from 0 to 10;
846
                password "nazdar" from 10;
847
        }
848
        authentication none;
849
        import filter { print "importing"; accept; };
850
        export filter { print "exporting"; accept; };
851
}
852
</code>
853

    
854
<sect1>Static
855

    
856
<p>The Static protocol doesn't communicate with other routers in the network,
857
but instead it allows you to define routes manually which is often used for
858
specifying how to forward packets to parts of the network which don't use
859
dynamic routing at all and also for defining sink routes (i.e., those
860
telling to return packets as undeliverable if they are in your IP block,
861
you don't have any specific destination for them and you don't want to send
862
them out through the default route to prevent routing loops).
863

    
864
<p>There are three types of static routes: `classical' routes telling to
865
forward packets to a neighboring router, device routes specifying forwarding
866
to hosts on a directly connected network and special routes (sink, blackhole
867
etc.) which specify a special action to be done instead of forwarding the
868
packet.
869

    
870
<p>When the particular destination is not available (the interface is down or
871
the next hop of the route is not a neighbor at the moment), Static just
872
uninstalls the route from the table its connected to and adds it again as soon
873
as the destinations becomes adjacent again.
874

    
875
<p>The Static protocol has no configuration options. Instead, the
876
definition of the protocol contains a list of static routes which
877
can contain:
878

    
879
<descrip>
880
	<tag>route <m/prefix/ via <m/ip/</tag> Static route through
881
	a neighboring router.
882
	<tag>route <m/prefix/ via <m/"interface"/</tag> Static device
883
	route through an interface to hosts on a directly connected network.
884
	<tag>route <m/prefix/ drop|reject|prohibit</tag> Special routes
885
	specifying to drop the packet, return it as unreachable or return
886
	it as administratively prohibited.
887
</descrip>
888

    
889
<p>Static routes have no specific attributes.
890

    
891
<p>Example static config might look like this:
892

    
893
<p><code>
894
protocol static {
895
	table testable;				# Connect to non-default routing table
896
	route 0.0.0.0/0 via 62.168.0.13;	# Default route
897
	route 62.168.0.0/25 reject;		# Sink route
898
	route 10.2.0.0/24 via "arc0";		# Secondary network
899
}
900
</code>
901

    
902
<sect>Getting more help
903

    
904
<p>This is really last section of this file, should give pointers to
905
programmers documentation, web pages mailing lists and similar stuff.
906

    
907

    
908
</article>
909

    
910

    
911
<!--
912
# LocalWords: IPv doctype verb GPL sgml html unix dvi sgmltools linuxdoc dtd descrip config conf syslog stderr auth ospf bgp router's IP expr num inst bool int ip px len enum cf md eval ipaddress pxlen netmask bgppath bgpmask clist gw RTS EXT quitbird nolisten UID timeouttime garbagetime RFC doc 
913
-->