]>
Commit | Line | Data |
---|---|---|
1 | <!doctype birddoc system> | |
2 | ||
3 | <!-- | |
4 | BIRD documentation | |
5 | ||
6 | This documentation can have 4 forms: sgml (this is master copy), html, ASCII | |
7 | text and dvi/postscript (generated from sgml using sgmltools). You should always | |
8 | edit master copy. | |
9 | ||
10 | This is a slightly modified linuxdoc dtd. Anything in <descrip> tags is | |
11 | considered definition of configuration primitives, <cf> is fragment of | |
12 | configuration within normal text, <m> is "meta" information within fragment of | |
13 | configuration - something in config which is not keyword. | |
14 | ||
15 | (set-fill-column 80) | |
16 | ||
17 | Copyright 1999 - 2022 CZ.NIC, z.s.p.o , distribute under GPL version 2 or later. | |
18 | ||
19 | --> | |
20 | ||
21 | <book> | |
22 | ||
23 | <title>BIRD {{ VERSION }} User's Guide | |
24 | <author> | |
25 | Ondrej Filip <it/<feela@network.cz>/, | |
26 | Martin Mares <it/<mj@ucw.cz>/, | |
27 | Maria Matejka <it/<mq@jmq.cz>/, | |
28 | Ondrej Zajicek <it/<santiago@crfreenet.org>/ | |
29 | </author> | |
30 | ||
31 | <abstract> | |
32 | This document contains user documentation for the BIRD Internet Routing Daemon project. | |
33 | </abstract> | |
34 | ||
35 | <!-- Table of contents --> | |
36 | <toc> | |
37 | ||
38 | <!-- Begin the document --> | |
39 | ||
40 | ||
41 | <chapt>Introduction | |
42 | <label id="intro"> | |
43 | ||
44 | <sect>What is BIRD | |
45 | <label id="what-is-bird"> | |
46 | ||
47 | <p>The name `BIRD' is actually an acronym standing for `BIRD Internet Routing | |
48 | Daemon'. Let's take a closer look at the meaning of the name: | |
49 | ||
50 | <p><em/BIRD/: Well, we think we have already explained that. It's an acronym | |
51 | standing for `BIRD Internet Routing Daemon', you remember, don't you? :-) | |
52 | ||
53 | <p><em/Internet Routing/: It's a program (well, a daemon, as you are going to | |
54 | discover in a moment) which works as a dynamic router in an Internet type | |
55 | network (that is, in a network running either the IPv4 or the IPv6 protocol). | |
56 | Routers are devices which forward packets between interconnected networks in | |
57 | order to allow hosts not connected directly to the same local area network to | |
58 | communicate with each other. They also communicate with the other routers in the | |
59 | Internet to discover the topology of the network which allows them to find | |
60 | optimal (in terms of some metric) rules for forwarding of packets (which are | |
61 | called routing tables) and to adapt themselves to the changing conditions such | |
62 | as outages of network links, building of new connections and so on. Most of | |
63 | these routers are costly dedicated devices running obscure firmware which is | |
64 | hard to configure and not open to any changes (on the other hand, their special | |
65 | hardware design allows them to keep up with lots of high-speed network | |
66 | interfaces, better than general-purpose computer does). Fortunately, most | |
67 | operating systems of the UNIX family allow an ordinary computer to act as a | |
68 | router and forward packets belonging to the other hosts, but only according to a | |
69 | statically configured table. | |
70 | ||
71 | <p>A <em/Routing Daemon/ is in UNIX terminology a non-interactive program | |
72 | running on background which does the dynamic part of Internet routing, that is | |
73 | it communicates with the other routers, calculates routing tables and sends them | |
74 | to the OS kernel which does the actual packet forwarding. There already exist | |
75 | other such routing daemons: routed (RIP only), GateD (non-free), | |
76 | <HTMLURL URL="http://www.zebra.org" name="Zebra"> and | |
77 | <HTMLURL URL="http://sourceforge.net/projects/mrt" name="MRTD">, | |
78 | but their capabilities are limited and they are relatively hard to configure | |
79 | and maintain. | |
80 | ||
81 | <p>BIRD is an Internet Routing Daemon designed to avoid all of these shortcomings, | |
82 | to support all the routing technology used in the today's Internet or planned to | |
83 | be used in near future and to have a clean extensible architecture allowing new | |
84 | routing protocols to be incorporated easily. Among other features, BIRD | |
85 | supports: | |
86 | ||
87 | <itemize> | |
88 | <item>both IPv4 and IPv6 protocols | |
89 | <item>multiple routing tables | |
90 | <item>the Border Gateway Protocol (BGPv4) | |
91 | <item>the Routing Information Protocol (RIPv2, RIPng) | |
92 | <item>the Open Shortest Path First protocol (OSPFv2, OSPFv3) | |
93 | <item>the Babel Routing Protocol | |
94 | <item>the Router Advertisements for IPv6 hosts | |
95 | <item>a virtual protocol for exchange of routes between different | |
96 | routing tables on a single host | |
97 | <item>a command-line interface allowing on-line control and inspection | |
98 | of status of the daemon | |
99 | <item>soft reconfiguration (no need to use complex online commands to | |
100 | change the configuration, just edit the configuration file and | |
101 | notify BIRD to re-read it and it will smoothly switch itself to | |
102 | the new configuration, not disturbing routing protocols unless | |
103 | they are affected by the configuration changes) | |
104 | <item>a powerful language for route filtering | |
105 | </itemize> | |
106 | ||
107 | <p>BIRD has been developed at the Faculty of Math and Physics, Charles | |
108 | University, Prague, Czech Republic as a student project. It can be freely | |
109 | distributed under the terms of the GNU General Public License. | |
110 | ||
111 | <p>BIRD has been designed to work on all UNIX-like systems. It has been | |
112 | developed and tested under Linux 2.0 to 2.6, and then ported to FreeBSD, NetBSD | |
113 | and OpenBSD, porting to other systems (even non-UNIX ones) should be relatively | |
114 | easy due to its highly modular architecture. | |
115 | ||
116 | <p>BIRD 1.x supported either IPv4 or IPv6 protocol, but had to be compiled separately | |
117 | for each one. BIRD~2 supports both of them with a possibility of further extension. | |
118 | BIRD~2 supports Linux at least 3.16, FreeBSD 10, NetBSD 7.0, and OpenBSD 5.8. | |
119 | Anyway, it will probably work well also on older systems. | |
120 | ||
121 | <sect>Installing BIRD | |
122 | <label id="install"> | |
123 | ||
124 | <p>On a recent UNIX system with GNU development tools (GCC, binutils, m4, make) | |
125 | and Perl, installing BIRD should be as easy as: | |
126 | ||
127 | <code> | |
128 | ./configure | |
129 | make | |
130 | make install | |
131 | vi /usr/local/etc/bird.conf | |
132 | bird | |
133 | </code> | |
134 | ||
135 | <p>You can use <tt>./configure --help</tt> to get a list of configure | |
136 | options. The most important ones are: <tt/--with-protocols=/ to produce a slightly smaller | |
137 | BIRD executable by configuring out routing protocols you don't use, and | |
138 | <tt/--prefix=/ to install BIRD to a place different from <file>/usr/local</file>. | |
139 | ||
140 | ||
141 | <sect>Running BIRD | |
142 | <label id="argv"> | |
143 | ||
144 | <p>You can pass several command-line options to bird: | |
145 | ||
146 | <descrip> | |
147 | <tag><label id="argv-config">-c <m/config name/</tag> | |
148 | use given configuration file instead of <it/prefix/<file>/etc/bird.conf</file>. | |
149 | ||
150 | <tag><label id="argv-debug">-d</tag> | |
151 | enable debug messages to stderr, and run bird in foreground. | |
152 | ||
153 | <tag><label id="argv-debug-file">-D <m/filename of debug log/</tag> | |
154 | enable debug messages to given file. | |
155 | ||
156 | <tag><label id="argv-foreground">-f</tag> | |
157 | run bird in foreground. | |
158 | ||
159 | <tag><label id="argv-group">-g <m/group/</tag> | |
160 | use that group ID, see the next section for details. | |
161 | ||
162 | <tag><label id="argv-help">-h, --help</tag> | |
163 | display command-line options to bird. | |
164 | ||
165 | <tag><label id="argv-local">-l</tag> | |
166 | look for a configuration file and a communication socket in the current | |
167 | working directory instead of in default system locations. However, paths | |
168 | specified by options <cf/-c/, <cf/-s/ have higher priority. | |
169 | ||
170 | <tag><label id="argv-parse">-p</tag> | |
171 | just parse the config file and exit. Return value is zero if the config | |
172 | file is valid, nonzero if there are some errors. | |
173 | ||
174 | <tag><label id="argv-pid">-P <m/name of PID file/</tag> | |
175 | create a PID file with given filename. | |
176 | ||
177 | <tag><label id="argv-recovery">-R</tag> | |
178 | apply graceful restart recovery after start. | |
179 | ||
180 | <tag><label id="argv-socket">-s <m/name of communication socket/</tag> | |
181 | use given filename for a socket for communications with the client, | |
182 | default is <it/prefix/<file>/var/run/bird.ctl</file>. | |
183 | ||
184 | <tag><label id="argv-user">-u <m/user/</tag> | |
185 | drop privileges and use that user ID, see the next section for details. | |
186 | ||
187 | <tag><label id="argv-version">--version</tag> | |
188 | display bird version. | |
189 | </descrip> | |
190 | ||
191 | <p>BIRD writes messages about its work to log files or syslog (according to config). | |
192 | ||
193 | ||
194 | <sect>Privileges | |
195 | <label id="privileges"> | |
196 | ||
197 | <p>BIRD, as a routing daemon, uses several privileged operations (like setting | |
198 | routing table and using raw sockets). Traditionally, BIRD is executed and runs | |
199 | with root privileges, which may be prone to security problems. The recommended | |
200 | way is to use a privilege restriction (options <cf/-u/, <cf/-g/). In that case | |
201 | BIRD is executed with root privileges, but it changes its user and group ID to | |
202 | an unprivileged ones, while using Linux capabilities to retain just required | |
203 | privileges (capabilities CAP_NET_*). Note that the control socket is created | |
204 | before the privileges are dropped, but the config file is read after that. The | |
205 | privilege restriction is not implemented in BSD port of BIRD. | |
206 | ||
207 | <p>An unprivileged user (as an argument to <cf/-u/ options) may be the user | |
208 | <cf/nobody/, but it is suggested to use a new dedicated user account (like | |
209 | <cf/bird/). The similar considerations apply for the group option, but there is | |
210 | one more condition -- the users in the same group can use <file/birdc/ to | |
211 | control BIRD. | |
212 | ||
213 | <p>Finally, there is a possibility to use external tools to run BIRD in an | |
214 | environment with restricted privileges. This may need some configuration, but it | |
215 | is generally easy -- BIRD needs just the standard library, privileges to read | |
216 | the config file and create the control socket and the CAP_NET_* capabilities. | |
217 | ||
218 | ||
219 | <chapt>Architecture | |
220 | <label id="architecture"> | |
221 | ||
222 | <sect>Routing tables | |
223 | <label id="routing-tables"> | |
224 | ||
225 | <p>The heart of BIRD is a routing table. BIRD has several independent routing tables; | |
226 | each of them contains routes of exactly one <m/nettype/ (see below). There are two | |
227 | default tables -- <cf/master4/ for IPv4 routes and <cf/master6/ for IPv6 routes. | |
228 | Other tables must be explicitly configured. | |
229 | ||
230 | <p> | |
231 | These routing tables are not kernel forwarding tables. No forwarding is done by | |
232 | BIRD. If you want to forward packets using the routes in BIRD tables, you may | |
233 | use the Kernel protocol (see below) to synchronize them with kernel FIBs. | |
234 | ||
235 | <p> | |
236 | Every nettype defines a (kind of) primary key on routes. Every route source can | |
237 | supply one route for every possible primary key; new route announcement replaces | |
238 | the old route from the same source, keeping other routes intact. BIRD always | |
239 | chooses the best route for each primary key among the known routes and keeps the | |
240 | others as suboptimal. When the best route is retracted, BIRD re-runs the best | |
241 | route selection algorithm to find the current best route. | |
242 | ||
243 | <p> | |
244 | The global best route selection algorithm is (roughly) as follows: | |
245 | ||
246 | <itemize> | |
247 | <item>Preferences of the routes are compared. | |
248 | <item>Source protocol instance preferences are compared. | |
249 | <item>If source protocols are the same (e.g. BGP vs. BGP), the protocol's route selection algorithm is invoked. | |
250 | <item>If source protocols are different (e.g. BGP vs. OSPF), result of the algorithm is undefined. | |
251 | </itemize> | |
252 | ||
253 | <p><label id="dsc-table-sorted">Usually, a routing table just chooses a selected | |
254 | route from a list of entries for one network. Optionally, these lists of entries | |
255 | are kept completely sorted (according to preference or some protocol-dependent | |
256 | metric). See <ref id="rtable-sorted" name="sorted"> table option for details. | |
257 | ||
258 | <sect>Routes and network types | |
259 | <label id="routes"> | |
260 | ||
261 | <p>BIRD works with several types of routes. Some of them are typical IP routes, | |
262 | others are better described as forwarding rules. We call them all routes, | |
263 | regardless of this difference. | |
264 | ||
265 | <p>Every route consists of several attributes (read more about them in the | |
266 | <ref id="route-attributes" name="Route attributes"> section); the common for all | |
267 | routes are: | |
268 | ||
269 | <itemize> | |
270 | <item>IP address of router which told us about this route | |
271 | <item>Source protocol instance | |
272 | <item>Route preference | |
273 | <item>Optional attributes defined by protocols | |
274 | </itemize> | |
275 | ||
276 | <p>Other attributes depend on nettypes. Some of them are part of the primary key, these are marked (PK). | |
277 | ||
278 | <sect1>IPv4 and IPv6 routes | |
279 | <label id="ip-routes"> | |
280 | ||
281 | <p>The traditional routes. Configuration keywords are <cf/ipv4/ and <cf/ipv6/. | |
282 | ||
283 | <itemize> | |
284 | <item>(PK) Route destination (IP prefix together with its length) | |
285 | <item>Route next hops (see below) | |
286 | </itemize> | |
287 | ||
288 | <sect1>IPv6 source-specific routes | |
289 | <label id="ip-sadr-routes"> | |
290 | ||
291 | <p>The IPv6 routes containing both destination and source prefix. They are used | |
292 | for source-specific routing (SSR), also called source-address dependent routing | |
293 | (SADR), see <rfc id="8043">. Currently limited mostly to the Babel protocol. | |
294 | Configuration keyword is <cf/ipv6 sadr/. | |
295 | ||
296 | <itemize> | |
297 | <item>(PK) Route destination (IP prefix together with its length) | |
298 | <item>(PK) Route source (IP prefix together with its length) | |
299 | <item>Route next hops (see below) | |
300 | </itemize> | |
301 | ||
302 | <sect1>VPN IPv4 and IPv6 routes | |
303 | <label id="vpn-routes"> | |
304 | ||
305 | <p>Routes for IPv4 and IPv6 with VPN Route Distinguisher (<rfc id="4364">). | |
306 | Configuration keywords are <cf/vpn4/ and <cf/vpn6/. | |
307 | ||
308 | <itemize> | |
309 | <item>(PK) Route destination (IP prefix together with its length) | |
310 | <item>(PK) Route distinguisher (according to <rfc id="4364">) | |
311 | <item>Route next hops | |
312 | </itemize> | |
313 | ||
314 | <sect1>Route Origin Authorization for IPv4 and IPv6 | |
315 | <label id="roa-routes"> | |
316 | ||
317 | <p>These entries can be used to validate route origination of BGP routes. | |
318 | A ROA entry specifies prefixes which could be originated by an AS number. | |
319 | Their keywords are <cf/roa4/ and <cf/roa6/. | |
320 | ||
321 | <itemize> | |
322 | <item>(PK) IP prefix together with its length | |
323 | <item>(PK) Matching prefix maximal length | |
324 | <item>(PK) AS number | |
325 | </itemize> | |
326 | ||
327 | <sect1>Flowspec for IPv4 and IPv6 | |
328 | <label id="flow-routes"> | |
329 | ||
330 | <p>Flowspec rules are a form of firewall and traffic flow control rules | |
331 | distributed mostly via BGP. These rules may help the operators stop various | |
332 | network attacks in the beginning before eating up the whole bandwidth. | |
333 | Configuration keywords are <cf/flow4/ and <cf/flow6/. | |
334 | ||
335 | <itemize> | |
336 | <item>(PK) IP prefix together with its length | |
337 | <item>(PK) Flow definition data | |
338 | <item>Flow action (encoded internally as BGP communities according to <rfc id="8955">) | |
339 | </itemize> | |
340 | ||
341 | <sect1>MPLS switching rules | |
342 | <label id="mpls-routes"> | |
343 | ||
344 | <p>MPLS routes control MPLS forwarding in the same way as IP routes control IP | |
345 | forwarding. MPLS-aware routing protocols produce both labeled IP routes and | |
346 | corresponding MPLS routes. Configuration keyword is <cf/mpls/. | |
347 | ||
348 | <itemize> | |
349 | <item>(PK) MPLS label | |
350 | <item>Route next hops | |
351 | </itemize> | |
352 | ||
353 | <sect1>Route next hops | |
354 | <label id="route-next-hop"> | |
355 | ||
356 | <p>This is not a nettype. The route next hop is a complex attribute common for many | |
357 | nettypes as you can see before. Every next hop has its assigned device | |
358 | (either assumed from its IP address or set explicitly). It may have also | |
359 | an IP address and an MPLS stack (one or both independently). | |
360 | Maximal MPLS stack depth is set (in compile time) to 8 labels. | |
361 | ||
362 | <p>Every route (when eligible to have a next hop) can have more than one next hop. | |
363 | In that case, every next hop has also its weight. | |
364 | ||
365 | <sect>Protocols and channels | |
366 | <label id="protocols-concept"> | |
367 | ||
368 | <p>BIRD protocol is an abstract class of producers and consumers of the routes. | |
369 | Each protocol may run in multiple instances and bind on one side to route | |
370 | tables via channels, on the other side to specified listen sockets (BGP), | |
371 | interfaces (Babel, OSPF, RIP), APIs (Kernel, Direct), or nothing (Static, Pipe). | |
372 | ||
373 | <p>There are also two protocols that do not have any channels -- BFD and Device. | |
374 | Both of them are kind of service for other protocols. | |
375 | ||
376 | <p>Each protocol is connected to a routing table through a channel. Some protocols | |
377 | support only one channel (OSPF, RIP), some protocols support more channels (BGP, Direct). | |
378 | Each channel has two filters which can accept, reject and modify the routes. | |
379 | An <it/export/ filter is applied to routes passed from the routing table to the protocol, | |
380 | an <it/import/ filter is applied to routes in the opposite direction. | |
381 | ||
382 | <sect>Graceful restart | |
383 | <label id="graceful-restart"> | |
384 | ||
385 | <p>When BIRD is started after restart or crash, it repopulates routing tables in | |
386 | an uncoordinated manner, like after clean start. This may be impractical in some | |
387 | cases, because if the forwarding plane (i.e. kernel routing tables) remains | |
388 | intact, then its synchronization with BIRD would temporarily disrupt packet | |
389 | forwarding until protocols converge. Graceful restart is a mechanism that could | |
390 | help with this issue. Generally, it works by starting protocols and letting them | |
391 | repopulate routing tables while deferring route propagation until protocols | |
392 | acknowledge their convergence. Note that graceful restart behavior have to be | |
393 | configured for all relevant protocols and requires protocol-specific support | |
394 | (currently implemented for Kernel and BGP protocols), it is activated for | |
395 | particular boot by option <cf/-R/. | |
396 | ||
397 | <p>Some protocols (e.g. BGP) could be restarted gracefully after both | |
398 | intentional outage and crash, while others (e.g. OSPF) after intentional outage | |
399 | only. For planned graceful restart, BIRD must be shut down by | |
400 | <ref id="cli-graceful-restart" name="graceful restart"> command instead of | |
401 | regular <ref id="cli-down" name="down"> command. In this way routing neighbors | |
402 | are notified about planned graceful restart and routes are kept in kernel table | |
403 | after shutdown. | |
404 | ||
405 | <sect>MPLS | |
406 | <label id="mpls"> | |
407 | ||
408 | <p>Multiprotocol Label Switching (MPLS) is a networking technology which works | |
409 | below IP routing but above the link (e.g. ethernet) layer. It is described in | |
410 | <rfc id="3031">. | |
411 | ||
412 | In regular IP forwarding, the destination address of a packet is independently | |
413 | examined in each hop, a route with longest prefix match is selected from the | |
414 | routing table, and packet is processed accordingly. In general, there is no | |
415 | difference between border routers and internal routers w.r.t. IP forwarding. | |
416 | ||
417 | In MPLS forwarding, when a packet enters the network, it is classified (based on | |
418 | destination address, ingress interface and other factors) into one of forwarding | |
419 | equivalence classes (FECs), then a header with a MPLS label identifying the FEC | |
420 | is attached to it, and the packet is forwarded. In internal routers, only the | |
421 | MPLS label is examined, the matching MPLS route is selected from the MPLS | |
422 | routing table, and the packet is processed accordingly. The specific value of | |
423 | MPLS label has local meaning only and may change between hops (that is why it is | |
424 | called label switching). When the packet leaves the network, the MPLS header is | |
425 | removed. | |
426 | ||
427 | The advantage of the MPLS approach is that other factors than the destination | |
428 | address can be considered and used consistently in the whole network, for | |
429 | example IP traffic with multiple overlapping private address ranges could be | |
430 | mixed together, or particular paths for specific flows could be defined. Another | |
431 | advantage is that MPLS forwarding by internal routers can be much simpler than | |
432 | IP forwarding, as instead of the longest prefix match algorithm it uses simpler | |
433 | exact match for MPLS route selection. The disadvantage is additional complexity | |
434 | in signaling. For further details, see <rfc id="3031">. | |
435 | ||
436 | MPLS-aware routing protocols not only distribute IP routing information, but | |
437 | they also distribute labels. Therefore, they produce labeled routes - routes | |
438 | representing label switched paths (LSPs) through the MPLS domain. Such routes | |
439 | have IP prefix and next hop address like regular (non-labeled) routes, but they | |
440 | also have local MPLS label (in route attribute <ref id="rta-mpls-label" | |
441 | name="mpls_label">) and outgoing MPLS label (as a part of the next hop). They | |
442 | are stored in regular IP routing tables. | |
443 | ||
444 | Labeled routes are used for exchange of routing information between routing | |
445 | protocols and for ingress (IP -> MPLS) forwarding, but they are not directly | |
446 | used for MPLS forwarding. For that purpose <ref id="mpls-routes" name="MPLS | |
447 | routes"> are used. These are routes that have local MPLS label as a primary key | |
448 | and they are stored in the MPLS routing table. | |
449 | ||
450 | In BIRD, the whole process generally works this way: A MPLS-aware routing | |
451 | protocol (say BGP) receives routing information including remote label. It | |
452 | produces a route with attribute <ref id="rta-mpls-policy" name="mpls_policy"> | |
453 | specifying desired <ref id="mpls-channel-label-policy" name="MPLS label policy">. | |
454 | Such route then passes the import filter (which could modify the MPLS label | |
455 | policy or perhaps assign a static label) and when it is accepted, a local MPLS | |
456 | label is selected (according to the label policy) and attached to the route, | |
457 | producing labeled route. When a new MPLS label is allocated, the MPLS-aware | |
458 | protocol automatically produces corresponding MPLS route. When all labeled | |
459 | routes that use specific local MPLS label are retracted, the corresponding MPLS | |
460 | route is retracted too. | |
461 | ||
462 | There are three important concepts for MPLS in BIRD: MPLS domains, MPLS tables | |
463 | and MPLS channels. MPLS domain represents an independent label space, all | |
464 | MPLS-aware protocols are associated with some MPLS domain. It is responsible for | |
465 | label management, handling label allocation requests from MPLS-aware protocols. | |
466 | MPLS table is just a routing table for MPLS routes. Routers usually have one | |
467 | MPLS domain and one MPLS table, with Kernel protocol to export MPLS routes into | |
468 | kernel FIB. | |
469 | ||
470 | MPLS channels make protocols MPLS-aware, they are responsible for keeping track | |
471 | of active FECs (and corresponding allocated labels), selecting FECs / local | |
472 | labels for labeled routes, and maintaining correspondence between labeled routes | |
473 | and MPLS routes. | |
474 | ||
475 | Note that local labels are allocated to individual MPLS-aware protocols and | |
476 | therefore it is not possible to share local labels between different protocols. | |
477 | ||
478 | ||
479 | <chapt>Configuration | |
480 | <label id="config"> | |
481 | ||
482 | <sect>Introduction | |
483 | <label id="config-intro"> | |
484 | ||
485 | <p>BIRD is configured using a text configuration file. Upon startup, BIRD reads | |
486 | <it/prefix/<file>/etc/bird.conf</file> (unless the <tt/-c/ command line option | |
487 | is given). Configuration may be changed at user's request: if you modify the | |
488 | config file and then signal BIRD with <tt/SIGHUP/, it will adjust to the new | |
489 | config. Then there's the client which allows you to talk with BIRD in an | |
490 | extensive way. | |
491 | ||
492 | <p>In the config, everything on a line after <cf/#/ or inside <cf>/* */</cf> is | |
493 | a comment, whitespace characters are treated as a single space. If there's a | |
494 | variable number of options, they are grouped using the <cf/{ }/ brackets. Each | |
495 | option is terminated by a <cf/;/. Configuration is case sensitive. There are two | |
496 | ways how to name symbols (like protocol names, filter names, constants etc.). | |
497 | You can either use a simple string starting with a letter (or underscore) | |
498 | followed by any combination of letters, numbers and underscores (e.g. <cf/R123/, | |
499 | <cf/my_filter/, <cf/bgp5/) or you can enclose the name into apostrophes (<cf/'/) | |
500 | and than you can use any combination of numbers, letters, underscores, hyphens, | |
501 | dots and colons (e.g. <cf/'1:strange-name'/, <cf/'-NAME-'/, <cf/'cool::name'/). | |
502 | ||
503 | <p>In most cases where options use an argument that is a basic data type (e.g. | |
504 | number, string, IP address) it is possible to use a named constant (defined | |
505 | by <ref id="opt-define" name="define"> statement), or a constant expression | |
506 | enclosed in parenthesis (e.g. <cf/(2 + 2)/). These expressions use | |
507 | <ref id="filters" name="the BIRD filter language">. | |
508 | ||
509 | <p>Here is an example of a simple config file. It enables synchronization of | |
510 | routing tables with OS kernel, learns network interfaces and runs RIP on all | |
511 | network interfaces found. | |
512 | ||
513 | <code> | |
514 | protocol kernel { | |
515 | ipv4 { | |
516 | export all; # Default is export none | |
517 | }; | |
518 | persist; # Don't remove routes on BIRD shutdown | |
519 | } | |
520 | ||
521 | protocol device { | |
522 | } | |
523 | ||
524 | protocol rip { | |
525 | ipv4 { | |
526 | import all; | |
527 | export all; | |
528 | }; | |
529 | interface "*"; | |
530 | } | |
531 | </code> | |
532 | ||
533 | ||
534 | <sect>Global options | |
535 | <label id="global-opts"> | |
536 | ||
537 | <p><descrip> | |
538 | <tag><label id="opt-include">include "<m/filename/";</tag> | |
539 | This statement causes inclusion of a new file. The <m/filename/ could | |
540 | also be a wildcard, in that case matching files are included in | |
541 | alphabetic order. The maximal depth is 8. Note that this statement can | |
542 | be used anywhere in the config file, even inside other options, but | |
543 | always on the beginning of line. In the following example, the first | |
544 | semicolon belongs to the <cf/include/, the second to <cf/ipv6 table/. | |
545 | If the <file/tablename.conf/ contains exactly one token (the name of the | |
546 | table), this construction is correct: | |
547 | <code> | |
548 | ipv6 table | |
549 | include "tablename.conf";; | |
550 | </code> | |
551 | ||
552 | <tag><label id="opt-log">log "<m/filename/" [<m/limit/ "<m/backup/"] | syslog [name <m/name/] | stderr | udp <m/address/ [port <m/port/] all|{ <m/list of classes/ }</tag> | |
553 | Set logging of messages having the given class (either <cf/all/ or <cf>{ | |
554 | error|trace [, <m/.../] }</cf> etc.) into selected destination - a file | |
555 | specified as a filename string (with optional log rotation information), | |
556 | syslog (with optional name argument), the stderr output, or as a UDP | |
557 | message (in <rfc id="3164"> syslog format). | |
558 | ||
559 | Classes are: | |
560 | <cf/info/, <cf/warning/, <cf/error/ and <cf/fatal/ for messages about local problems, | |
561 | <cf/debug/ for debugging messages, | |
562 | <cf/trace/ when you want to know what happens in the network, | |
563 | <cf/remote/ for messages about misbehavior of remote machines, | |
564 | <cf/auth/ about authentication failures, | |
565 | <cf/bug/ for internal BIRD bugs. | |
566 | ||
567 | Logging directly to file supports basic log rotation -- there is an | |
568 | optional log file limit and a backup filename, when log file reaches the | |
569 | limit, the current log file is renamed to the backup filename and a new | |
570 | log file is created. | |
571 | ||
572 | You may specify more than one <cf/log/ line to establish logging to | |
573 | multiple destinations. Default: log everything to the system log, or | |
574 | to the debug output if debugging is enabled by <cf/-d//<cf/-D/ | |
575 | command-line option. | |
576 | ||
577 | <tag><label id="opt-debug-protocols">debug protocols all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag> | |
578 | Set global defaults of protocol debugging options. | |
579 | See <ref id="proto-debug" name="debug"> in the following section. | |
580 | Default: off. | |
581 | ||
582 | <tag><label id="opt-debug-channels">debug channels all|off|{ states|routes|filters|events [, <m/.../] }</tag> | |
583 | Set global defaults of channel debugging options. | |
584 | See <ref id="channel-debug" name="debug"> in the channel section. | |
585 | Default: off. | |
586 | ||
587 | <tag><label id="opt-debug-tables">debug tables all|off|{ states|routes|filters|events [, <m/.../] }</tag> | |
588 | Set global defaults of table debugging options. | |
589 | See <ref id="table-debug" name="debug"> in the table section. | |
590 | Default: off. | |
591 | ||
592 | <tag><label id="opt-debug-commands">debug commands <m/number/</tag> | |
593 | Control logging of client connections (0 for no logging, 1 for logging | |
594 | of connects and disconnects, 2 and higher for logging of all client | |
595 | commands). Default: 0. | |
596 | ||
597 | <tag><label id="opt-debug-latency">debug latency <m/switch/</tag> | |
598 | Activate tracking of elapsed time for internal events. Recent events | |
599 | could be examined using <cf/dump events/ command. Default: off. | |
600 | ||
601 | <tag><label id="opt-debug-latency-limit">debug latency limit <m/time/</tag> | |
602 | If <cf/debug latency/ is enabled, this option allows to specify a limit | |
603 | for elapsed time. Events exceeding the limit are logged. Default: 1 s. | |
604 | ||
605 | <tag><label id="opt-watchdog-warn">watchdog warning <m/time/</tag> | |
606 | Set time limit for I/O loop cycle. If one iteration took more time to | |
607 | complete, a warning is logged. Default: 5 s. | |
608 | ||
609 | <tag><label id="opt-watchdog-timeout">watchdog timeout <m/time/</tag> | |
610 | Set time limit for I/O loop cycle. If the limit is breached, BIRD is | |
611 | killed by abort signal. The timeout has effective granularity of | |
612 | seconds, zero means disabled. Default: disabled (0). | |
613 | ||
614 | <tag><label id="opt-mrtdump">mrtdump "<m/filename/"</tag> | |
615 | Set MRTdump file name. This option must be specified to allow MRTdump | |
616 | feature. Default: no dump file. | |
617 | ||
618 | <tag><label id="opt-mrtdump-protocols">mrtdump protocols all|off|{ states|messages [, <m/.../] }</tag> | |
619 | Set global defaults of MRTdump options. See <cf/mrtdump/ in the | |
620 | following section. Default: off. | |
621 | ||
622 | <tag><label id="opt-filter">filter <m/name local variables/{ <m/commands/ }</tag> | |
623 | Define a filter. You can learn more about filters in the following | |
624 | chapter. | |
625 | ||
626 | <tag><label id="opt-function">function <m/name/ (<m/parameters/) [ -> <m/return type/ ] <m/local variables/ { <m/commands/ }</tag> | |
627 | Define a function. You can learn more about functions in the following chapter. | |
628 | ||
629 | <tag><label id="opt-protocol">protocol rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag> | |
630 | Define a protocol instance called <cf><m/name/</cf> (or with a name like | |
631 | "rip5" generated automatically if you don't specify any | |
632 | <cf><m/name/</cf>). You can learn more about configuring protocols in | |
633 | their own chapters. When <cf>from <m/name2/</cf> expression is used, | |
634 | initial protocol options are taken from protocol or template | |
635 | <cf><m/name2/</cf> You can run more than one instance of most protocols | |
636 | (like RIP or BGP). By default, no instances are configured. | |
637 | ||
638 | <tag><label id="opt-template">template rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag> | |
639 | Define a protocol template instance called <m/name/ (or with a name like | |
640 | "bgp1" generated automatically if you don't specify any <m/name/). | |
641 | Protocol templates can be used to group common options when many | |
642 | similarly configured protocol instances are to be defined. Protocol | |
643 | instances (and other templates) can use templates by using <cf/from/ | |
644 | expression and the name of the template. At the moment templates (and | |
645 | <cf/from/ expression) are not implemented for OSPF protocol. | |
646 | ||
647 | <tag><label id="opt-define">define <m/constant/ = <m/expression/</tag> | |
648 | Define a constant. You can use it later in every place you could use a | |
649 | value of the same type. Besides, there are some predefined numeric | |
650 | constants based on /etc/iproute2/rt_* files. A list of defined constants | |
651 | can be seen (together with other symbols) using 'show symbols' command. | |
652 | ||
653 | <tag><label id="opt-attribute">attribute <m/type/ <m/name/</tag> | |
654 | Declare a custom route attribute. You can set and get it in filters like | |
655 | any other route attribute. This feature is intended for marking routes | |
656 | in import filters for export filtering purposes instead of locally | |
657 | assigned BGP communities which have to be deleted in export filters. | |
658 | ||
659 | <tag><label id="opt-router-id">router id <m/number/ | <m/IPv4 address/</tag> | |
660 | Set BIRD's router ID. It's a 4-byte non-zero integer that should be unique | |
661 | within an AS. Default: the lowest IPv4 address of the router. | |
662 | ||
663 | <tag><label id="opt-router-id-from">router id from [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../]</tag> | |
664 | Set BIRD's router ID based on an IPv4 address of an interface specified by | |
665 | an interface pattern. | |
666 | See <ref id="proto-iface" name="interface"> section for detailed | |
667 | description of interface patterns with extended clauses. | |
668 | ||
669 | <tag><label id="opt-hostname">hostname "<m/name/"</tag> | |
670 | Set hostname. Default: node name as returned by `uname -n'. | |
671 | ||
672 | <tag><label id="opt-graceful-restart">graceful restart wait <m/number/</tag> | |
673 | During graceful restart recovery, BIRD waits for convergence of routing | |
674 | protocols. This option allows to specify a timeout for the recovery to | |
675 | prevent waiting indefinitely if some protocols cannot converge. Default: | |
676 | 240 seconds. | |
677 | ||
678 | <tag><label id="opt-timeformat">timeformat route|protocol|base|log "<m/format1/" [<m/limit/ "<m/format2/"]</tag> | |
679 | This option allows to specify a format of date/time used by BIRD. The | |
680 | first argument specifies for which purpose such format is used. | |
681 | <cf/route/ is a format used in 'show route' command output, | |
682 | <cf/protocol/ is used in 'show protocols' command output, <cf/base/ is | |
683 | used for other commands and <cf/log/ is used in a log file. | |
684 | ||
685 | "<m/format1/" is a format string using <it/strftime(3)/ notation (see | |
686 | <it/man strftime/ for details). It is extended to support sub-second | |
687 | time part with variable precision (up to microseconds) using "%f" | |
688 | conversion code (e.g., "%T.%3f" is hh:mm:ss.sss time). <m/limit/ and | |
689 | "<m/format2/" allow to specify the second format string for times in | |
690 | past deeper than <m/limit/ seconds. | |
691 | ||
692 | There are several shorthands: <cf/iso long/ is a ISO 8601 date/time | |
693 | format (YYYY-MM-DD hh:mm:ss) that can be also specified using <cf/"%F | |
694 | %T"/. Similarly, <cf/iso long ms/ and <cf/iso long us/ are ISO 8601 | |
695 | date/time formats with millisecond or microsecond precision. | |
696 | <cf/iso short/ is a variant of ISO 8601 that uses just the time format | |
697 | (hh:mm:ss) for near times (up to 20 hours in the past) and the date | |
698 | format (YYYY-MM-DD) for far times. This is a shorthand for <cf/"%T" | |
699 | 72000 "%F"/. And there are also <cf/iso short ms/ and <cf/iso short us/ | |
700 | high-precision variants of that. | |
701 | ||
702 | By default, BIRD uses the <cf/iso short ms/ format for <cf/route/ and | |
703 | <cf/protocol/ times, and the <cf/iso long ms/ format for <cf/base/ and | |
704 | <cf/log/ times. | |
705 | ||
706 | <tag><label id="opt-table"><m/nettype/ table <m/name/ [ { <m/option/; [<m/.../] } ]</tag> | |
707 | Define a new routing table. The default routing tables <cf/master4/ and | |
708 | <cf/master6/ are defined implicitly, other routing tables have to be | |
709 | defined by this option. See the <ref id="rtable-opts" | |
710 | name="routing table configuration section"> for routing table options. | |
711 | ||
712 | <tag><label id="opt-mpls-domain">mpls domain <m/name/ [ { <m/option/; [<m/.../] } ]</tag> | |
713 | Define a new MPLS domain. MPLS domains represent independent label | |
714 | spaces and are responsible for MPLS label management. All MPLS-aware | |
715 | protocols are associated with some MPLS domain. See the <ref id="mpls-opts" | |
716 | name="MPLS configuration section"> for MPLS domain options. | |
717 | ||
718 | <tag><label id="opt-eval">eval <m/expr/</tag> | |
719 | Evaluates given filter expression. It is used by the developers for testing of filters. | |
720 | </descrip> | |
721 | ||
722 | ||
723 | <sect>Routing table options | |
724 | <label id="rtable-opts"> | |
725 | ||
726 | <p>Most routing tables do not need any options and are defined without an option | |
727 | block, but there are still some options to tweak routing table behavior. Note | |
728 | that implicit tables (<cf/master4/ and <cf/master6/) can be redefined in order | |
729 | to set options. | |
730 | ||
731 | <descrip> | |
732 | <tag><label id="table-debug">debug all|off|{ states|routes|filters [, <m/.../] }</tag> | |
733 | Set table debugging options. Like in <ref id="proto-debug" | |
734 | name="protocol debugging">, tables are capable of writing trace | |
735 | messages about its work to the log (with category <cf/trace/). | |
736 | For now, this does nothing, but in version 3, it is used. Default: off. | |
737 | ||
738 | <tag><label id="rtable-sorted">sorted <m/switch/</tag> | |
739 | Usually, a routing table just chooses the selected (best) route from a | |
740 | list of routes for each network, while keeping remaining routes unsorted. | |
741 | If enabled, these lists of routes are kept completely sorted (according | |
742 | to preference or some protocol-dependent metric). | |
743 | ||
744 | This is needed for some protocol features (e.g. <cf/secondary/ option of | |
745 | BGP protocol, which allows to accept not just a selected route, but the | |
746 | first route (in the sorted list) that is accepted by filters), but it is | |
747 | incompatible with some other features (e.g. <cf/deterministic med/ | |
748 | option of BGP protocol, which activates a way of choosing selected route | |
749 | that cannot be described using comparison and ordering). Minor advantage | |
750 | is that routes are shown sorted in <cf/show route/, minor disadvantage | |
751 | is that it is slightly more computationally expensive. Default: off. | |
752 | ||
753 | <tag><label id="rtable-trie">trie <m/switch/</tag> | |
754 | BIRD routing tables are implemented with hash tables, which is efficient | |
755 | for exact-match lookups, but inconvenient for longest-match lookups or | |
756 | interval lookups (finding superprefix or subprefixes). This option | |
757 | activates additional trie structure that is used to accelerate these | |
758 | lookups, while using the hash table for exact-match lookups. | |
759 | ||
760 | This has advantage for <ref id="rpki" name="RPKI"> (on ROA tables), | |
761 | for <ref id="bgp-gateway" name="recursive next-hops"> (on IGP tables), | |
762 | and is required for <ref id="bgp-validate" name="flowspec validation"> | |
763 | (on base IP tables). Another advantage is that interval results (like | |
764 | from <cf/show route in .../ command) are lexicographically sorted. The | |
765 | disadvantage is that trie-enabled routing tables require more memory, | |
766 | which may be an issue especially in multi-table setups. Default: off. | |
767 | ||
768 | <tag><label id="rtable-min-settle-time">min settle time <m/time/</tag> | |
769 | Specify a minimum value of the settle time. When a ROA table changes, | |
770 | automatic <ref id="proto-rpki-reload" name="RPKI reload"> may be | |
771 | triggered, after a short settle time. Minimum settle time is a delay | |
772 | from the last ROA table change to wait for more updates. Default: 1 s. | |
773 | ||
774 | <tag><label id="rtable-max-settle-time">max settle time <m/time/</tag> | |
775 | Specify a maximum value of the settle time. When a ROA table changes, | |
776 | automatic <ref id="proto-rpki-reload" name="RPKI reload"> may be | |
777 | triggered, after a short settle time. Maximum settle time is an upper | |
778 | limit to the settle time from the initial ROA table change even if | |
779 | there are consecutive updates gradually renewing the settle time. | |
780 | Default: 20 s. | |
781 | ||
782 | <tag><label id="rtable-gc-threshold">gc threshold <m/number/</tag> | |
783 | Specify a minimum amount of removed networks that triggers a garbage | |
784 | collection (GC) cycle. Default: 1000. | |
785 | ||
786 | <tag><label id="rtable-gc-period">gc period <m/time/</tag> | |
787 | Specify a period of time between consecutive GC cycles. When there is a | |
788 | significant amount of route withdraws, GC cycles are executed repeatedly | |
789 | with given period time (with some random factor). When there is just | |
790 | small amount of changes, GC cycles are not executed. In extensive route | |
791 | server setups, running GC on hundreds of full BGP routing tables can | |
792 | take significant amount of time, therefore they should use higher GC | |
793 | periods. Default: adaptive, based on number of routing tables in the | |
794 | configuration. From 10 s (with <= 25 routing tables) up to 600 s (with | |
795 | >= 1500 routing tables). | |
796 | </descrip> | |
797 | ||
798 | ||
799 | <sect>Protocol options | |
800 | <label id="protocol-opts"> | |
801 | ||
802 | <p>For each protocol instance, you can configure a bunch of options. Some of | |
803 | them (those described in this section) are generic, some are specific to the | |
804 | protocol (see sections talking about the protocols). | |
805 | ||
806 | <p>Several options use a <m/switch/ argument. It can be either <cf/on/, | |
807 | <cf/yes/ or a numeric expression with a non-zero value for the option to be | |
808 | enabled or <cf/off/, <cf/no/ or a numeric expression evaluating to zero to | |
809 | disable it. An empty <m/switch/ is equivalent to <cf/on/ ("silence means | |
810 | agreement"). | |
811 | ||
812 | <descrip> | |
813 | <tag><label id="proto-disabled">disabled <m/switch/</tag> | |
814 | Disables the protocol. You can change the disable/enable status from the | |
815 | command line interface without needing to touch the configuration. | |
816 | Disabled protocols are not activated. Default: protocol is enabled. | |
817 | ||
818 | <tag><label id="proto-debug">debug all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag> | |
819 | Set protocol debugging options. If asked, each protocol is capable of | |
820 | writing trace messages about its work to the log (with category | |
821 | <cf/trace/). You can either request printing of <cf/all/ trace messages | |
822 | or only of the selected types: <cf/states/ for protocol state changes | |
823 | (protocol going up, down, starting, stopping etc.), <cf/routes/ for | |
824 | routes exchanged with the routing table, <cf/filters/ for details on | |
825 | route filtering, <cf/interfaces/ for interface change events sent to | |
826 | the protocol, <cf/events/ for events internal to the protocol and | |
827 | <cf/packets/ for packets sent and received by the protocol. Classes | |
828 | <cf/routes/ and <cf/filters/ can be also set per-channel using | |
829 | <ref id="channel-debug" name="channel debugging option">) Default: off. | |
830 | ||
831 | <tag><label id="proto-mrtdump">mrtdump all|off|{ states|messages [, <m/.../] }</tag> | |
832 | Set protocol MRTdump flags. MRTdump is a standard binary format for | |
833 | logging information from routing protocols and daemons. These flags | |
834 | control what kind of information is logged from the protocol to the | |
835 | MRTdump file (which must be specified by global <cf/mrtdump/ option, see | |
836 | the previous section). Although these flags are similar to flags of | |
837 | <cf/debug/ option, their meaning is different and protocol-specific. For | |
838 | BGP protocol, <cf/states/ logs BGP state changes and <cf/messages/ logs | |
839 | received BGP messages. Other protocols does not support MRTdump yet. | |
840 | ||
841 | <tag><label id="proto-router-id">router id <m/number/ | <m/IPv4 address/</tag> | |
842 | This option can be used to override global router id for a given | |
843 | protocol. Default: uses global router id. | |
844 | ||
845 | <tag><label id="proto-hostname">hostname "<m/name/"</tag> | |
846 | This option can be used to override global hostname for a given | |
847 | protocol. Default: uses global hostname. | |
848 | ||
849 | <tag><label id="proto-description">description "<m/text/"</tag> | |
850 | This is an optional description of the protocol. It is displayed as a | |
851 | part of the output of 'show protocols all' command. | |
852 | ||
853 | <tag><label id="proto-vrf">vrf "<m/text/"|default</tag> | |
854 | Associate the protocol with specific VRF. The protocol will be | |
855 | restricted to interfaces assigned to the VRF and will use sockets bound | |
856 | to the VRF. A corresponding VRF interface must exist on OS level. For | |
857 | kernel protocol, an appropriate table still must be explicitly selected | |
858 | by <cf/table/ option. | |
859 | ||
860 | By selecting <cf/default/, the protocol is associated with the default | |
861 | VRF; i.e., it will be restricted to interfaces not assigned to any | |
862 | regular VRF. That is different from not specifying <cf/vrf/ at all, in | |
863 | which case the protocol may use any interface regardless of its VRF | |
864 | status. | |
865 | ||
866 | Note that for proper VRF support it is necessary to use Linux kernel | |
867 | version at least 4.14, older versions have limited VRF implementation. | |
868 | Before Linux kernel 5.0, a socket bound to a port in default VRF collide | |
869 | with others in regular VRFs. In BGP, this can be avoided by using | |
870 | <ref id="bgp-strict-bind" name="strict bind"> option. | |
871 | ||
872 | <tag><label id="proto-channel"><m/channel name/ [{<m/channel config/}]</tag> | |
873 | Every channel must be explicitly stated. See the protocol-specific | |
874 | configuration for the list of supported channel names. See the | |
875 | <ref id="channel-opts" name="channel configuration section"> for channel | |
876 | definition. | |
877 | </descrip> | |
878 | ||
879 | <p>There are several options that give sense only with certain protocols: | |
880 | ||
881 | <descrip> | |
882 | <tag><label id="proto-iface">interface [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../] [ { <m/option/; [<m/.../] } ]</tag> | |
883 | Specifies a set of interfaces on which the protocol is activated with | |
884 | given interface-specific options. A set of interfaces specified by one | |
885 | interface option is described using an interface pattern. The interface | |
886 | pattern consists of a sequence of clauses (separated by commas), each | |
887 | clause is a mask specified as a shell-like pattern. Interfaces are | |
888 | matched by their name. | |
889 | ||
890 | An interface matches the pattern if it matches any of its clauses. If | |
891 | the clause begins with <cf/-/, matching interfaces are excluded. Patterns | |
892 | are processed left-to-right, thus <cf/interface "eth0", -"eth*", "*";/ | |
893 | means eth0 and all non-ethernets. | |
894 | ||
895 | Some protocols (namely OSPFv2 and Direct) support extended clauses that | |
896 | may contain a mask, a prefix, or both of them. An interface matches such | |
897 | clause if its name matches the mask (if specified) and its address | |
898 | matches the prefix (if specified). Extended clauses are used when the | |
899 | protocol handles multiple addresses on an interface independently. | |
900 | ||
901 | An interface option can be used more times with different interface-specific | |
902 | options, in that case for given interface the first matching interface | |
903 | option is used. | |
904 | ||
905 | This option is allowed in Babel, BFD, Device, Direct, OSPF, RAdv and RIP | |
906 | protocols. In OSPF protocol it is used in the <cf/area/ subsection. | |
907 | ||
908 | Default: none. | |
909 | ||
910 | Examples: | |
911 | ||
912 | <cf>interface "*" { type broadcast; };</cf> - start the protocol on all | |
913 | interfaces with <cf>type broadcast</cf> option. | |
914 | ||
915 | <cf>interface "eth1", "eth4", "eth5" { type ptp; };</cf> - start the | |
916 | protocol on enumerated interfaces with <cf>type ptp</cf> option. | |
917 | ||
918 | <cf>interface -192.168.1.0/24, 192.168.0.0/16;</cf> - start the protocol | |
919 | on all interfaces that have address from 192.168.0.0/16, but not from | |
920 | 192.168.1.0/24. | |
921 | ||
922 | <cf>interface "eth*" 192.168.1.0/24;</cf> - start the protocol on all | |
923 | ethernet interfaces that have address from 192.168.1.0/24. | |
924 | ||
925 | <tag><label id="proto-tx-class">tx class|dscp <m/number/</tag> | |
926 | This option specifies the value of ToS/DS/Class field in IP headers of | |
927 | the outgoing protocol packets. This may affect how the protocol packets | |
928 | are processed by the network relative to the other network traffic. With | |
929 | <cf/class/ keyword, the value (0-255) is used for the whole ToS/Class | |
930 | octet (but two bits reserved for ECN are ignored). With <cf/dscp/ | |
931 | keyword, the value (0-63) is used just for the DS field in the octet. | |
932 | Default value is 0xc0 (DSCP 0x30 - CS6). | |
933 | ||
934 | <tag><label id="proto-tx-priority">tx priority <m/number/</tag> | |
935 | This option specifies the local packet priority. This may affect how the | |
936 | protocol packets are processed in the local TX queues. This option is | |
937 | Linux specific. Default value is 7 (highest priority, privileged traffic). | |
938 | ||
939 | <tag><label id="proto-pass">password "<m/password/" | <m/bytestring/ [ { <m>password options</m> } ] </tag> | |
940 | Specifies a password that can be used by the protocol as a shared secret | |
941 | key. Password option can be used more times to specify more passwords. | |
942 | If more passwords are specified, it is a protocol-dependent decision | |
943 | which one is really used. Specifying passwords does not mean that | |
944 | authentication is enabled, authentication can be enabled by separate, | |
945 | protocol-dependent <cf/authentication/ option. | |
946 | ||
947 | A password can be specified as a string or as a sequence of hexadecimal | |
948 | digit pairs (<ref id="type-bytestring" name="bytestring">). | |
949 | ||
950 | This option is allowed in BFD, OSPF, RIP, and Babel protocols. BGP has | |
951 | also <cf/password/ option, but it is slightly different and described | |
952 | separately. Default: none. | |
953 | </descrip> | |
954 | ||
955 | <p>Password option can contain section with some (not necessary all) password sub-options: | |
956 | ||
957 | <descrip> | |
958 | <tag><label id="proto-pass-id">id <m>number</m></tag> | |
959 | ID of the password, (0-255). If it is not specified, BIRD will choose ID | |
960 | based on an order of the password item in the interface, starting from | |
961 | 1. For example, second password item in one interface will have default | |
962 | ID 2. ID 0 is allowed by BIRD, but some other implementations may not | |
963 | allow it. ID is used by some routing protocols to identify which | |
964 | password was used to authenticate protocol packets. | |
965 | ||
966 | <tag><label id="proto-pass-gen-from">generate from "<m/time/"</tag> | |
967 | The start time of the usage of the password for packet signing. | |
968 | The format of <cf><m/time/</cf> is <tt>YYYY-MM-DD [hh:mm:ss[.sss]]</tt>. | |
969 | ||
970 | <tag><label id="proto-pass-gen-to">generate to "<m/time/"</tag> | |
971 | The last time of the usage of the password for packet signing. | |
972 | ||
973 | <tag><label id="proto-pass-accept-from">accept from "<m/time/"</tag> | |
974 | The start time of the usage of the password for packet verification. | |
975 | ||
976 | <tag><label id="proto-pass-accept-to">accept to "<m/time/"</tag> | |
977 | The last time of the usage of the password for packet verification. | |
978 | ||
979 | <tag><label id="proto-pass-from">from "<m/time/"</tag> | |
980 | Shorthand for setting both <cf/generate from/ and <cf/accept from/. | |
981 | ||
982 | <tag><label id="proto-pass-to">to "<m/time/"</tag> | |
983 | Shorthand for setting both <cf/generate to/ and <cf/accept to/. | |
984 | ||
985 | <tag><label id="proto-pass-algorithm">algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 | blake2s128 | blake2s256 | blake2b256 | blake2b512 )</tag> | |
986 | The message authentication algorithm for the password when cryptographic | |
987 | authentication is enabled. The default value depends on the protocol. | |
988 | For RIP and OSPFv2 it is Keyed-MD5 (for compatibility), for OSPFv3 and | |
989 | Babel it is HMAC-SHA-256. | |
990 | ||
991 | </descrip> | |
992 | ||
993 | ||
994 | <sect>Channel options | |
995 | <label id="channel-opts"> | |
996 | ||
997 | <p>Every channel belongs to a protocol and is configured inside its block. The | |
998 | minimal channel config is empty, then it uses default values. The name of the | |
999 | channel implies its nettype. Channel definitions can be inherited from protocol | |
1000 | templates. Multiple definitions of the same channel are forbidden, but channels | |
1001 | inherited from templates can be updated by new definitions. | |
1002 | ||
1003 | <descrip> | |
1004 | <tag><label id="channel-debug">debug all|off|{ states|routes|filters [, <m/.../] }</tag> | |
1005 | Set channel debugging options. Like in <ref id="proto-debug" | |
1006 | name="protocol debugging">, channels are capable of writing trace | |
1007 | messages about its work to the log (with category <cf/trace/). You can | |
1008 | either request printing of <cf/all/ trace messages or only of the | |
1009 | selected types: <cf/states/ for channel state changes (channel going up, | |
1010 | down, feeding, reloading etc.), <cf/routes/ for routes propagated | |
1011 | through the channel, <cf/filters/ for details on route filtering, | |
1012 | remaining debug flags are not used in channel debug. Default: off. | |
1013 | ||
1014 | <tag><label id="proto-table">table <m/name/</tag> | |
1015 | Specify a table to which the channel is connected. Default: the first | |
1016 | table of given nettype. | |
1017 | ||
1018 | <tag><label id="proto-preference">preference <m/expr/</tag> | |
1019 | Sets the preference of routes generated by the protocol and imported | |
1020 | through this channel. Default: protocol dependent. | |
1021 | ||
1022 | <tag><label id="proto-import">import all | none | filter <m/name/ | filter { <m/filter commands/ } | where <m/boolean filter expression/</tag> | |
1023 | Specify a filter to be used for filtering routes coming from the | |
1024 | protocol to the routing table. <cf/all/ is for keeping all routes, | |
1025 | <cf/none/ is for dropping all routes. Default: <cf/all/ (except for | |
1026 | EBGP). | |
1027 | ||
1028 | <tag><label id="proto-export">export <m/filter/</tag> | |
1029 | This is similar to the <cf>import</cf> keyword, except that it works in | |
1030 | the direction from the routing table to the protocol. Default: <cf/none/ | |
1031 | (except for EBGP and L3VPN). | |
1032 | ||
1033 | <tag><label id="proto-import-keep-filtered">import keep filtered <m/switch/</tag> | |
1034 | Usually, if an import filter rejects a route, the route is forgotten. | |
1035 | When this option is active, these routes are kept in the routing table, | |
1036 | but they are hidden and not propagated to other protocols. But it is | |
1037 | possible to show them using <cf/show route filtered/. Note that this | |
1038 | option does not work for the pipe protocol. Default: off. | |
1039 | ||
1040 | <tag><label id="proto-rpki-reload">rpki reload <m/switch/</tag> | |
1041 | Import or export filters may depend on route RPKI status (using | |
1042 | <cf/roa_check()/ or <cf/aspa_check()/ operators). In contrast to other | |
1043 | filter operators, this status for the same route may change as the | |
1044 | content of ROA and ASPA tables changes. When this option is active, BIRD | |
1045 | activates automatic reload of affected channels whenever ROA and ASPA | |
1046 | tables are updated (after a short settle time). When disabled, route | |
1047 | reloads have to be requested manually. The option is ignored if neither | |
1048 | <cf/roa_check()/ nor <cf/aspa_check()/ is used in channel filters. Note | |
1049 | that for BGP channels, automatic reload requires | |
1050 | <ref id="bgp-import-table" name="import table"> or | |
1051 | <ref id="bgp-export-table" name="export table"> (for respective | |
1052 | direction). Default: on. | |
1053 | ||
1054 | <tag><label id="proto-import-limit">import limit [<m/number/ | off ] [action warn | block | restart | disable]</tag> | |
1055 | Specify an import route limit (a maximum number of routes imported from | |
1056 | the protocol) and optionally the action to be taken when the limit is | |
1057 | hit. Warn action just prints warning log message. Block action discards | |
1058 | new routes coming from the protocol. Restart and disable actions shut | |
1059 | the protocol down like appropriate commands. Disable is the default | |
1060 | action if an action is not explicitly specified. Note that limits are | |
1061 | reset during protocol reconfigure, reload or restart. Default: <cf/off/. | |
1062 | ||
1063 | <tag><label id="proto-receive-limit">receive limit [<m/number/ | off ] [action warn | block | restart | disable]</tag> | |
1064 | Specify an receive route limit (a maximum number of routes received from | |
1065 | the protocol and remembered). It works almost identically to <cf>import | |
1066 | limit</cf> option, the only difference is that if <cf/import keep | |
1067 | filtered/ option is active, filtered routes are counted towards the | |
1068 | limit and blocked routes are forgotten, as the main purpose of the | |
1069 | receive limit is to protect routing tables from overflow. Import limit, | |
1070 | on the contrary, counts accepted routes only and routes blocked by the | |
1071 | limit are handled like filtered routes. Default: <cf/off/. | |
1072 | ||
1073 | <tag><label id="proto-export-limit">export limit [ <m/number/ | off ] [action warn | block | restart | disable]</tag> | |
1074 | Specify an export route limit, works similarly to the <cf>import | |
1075 | limit</cf> option, but for the routes exported to the protocol. This | |
1076 | option is experimental, there are some problems in details of its | |
1077 | behavior -- the number of exported routes can temporarily exceed the | |
1078 | limit without triggering it during protocol reload, exported routes | |
1079 | counter ignores route blocking and block action also blocks route | |
1080 | updates of already accepted routes -- and these details will probably | |
1081 | change in the future. Default: <cf/off/. | |
1082 | </descrip> | |
1083 | ||
1084 | <p>This is a trivial example of RIP configured for IPv6 on all interfaces: | |
1085 | <code> | |
1086 | protocol rip ng { | |
1087 | ipv6; | |
1088 | interface "*"; | |
1089 | } | |
1090 | </code> | |
1091 | ||
1092 | <p>This is a non-trivial example. | |
1093 | <code> | |
1094 | protocol rip ng { | |
1095 | ipv6 { | |
1096 | table mytable6; | |
1097 | import filter { ... }; | |
1098 | export filter { ... }; | |
1099 | import limit 50; | |
1100 | }; | |
1101 | interface "*"; | |
1102 | } | |
1103 | </code> | |
1104 | ||
1105 | <p>And this is even more complicated example using templates. | |
1106 | <code> | |
1107 | template bgp { | |
1108 | local 198.51.100.14 as 65000; | |
1109 | ||
1110 | ipv4 { | |
1111 | table mytable4; | |
1112 | import filter { ... }; | |
1113 | export none; | |
1114 | }; | |
1115 | ipv6 { | |
1116 | table mytable6; | |
1117 | import filter { ... }; | |
1118 | export none; | |
1119 | }; | |
1120 | } | |
1121 | ||
1122 | protocol bgp from { | |
1123 | neighbor 198.51.100.130 as 64496; | |
1124 | ||
1125 | # IPv4 channel is inherited as-is, while IPv6 | |
1126 | # channel is adjusted by export filter option | |
1127 | ipv6 { | |
1128 | export filter { ... }; | |
1129 | }; | |
1130 | } | |
1131 | </code> | |
1132 | ||
1133 | ||
1134 | <sect>MPLS options | |
1135 | <label id="mpls-opts"> | |
1136 | ||
1137 | <p>The MPLS domain definition is mandatory for a MPLS router. All MPLS channels | |
1138 | and MPLS-aware protocols are associated with some MPLS domain (although usually | |
1139 | implicitly with the sole one). In the MPLS domain definition you can configure | |
1140 | details of MPLS label allocation. Currently, there is just one option, | |
1141 | <cf/label range/. | |
1142 | ||
1143 | <p>Note that the MPLS subsystem is experimental, it is likely that there will be | |
1144 | some backward-incompatible changes in the future. | |
1145 | ||
1146 | <descrip> | |
1147 | <tag><label id="mpls-domain-label-range">label range <m/name/ { start <m/number/; length <m/number/; [<m/.../] }</tag> | |
1148 | Define a new label range, or redefine implicit label ranges <cf/static/ | |
1149 | and <cf/dynamic/. MPLS channels use configured label ranges for dynamic | |
1150 | label allocation, while <cf/static/ label range is used for static label | |
1151 | allocation. The label range definition must specify the extent of the | |
1152 | range. By default, the range <cf/static/ is 16-1000, while the range | |
1153 | <cf/dynamic/ is 1000-10000. | |
1154 | </descrip> | |
1155 | ||
1156 | <p>MPLS channel should be defined in each MPLS-aware protocol in addition to its | |
1157 | regular channels. It is responsible for label allocation and for announcing MPLS | |
1158 | routes to the MPLS routing table. Besides common <ref id="channel-opts" | |
1159 | name="channel options">, MPLS channels have some specific options: | |
1160 | ||
1161 | <descrip> | |
1162 | <tag><label id="mpls-channel-domain">domain <m/name/</tag> | |
1163 | Specify a MPLS domain to which this channel and protocol belongs. | |
1164 | Default: The first defined MPLS domain. | |
1165 | ||
1166 | <tag><label id="mpls-channel-label-range">label range <m/name/</tag> | |
1167 | Use specific label range for dynamic label allocation. Note that static | |
1168 | labels always use the range <cf/static/. Default: the range <cf/dynamic/. | |
1169 | ||
1170 | <tag><label id="mpls-channel-label-policy">label policy static|prefix|aggregate|vrf</tag> | |
1171 | Label policy specifies how routes are grouped to forwarding equivalence | |
1172 | classes (FECs) and how labels are assigned to them. | |
1173 | ||
1174 | The policy <cf/static/ means no dynamic label allocation is done, and | |
1175 | static labels must be set in import filters using the route attribute | |
1176 | <ref id="rta-mpls-label" name="mpls_label">. | |
1177 | ||
1178 | The policy <cf/prefix/ means each prefix uses separate label associated | |
1179 | with that prefix. When a labeled route is updated, it keeps the label. | |
1180 | This policy is appropriate for IGPs. | |
1181 | ||
1182 | The policy <cf/aggregate/ means routes are grouped to FECs according to | |
1183 | their next hops (including next hop labels), and one label is used for | |
1184 | all routes in the same FEC. When a labeled route is updated, it may | |
1185 | change next hop, change FEC and therefore change label. This policy is | |
1186 | appropriate for BGP. | |
1187 | ||
1188 | The policy <cf/vrf/ is only valid in L3VPN protocols. It uses one label | |
1189 | for all routes from a VRF, while replacing the original next hop with | |
1190 | lookup in the VRF. | |
1191 | ||
1192 | Default: <cf/prefix/. | |
1193 | </descrip> | |
1194 | ||
1195 | <p>This is a trivial example of MPLS setup: | |
1196 | <code> | |
1197 | mpls domain mdom { | |
1198 | label range bgprange { start 2000; length 1000; }; | |
1199 | } | |
1200 | ||
1201 | mpls table mtab; | |
1202 | ||
1203 | protocol static { | |
1204 | ipv6; | |
1205 | mpls; | |
1206 | ||
1207 | route 2001:db8:1:1/64 mpls 100 via 2001:db8:1:2::1/64 mpls 200; | |
1208 | } | |
1209 | ||
1210 | protocol bgp { | |
1211 | # regular channels | |
1212 | ipv6 mpls { ... }; | |
1213 | vpn6 mpls { ... }; | |
1214 | ||
1215 | # MPLS channel | |
1216 | mpls { | |
1217 | # domain mdom; | |
1218 | # table mtab; | |
1219 | label range bgprange; | |
1220 | label policy aggregate; | |
1221 | }; | |
1222 | ||
1223 | ... | |
1224 | } | |
1225 | </code> | |
1226 | ||
1227 | ||
1228 | <chapt>Remote control | |
1229 | <label id="remote-control"> | |
1230 | ||
1231 | <sect>Overview | |
1232 | <label id="remote-control-overview"> | |
1233 | ||
1234 | <p>You can use the command-line client <file>birdc</file> to talk with a running | |
1235 | BIRD. Communication is done using the appropriate UNIX domain socket. The | |
1236 | commands can perform simple actions such as enabling/disabling of protocols, | |
1237 | telling BIRD to show various information, telling it to show routing table | |
1238 | filtered by filter, or asking BIRD to reconfigure. Press <tt/?/ at any time to | |
1239 | get online help. Option <tt/-r/ can be used to enable a restricted mode of BIRD | |
1240 | client, which allows just read-only commands (<cf/show .../). Option <tt/-v/ can | |
1241 | be passed to the client, to make it dump numeric return codes along with the | |
1242 | messages. You do not necessarily need to use <file/birdc/ to talk to BIRD, your | |
1243 | own applications could do that, too -- the format of communication between BIRD | |
1244 | and <file/birdc/ is stable (see the programmer's documentation). | |
1245 | ||
1246 | <p>There is also lightweight variant of BIRD client called <file/birdcl/, which | |
1247 | does not support command line editing and history and has minimal dependencies. | |
1248 | This is useful for running BIRD in resource constrained environments, where | |
1249 | Readline library (required for regular BIRD client) is not available. | |
1250 | ||
1251 | <sect>Configuration | |
1252 | <label id="remote-control-configuration"> | |
1253 | ||
1254 | <p>By default, BIRD opens <file/bird.ctl/ UNIX domain socket and the CLI tool | |
1255 | connects to it. If changed on the command line by the <tt/-s/ option, | |
1256 | BIRD or the CLI tool connects there instead. | |
1257 | ||
1258 | <p>It's also possible to configure additional remote control sockets in the | |
1259 | configuration file by <cf/cli "name";/ and you can open how many | |
1260 | sockets you wish. There are no checks whether the user configured the same | |
1261 | socket multiple times and BIRD may behave weirdly if this happens. On shutdown, | |
1262 | the additional sockets get removed immediately and only the main socket stays | |
1263 | until the very end. | |
1264 | ||
1265 | <p>The remote control socket can be also set as restricted by | |
1266 | <cf/cli "name" { restrict; };/ instead of sending the <cf/restrict/ command | |
1267 | after connecting. The user may still overload the daemon by requesting insanely | |
1268 | complex filters so you shouldn't expose this socket to public anyway. | |
1269 | ||
1270 | <sect>Usage | |
1271 | <label id="remote-control-usage"> | |
1272 | ||
1273 | <p>Here is a brief list of supported functions. | |
1274 | ||
1275 | <p>Note: Many commands have the <m/name/ of the protocol instance as an argument. | |
1276 | This argument can be omitted if there exists only a single instance. | |
1277 | ||
1278 | <descrip> | |
1279 | <tag><label id="cli-show-status">show status</tag> | |
1280 | Show router status, that is BIRD version, uptime and time from last | |
1281 | reconfiguration. | |
1282 | ||
1283 | <tag><label id="cli-show-interfaces">show interfaces [summary]</tag> | |
1284 | Show the list of interfaces. For each interface, print its type, state, | |
1285 | MTU and addresses assigned. | |
1286 | ||
1287 | <tag><label id="cli-show-protocols">show protocols [all]</tag> | |
1288 | Show list of protocol instances along with tables they are connected to | |
1289 | and protocol status, possibly giving verbose information, if <cf/all/ is | |
1290 | specified. | |
1291 | ||
1292 | <!-- TODO: Move these protocol-specific remote control commands to the protocol sections --> | |
1293 | <tag><label id="cli-show-ospf-iface">show ospf interface [<m/name/] ["<m/interface/"]</tag> | |
1294 | Show detailed information about OSPF interfaces. | |
1295 | ||
1296 | <tag><label id="cli-show-ospf-neighbors">show ospf neighbors [<m/name/] ["<m/interface/"]</tag> | |
1297 | Show a list of OSPF neighbors and a state of adjacency to them. | |
1298 | ||
1299 | <tag><label id="cli-show-ospf-state">show ospf state [all] [<m/name/]</tag> | |
1300 | Show detailed information about OSPF areas based on a content of the | |
1301 | link-state database. It shows network topology, stub networks, | |
1302 | aggregated networks and routers from other areas and external routes. | |
1303 | The command shows information about reachable network nodes, use option | |
1304 | <cf/all/ to show information about all network nodes in the link-state | |
1305 | database. | |
1306 | ||
1307 | <tag><label id="cli-show-ospf-topology">show ospf topology [all] [<m/name/]</tag> | |
1308 | Show a topology of OSPF areas based on a content of the link-state | |
1309 | database. It is just a stripped-down version of 'show ospf state'. | |
1310 | ||
1311 | <tag><label id="cli-show-ospf-lsadb">show ospf lsadb [global | area <m/id/ | link] [type <m/number/] [lsid <m/id/] [self | router <m/id/] [<m/name/] </tag> | |
1312 | Show contents of an OSPF LSA database. Options could be used to filter | |
1313 | entries. | |
1314 | ||
1315 | <tag><label id="cli-show-rip-interfaces">show rip interfaces [<m/name/] ["<m/interface/"]</tag> | |
1316 | Show detailed information about RIP interfaces. | |
1317 | ||
1318 | <tag><label id="cli-show-rip-neighbors">show rip neighbors [<m/name/] ["<m/interface/"]</tag> | |
1319 | Show a list of RIP neighbors and associated state. | |
1320 | ||
1321 | <tag><label id="cli-show-static">show static [<m/name/]</tag> | |
1322 | Show detailed information about static routes. | |
1323 | ||
1324 | <tag><label id="cli-show-bfd-sessions">show bfd sessions [<m/name/] [address (<m/IP/|<m/prefix/)] [(interface|dev) "<m/name/"] [ipv4|ipv6] [direct|multihop] [all]</tag> | |
1325 | Show information about BFD sessions. Options could be used to filter | |
1326 | entries, or in the case of the option <cf/all/ to give verbose output. | |
1327 | ||
1328 | <tag><label id="cli-show-symbols">show symbols [table|filter|function|protocol|template|roa|<m/symbol/]</tag> | |
1329 | Show the list of symbols defined in the configuration (names of | |
1330 | protocols, routing tables etc.). | |
1331 | ||
1332 | <tag><label id="cli-show-route">show route [[(for|in)] <m/prefix/|for <m/IP/] [table (<m/t/|all)] [(import|export) table <m/p/.<m/c/] [filter <m/f/|where <m/cond/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag> | |
1333 | Show contents of specified routing tables, that is routes, their metrics | |
1334 | and (in case the <cf/all/ switch is given) all their attributes. | |
1335 | ||
1336 | <p>You can specify a <m/prefix/ if you want to print routes for a | |
1337 | specific network. If you use <cf>for <m/prefix or IP/</cf>, you'll get | |
1338 | the entry which will be used for forwarding of packets to the given | |
1339 | destination. Finally, if you use <cf>in <m/prefix/</cf>, you get all | |
1340 | prefixes covered by the given prefix. | |
1341 | By default, all routes for each network are printed with | |
1342 | the selected one at the top, unless <cf/primary/ is given in which case | |
1343 | only the selected route is shown. | |
1344 | ||
1345 | <p>The <cf/show route/ command can process one or multiple routing | |
1346 | tables. The set of selected tables is determined on three levels: First, | |
1347 | tables can be explicitly selected by <cf/table/ switch, which could be | |
1348 | used multiple times, all tables are specified by <cf/table all/. Second, | |
1349 | tables can be implicitly selected by channels or protocols that are | |
1350 | arguments of several other switches (e.g., <cf/export/, <cf/protocol/). | |
1351 | Last, the set of default tables is used: <cf/master4/, <cf/master6/ and | |
1352 | each first table of any other network type. | |
1353 | ||
1354 | <p>There are internal tables when <cf/(import|export) table/ options | |
1355 | are used for some channels. They can be selected explicitly with | |
1356 | <cf/(import|export) table/ switch, specifying protocol <m/p/ and | |
1357 | channel name <m/c/. | |
1358 | ||
1359 | <p>You can also ask for printing only routes processed and accepted by | |
1360 | a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ } | |
1361 | </cf> or matching a given condition (<cf>where <m/condition/</cf>). | |
1362 | ||
1363 | The <cf/export/, <cf/preexport/ and <cf/noexport/ switches ask for | |
1364 | printing of routes that are exported to the specified protocol or | |
1365 | channel. With <cf/preexport/, the export filter of the channel is | |
1366 | skipped. With <cf/noexport/, routes rejected by the export filter are | |
1367 | printed instead. Note that routes not exported for other reasons | |
1368 | (e.g. secondary routes or routes imported from that protocol) are not | |
1369 | printed even with <cf/noexport/. These switches also imply that | |
1370 | associated routing tables are selected instead of default ones. | |
1371 | ||
1372 | <p>You can also select just routes added by a specific protocol. | |
1373 | <cf>protocol <m/p/</cf>. This switch also implies that associated | |
1374 | routing tables are selected instead of default ones. | |
1375 | ||
1376 | <p>If BIRD is configured to keep filtered routes (see <cf/import keep | |
1377 | filtered/ option), you can show them instead of routes by using | |
1378 | <cf/filtered/ switch. | |
1379 | ||
1380 | <p>The <cf/stats/ switch requests showing of route statistics (the | |
1381 | number of networks, number of routes before and after filtering). If | |
1382 | you use <cf/count/ instead, only the statistics will be printed. | |
1383 | ||
1384 | <tag><label id="cli-mrt-dump">mrt dump table <m/name/|"<m/pattern/" to "<m/filename/" [filter <m/f/|where <m/c/]</tag> | |
1385 | Dump content of a routing table to a specified file in MRT table dump | |
1386 | format. See <ref id="mrt" name="MRT protocol"> for details. | |
1387 | ||
1388 | <tag><label id="cli-configure">configure [soft] ["<m/config file/"] [timeout [<m/number/]]</tag> | |
1389 | Reload configuration from a given file. BIRD will smoothly switch itself | |
1390 | to the new configuration, protocols are reconfigured if possible, | |
1391 | restarted otherwise. Changes in filters usually lead to restart of | |
1392 | affected protocols. | |
1393 | ||
1394 | The previous configuration is saved and the user can switch back to it | |
1395 | with <ref id="cli-configure-undo" name="configure undo"> command. The | |
1396 | old saved configuration is released (even if the reconfiguration attempt | |
1397 | fails due to e.g. a syntax error). | |
1398 | ||
1399 | If <cf/soft/ option is used, changes in filters does not cause BIRD to | |
1400 | restart affected protocols, therefore already accepted routes (according | |
1401 | to old filters) would be still propagated, but new routes would be | |
1402 | processed according to the new filters. | |
1403 | ||
1404 | If <cf/timeout/ option is used, config timer is activated. The new | |
1405 | configuration could be either confirmed using <cf/configure confirm/ | |
1406 | command, or it will be reverted to the old one when the config timer | |
1407 | expires. This is useful for cases when reconfiguration breaks current | |
1408 | routing and a router becomes inaccessible for an administrator. The | |
1409 | config timeout expiration is equivalent to <cf/configure undo/ | |
1410 | command. The timeout duration could be specified, default is 300 s. | |
1411 | ||
1412 | <tag><label id="cli-configure-confirm">configure confirm</tag> | |
1413 | Deactivate the config undo timer and therefore confirm the current | |
1414 | configuration. | |
1415 | ||
1416 | <tag><label id="cli-configure-undo">configure undo</tag> | |
1417 | Undo the last configuration change and smoothly switch back to the | |
1418 | previous (stored) configuration. If the last configuration change was | |
1419 | soft, the undo change is also soft. There is only one level of undo, but | |
1420 | in some specific cases when several reconfiguration requests are given | |
1421 | immediately in a row and the intermediate ones are skipped then the undo | |
1422 | also skips them back. | |
1423 | ||
1424 | <tag><label id="cli-configure-check">configure check ["<m/config file/"]</tag> | |
1425 | Read and parse given config file, but do not use it. useful for checking | |
1426 | syntactic and some semantic validity of an config file. | |
1427 | ||
1428 | <tag><label id="cli-enable-disable-restart">enable|disable|restart <m/name/|"<m/pattern/"|all</tag> | |
1429 | Enable, disable or restart a given protocol instance, instances matching | |
1430 | the <cf><m/pattern/</cf> or <cf/all/ instances. | |
1431 | ||
1432 | <tag><label id="cli-reload">reload [in|out] <m/name/|"<m/pattern/"|all</tag> | |
1433 | Reload a given protocol instance, that means re-import routes from the | |
1434 | protocol instance and re-export preferred routes to the instance. If | |
1435 | <cf/in/ or <cf/out/ options are used, the command is restricted to one | |
1436 | direction (re-import or re-export). | |
1437 | ||
1438 | This command is useful if appropriate filters have changed but the | |
1439 | protocol instance was not restarted (or reloaded), therefore it still | |
1440 | propagates the old set of routes. For example when <cf/configure soft/ | |
1441 | command was used to change filters. | |
1442 | ||
1443 | Re-export always succeeds, but re-import is protocol-dependent and might | |
1444 | fail (for example, if BGP neighbor does not support route-refresh | |
1445 | extension). In that case, re-export is also skipped. Note that for the | |
1446 | pipe protocol, both directions are always reloaded together (<cf/in/ or | |
1447 | <cf/out/ options are ignored in that case). | |
1448 | ||
1449 | <tag><label id="cli-timeformat">timeformat "<m/format1/" [<m/limit/ "<m/format2/"]</tag> | |
1450 | Override format of date/time used by BIRD in this CLI session. | |
1451 | ||
1452 | Meaning of "<m/format1/", <m/limit/, and "<m/format2/" is the same as in the | |
1453 | <ref id="opt-timeformat" name="timeformat"> configuration option. Also, the | |
1454 | same <cf/iso .../ shorthands may be used. | |
1455 | ||
1456 | <tag><label id="cli-down">down</tag> | |
1457 | Shut BIRD down. | |
1458 | ||
1459 | <tag><label id="cli-graceful-restart">graceful restart</tag> | |
1460 | Shut BIRD down for graceful restart. See <ref id="graceful-restart" | |
1461 | name="graceful restart"> section for details. | |
1462 | ||
1463 | <tag><label id="cli-debug">debug <m/protocol/|<m/pattern/|all all|off|{ states|routes|filters|events|packets [, <m/.../] }</tag> | |
1464 | Control protocol debugging. | |
1465 | ||
1466 | <tag><label id="cli-dump">dump resources|sockets|ao keys|events|interfaces|neighbors|attributes|routes|protocols "<m/file/"</tag> | |
1467 | Creates the given file (it must not exist) and dumps contents of | |
1468 | internal data structures there. By sending SIGUSR1, you get all of | |
1469 | these concatenated to <cf/bird.dump/ in the current directory. | |
1470 | The file is only readable for the user running the daemon. | |
1471 | The format of dump files is internal and could change in the future | |
1472 | without any notice. | |
1473 | ||
1474 | <tag><label id="cli-echo">echo all|off|{ <m/list of log classes/ } [ <m/buffer-size/ ]</tag> | |
1475 | Control echoing of log messages to the command-line output. | |
1476 | See <ref id="opt-log" name="log option"> for a list of log classes. | |
1477 | ||
1478 | <tag><label id="cli-eval">eval <m/expr/</tag> | |
1479 | Evaluate given expression. | |
1480 | </descrip> | |
1481 | ||
1482 | ||
1483 | <chapt>Filters | |
1484 | <label id="filters"> | |
1485 | ||
1486 | <sect>Introduction | |
1487 | <label id="filters-intro"> | |
1488 | ||
1489 | <p>BIRD contains a simple programming language. (No, it can't yet read mail :-). | |
1490 | There are two objects in this language: filters and functions. Filters are | |
1491 | interpreted by BIRD core when a route is being passed between protocols and | |
1492 | routing tables. The filter language contains control structures such as if's and | |
1493 | switches, but it allows no loops. An example of a filter using many features can | |
1494 | be found in <file>filter/test.conf</file>. | |
1495 | ||
1496 | <p>Filter gets the route, looks at its attributes and modifies some of them if | |
1497 | it wishes. At the end, it decides whether to pass the changed route through | |
1498 | (using <cf/accept/) or whether to <cf/reject/ it. A simple filter looks like | |
1499 | this: | |
1500 | ||
1501 | <code> | |
1502 | filter not_too_far | |
1503 | { | |
1504 | int var; | |
1505 | if defined( rip_metric ) then | |
1506 | var = rip_metric; | |
1507 | else { | |
1508 | var = 1; | |
1509 | rip_metric = 1; | |
1510 | } | |
1511 | if rip_metric > 10 then | |
1512 | reject "RIP metric is too big"; | |
1513 | else | |
1514 | accept "ok"; | |
1515 | } | |
1516 | </code> | |
1517 | ||
1518 | <p>As you can see, a filter has a header, a list of local variables, and a body. | |
1519 | The header consists of the <cf/filter/ keyword followed by a (unique) name of | |
1520 | filter. The list of local variables consists of <cf><m>type name</m>;</cf> | |
1521 | pairs where each pair declares one local variable. The body consists of <cf> | |
1522 | { <m>statements</m> }</cf>. Each <m/statement/ is terminated by a <cf/;/. You | |
1523 | can group several statements to a single compound statement by using braces | |
1524 | (<cf>{ <m>statements</m> }</cf>) which is useful if you want to make a bigger | |
1525 | block of code conditional. | |
1526 | ||
1527 | <p>BIRD supports functions, so that you don not have to repeat the same blocks | |
1528 | of code over and over. Functions can have zero or more parameters and they can | |
1529 | have local variables. If the function returns value, then you should always | |
1530 | specify its return type. Direct recursion is possible. Function definitions look | |
1531 | like this: | |
1532 | ||
1533 | <code> | |
1534 | function name() -> int | |
1535 | { | |
1536 | int local_variable; | |
1537 | int another_variable = 5; | |
1538 | return 42; | |
1539 | } | |
1540 | ||
1541 | function with_parameters(int parameter) -> pair | |
1542 | { | |
1543 | print parameter; | |
1544 | return (1, 2); | |
1545 | } | |
1546 | </code> | |
1547 | ||
1548 | <p>Like in C programming language, variables are declared inside function body, | |
1549 | either at the beginning, or mixed with other statements. Declarations may | |
1550 | contain initialization. You can also declare variables in nested blocks, such | |
1551 | variables have scope restricted to such block. There is a deprecated syntax to | |
1552 | declare variables after the <cf/function/ line, but before the first <cf/{/. | |
1553 | Functions are called like in C: <cf>name(); with_parameters(5);</cf>. Function | |
1554 | may return values using the <cf>return <m/[expr]/</cf> command. Returning a | |
1555 | value exits from current function (this is similar to C). | |
1556 | ||
1557 | <p>Filters are defined in a way similar to functions except they cannot have | |
1558 | explicit parameters and cannot return. They get a route table entry as an implicit parameter, it | |
1559 | is also passed automatically to any functions called. The filter must terminate | |
1560 | with either <cf/accept/ or <cf/reject/ statement. If there is a runtime error in | |
1561 | filter, the route is rejected. | |
1562 | ||
1563 | <p>A nice trick to debug filters is to use <cf>show route filter <m/name/</cf> | |
1564 | from the command line client. An example session might look like: | |
1565 | ||
1566 | <code> | |
1567 | pavel@bug:~/bird$ ./birdc -s bird.ctl | |
1568 | BIRD 0.0.0 ready. | |
1569 | bird> show route | |
1570 | 10.0.0.0/8 dev eth0 [direct1 23:21] (240) | |
1571 | 195.113.30.2/32 dev tunl1 [direct1 23:21] (240) | |
1572 | 127.0.0.0/8 dev lo [direct1 23:21] (240) | |
1573 | bird> show route ? | |
1574 | show route [<prefix>] [table <t>] [filter <f>] [all] [primary]... | |
1575 | bird> show route filter { if 127.0.0.5 ˜ net then accept; } | |
1576 | 127.0.0.0/8 dev lo [direct1 23:21] (240) | |
1577 | bird> | |
1578 | </code> | |
1579 | ||
1580 | ||
1581 | <sect>Data types | |
1582 | <label id="data-types"> | |
1583 | ||
1584 | <p>Each variable and each value has certain type. Booleans, integers and enums | |
1585 | are incompatible with each other (that is to prevent you from shooting oneself | |
1586 | in the foot). | |
1587 | ||
1588 | <descrip> | |
1589 | <tag><label id="type-bool">bool</tag> | |
1590 | This is a boolean type, it can have only two values, <cf/true/ and | |
1591 | <cf/false/. Boolean is the only type you can use in <cf/if/ statements. | |
1592 | ||
1593 | <tag><label id="type-int">int</tag> | |
1594 | This is a general integer type. It is an unsigned 32bit type; i.e., you | |
1595 | can expect it to store values from 0 to 4294967295. Overflows are not | |
1596 | checked. You can use <cf/0x1234/ syntax to write hexadecimal values. | |
1597 | ||
1598 | <tag><label id="type-pair">pair</tag> | |
1599 | This is a pair of two short integers. Each component can have values | |
1600 | from 0 to 65535. Literals of this type are written as <cf/(1234,5678)/. | |
1601 | The same syntax can also be used to construct a pair from two arbitrary | |
1602 | integer expressions (for example <cf/(1+2,a)/). | |
1603 | ||
1604 | Operators <cf/.asn/ and <cf/.data/ can be used to extract corresponding | |
1605 | components of a pair: <cf>(<m/asn/, <m/data/)</cf>. | |
1606 | ||
1607 | <tag><label id="type-quad">quad</tag> | |
1608 | This is a dotted quad of numbers used to represent router IDs (and | |
1609 | others). Each component can have a value from 0 to 255. Literals of | |
1610 | this type are written like IPv4 addresses. | |
1611 | ||
1612 | <tag><label id="type-string">string</tag> | |
1613 | This is a string of characters. There are no ways to modify strings in | |
1614 | filters. You can pass them between functions, assign them to variables | |
1615 | of type <cf/string/, print such variables, use standard string | |
1616 | comparison operations (e.g. <cf/=, !=, <, >, <=, >=/), and | |
1617 | concatenate two strings with <cf>append(<m/A/, <m/B/)</cf> function or | |
1618 | <cf/++/ operator. | |
1619 | ||
1620 | String literals are written as <cf/"This is a string constant"/. | |
1621 | Additionally matching (<cf/˜, !˜/) operators could be used | |
1622 | to match a string value against a shell pattern (represented also as a | |
1623 | string). | |
1624 | ||
1625 | <tag><label id="type-bytestring">bytestring</tag> | |
1626 | This is a sequence of arbitrary bytes. There are no ways to modify | |
1627 | bytestrings in filters. You can pass them between functions, assign | |
1628 | them to variables of type <cf/bytestring/, print such values, compare | |
1629 | bytestings (<cf/=, !=/), and concatenate two bytestrings with | |
1630 | <cf>append(<m/A/, <m/B/)</cf> function or <cf/++/ operator. | |
1631 | ||
1632 | Bytestring literals are written as a sequence of hexadecimal digit | |
1633 | pairs, optionally colon-separated. A bytestring specified this way | |
1634 | must be either at least 16 bytes (32 digits) long, or prefixed by the | |
1635 | <cf/hex:/ prefix: <cf/01:23:45:67:89:ab:cd:ef:01:23:45:67:89:ab:cd:ef/, | |
1636 | <cf/0123456789abcdef0123456789abcdef/, <cf/hex:/, <cf/hex:12:34:56/, | |
1637 | <cf/hex:12345678/. | |
1638 | ||
1639 | A bytestring can be made from a hex string using <cf/from_hex()/ | |
1640 | function. Source strings can use any number of dots, colons, hyphens | |
1641 | and spaces as byte separators: <cf/from_hex(" 12.34 56:78 ab-cd-ef ")/. | |
1642 | ||
1643 | <tag><label id="type-ip">ip</tag> | |
1644 | This type can hold a single IP address. The IPv4 addresses are stored as | |
1645 | IPv4-Mapped IPv6 addresses so one data type for both of them is used. | |
1646 | Whether the address is IPv4 or not may be checked by <cf>.is_v4</cf> | |
1647 | which returns a <cf/bool/. IP addresses are written in the standard | |
1648 | notation (<cf/10.20.30.40/ or <cf/fec0:3:4::1/). You can apply special | |
1649 | operator <cf>.mask(<m>number</m>)</cf> on values of type ip. It masks out | |
1650 | all but first <cf><m>number</m></cf> bits from the IP address. So | |
1651 | <cf/1.2.3.4.mask(8) = 1.0.0.0/ is true. | |
1652 | ||
1653 | <tag><label id="type-prefix">prefix</tag> | |
1654 | This type can hold a network prefix consisting of IP address, prefix | |
1655 | length and several other values. This is the key in route tables. | |
1656 | ||
1657 | Prefixes may be of several types, which can be determined by the special | |
1658 | operator <cf/.type/. The type may be: | |
1659 | ||
1660 | <cf/NET_IP4/ and <cf/NET_IP6/ prefixes hold an IP prefix. The literals | |
1661 | are written as <cf><m/ipaddress//<m/pxlen/</cf>. There are two special | |
1662 | operators on these: <cf/.ip/ which extracts the IP address from the | |
1663 | pair, and <cf/.len/, which separates prefix length from the pair. | |
1664 | So <cf>1.2.0.0/16.len = 16</cf> is true. | |
1665 | ||
1666 | <cf/NET_IP6_SADR/ nettype holds both destination and source IPv6 | |
1667 | prefix. The literals are written as <cf><m/ipaddress//<m/pxlen/ from | |
1668 | <m/ipaddress//<m/pxlen/</cf>, where the first part is the destination | |
1669 | prefix and the second art is the source prefix. They support the same | |
1670 | operators as IP prefixes, but just for the destination part. They also | |
1671 | support <cf/.src/ and <cf/.dst/ operators to get respective parts of the | |
1672 | address as separate <cf/NET_IP6/ values. | |
1673 | ||
1674 | <cf/NET_VPN4/ and <cf/NET_VPN6/ prefixes hold an IP prefix with VPN | |
1675 | Route Distinguisher (<rfc id="4364">). They support the same special | |
1676 | operators as IP prefixes, and also <cf/.rd/ which extracts the Route | |
1677 | Distinguisher. Their literals are written | |
1678 | as <cf><m/rd/ <m/ipprefix/</cf> | |
1679 | ||
1680 | <cf/NET_ROA4/ and <cf/NET_ROA6/ prefixes hold an IP prefix range | |
1681 | together with an ASN. They support the same special operators as IP | |
1682 | prefixes, and also <cf/.maxlen/ which extracts maximal prefix length, | |
1683 | and <cf/.asn/ which extracts the ASN. | |
1684 | ||
1685 | <cf/NET_FLOW4/ and <cf/NET_FLOW6/ hold an IP prefix together with a | |
1686 | flowspec rule. Filters currently do not support much flowspec parsing, | |
1687 | only <cf/.src/ and <cf/.dst/ operators to get source and destination | |
1688 | parts of the flowspec as separate <cf/NET_IP4/ / <cf/NET_IP6/ values. | |
1689 | ||
1690 | <cf/NET_MPLS/ holds a single MPLS label and its handling is currently | |
1691 | not implemented. | |
1692 | ||
1693 | <tag><label id="type-rd"><label id="type-vpnrd">rd</tag> | |
1694 | This is a route distinguisher according to <rfc id="4364">. There are | |
1695 | three kinds of RDs: <cf><m/asn/:<m/32bit int/</cf>, <cf><m/asn4/:<m/16bit int/</cf> | |
1696 | and <cf><m/IPv4 address/:<m/32bit int/</cf> | |
1697 | ||
1698 | <tag><label id="type-ec">ec</tag> | |
1699 | This is a specialized type used to represent BGP extended community | |
1700 | values. It is essentially a 64bit value, literals of this type are | |
1701 | usually written as <cf>(<m/kind/, <m/key/, <m/value/)</cf>, where | |
1702 | <cf/kind/ is a kind of extended community (e.g. <cf/rt/ / <cf/ro/ for a | |
1703 | route target / route origin communities), the format and possible values | |
1704 | of <cf/key/ and <cf/value/ are usually integers, but it depends on the | |
1705 | used kind. Similarly to pairs, ECs can be constructed using expressions | |
1706 | for <cf/key/ and <cf/value/ parts, (e.g. <cf/(ro, myas, 3*10)/, where | |
1707 | <cf/myas/ is an integer variable). | |
1708 | ||
1709 | <tag><label id="type-lc">lc</tag> | |
1710 | This is a specialized type used to represent BGP large community | |
1711 | values. It is essentially a triplet of 32bit values, where the first | |
1712 | value is reserved for the AS number of the issuer, while meaning of | |
1713 | remaining parts is defined by the issuer. Literals of this type are | |
1714 | written as <cf/(123, 456, 789)/, with any integer values. Similarly to | |
1715 | pairs, LCs can be constructed using expressions for its parts, (e.g. | |
1716 | <cf/(myas, 10+20, 3*10)/, where <cf/myas/ is an integer variable). | |
1717 | ||
1718 | Operators <cf/.asn/, <cf/.data1/, and <cf/.data2/ can be used | |
1719 | to extract corresponding components of LCs: | |
1720 | <cf>(<m/asn/, <m/data1/, <m/data2/)</cf>. | |
1721 | ||
1722 | <tag><label id="type-set">int|pair|quad|ip|prefix|ec|lc|rd|enum set</tag> | |
1723 | Filters recognize several types of sets. Sets are similar to strings: you | |
1724 | can pass them around but you cannot modify them. Literals of type <cf>int | |
1725 | set</cf> look like <cf> [ 1, 2, 5..7 ]</cf>. As you can see, both simple | |
1726 | values and ranges are permitted in sets. | |
1727 | ||
1728 | For pair sets, expressions like <cf/(123,*)/ can be used to denote | |
1729 | ranges (in that case <cf/(123,0)..(123,65535)/). You can also use | |
1730 | <cf/(123,5..100)/ for range <cf/(123,5)..(123,100)/. You can also use | |
1731 | <cf/*/ and <cf/a..b/ expressions in the first part of a pair, note that | |
1732 | such expressions are translated to a set of intervals, which may be | |
1733 | memory intensive. E.g. <cf/(*,4..20)/ is translated to <cf/(0,4..20), | |
1734 | (1,4..20), (2,4..20), ... (65535, 4..20)/. | |
1735 | ||
1736 | EC sets use similar expressions like pair sets, e.g. <cf/(rt, 123, | |
1737 | 10..20)/ or <cf/(ro, 123, *)/. Expressions requiring the translation | |
1738 | (like <cf/(rt, *, 3)/) are not allowed (as they usually have 4B range | |
1739 | for ASNs). | |
1740 | ||
1741 | Also LC sets use similar expressions like pair sets. You can use ranges | |
1742 | and wildcards, but if one field uses that, more specific (later) fields | |
1743 | must be wildcards. E.g., <cf/(10, 20..30, *)/ or <cf/(10, 20, 30..40)/ | |
1744 | is valid, while <cf/(10, *, 20..30)/ or <cf/(10, 20..30, 40)/ is not | |
1745 | valid. | |
1746 | ||
1747 | You can also use named constants or compound expressions for non-prefix | |
1748 | set values. However, it must be possible to evaluate these expressions | |
1749 | before daemon boots. So you can use only constants inside them. Also, | |
1750 | in case of compound expressions, they require parentheses around them. | |
1751 | E.g. | |
1752 | ||
1753 | <code> | |
1754 | define one=1; | |
1755 | define myas=64500; | |
1756 | ||
1757 | int set odds = [ one, (2+1), (6-one), (2*2*2-1), 9, 11 ]; | |
1758 | pair set ps = [ (1,one+one), (3,4)..(4,8), (5,*), (6,3..6), (7..9,*) ]; | |
1759 | ec set es = [ (rt, myas, *), (rt, myas+2, 0..16*16*16-1) ]; | |
1760 | </code> | |
1761 | ||
1762 | Sets of prefixes are special: their literals does not allow ranges, but | |
1763 | allows prefix patterns that are written | |
1764 | as <cf><m>ipaddress</m>/<m>pxlen</m>{<m>low</m>,<m>high</m>}</cf>. | |
1765 | Prefix <cf><m>ip1</m>/<m>len1</m></cf> matches prefix | |
1766 | pattern <cf><m>ip2</m>/<m>len2</m>{<m>l</m>,<m>h</m>}</cf> if the | |
1767 | first <cf>min(len1, len2)</cf> bits of <cf/ip1/ and <cf/ip2/ are | |
1768 | identical and <cf>l <= len1 <= h</cf>. A valid prefix pattern | |
1769 | has to satisfy <cf>low <= high</cf>, but <cf/pxlen/ is not | |
1770 | constrained by <cf/low/ or <cf/high/. Obviously, a prefix matches a | |
1771 | prefix set literal if it matches any prefix pattern in the prefix set | |
1772 | literal. | |
1773 | ||
1774 | There are also two shorthands for prefix patterns: <cf><m/address//<m/len/+</cf> | |
1775 | is a shorthand for <cf><m/address//<m/len/{<m/len/,<m/maxlen/}</cf> | |
1776 | (where <cf><m/maxlen/</cf> is 32 for IPv4 and 128 for IPv6), that means | |
1777 | network prefix <cf><m/address//<m/len/</cf> and all its subnets. | |
1778 | <cf><m/address//<m/len/-</cf> is a shorthand for | |
1779 | <cf><m/address//<m/len/{0,<m/len/}</cf>, that means network prefix | |
1780 | <cf><m/address//<m/len/</cf> and all its supernets (network prefixes | |
1781 | that contain it). | |
1782 | ||
1783 | 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} | |
1784 | ]</cf> matches prefix <cf>1.0.0.0/8</cf>, all subprefixes of | |
1785 | <cf>2.0.0.0/8</cf>, all superprefixes of <cf>3.0.0.0/8</cf> and prefixes | |
1786 | <cf/4.X.X.X/ whose prefix length is 16 to 24. <cf>[ 0.0.0.0/0{20,24} ]</cf> | |
1787 | matches all prefixes (regardless of IP address) whose prefix length is | |
1788 | 20 to 24, <cf>[ 1.2.3.4/32- ]</cf> matches any prefix that contains IP | |
1789 | address <cf>1.2.3.4</cf>. <cf>1.2.0.0/16 ˜ [ 1.0.0.0/8{15,17} ]</cf> | |
1790 | is true, but <cf>1.0.0.0/16 ˜ [ 1.0.0.0/8- ]</cf> is false. | |
1791 | ||
1792 | Cisco-style patterns like <cf>10.0.0.0/8 ge 16 le 24</cf> can be expressed | |
1793 | in BIRD as <cf>10.0.0.0/8{16,24}</cf>, <cf>192.168.0.0/16 le 24</cf> as | |
1794 | <cf>192.168.0.0/16{16,24}</cf> and <cf>192.168.0.0/16 ge 24</cf> as | |
1795 | <cf>192.168.0.0/16{24,32}</cf>. | |
1796 | ||
1797 | It is not possible to mix IPv4 and IPv6 prefixes in a prefix set. It is | |
1798 | currently possible to mix IPv4 and IPv6 addresses in an ip set, but that | |
1799 | behavior may change between versions without any warning; don't do it | |
1800 | unless you are more than sure what you are doing. (Really, don't do it.) | |
1801 | ||
1802 | <tag><label id="type-enum">enum</tag> | |
1803 | Enumeration types are fixed sets of possibilities. You can't define your | |
1804 | own variables of such type, but some route attributes are of enumeration | |
1805 | type. Enumeration types are incompatible with each other. | |
1806 | ||
1807 | <tag><label id="type-bgppath">bgppath</tag> | |
1808 | BGP path is a list of autonomous system numbers. You can't write | |
1809 | literals of this type. There are several special operators on bgppaths: | |
1810 | ||
1811 | <cf><m/P/.first</cf> returns the first ASN (the neighbor ASN) in path <m/P/. | |
1812 | ||
1813 | <cf><m/P/.last</cf> returns the last ASN (the source ASN) in path <m/P/. | |
1814 | ||
1815 | <cf><m/P/.last_nonaggregated</cf> returns the last ASN in the non-aggregated part of the path <m/P/. | |
1816 | ||
1817 | Both <cf/first/ and <cf/last/ return zero if there is no appropriate | |
1818 | ASN, for example if the path contains an AS set element as the first (or | |
1819 | the last) part. If the path ends with an AS set, <cf/last_nonaggregated/ | |
1820 | may be used to get last ASN before any AS set. | |
1821 | ||
1822 | <cf><m/P/.len</cf> returns the length of path <m/P/. | |
1823 | ||
1824 | <cf><m/P/.empty</cf> makes the path <m/P/ empty. Can't be used as a value, always modifies the object. | |
1825 | ||
1826 | <cf><m/P/.prepend(<m/A/)</cf> prepends ASN <m/A/ to path <m/P/ and | |
1827 | returns the result. | |
1828 | ||
1829 | <cf><m/P/.delete(<m/A/)</cf> deletes all instances of ASN <m/A/ from | |
1830 | from path <m/P/ and returns the result. <m/A/ may also be an integer | |
1831 | set, in that case the operator deletes all ASNs from path <m/P/ that are | |
1832 | also members of set <m/A/. | |
1833 | ||
1834 | <cf><m/P/.filter(<m/A/)</cf> deletes all ASNs from path <m/P/ that are | |
1835 | not members of integer set <m/A/, and returns the result. | |
1836 | I.e., <cf/filter/ do the same as <cf/delete/ with inverted set <m/A/. | |
1837 | ||
1838 | Methods <cf>prepend</cf>, <cf>delete</cf> and <cf>filter</cf> keep the | |
1839 | original object intact as long as you use the result in any way. You can | |
1840 | also write e.g. <cf><m/P/.prepend(<m/A/);</cf> as a standalone statement. | |
1841 | This variant does modify the original object with the result of the operation. | |
1842 | ||
1843 | <tag><label id="type-bgpmask">bgpmask</tag> | |
1844 | BGP masks are patterns used for BGP path matching (using <cf>path | |
1845 | ˜ [= 2 3 5 * =]</cf> syntax). The masks resemble wildcard patterns | |
1846 | as used by UNIX shells. Autonomous system numbers match themselves, | |
1847 | <cf/*/ matches any (even empty) sequence of arbitrary AS numbers and | |
1848 | <cf/?/ matches one arbitrary AS number. For example, if <cf>bgp_path</cf> | |
1849 | is 4 3 2 1, then: <tt>bgp_path ˜ [= * 4 3 * =]</tt> is true, | |
1850 | but <tt>bgp_path ˜ [= * 4 5 * =]</tt> is false. There is also | |
1851 | <cf/+/ operator which matches one or multiple instances of previous | |
1852 | expression, e.g. <tt>[= 1 2+ 3 =]</tt> matches both path 1 2 3 and path | |
1853 | 1 2 2 2 3, but not 1 3 nor 1 2 4 3. Note that while <cf/*/ and <cf/?/ | |
1854 | are wildcard-style operators, <cf/+/ is regex-style operator. | |
1855 | ||
1856 | BGP mask expressions can also contain integer expressions enclosed in | |
1857 | parenthesis and integer variables, for example <tt>[= * 4 (1+2) a =]</tt>. | |
1858 | You can also use ranges (e.g. <tt>[= * 3..5 2 100..200 * =]</tt>) | |
1859 | and sets (e.g. <tt>[= 1 2 [3, 5, 7] * =]</tt>). | |
1860 | ||
1861 | <tag><label id="type-clist">clist</tag> | |
1862 | Clist is similar to a set, except that unlike other sets, it can be | |
1863 | modified. The type is used for community list (a set of pairs) and for | |
1864 | cluster list (a set of quads). There exist no literals of this type. | |
1865 | There are special operators on clists: | |
1866 | ||
1867 | <cf><m/C/.len</cf> returns the length of clist <m/C/. | |
1868 | ||
1869 | <cf><m/C/.empty</cf> makes the list <m/C/ empty. Can't be used as a value, always modifies the object. | |
1870 | ||
1871 | <cf><m/C/.add(<m/P/)</cf> adds pair (or quad) <m/P/ to clist <m/C/ and | |
1872 | returns the result. If item <m/P/ is already in clist <m/C/, it does | |
1873 | nothing. <m/P/ may also be a clist, in that case all its members are | |
1874 | added; i.e., it works as clist union. | |
1875 | ||
1876 | <cf><m/C/.delete(<m/P/)</cf> deletes pair (or quad) <m/P/ from clist | |
1877 | <m/C/ and returns the result. If clist <m/C/ does not contain item | |
1878 | <m/P/, it does nothing. <m/P/ may also be a pair (or quad) set, in that | |
1879 | case the operator deletes all items from clist <m/C/ that are also | |
1880 | members of set <m/P/. Moreover, <m/P/ may also be a clist, which works | |
1881 | analogously; i.e., it works as clist difference. | |
1882 | ||
1883 | <cf><m/C/.filter(<m/P/)</cf> deletes all items from clist <m/C/ that are | |
1884 | not members of pair (or quad) set <m/P/, and returns the result. I.e., <cf/filter/ do the same | |
1885 | as <cf/delete/ with inverted set <m/P/. <m/P/ may also be a clist, which | |
1886 | works analogously; i.e., it works as clist intersection. | |
1887 | ||
1888 | Methods <cf>add</cf>, <cf>delete</cf> and <cf>filter</cf> keep the | |
1889 | original object intact as long as you use the result in any way. You can | |
1890 | also write e.g. <cf><m/P/.add(<m/A/);</cf> as a standalone statement. | |
1891 | This variant does modify the original object with the result of the operation. | |
1892 | ||
1893 | <cf><m/C/.min</cf> returns the minimum element of clist <m/C/. | |
1894 | ||
1895 | <cf><m/C/.max</cf> returns the maximum element of clist <m/C/. | |
1896 | ||
1897 | Operators <cf/.min/, <cf/.max/ can be used together with <cf/filter/ | |
1898 | to extract the community from the specific subset of communities | |
1899 | (e.g. localpref or prepend) without the need to check every possible | |
1900 | value (e.g. <cf/filter(bgp_community, [(23456, 1000..1099)]).min/). | |
1901 | ||
1902 | <tag><label id="type-eclist">eclist</tag> | |
1903 | Eclist is a data type used for BGP extended community lists. Eclists | |
1904 | are very similar to clists, but they are sets of ECs instead of pairs. | |
1905 | The same operations (like <cf/add/, <cf/delete/ or <cf/˜/ and | |
1906 | <cf/!˜/ membership operators) can be used to modify or test | |
1907 | eclists, with ECs instead of pairs as arguments. | |
1908 | ||
1909 | <tag><label id="type-lclist">lclist</tag> | |
1910 | Lclist is a data type used for BGP large community lists. Like eclists, | |
1911 | lclists are very similar to clists, but they are sets of LCs instead of | |
1912 | pairs. The same operations (like <cf/add/, <cf/delete/ or <cf/˜/ | |
1913 | and <cf/!˜/ membership operators) can be used to modify or test | |
1914 | lclists, with LCs instead of pairs as arguments. | |
1915 | </descrip> | |
1916 | ||
1917 | ||
1918 | <sect>Operators | |
1919 | <label id="operators"> | |
1920 | ||
1921 | <p>The filter language supports common integer operators <cf>(+,-,*,/)</cf>, | |
1922 | parentheses <cf/(a*(b+c))/, comparison <cf/(a=b, a!=b, a<b, a>=b)/.</p> | |
1923 | ||
1924 | <p>Logical operations include unary not (<cf/!/), and (<cf/&&/), and or | |
1925 | (<cf/||/).</p> | |
1926 | ||
1927 | <p>Strings and bytestrings can be concatenated with <cf/++/ operator.</p> | |
1928 | ||
1929 | <p>Special operators include (<cf/˜/, <cf/!˜/) for "is (not) element | |
1930 | of a set" operation - it can be used on: | |
1931 | <itemize> | |
1932 | <item>element and set of elements of the same type (returning true if | |
1933 | element is contained in the given set) | |
1934 | <item>two strings (returning true if the first string matches a shell-like | |
1935 | pattern stored in the second string) | |
1936 | <item>IP and prefix (returning true if IP is within the range defined by | |
1937 | that prefix) | |
1938 | <item>prefix and prefix (returning true if the first prefix is more specific | |
1939 | than the second one) | |
1940 | <item>bgppath and bgpmask (returning true if the path matches the mask) | |
1941 | <item>number and bgppath (returning true if the number is in the path) | |
1942 | <item>bgppath and int (number) set (returning true if any ASN from the | |
1943 | path is in the set) | |
1944 | <item>pair/quad and clist (returning true if the pair/quad is element of | |
1945 | the clist) | |
1946 | <item>clist and pair/quad set (returning true if there is an element of the | |
1947 | clist that is also a member of the pair/quad set). | |
1948 | </itemize> | |
1949 | ||
1950 | <p>There are also operators related to RPKI infrastructure used to run | |
1951 | <rfc id="6483"> route origin validation and (draft) AS path validation. | |
1952 | ||
1953 | <itemize> | |
1954 | <item><cf>roa_check(<m/table/)</cf> checks the current route in the specified | |
1955 | ROA table and returns <cf>ROA_UNKNOWN</cf>, <cf>ROA_INVALID</cf> or <cf>ROA_VALID</cf>, | |
1956 | if the validation result is unknown, invalid, or valid, respectively. The result is | |
1957 | valid if there is a matching ROA, it is invalid if there is either matching ROA | |
1958 | with a different ASN, or any covering ROA with shorter maximal prefix length. | |
1959 | ||
1960 | <item><cf>roa_check(<m/table/, <m/prefix/, <m/asn/)</cf> is an explicit version | |
1961 | of the ROA check if the user for whatever reason needs to check a different prefix | |
1962 | or different ASN than the default one. The equivalent call of the short variant | |
1963 | is <cf>roa_check(<m/table/, net, bgp_path.last)</cf> and it is faster | |
1964 | to call the short variant. | |
1965 | ||
1966 | <item><cf>aspa_check_downstream(<m/table/)</cf> checks the current route | |
1967 | in the specified ASPA table and returns <cf>ASPA_UNKNOWN</cf>, <cf>ASPA_INVALID</cf>, | |
1968 | or <cf>ASPA_VALID</cf> if the validation result is unknown, invalid, or valid, | |
1969 | respectively. The result is valid if there is a full coverage of matching | |
1970 | ASPA records according to the Algorithm for Downstream Paths by the (draft). | |
1971 | This operator is not present if BGP is not compiled in. | |
1972 | ||
1973 | <item><cf>aspa_check_upstream(<m/table/)</cf> checks the current route | |
1974 | in the specified ASPA table as the former operator, but it applies the | |
1975 | (stricter) Algorithm for Upstream Paths by the (draft). | |
1976 | This operator is not present if BGP is not compiled in. | |
1977 | ||
1978 | <item><cf>aspa_check(<m/table/, <m/path/, <m/is_upstream/)</cf> is | |
1979 | an explicit version of the former two ASPA check operators. The equivalent | |
1980 | of <cf>aspa_check_downstream</cf> is <cf>aspa_check(<m/table/, bgp_path, false)</cf> | |
1981 | and for <cf>aspa_check_upstream</cf> it is | |
1982 | <cf>aspa_check(<m/table/, bgp_path, true)</cf>. | |
1983 | Note: the ASPA check does not include the local ASN in the AS path. | |
1984 | Also, <cf>ASPA_INVALID</cf> is returned for an empty AS path | |
1985 | or for AS path containing <cf>CONFED_SET</cf> or <cf>CONFED_SEQUENCE</cf> blocks, | |
1986 | as the (draft) stipulates. | |
1987 | </itemize> | |
1988 | ||
1989 | <p>The following example checks for ROA and ASPA on routes from a customer: | |
1990 | ||
1991 | <code> | |
1992 | roa6 table r6; | |
1993 | aspa table at; | |
1994 | attribute int valid_roa; | |
1995 | attribute int valid_aspa; | |
1996 | ||
1997 | filter customer_check { | |
1998 | case roa_check(r6) { | |
1999 | ROA_INVALID: reject "Invalid ROA"; | |
2000 | ROA_VALID: valid_roa = 1; | |
2001 | } | |
2002 | ||
2003 | case aspa_check_upstream(at) { | |
2004 | ASPA_INVALID: reject "Invalid ASPA"; | |
2005 | ASPA_VALID: valid_aspa = 1; | |
2006 | } | |
2007 | ||
2008 | accept; | |
2009 | } | |
2010 | </code> | |
2011 | ||
2012 | <sect>Control structures | |
2013 | <label id="control-structures"> | |
2014 | ||
2015 | <p>Filters support several control structures: conditions, for loops and case | |
2016 | switches. | |
2017 | ||
2018 | <p>Syntax of a condition is: <cf>if <m>boolean expression</m> then <m/commandT/; | |
2019 | else <m/commandF/;</cf> and you can use <cf>{ <m/command1/; <m/command2/; | |
2020 | <m>...</m> }</cf> instead of either command. The <cf>else</cf> clause may be | |
2021 | omitted. If the <cf><m>boolean expression</m></cf> is true, <m/commandT/ is | |
2022 | executed, otherwise <m/commandF/ is executed. | |
2023 | ||
2024 | <p>For loops allow to iterate over elements in compound data like BGP paths or | |
2025 | community lists. The syntax is: <cf>for [ <m/type/ ] <m/variable/ in <m/expr/ | |
2026 | do <m/command/;</cf> and you can also use compound command like in conditions. | |
2027 | The expression is evaluated to a compound data, then for each element from such | |
2028 | data the command is executed with the item assigned to the variable. A variable | |
2029 | may be an existing one (when just name is used) or a locally defined (when type | |
2030 | and name is used). In both cases, it must have the same type as elements. | |
2031 | ||
2032 | <p>The <cf>case</cf> is similar to case from Pascal. Syntax is <cf>case | |
2033 | <m/expr/ { else: | <m/set_body_expr/ /: <m/statement/ ; [... ] }</cf>. | |
2034 | The expression after <cf>case</cf> can be of any type that could be a member of | |
2035 | a set, while the <m/set_body_expr/ before <cf/:/ can be anything (constants, | |
2036 | intervals, expressions) that could be a part of a set literal. One exception is | |
2037 | prefix type, which can be used in sets bud not in <cf/case/ structure. Multiple | |
2038 | commands are allowed without <cf/{}/ grouping. If <cf><m/expr/</cf> matches one | |
2039 | of the <cf/:/ clauses, statements between it and next <cf/:/ statement are | |
2040 | executed. If <cf><m/expr/</cf> matches neither of the <cf/:/ clauses, the | |
2041 | statements after <cf/else:/ are executed. | |
2042 | ||
2043 | <p>Here is example that uses <cf/if/ and <cf/case/ structures: | |
2044 | ||
2045 | <code> | |
2046 | if 1234 = i then printn "."; else { | |
2047 | print "not 1234"; | |
2048 | print "You need {} around multiple commands"; | |
2049 | } | |
2050 | ||
2051 | for int asn in bgp_path do { | |
2052 | printn "ASN: ", asn; | |
2053 | if asn < 65536 then print " (2B)"; else print " (4B)"; | |
2054 | } | |
2055 | ||
2056 | case arg1 { | |
2057 | 2: print "two"; print "I can do more commands without {}"; | |
2058 | 3 .. 5: print "three to five"; | |
2059 | else: print "something else"; | |
2060 | } | |
2061 | </code> | |
2062 | ||
2063 | ||
2064 | <sect>Route attributes | |
2065 | <label id="route-attributes"> | |
2066 | ||
2067 | <p>A filter is implicitly passed a route, and it can access its attributes just | |
2068 | like it accesses variables. There are common route attributes, protocol-specific | |
2069 | route attributes and custom route attributes. Most common attributes are | |
2070 | mandatory (always defined), while remaining are optional. Attempts to access | |
2071 | undefined attribute result in a runtime error; you can check if an attribute is | |
2072 | defined by using the <cf>defined( <m>attribute</m> )</cf> operator. One notable | |
2073 | exception to this rule are attributes of bgppath and *clist types, where | |
2074 | undefined value is regarded as empty bgppath/*clist for most purposes. | |
2075 | ||
2076 | Attributes can be defined by just setting them in filters. Custom attributes | |
2077 | have to be first declared by <ref id="opt-attribute" name="attribute"> global | |
2078 | option. You can also undefine optional attribute back to non-existence by using | |
2079 | the <cf>unset( <m/attribute/ )</cf> operator. | |
2080 | ||
2081 | Common route attributes are: | |
2082 | ||
2083 | <descrip> | |
2084 | <tag><label id="rta-net"><m/prefix/ net</tag> | |
2085 | The network prefix or anything else the route is talking about. The | |
2086 | primary key of the routing table. Read-only. (See the <ref id="routes" | |
2087 | name="chapter about routes">.) | |
2088 | ||
2089 | <tag><label id="rta-scope"><m/enum/ scope</tag> | |
2090 | The scope of the route. Possible values: <cf/SCOPE_HOST/ for routes | |
2091 | local to this host, <cf/SCOPE_LINK/ for those specific for a physical | |
2092 | link, <cf/SCOPE_SITE/ and <cf/SCOPE_ORGANIZATION/ for private routes and | |
2093 | <cf/SCOPE_UNIVERSE/ for globally visible routes. This attribute is not | |
2094 | interpreted by BIRD and can be used to mark routes in filters. The | |
2095 | default value for new routes is <cf/SCOPE_UNIVERSE/. | |
2096 | ||
2097 | <tag><label id="rta-preference"><m/int/ preference</tag> | |
2098 | Preference of the route. Valid values are 0-65535. (See the chapter | |
2099 | about routing tables.) | |
2100 | ||
2101 | <tag><label id="rta-from"><m/ip/ from</tag> | |
2102 | The router which the route has originated from. | |
2103 | ||
2104 | <tag><label id="rta-gw"><m/ip/ gw</tag> | |
2105 | Next hop packets routed using this route should be forwarded to. | |
2106 | ||
2107 | <tag><label id="rta-proto"><m/string/ proto</tag> | |
2108 | The name of the protocol which the route has been imported from. | |
2109 | Read-only. | |
2110 | ||
2111 | <tag><label id="rta-source"><m/enum/ source</tag> | |
2112 | what protocol has told me about this route. Possible values: | |
2113 | <cf/RTS_STATIC/, <cf/RTS_INHERIT/, <cf/RTS_DEVICE/, | |
2114 | <cf/RTS_RIP/, <cf/RTS_OSPF/, <cf/RTS_OSPF_IA/, <cf/RTS_OSPF_EXT1/, | |
2115 | <cf/RTS_OSPF_EXT2/, <cf/RTS_BGP/, <cf/RTS_PIPE/, <cf/RTS_BABEL/. | |
2116 | ||
2117 | <tag><label id="rta-dest"><m/enum/ dest</tag> | |
2118 | Type of destination the packets should be sent to | |
2119 | (<cf/RTD_ROUTER/ for forwarding to a neighboring router, | |
2120 | <cf/RTD_DEVICE/ for routing to a directly-connected network, | |
2121 | <cf/RTD_MULTIPATH/ for multipath destinations, | |
2122 | <cf/RTD_BLACKHOLE/ for packets to be silently discarded, | |
2123 | <cf/RTD_UNREACHABLE/, <cf/RTD_PROHIBIT/ for packets that should be | |
2124 | returned with ICMP host unreachable / ICMP administratively prohibited | |
2125 | messages). Can be changed, but only to <cf/RTD_BLACKHOLE/, | |
2126 | <cf/RTD_UNREACHABLE/ or <cf/RTD_PROHIBIT/. | |
2127 | ||
2128 | <tag><label id="rta-ifname"><m/string/ ifname</tag> | |
2129 | Name of the outgoing interface. Sink routes (like blackhole, unreachable | |
2130 | or prohibit) and multipath routes have no interface associated with | |
2131 | them, so <cf/ifname/ returns an empty string for such routes. Setting it | |
2132 | would also change route to a direct one (remove gateway). | |
2133 | ||
2134 | <tag><label id="rta-ifindex"><m/int/ ifindex</tag> | |
2135 | Index of the outgoing interface. System wide index of the interface. May | |
2136 | be used for interface matching, however indexes might change on interface | |
2137 | creation/removal. Zero is returned for routes with undefined outgoing | |
2138 | interfaces. Read-only. | |
2139 | ||
2140 | <tag><label id="rta-onlink"><m/bool/ onlink</tag> | |
2141 | Onlink flag means that the specified nexthop is accessible on the | |
2142 | interface regardless of IP prefixes configured on the interface. | |
2143 | The attribute can be used to configure such next hops by first setting | |
2144 | <cf/onlink = true/ and <cf/ifname/, and then setting <cf/gw/. Possible | |
2145 | use case for setting this flag is to automatically build overlay IP-IP | |
2146 | networks on linux. | |
2147 | ||
2148 | <tag><label id="rta-weight"><m/int/ weight</tag> | |
2149 | Multipath weight of route next hops. Valid values are 1-256. Reading | |
2150 | returns the weight of the first next hop, setting it sets weights of all | |
2151 | next hops to the specified value. Therefore, this attribute is not much | |
2152 | useful for manipulating individual next hops of an ECMP route, but can | |
2153 | be used in BGP multipath setup to set weights of individual routes that | |
2154 | are merged to one ECMP route during export to the Kernel protocol | |
2155 | (with active <ref id="krt-merge-paths" name="marge paths"> option). | |
2156 | ||
2157 | <tag><label id="rta-gw-mpls"><m/int/ gw_mpls</tag> | |
2158 | Outgoing MPLS label attached to route (i.e., incoming MPLS label on the | |
2159 | next hop router for this label-switched path). Reading returns the label | |
2160 | value and setting it sets it to the start of the label stack. Setting | |
2161 | implicit-NULL label (3) disables the MPLS label stack. Only the first | |
2162 | next hop and only one label in the label stack supported right now. This | |
2163 | is experimental option, will be likely changed in the future to handle | |
2164 | full MPLS label stack. | |
2165 | ||
2166 | <tag><label id="rta-igp-metric"><m/int/ igp_metric</tag> | |
2167 | The optional attribute that can be used to specify a distance to the | |
2168 | network for routes that do not have a native protocol metric attribute | |
2169 | (like <cf/ospf_metric1/ for OSPF routes). It is used mainly by BGP to | |
2170 | compare internal distances to boundary routers (see below). | |
2171 | ||
2172 | <tag><label id="rta-mpls-label"><m/int/ mpls_label</tag> | |
2173 | Local MPLS label attached to the route. This attribute is produced by | |
2174 | MPLS-aware protocols for labeled routes. It can also be set in import | |
2175 | filters to assign static labels, but that also requires static MPLS | |
2176 | label policy. | |
2177 | ||
2178 | <tag><label id="rta-mpls-policy"><m/enum/ mpls_policy</tag> | |
2179 | For MPLS-aware protocols, this attribute defines which | |
2180 | <ref id="mpls-channel-label-policy" name="MPLS label policy"> will be | |
2181 | used for the route. It can be set in import filters to change it on | |
2182 | per-route basis. Valid values are <cf/MPLS_POLICY_NONE/ (no label), | |
2183 | <cf/MPLS_POLICY_STATIC/ (static label), <cf/MPLS_POLICY_PREFIX/ | |
2184 | (per-prefix label), <cf/MPLS_POLICY_AGGREGATE/ (aggregated label), | |
2185 | and <cf/MPLS_POLICY_VRF/ (per-VRF label). See <ref | |
2186 | id="mpls-channel-label-policy" name="MPLS label policy"> for details. | |
2187 | ||
2188 | <tag><label id="rta-mpls-class"><m/int/ mpls_class</tag> | |
2189 | When <ref id="mpls-channel-label-policy" name="MPLS label policy"> is | |
2190 | set to <cf/aggregate/, it may be useful to apply more fine-grained | |
2191 | aggregation than just one based on next hops. When routes have different | |
2192 | value of this attribute, they will not be aggregated under one local | |
2193 | label even if they have the same next hops. | |
2194 | </descrip> | |
2195 | ||
2196 | <p>Protocol-specific route attributes are described in the corresponding | |
2197 | protocol sections. | |
2198 | ||
2199 | ||
2200 | <sect>Other statements | |
2201 | <label id="other-statements"> | |
2202 | ||
2203 | <p>The following statements are available: | |
2204 | ||
2205 | <descrip> | |
2206 | <tag><label id="assignment"><m/variable/ = <m/expr/</tag> | |
2207 | Set variable (or route attribute) to a given value. | |
2208 | ||
2209 | <tag><label id="filter-accept-reject">accept|reject [ <m/expr/ ]</tag> | |
2210 | Accept or reject the route, possibly printing <cf><m>expr</m></cf>. | |
2211 | ||
2212 | <tag><label id="return">return <m/expr/</tag> | |
2213 | Return <cf><m>expr</m></cf> from the current function, the function ends | |
2214 | at this point. | |
2215 | ||
2216 | <tag><label id="print">print|printn <m/expr/ [<m/, expr.../]</tag> | |
2217 | Prints given expressions; useful mainly while debugging filters. The | |
2218 | <cf/printn/ variant does not terminate the line. | |
2219 | </descrip> | |
2220 | ||
2221 | ||
2222 | <chapt>Protocols | |
2223 | <label id="protocols"> | |
2224 | ||
2225 | <sect>Aggregator | |
2226 | <label id="aggregator"> | |
2227 | ||
2228 | <sect1>Introduction | |
2229 | <label id="aggregator-intro"> | |
2230 | <p>The Aggregator protocol explicitly merges routes by the given rules. There | |
2231 | are four phases of aggregation. First routes are filtered, then sorted into buckets, | |
2232 | then buckets are merged and finally the results are filtered once again. | |
2233 | Aggregating an already aggregated route is forbidden. | |
2234 | ||
2235 | <p>This is an experimental protocol, use with caution. | |
2236 | ||
2237 | <sect1>Configuration | |
2238 | <label id="aggregator-config"> | |
2239 | <p><descrip> | |
2240 | <tag><label id="aggregator-table">table <m/table/</tag> | |
2241 | The table from which routes are exported to get aggregated. | |
2242 | ||
2243 | <tag><label id="aggregator-export">export <m/.../</tag> | |
2244 | A standard channel's <cf/export/ clause, defining which routes are accepted into aggregation. | |
2245 | ||
2246 | <tag><label id="aggregator-rule">aggregate on <m/expr/ | <m/attribute/ [<m/, .../]</tag> | |
2247 | All the given filter expressions and route attributes are evaluated for each route. Then routes | |
2248 | are sorted into buckets where <em/all/ values are the same. Note: due to performance reasons, | |
2249 | all filter expressions must return a compact type, e.g. integer, a BGP | |
2250 | (standard, extended, large) community or an IP address. If you need to compare e.g. modified | |
2251 | AS Paths in the aggregation rule, you can define a custom route attribute and set this attribute | |
2252 | in the export filter. For now, it's mandatory to say <cf/net/ here, we can't merge prefixes yet. | |
2253 | ||
2254 | <tag><label id="aggregation-merge">merge by { <m/filter code/ }</tag> | |
2255 | The given filter code has an extra symbol defined: <cf/routes/. By iterating over <cf/routes/, | |
2256 | you get all the routes in the bucket and you can construct your new route. All attributes | |
2257 | selected in <cf/aggregate on/ are already set to the common values. For now, it's not possible | |
2258 | to use a named filter here. You have to finalize the route by calling <cf/accept/. | |
2259 | ||
2260 | <tag><label id="aggregator-import">import <m/.../</tag> | |
2261 | Filter applied to the route after <cf/merge by/. Here you can use a named filter. | |
2262 | ||
2263 | <tag><label id="aggregator-peer-table">peer table <m/table/</tag> | |
2264 | The table to which aggregated routes are imported. It may be the same table | |
2265 | as <cf/table/. | |
2266 | </descrip> | |
2267 | ||
2268 | <sect1>Example | |
2269 | <label id="aggregator-example"> | |
2270 | ||
2271 | <p><code> | |
2272 | protocol aggregator { | |
2273 | table master6; | |
2274 | export where defined(bgp_path); | |
2275 | /* Merge all routes with the same AS Path length */ | |
2276 | aggregate on net, bgp_path.len; | |
2277 | merge by { | |
2278 | for route r in routes do { | |
2279 | if ! defined(bgp_path) then { bgp_path = r.bgp_path } | |
2280 | bgp_community = bgp_community.add(r.bgp_community); | |
2281 | } | |
2282 | accept; | |
2283 | }; | |
2284 | import all; | |
2285 | peer table agr_result; | |
2286 | } | |
2287 | </code> | |
2288 | ||
2289 | <sect>Babel | |
2290 | <label id="babel"> | |
2291 | ||
2292 | <sect1>Introduction | |
2293 | <label id="babel-intro"> | |
2294 | ||
2295 | <p>The Babel protocol | |
2296 | (<rfc id="8966">) is a loop-avoiding distance-vector routing protocol that is | |
2297 | robust and efficient both in ordinary wired networks and in wireless mesh | |
2298 | networks. Babel is conceptually very simple in its operation and "just works" | |
2299 | in its default configuration, though some configuration is possible and in some | |
2300 | cases desirable. | |
2301 | ||
2302 | <p>The Babel protocol is dual stack; i.e., it can carry both IPv4 and IPv6 | |
2303 | routes over the same IPv6 transport. For sending and receiving Babel packets, | |
2304 | only a link-local IPv6 address is needed. | |
2305 | ||
2306 | <p>BIRD implements an extension for IPv6 source-specific routing (SSR or SADR), | |
2307 | but must be configured accordingly to use it. SADR-enabled Babel router can | |
2308 | interoperate with non-SADR Babel router, but the later would ignore routes | |
2309 | with specific (non-zero) source prefix. | |
2310 | ||
2311 | <sect1>Configuration | |
2312 | <label id="babel-config"> | |
2313 | ||
2314 | <p>The Babel protocol support both IPv4 and IPv6 channels; both can be | |
2315 | configured simultaneously. It can also be configured with <ref | |
2316 | id="ip-sadr-routes" name="IPv6 SADR"> channel instead of regular IPv6 | |
2317 | channel, in such case SADR support is enabled. Babel supports no global | |
2318 | configuration options apart from those common to all other protocols, but | |
2319 | supports the following per-interface configuration options: | |
2320 | ||
2321 | <code> | |
2322 | protocol babel [<name>] { | |
2323 | ipv4 { <channel config> }; | |
2324 | ipv6 [sadr] { <channel config> }; | |
2325 | randomize router id <switch>; | |
2326 | interface <interface pattern> { | |
2327 | type wired|wireless|tunnel; | |
2328 | rxcost <number>; | |
2329 | limit <number>; | |
2330 | hello interval <time>; | |
2331 | update interval <time>; | |
2332 | port <number>; | |
2333 | tx class|dscp <number>; | |
2334 | tx priority <number>; | |
2335 | rx buffer <number>; | |
2336 | tx length <number>; | |
2337 | check link <switch>; | |
2338 | next hop ipv4 <address>; | |
2339 | next hop ipv6 <address>; | |
2340 | next hop prefer native|ipv6; | |
2341 | extended next hop <switch>; | |
2342 | rtt cost <number>; | |
2343 | rtt min <time>; | |
2344 | rtt max <time>; | |
2345 | rtt decay <number>; | |
2346 | send timestamps <switch>; | |
2347 | authentication none|mac [permissive]; | |
2348 | password "<text>"; | |
2349 | password "<text>" { | |
2350 | id <number>; | |
2351 | generate from "<date>"; | |
2352 | generate to "<date>"; | |
2353 | accept from "<date>"; | |
2354 | accept to "<date>"; | |
2355 | from "<date>"; | |
2356 | to "<date>"; | |
2357 | algorithm ( hmac sha1 | hmac sha256 | hmac sha384 | | |
2358 | hmac sha512 | blake2s128 | blake2s256 | blake2b256 | blake2b512 ); | |
2359 | }; | |
2360 | }; | |
2361 | } | |
2362 | </code> | |
2363 | ||
2364 | <descrip> | |
2365 | <tag><label id="babel-channel">ipv4 | ipv6 [sadr] <m/channel config/</tag> | |
2366 | The supported channels are IPv4, IPv6, and IPv6 SADR. | |
2367 | ||
2368 | <tag><label id="babel-random-router-id">randomize router id <m/switch/</tag> | |
2369 | If enabled, Bird will randomize the top 32 bits of its router ID whenever | |
2370 | the protocol instance starts up. If a Babel node restarts, it loses its | |
2371 | sequence number, which can cause its routes to be rejected by peers until | |
2372 | the state is cleared out by other nodes in the network (which can take on | |
2373 | the order of minutes). Enabling this option causes Bird to pick a random | |
2374 | router ID every time it starts up, which avoids this problem at the cost | |
2375 | of not having stable router IDs in the network. Default: no. | |
2376 | ||
2377 | <tag><label id="babel-type">type wired|wireless|tunnel </tag> | |
2378 | This option specifies the interface type: Wired, wireless or tunnel. On | |
2379 | wired interfaces a neighbor is considered unreachable after a small number | |
2380 | of Hello packets are lost, as described by <cf/limit/ option. On wireless | |
2381 | interfaces the ETX link quality estimation technique is used to compute | |
2382 | the metrics of routes discovered over this interface. This technique will | |
2383 | gradually degrade the metric of routes when packets are lost rather than | |
2384 | the more binary up/down mechanism of wired type links. A tunnel is like a | |
2385 | wired interface, but turns on RTT-based metrics with a default cost of 96. | |
2386 | Default: <cf/wired/. | |
2387 | ||
2388 | <tag><label id="babel-rxcost">rxcost <m/number/</tag> | |
2389 | This option specifies the nominal RX cost of the interface. The effective | |
2390 | neighbor costs for route metrics will be computed from this value with a | |
2391 | mechanism determined by the interface <cf/type/. Note that in contrast to | |
2392 | other routing protocols like RIP or OSPF, the <cf/rxcost/ specifies the | |
2393 | cost of RX instead of TX, so it affects primarily neighbors' route | |
2394 | selection and not local route selection. Default: 96 for wired interfaces, | |
2395 | 256 for wireless. | |
2396 | ||
2397 | <tag><label id="babel-limit">limit <m/number/</tag> | |
2398 | BIRD keeps track of received Hello messages from each neighbor to | |
2399 | establish neighbor reachability. For wired type interfaces, this option | |
2400 | specifies how many of last 16 hellos have to be correctly received in | |
2401 | order to neighbor is assumed to be up. The option is ignored on wireless | |
2402 | type interfaces, where gradual cost degradation is used instead of sharp | |
2403 | limit. Default: 12. | |
2404 | ||
2405 | <tag><label id="babel-hello">hello interval <m/time/ s|ms</tag> | |
2406 | Interval at which periodic Hello messages are sent on this interface, | |
2407 | with time units. Default: 4 seconds. | |
2408 | ||
2409 | <tag><label id="babel-update">update interval <m/time/ s|ms</tag> | |
2410 | Interval at which periodic (full) updates are sent, with time | |
2411 | units. Default: 4 times the hello interval. | |
2412 | ||
2413 | <tag><label id="babel-port">port <m/number/</tag> | |
2414 | This option selects an UDP port to operate on. The default is to operate | |
2415 | on port 6696 as specified in the Babel RFC. | |
2416 | ||
2417 | <tag><label id="babel-tx-class">tx class|dscp|priority <m/number/</tag> | |
2418 | These options specify the ToS/DiffServ/Traffic class/Priority of the | |
2419 | outgoing Babel packets. See <ref id="proto-tx-class" name="tx class"> common | |
2420 | option for detailed description. | |
2421 | ||
2422 | <tag><label id="babel-rx-buffer">rx buffer <m/number/</tag> | |
2423 | This option specifies the size of buffers used for packet processing. | |
2424 | The buffer size should be bigger than maximal size of received packets. | |
2425 | The default value is the interface MTU, and the value will be clamped to a | |
2426 | minimum of 512 bytes + IP packet overhead. | |
2427 | ||
2428 | <tag><label id="babel-tx-length">tx length <m/number/</tag> | |
2429 | This option specifies the maximum length of generated Babel packets. To | |
2430 | avoid IP fragmentation, it should not exceed the interface MTU value. | |
2431 | The default value is the interface MTU value, and the value will be | |
2432 | clamped to a minimum of 512 bytes + IP packet overhead. | |
2433 | ||
2434 | <tag><label id="babel-check-link">check link <m/switch/</tag> | |
2435 | If set, the hardware link state (as reported by OS) is taken into | |
2436 | consideration. When the link disappears (e.g. an ethernet cable is | |
2437 | unplugged), neighbors are immediately considered unreachable and all | |
2438 | routes received from them are withdrawn. It is possible that some | |
2439 | hardware drivers or platforms do not implement this feature. Default: | |
2440 | yes. | |
2441 | ||
2442 | <tag><label id="babel-next-hop-ipv4">next hop ipv4 <m/address/</tag> | |
2443 | Set the IPv4 next hop address advertised for (IPv4) routes advertised on | |
2444 | this interface. Default: the preferred IPv4 address of the interface. | |
2445 | ||
2446 | <tag><label id="babel-next-hop-ipv6">next hop ipv6 <m/address/</tag> | |
2447 | Set the IPv6 next hop address advertised for routes advertised on this | |
2448 | interface. If not set, the same link-local address that is used as the | |
2449 | source for Babel packets will be used. In normal operation, it should not | |
2450 | be necessary to set this option. | |
2451 | ||
2452 | <tag><label id="babel-next-hop-prefer">next hop prefer native|ipv6</tag> | |
2453 | By default, BIRD prefers to advertise IPv4 routes with an IPv4 next hop | |
2454 | address, using an IPv6 next hop address only when IPv4 addresses are | |
2455 | absent from the interface. When set to <cf/ipv6/, BIRD will advertise IPv4 | |
2456 | routes with an IPv6 next hop address even when IPv4 addresses are present | |
2457 | on the interface (assuming the option <ref id="babel-extended-next-hop" | |
2458 | name="extended next hop"> is enabled). Default: native. | |
2459 | ||
2460 | <tag><label id="babel-extended-next-hop">extended next hop <m/switch/</tag> | |
2461 | Specify whether BIRD should allow IPv4 routes with an IPv6 next hop, as | |
2462 | described in <rfc id="9229">. Note that when both IPv4 and IPv6 next hops | |
2463 | are available, the option <ref id="babel-next-hop-prefer" | |
2464 | name="next hop prefer"> controls which one is advertised. Default: yes. | |
2465 | ||
2466 | <tag><label id="babel-rtt-cost">rtt cost <m/number/</tag> | |
2467 | The RTT-based cost that will be applied to all routes from each neighbour | |
2468 | based on the measured RTT to that neighbour. If this value is set, | |
2469 | timestamps will be included in generated Babel Hello and IHU messages, and | |
2470 | (if the neighbours also have timestamps enabled), the RTT to each | |
2471 | neighbour will be computed. An additional cost is added to a neighbour if | |
2472 | its RTT is above the <ref id="babel-rtt-min" name="rtt min"> value | |
2473 | configured on the interface. The added cost scales linearly from 0 up to | |
2474 | the RTT cost configured in this option; the full cost is applied if the | |
2475 | neighbour RTT reaches the RTT configured in the <ref id="babel-rtt-max" | |
2476 | name="rtt max"> option (and for all RTTs above this value). Default: 0 | |
2477 | (disabled), except for tunnel interfaces, where it is 96. | |
2478 | ||
2479 | <tag><label id="babel-rtt-min">rtt min <m/time/ s|ms</tag> | |
2480 | The minimum RTT above which the RTT cost will start to be applied (scaling | |
2481 | linearly from zero up to the full cost). Default: 10 ms | |
2482 | ||
2483 | <tag><label id="babel-rtt-max">rtt max <m/time/ s|ms</tag> | |
2484 | The maximum RTT above which the full RTT cost will start be applied. | |
2485 | Default: 120 ms | |
2486 | ||
2487 | <tag><label id="babel-rtt-decay">rtt decay <m/number/</tag> | |
2488 | The decay factor used for the exponentional moving average of the RTT | |
2489 | samples from each neighbour, in units of 1/256. Higher values discards old | |
2490 | RTT samples faster. Must be between 1 and 256. Default: 42 | |
2491 | ||
2492 | <tag><label id="babel-send-timestamps">send timestamps <m/switch/</tag> | |
2493 | Whether to send the timestamps used for RTT calculation on this interface. | |
2494 | Sending the timestamps enables peers to calculate an RTT to this node, | |
2495 | even if no RTT cost is applied to the route metrics. Default: yes. | |
2496 | ||
2497 | <tag><label id="babel-authentication">authentication none|mac [permissive]</tag> | |
2498 | Selects authentication method to be used. <cf/none/ means that packets | |
2499 | are not authenticated at all, <cf/mac/ means MAC authentication is | |
2500 | performed as described in <rfc id="8967">. If MAC authentication is | |
2501 | selected, the <cf/permissive/ suffix can be used to select an operation | |
2502 | mode where outgoing packets are signed, but incoming packets will be | |
2503 | accepted even if they fail authentication. This can be useful for | |
2504 | incremental deployment of MAC authentication across a network. If MAC | |
2505 | authentication is selected, a key must be specified with the | |
2506 | <cf/password/ configuration option. Default: none. | |
2507 | ||
2508 | <tag><label id="babel-password">password "<m/text/"</tag> | |
2509 | Specifies a password used for authentication. See the <ref id="proto-pass" | |
2510 | name="password"> common option for a detailed description. The Babel | |
2511 | protocol will only accept HMAC-based algorithms or one of the Blake | |
2512 | algorithms, and the length of the supplied password string must match the | |
2513 | key size used by the selected algorithm. | |
2514 | </descrip> | |
2515 | ||
2516 | <sect1>Attributes | |
2517 | <label id="babel-attr"> | |
2518 | ||
2519 | <p>Babel defines just one attribute: the internal babel metric of the route. It | |
2520 | is exposed as the <cf/babel_metric/ attribute and has range from 1 to infinity | |
2521 | (65535). | |
2522 | ||
2523 | <sect1>Example | |
2524 | <label id="babel-exam"> | |
2525 | ||
2526 | <p><code> | |
2527 | protocol babel { | |
2528 | interface "eth*" { | |
2529 | type wired; | |
2530 | }; | |
2531 | interface "wlan0", "wlan1" { | |
2532 | type wireless; | |
2533 | hello interval 1; | |
2534 | rxcost 512; | |
2535 | }; | |
2536 | interface "tap0"; | |
2537 | ||
2538 | # This matches the default of babeld: redistribute all addresses | |
2539 | # configured on local interfaces, plus re-distribute all routes received | |
2540 | # from other babel peers. | |
2541 | ||
2542 | ipv4 { | |
2543 | export where (source = RTS_DEVICE) || (source = RTS_BABEL); | |
2544 | }; | |
2545 | ipv6 { | |
2546 | export where (source = RTS_DEVICE) || (source = RTS_BABEL); | |
2547 | }; | |
2548 | } | |
2549 | </code> | |
2550 | ||
2551 | <sect1>Known issues | |
2552 | <label id="babel-issues"> | |
2553 | ||
2554 | <p>When retracting a route, Babel generates an unreachable route for a little | |
2555 | while (according to RFC). The interaction of this behavior with other protocols | |
2556 | is not well tested and strange things may happen. | |
2557 | ||
2558 | ||
2559 | <sect>BFD | |
2560 | <label id="bfd"> | |
2561 | ||
2562 | <sect1>Introduction | |
2563 | <label id="bfd-intro"> | |
2564 | ||
2565 | <p>Bidirectional Forwarding Detection (BFD) is not a routing protocol itself, it | |
2566 | is an independent tool providing liveness and failure detection. Routing | |
2567 | protocols like OSPF and BGP use integrated periodic "hello" messages to monitor | |
2568 | liveness of neighbors, but detection times of these mechanisms are high (e.g. 40 | |
2569 | seconds by default in OSPF, could be set down to several seconds). BFD offers | |
2570 | universal, fast and low-overhead mechanism for failure detection, which could be | |
2571 | attached to any routing protocol in an advisory role. | |
2572 | ||
2573 | <p>BFD consists of mostly independent BFD sessions. Each session monitors an | |
2574 | unicast bidirectional path between two BFD-enabled routers. This is done by | |
2575 | periodically sending control packets in both directions. BFD does not handle | |
2576 | neighbor discovery, BFD sessions are created on demand by request of other | |
2577 | protocols (like OSPF or BGP), which supply appropriate information like IP | |
2578 | addresses and associated interfaces. When a session changes its state, these | |
2579 | protocols are notified and act accordingly (e.g. break an OSPF adjacency when | |
2580 | the BFD session went down). | |
2581 | ||
2582 | <p>BIRD implements basic BFD behavior as defined in <rfc id="5880"> (some | |
2583 | advanced features like the echo mode are not implemented), IP transport for BFD | |
2584 | as defined in <rfc id="5881"> and <rfc id="5883"> and interaction with client | |
2585 | protocols as defined in <rfc id="5882">. | |
2586 | ||
2587 | <p>BFD packets are sent with a dynamic source port number. Linux systems use by | |
2588 | default a bit different dynamic port range than the IANA approved one | |
2589 | (49152-65535). If you experience problems with compatibility, please adjust | |
2590 | <cf>/proc/sys/net/ipv4/ip_local_port_range</cf>. | |
2591 | ||
2592 | <sect1>Configuration | |
2593 | <label id="bfd-config"> | |
2594 | ||
2595 | <p>BFD configuration consists mainly of multiple definitions of interfaces. | |
2596 | Most BFD config options are session specific. When a new session is requested | |
2597 | and dynamically created, it is configured from one of these definitions. For | |
2598 | sessions to directly connected neighbors, <cf/interface/ definitions are chosen | |
2599 | based on the interface associated with the session, while <cf/multihop/ | |
2600 | definition is used for multihop sessions. If no definition is relevant, the | |
2601 | session is just created with the default configuration. Therefore, an empty BFD | |
2602 | configuration is often sufficient. | |
2603 | ||
2604 | <p>Note that to use BFD for other protocols like OSPF or BGP, these protocols | |
2605 | also have to be configured to request BFD sessions, usually by <cf/bfd/ option. | |
2606 | In BGP case, it is also possible to specify per-peer BFD session options (e.g. | |
2607 | rx/tx intervals) as a part of the <cf/bfd/ option. | |
2608 | ||
2609 | <p>A BFD instance not associated with any VRF handles session requests from all | |
2610 | other protocols, even ones associated with a VRF. Such setup would work for | |
2611 | single-hop BFD sessions if <cf/net.ipv4.udp_l3mdev_accept/ sysctl is enabled, | |
2612 | but does not currently work for multihop sessions. Another approach is to | |
2613 | configure multiple BFD instances, one for each VRF (including the default VRF). | |
2614 | Each BFD instance associated with a VRF (regular or default) only handles | |
2615 | session requests from protocols in the same VRF. | |
2616 | ||
2617 | <p>Some of BFD session options require <m/time/ value, which has to be specified | |
2618 | with the appropriate unit: <m/number/ <cf/s/|<cf/ms/|<cf/us/. Although microseconds | |
2619 | are allowed as units, practical minimum values are usually in order of tens of | |
2620 | milliseconds. | |
2621 | ||
2622 | <code> | |
2623 | protocol bfd [<name>] { | |
2624 | accept [ipv4|ipv6] [direct|multihop]; | |
2625 | strict bind <switch>; | |
2626 | zero udp6 checksum rx <switch>; | |
2627 | interface <interface pattern> { | |
2628 | interval <time>; | |
2629 | min rx interval <time>; | |
2630 | min tx interval <time>; | |
2631 | idle tx interval <time>; | |
2632 | multiplier <number>; | |
2633 | passive <switch>; | |
2634 | authentication none; | |
2635 | authentication simple; | |
2636 | authentication [meticulous] keyed md5|sha1; | |
2637 | password "<text>"; | |
2638 | password "<text>" { | |
2639 | id <number>; | |
2640 | generate from "<date>"; | |
2641 | generate to "<date>"; | |
2642 | accept from "<date>"; | |
2643 | accept to "<date>"; | |
2644 | from "<date>"; | |
2645 | to "<date>"; | |
2646 | }; | |
2647 | }; | |
2648 | multihop { | |
2649 | interval <time>; | |
2650 | min rx interval <time>; | |
2651 | min tx interval <time>; | |
2652 | idle tx interval <time>; | |
2653 | multiplier <number>; | |
2654 | passive <switch>; | |
2655 | }; | |
2656 | neighbor <ip> [dev "<interface>"] [local <ip>] [multihop <switch>]; | |
2657 | } | |
2658 | </code> | |
2659 | ||
2660 | <descrip> | |
2661 | <tag><label id="bfd-accept">accept [ipv4|ipv6] [direct|multihop]</tag> | |
2662 | A BFD protocol instance accepts (by default) all BFD session requests | |
2663 | (with regard to VRF restrictions, see above). This option controls | |
2664 | whether IPv4 / IPv6 and direct / multihop session requests are accepted | |
2665 | (and which listening sockets are opened). It can be used, for example, | |
2666 | to configure separate BFD protocol instances for IPv4 and for IPv6 | |
2667 | sessions. | |
2668 | ||
2669 | <tag><label id="bfd-strict-bind">strict bind <m/switch/</tag> | |
2670 | Specify whether each BFD interface should use a separate listening | |
2671 | socket bound to its local address, or just use a shared listening socket | |
2672 | accepting all addresses. Binding to a specific address could be useful | |
2673 | in cases like running multiple BIRD instances on a machine, each | |
2674 | handling a different set of interfaces. Default: disabled. | |
2675 | ||
2676 | <tag><label id="bfd-zero-udp6-checksum-rx">zero udp6 checksum rx <m/switch/</tag> | |
2677 | UDP checksum computation is optional in IPv4 while it is mandatory in | |
2678 | IPv6. Some BFD implementations send UDP datagrams with zero (blank) | |
2679 | checksum even in IPv6 case. This option configures BFD listening sockets | |
2680 | to accept such datagrams. It is available only on platforms that support | |
2681 | the relevant socket option (e.g. <cf/UDP_NO_CHECK6_RX/ on Linux). | |
2682 | Default: disabled. | |
2683 | ||
2684 | <tag><label id="bfd-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag> | |
2685 | Interface definitions allow to specify options for sessions associated | |
2686 | with such interfaces and also may contain interface specific options. | |
2687 | See <ref id="proto-iface" name="interface"> common option for a detailed | |
2688 | description of interface patterns. Note that contrary to the behavior of | |
2689 | <cf/interface/ definitions of other protocols, BFD protocol would accept | |
2690 | sessions (in default configuration) even on interfaces not covered by | |
2691 | such definitions. | |
2692 | ||
2693 | <tag><label id="bfd-multihop">multihop { <m/options/ }</tag> | |
2694 | Multihop definitions allow to specify options for multihop BFD sessions, | |
2695 | in the same manner as <cf/interface/ definitions are used for directly | |
2696 | connected sessions. Currently only one such definition (for all multihop | |
2697 | sessions) could be used. | |
2698 | ||
2699 | <tag><label id="bfd-neighbor">neighbor <m/ip/ [dev "<m/interface/"] [local <m/ip/] [multihop <m/switch/]</tag> | |
2700 | BFD sessions are usually created on demand as requested by other | |
2701 | protocols (like OSPF or BGP). This option allows to explicitly add | |
2702 | a BFD session to the specified neighbor regardless of such requests. | |
2703 | ||
2704 | The session is identified by the IP address of the neighbor, with | |
2705 | optional specification of used interface and local IP. By default | |
2706 | the neighbor must be directly connected, unless the session is | |
2707 | configured as multihop. Note that local IP must be specified for | |
2708 | multihop sessions. | |
2709 | </descrip> | |
2710 | ||
2711 | <p>Session specific options (part of <cf/interface/ and <cf/multihop/ definitions): | |
2712 | ||
2713 | <descrip> | |
2714 | <tag><label id="bfd-interval">interval <m/time/</tag> | |
2715 | BFD ensures availability of the forwarding path associated with the | |
2716 | session by periodically sending BFD control packets in both | |
2717 | directions. The rate of such packets is controlled by two options, | |
2718 | <cf/min rx interval/ and <cf/min tx interval/ (see below). This option | |
2719 | is just a shorthand to set both of these options together. | |
2720 | ||
2721 | <tag><label id="bfd-min-rx-interval">min rx interval <m/time/</tag> | |
2722 | This option specifies the minimum RX interval, which is announced to the | |
2723 | neighbor and used there to limit the neighbor's rate of generated BFD | |
2724 | control packets. Default: 10 ms. | |
2725 | ||
2726 | <tag><label id="bfd-min-tx-interval">min tx interval <m/time/</tag> | |
2727 | This option specifies the desired TX interval, which controls the rate | |
2728 | of generated BFD control packets (together with <cf/min rx interval/ | |
2729 | announced by the neighbor). Note that this value is used only if the BFD | |
2730 | session is up, otherwise the value of <cf/idle tx interval/ is used | |
2731 | instead. Default: 100 ms. | |
2732 | ||
2733 | <tag><label id="bfd-idle-tx-interval">idle tx interval <m/time/</tag> | |
2734 | In order to limit unnecessary traffic in cases where a neighbor is not | |
2735 | available or not running BFD, the rate of generated BFD control packets | |
2736 | is lower when the BFD session is not up. This option specifies the | |
2737 | desired TX interval in such cases instead of <cf/min tx interval/. | |
2738 | Default: 1 s. | |
2739 | ||
2740 | <tag><label id="bfd-multiplier">multiplier <m/number/</tag> | |
2741 | Failure detection time for BFD sessions is based on established rate of | |
2742 | BFD control packets (<cf>min rx/tx interval</cf>) multiplied by this | |
2743 | multiplier, which is essentially (ignoring jitter) a number of missed | |
2744 | packets after which the session is declared down. Note that rates and | |
2745 | multipliers could be different in each direction of a BFD session. | |
2746 | Default: 5. | |
2747 | ||
2748 | <tag><label id="bfd-passive">passive <m/switch/</tag> | |
2749 | Generally, both BFD session endpoints try to establish the session by | |
2750 | sending control packets to the other side. This option allows to enable | |
2751 | passive mode, which means that the router does not send BFD packets | |
2752 | until it has received one from the other side. Default: disabled. | |
2753 | ||
2754 | <tag><label id="bfd-authentication-none">authentication none</tag> | |
2755 | No passwords are sent in BFD packets. This is the default value. | |
2756 | ||
2757 | <tag><label id="bfd-authentication-simple">authentication simple</tag> | |
2758 | Every packet carries 16 bytes of password. Received packets lacking this | |
2759 | password are ignored. This authentication mechanism is very weak. | |
2760 | ||
2761 | <tag><label id="bfd-authentication-keyed">authentication [meticulous] keyed md5|sha1</tag> | |
2762 | An authentication code is appended to each packet. The cryptographic | |
2763 | algorithm is keyed MD5 or keyed SHA-1. Note that the algorithm is common | |
2764 | for all keys (on one interface), in contrast to OSPF or RIP, where it | |
2765 | is a per-key option. Passwords (keys) are not sent open via network. | |
2766 | ||
2767 | The <cf/meticulous/ variant means that cryptographic sequence numbers | |
2768 | are increased for each sent packet, while in the basic variant they are | |
2769 | increased about once per second. Generally, the <cf/meticulous/ variant | |
2770 | offers better resistance to replay attacks but may require more | |
2771 | computation. | |
2772 | ||
2773 | <tag><label id="bfd-password">password "<m>text</m>"</tag> | |
2774 | Specifies a password used for authentication. See <ref id="proto-pass" | |
2775 | name="password"> common option for detailed description. Note that | |
2776 | password option <cf/algorithm/ is not available in BFD protocol. The | |
2777 | algorithm is selected by <cf/authentication/ option for all passwords. | |
2778 | ||
2779 | </descrip> | |
2780 | ||
2781 | <sect1>Example | |
2782 | <label id="bfd-exam"> | |
2783 | ||
2784 | <p><code> | |
2785 | protocol bfd { | |
2786 | interface "eth*" { | |
2787 | min rx interval 20 ms; | |
2788 | min tx interval 50 ms; | |
2789 | idle tx interval 300 ms; | |
2790 | }; | |
2791 | interface "gre*" { | |
2792 | interval 200 ms; | |
2793 | multiplier 10; | |
2794 | passive; | |
2795 | }; | |
2796 | multihop { | |
2797 | interval 200 ms; | |
2798 | multiplier 10; | |
2799 | }; | |
2800 | ||
2801 | neighbor 192.168.1.10; | |
2802 | neighbor 192.168.2.2 dev "eth2"; | |
2803 | neighbor 192.168.10.1 local 192.168.1.1 multihop; | |
2804 | } | |
2805 | </code> | |
2806 | ||
2807 | ||
2808 | <sect>BGP | |
2809 | <label id="bgp"> | |
2810 | ||
2811 | <p>The Border Gateway Protocol is the routing protocol used for backbone level | |
2812 | routing in the today's Internet. Contrary to other protocols, its convergence | |
2813 | does not rely on all routers following the same rules for route selection, | |
2814 | making it possible to implement any routing policy at any router in the network, | |
2815 | the only restriction being that if a router advertises a route, it must accept | |
2816 | and forward packets according to it. | |
2817 | ||
2818 | <p>BGP works in terms of autonomous systems (often abbreviated as AS). Each AS | |
2819 | is a part of the network with common management and common routing policy. It is | |
2820 | identified by a unique 16-bit number (ASN). Routers within each AS usually | |
2821 | exchange AS-internal routing information with each other using an interior | |
2822 | gateway protocol (IGP, such as OSPF or RIP). Boundary routers at the border of | |
2823 | the AS communicate global (inter-AS) network reachability information with their | |
2824 | neighbors in the neighboring AS'es via exterior BGP (eBGP) and redistribute | |
2825 | received information to other routers in the AS via interior BGP (iBGP). | |
2826 | ||
2827 | <p>Each BGP router sends to its neighbors updates of the parts of its routing | |
2828 | table it wishes to export along with complete path information (a list of AS'es | |
2829 | the packet will travel through if it uses the particular route) in order to | |
2830 | avoid routing loops. | |
2831 | ||
2832 | <sect1>Supported standards | |
2833 | <label id="bgp-standards"> | |
2834 | ||
2835 | <p> | |
2836 | <itemize> | |
2837 | <item> <rfc id="4271"> – Border Gateway Protocol 4 (BGP) | |
2838 | <item> <rfc id="1997"> – BGP Communities Attribute | |
2839 | <item> <rfc id="2385"> – Protection of BGP Sessions via TCP MD5 Signature | |
2840 | <item> <rfc id="2545"> – Use of BGP Multiprotocol Extensions for IPv6 | |
2841 | <item> <rfc id="2918"> – Route Refresh Capability | |
2842 | <item> <rfc id="3107"> – Carrying Label Information in BGP | |
2843 | <item> <rfc id="4360"> – BGP Extended Communities Attribute | |
2844 | <item> <rfc id="4364"> – BGP/MPLS IPv4 Virtual Private Networks | |
2845 | <item> <rfc id="4456"> – BGP Route Reflection | |
2846 | <item> <rfc id="4486"> – Subcodes for BGP Cease Notification Message | |
2847 | <item> <rfc id="4659"> – BGP/MPLS IPv6 Virtual Private Networks | |
2848 | <item> <rfc id="4724"> – Graceful Restart Mechanism for BGP | |
2849 | <item> <rfc id="4760"> – Multiprotocol extensions for BGP | |
2850 | <item> <rfc id="4798"> – Connecting IPv6 Islands over IPv4 MPLS | |
2851 | <item> <rfc id="5065"> – AS confederations for BGP | |
2852 | <item> <rfc id="5082"> – Generalized TTL Security Mechanism | |
2853 | <item> <rfc id="5492"> – Capabilities Advertisement with BGP | |
2854 | <item> <rfc id="8955"> – Dissemination of Flow Specification Rules for IPv4 | |
2855 | <item> <rfc id="8956"> – Dissemination of Flow Specification Rules for IPv6 | |
2856 | <item> <rfc id="5668"> – 4-Octet AS Specific BGP Extended Community | |
2857 | <item> <rfc id="5925"> – TCP Authentication Option | |
2858 | <item> <rfc id="6286"> – AS-Wide Unique BGP Identifier | |
2859 | <item> <rfc id="6608"> – Subcodes for BGP Finite State Machine Error | |
2860 | <item> <rfc id="6793"> – BGP Support for 4-Octet AS Numbers | |
2861 | <item> <rfc id="7311"> – Accumulated IGP Metric Attribute for BGP | |
2862 | <item> <rfc id="7313"> – Enhanced Route Refresh Capability for BGP | |
2863 | <item> <rfc id="7606"> – Revised Error Handling for BGP UPDATE Messages | |
2864 | <item> <rfc id="7911"> – Advertisement of Multiple Paths in BGP | |
2865 | <item> <rfc id="7947"> – Internet Exchange BGP Route Server | |
2866 | <item> <rfc id="8092"> – BGP Large Communities Attribute | |
2867 | <item> <rfc id="8212"> – Default EBGP Route Propagation Behavior without Policies | |
2868 | <item> <rfc id="8654"> – Extended Message Support for BGP | |
2869 | <item> <rfc id="8950"> – Advertising IPv4 NLRI with an IPv6 Next Hop | |
2870 | <item> <rfc id="9003"> – Extended BGP Administrative Shutdown Communication | |
2871 | <item> <rfc id="9072"> – Extended Optional Parameters Length for BGP OPEN Message | |
2872 | <item> <rfc id="9117"> – Revised Validation Procedure for BGP Flow Specifications | |
2873 | <item> <rfc id="9234"> – Route Leak Prevention and Detection Using Roles | |
2874 | <item> <rfc id="9494"> – Long-Lived Graceful Restart for BGP | |
2875 | <item> <rfc id="9687"> – Send Hold Timer | |
2876 | </itemize> | |
2877 | ||
2878 | <sect1>Route selection rules | |
2879 | <label id="bgp-route-select-rules"> | |
2880 | ||
2881 | <p>BGP doesn't have any simple metric, so the rules for selection of an optimal | |
2882 | route among multiple BGP routes with the same preference are a bit more complex | |
2883 | and they are implemented according to the following algorithm. It starts the | |
2884 | first rule, if there are more "best" routes, then it uses the second rule to | |
2885 | choose among them and so on. | |
2886 | ||
2887 | <itemize> | |
2888 | <item>Prefer route with the highest Local Preference attribute. | |
2889 | <item>Prefer route with the shortest AS path. | |
2890 | <item>Prefer IGP origin over EGP and EGP origin over incomplete. | |
2891 | <item>Prefer the lowest value of the Multiple Exit Discriminator. | |
2892 | <item>Prefer routes received via eBGP over ones received via iBGP. | |
2893 | <item>Prefer routes with lower internal distance to a boundary router. | |
2894 | <item>Prefer the route with the lowest value of router ID of the | |
2895 | advertising router. | |
2896 | </itemize> | |
2897 | ||
2898 | <sect1>IGP routing table | |
2899 | <label id="bgp-igp-routing-table"> | |
2900 | ||
2901 | <p>BGP is mainly concerned with global network reachability and with routes to | |
2902 | other autonomous systems. When such routes are redistributed to routers in the | |
2903 | AS via BGP, they contain IP addresses of a boundary routers (in route attribute | |
2904 | NEXT_HOP). BGP depends on existing IGP routing table with AS-internal routes to | |
2905 | determine immediate next hops for routes and to know their internal distances to | |
2906 | boundary routers for the purpose of BGP route selection. In BIRD, there is | |
2907 | usually one routing table used for both IGP routes and BGP routes. | |
2908 | ||
2909 | <sect1>Protocol configuration | |
2910 | <label id="bgp-proto-config"> | |
2911 | ||
2912 | <p>Each instance of the BGP corresponds to one neighboring router. This allows | |
2913 | to set routing policy and all the other parameters differently for each neighbor | |
2914 | using the following configuration parameters: | |
2915 | ||
2916 | <code> | |
2917 | protocol bgp [<name>] { | |
2918 | ipv4|ipv6|... { | |
2919 | <channel-options> | |
2920 | mandatory <switch>; | |
2921 | next hop keep <switch>|ibgp|ebgp; | |
2922 | next hop self <switch>|ibgp|ebgp; | |
2923 | next hop address <ip>; | |
2924 | next hop prefer global; | |
2925 | link local next hop format native|single|double; | |
2926 | gateway direct|recursive; | |
2927 | igp table <name>; | |
2928 | import table <switch>; | |
2929 | export table <switch>; | |
2930 | secondary <switch>; | |
2931 | validate <switch>; | |
2932 | base table <name>; | |
2933 | extended next hop <switch>; | |
2934 | require extended next hop <switch>; | |
2935 | add paths <switch>|rx|tx; | |
2936 | require add paths <switch>; | |
2937 | aigp <switch>|originate; | |
2938 | cost <number>; | |
2939 | graceful restart <switch>; | |
2940 | long lived graceful restart <switch>; | |
2941 | long lived stale time <number>; | |
2942 | min long lived stale time <number>; | |
2943 | max long lived stale time <number>; | |
2944 | }; | |
2945 | local [<ip>] [port <number>] [as <number>]; | |
2946 | neighbor [<ip> | range <prefix>] [onlink] [port <number>] [as <number>] [internal|external]; | |
2947 | interface "<text>"; | |
2948 | onlink <switch>; | |
2949 | direct; | |
2950 | multihop [<number>]; | |
2951 | source address <ip>; | |
2952 | dynamic name "<text>"; | |
2953 | dynamic name digits <number>; | |
2954 | strict bind <switch>; | |
2955 | free bind <switch>; | |
2956 | check link <switch>; | |
2957 | bfd <switch>|graceful| { <bfd-options> }; | |
2958 | ttl security <switch>; | |
2959 | authentication none|md5|ao; | |
2960 | password "<text>"; | |
2961 | keys { | |
2962 | key { | |
2963 | id <number>; | |
2964 | send id <number>; | |
2965 | recv id <number>; | |
2966 | secret "<text>"|<bytestring>; | |
2967 | algorithm ( hmac md5 | hmac sha1 | hmac sha224 | hmac sha256 | | |
2968 | hmac sha384 | hmac sha512 | cmac aes128 ); | |
2969 | preferred; | |
2970 | deprecated; | |
2971 | }; | |
2972 | ... | |
2973 | }; | |
2974 | setkey <switch>; | |
2975 | passive <switch>; | |
2976 | confederation <number>; | |
2977 | confederation member <switch>; | |
2978 | rr client <switch>; | |
2979 | rr cluster id <number>|<IPv4 address>; | |
2980 | rs client <switch>; | |
2981 | allow bgp_local_pref <switch>; | |
2982 | allow bgp_med <switch>; | |
2983 | allow local as [<number>]; | |
2984 | allow as sets <switch>; | |
2985 | enforce first as <switch>; | |
2986 | enable route refresh <switch>; | |
2987 | require route refresh <switch>; | |
2988 | enable enhanced route refresh <switch>; | |
2989 | require enhanced route refresh <switch>; | |
2990 | graceful restart <switch>|aware; | |
2991 | graceful restart time <number>; | |
2992 | min graceful restart time <number>; | |
2993 | max graceful restart time <number>; | |
2994 | require graceful restart <switch>; | |
2995 | long lived graceful restart <switch>|aware; | |
2996 | long lived stale time <number>; | |
2997 | min long lived stale time <number>; | |
2998 | max long lived stale time <number>; | |
2999 | require long lived graceful restart <switch>; | |
3000 | interpret communities <switch>; | |
3001 | enable as4 <switch>; | |
3002 | require as4 <switch>; | |
3003 | enable extended messages <switch>; | |
3004 | require extended messages <switch>; | |
3005 | capabilities <switch>; | |
3006 | advertise hostname <switch>; | |
3007 | require hostname <switch>; | |
3008 | disable after error <switch>; | |
3009 | disable after cease <switch>|<set-of-flags>; | |
3010 | hold time <number>; | |
3011 | min hold time <number>; | |
3012 | startup hold time <number>; | |
3013 | keepalive time <number>; | |
3014 | min keepalive time <number>; | |
3015 | send hold time <number>; | |
3016 | connect delay time <number>; | |
3017 | connect retry time <number>; | |
3018 | error wait time <number>, <number>; | |
3019 | error forget time <number>; | |
3020 | path metric <switch>; | |
3021 | med metric <switch>; | |
3022 | deterministic med <switch>; | |
3023 | igp metric <switch>; | |
3024 | prefer older <switch>; | |
3025 | default bgp_med <number>; | |
3026 | default bgp_local_pref <number>; | |
3027 | local role <role-name>; | |
3028 | require roles <switch>; | |
3029 | } | |
3030 | </code> | |
3031 | ||
3032 | <descrip> | |
3033 | <tag><label id="bgp-local">local [<m/ip/] [port <m/number/] [as <m/number/]</tag> | |
3034 | Define which AS we are part of. (Note that contrary to other IP routers, | |
3035 | BIRD is able to act as a router located in multiple AS'es simultaneously, | |
3036 | but in such cases you need to tweak the BGP paths manually in the filters | |
3037 | to get consistent behavior.) Optional <cf/ip/ argument specifies a source | |
3038 | address, equivalent to the <cf/source address/ option (see below). | |
3039 | Optional <cf/port/ argument specifies the local BGP port instead of | |
3040 | standard port 179. The parameter may be used multiple times with | |
3041 | different sub-options (e.g., both <cf/local 10.0.0.1 as 65000;/ and | |
3042 | <cf/local 10.0.0.1; local as 65000;/ are valid). This parameter is | |
3043 | mandatory. | |
3044 | ||
3045 | <tag><label id="bgp-neighbor">neighbor [<m/ip/ | range <m/prefix/] [port <m/number/] [as <m/number/] [internal|external]</tag> | |
3046 | Define neighboring router this instance will be talking to and what AS | |
3047 | it is located in. In case the neighbor is in the same AS as we are, we | |
3048 | automatically switch to IBGP. Alternatively, it is possible to specify | |
3049 | just <cf/internal/ or <cf/external/ instead of AS number, in that case | |
3050 | either local AS number, or any external AS number is accepted. | |
3051 | Optionally, the remote port may also be specified. Like <cf/local/ | |
3052 | parameter, this parameter may also be used multiple times with different | |
3053 | sub-options. This parameter is mandatory. | |
3054 | ||
3055 | It is possible to specify network prefix (with <cf/range/ keyword) | |
3056 | instead of explicit neighbor IP address. This enables dynamic BGP | |
3057 | behavior, where the BGP instance listens on BGP port, but new BGP | |
3058 | instances are spawned for incoming BGP connections (if source address | |
3059 | matches the network prefix). It is possible to mix regular BGP instances | |
3060 | with dynamic BGP instances and have multiple dynamic BGP instances with | |
3061 | different ranges. | |
3062 | ||
3063 | <tag><label id="bgp-iface">interface "<m/text/"</tag> | |
3064 | Define interface we should use for link-local BGP IPv6 sessions. | |
3065 | Interface can also be specified as a part of <cf/neighbor address/ | |
3066 | (e.g., <cf/neighbor fe80::1234%eth0 as 65000;/). The option may also be | |
3067 | used for non link-local sessions when it is necessary to explicitly | |
3068 | specify an interface, but only for direct (not multihop) sessions. | |
3069 | ||
3070 | <tag><label id="bgp-onlink">onlink <m/switch/</tag> | |
3071 | For a direct neighbor, the BGP session starts immediately without | |
3072 | waiting for the neighbor's address to appear on any interface. | |
3073 | This option requires an interface to be configured. Next hops | |
3074 | of all routes from this session also have the <cf/onlink/ attribute. | |
3075 | ||
3076 | This option may generally lead to weird behavior without other | |
3077 | configuration in place. One may e.g. need to insert a working route | |
3078 | for the given neighbor manually to allow for ACKs from the incoming | |
3079 | connection to be routed back correctly. That route may also need to | |
3080 | be announced via IGP, or <cf/next hop self/ in iBGP may be needed. | |
3081 | ||
3082 | When trying setups with no neighbor route in containerized environments, | |
3083 | we got some results with <cf/strict bind/. As of Linux 6.12, we can't | |
3084 | recommend running that setup though. | |
3085 | ||
3086 | Onlink behavior may also be specified inside the <cf/neighbor/ option. | |
3087 | Default: disabled. | |
3088 | ||
3089 | <tag><label id="bgp-direct">direct</tag> | |
3090 | Specify that the neighbor is directly connected. The IP address of the | |
3091 | neighbor must be from a directly reachable IP range (i.e. associated | |
3092 | with one of your router's interfaces), otherwise the BGP session | |
3093 | wouldn't start but it would wait for such interface to appear. The | |
3094 | alternative is the <cf/multihop/ option. Default: enabled for eBGP. | |
3095 | ||
3096 | <tag><label id="bgp-multihop">multihop [<m/number/]</tag> | |
3097 | Configure multihop BGP session to a neighbor that isn't directly | |
3098 | connected. Accurately, this option should be used if the configured | |
3099 | neighbor IP address does not match with any local network subnets. Such | |
3100 | IP address have to be reachable through system routing table. The | |
3101 | alternative is the <cf/direct/ option. For multihop BGP it is | |
3102 | recommended to explicitly configure the source address to have it | |
3103 | stable. Optional <cf/number/ argument can be used to specify the number | |
3104 | of hops (used for TTL). Note that the number of networks (edges) in a | |
3105 | path is counted; i.e., if two BGP speakers are separated by one router, | |
3106 | the number of hops is 2. Default: enabled for iBGP. | |
3107 | ||
3108 | <tag><label id="bgp-source-address">source address <m/ip/</tag> | |
3109 | Define local address we should use as a source address for the BGP | |
3110 | session. Default: the address of the local end of the interface our | |
3111 | neighbor is connected to. | |
3112 | ||
3113 | <tag><label id="bgp-dynamic-name">dynamic name "<m/text/"</tag> | |
3114 | Define common prefix of names used for new BGP instances spawned when | |
3115 | dynamic BGP behavior is active. Actual names also contain numeric | |
3116 | index to distinguish individual instances. Default: "dynbgp". | |
3117 | ||
3118 | <tag><label id="bgp-dynamic-name-digits">dynamic name digits <m/number/</tag> | |
3119 | Define minimum number of digits for index in names of spawned dynamic | |
3120 | BGP instances. E.g., if set to 2, then the first name would be | |
3121 | "dynbgp01". Default: 0. | |
3122 | ||
3123 | <tag><label id="bgp-strict-bind">strict bind <m/switch/</tag> | |
3124 | Specify whether BGP listening socket should be bound to a specific local | |
3125 | address (the same as the <cf/source address/) and associated interface, | |
3126 | or to all addresses. Binding to a specific address could be useful in | |
3127 | cases like running multiple BIRD instances on a machine, each using its | |
3128 | IP address. Note that listening sockets bound to a specific address and | |
3129 | to all addresses collide, therefore either all BGP protocols (of the | |
3130 | same address family and using the same local port) should have set | |
3131 | <cf/strict bind/, or none of them. Default: disabled. | |
3132 | ||
3133 | <tag><label id="bgp-free-bind">free bind <m/switch/</tag> | |
3134 | Use IP_FREEBIND socket option for the listening socket, which allows | |
3135 | binding to an IP address not (yet) assigned to an interface. Note that | |
3136 | all BGP instances that share a listening socket should have the same | |
3137 | value of the <cf/freebind/ option. Default: disabled. | |
3138 | ||
3139 | <tag><label id="bgp-check-link">check link <m>switch</m></tag> | |
3140 | BGP could use hardware link state into consideration. If enabled, | |
3141 | BIRD tracks the link state of the associated interface and when link | |
3142 | disappears (e.g. an ethernet cable is unplugged), the BGP session is | |
3143 | immediately shut down. Note that this option cannot be used with | |
3144 | multihop BGP. Default: enabled for direct BGP, disabled otherwise. | |
3145 | ||
3146 | <tag><label id="bgp-bfd">bfd <m>switch</m>|graceful| { <m/options/ }</tag> | |
3147 | BGP could use BFD protocol as an advisory mechanism for neighbor | |
3148 | liveness and failure detection. If enabled, BIRD setups a BFD session | |
3149 | for the BGP neighbor and tracks its liveness by it. This has an | |
3150 | advantage of an order of magnitude lower detection times in case of | |
3151 | failure. When a neighbor failure is detected, the BGP session is | |
3152 | restarted. Optionally, it can be configured (by <cf/graceful/ argument) | |
3153 | to trigger graceful restart instead of regular restart. It is also | |
3154 | possible to specify section with per-peer BFD session options instead of | |
3155 | just the switch argument. All BFD session-specific options are allowed | |
3156 | here. Note that BFD protocol also has to be configured, see | |
3157 | <ref id="bfd" name="BFD"> section for details. Default: disabled. | |
3158 | ||
3159 | <tag><label id="bgp-ttl-security">ttl security <m/switch/</tag> | |
3160 | Use GTSM (<rfc id="5082"> - the generalized TTL security mechanism). GTSM | |
3161 | protects against spoofed packets by ignoring received packets with a | |
3162 | smaller than expected TTL. To work properly, GTSM have to be enabled on | |
3163 | both sides of a BGP session. If both <cf/ttl security/ and | |
3164 | <cf/multihop/ options are enabled, <cf/multihop/ option should specify | |
3165 | proper hop value to compute expected TTL. Kernel support required: | |
3166 | Linux: 2.6.34+ (IPv4), 2.6.35+ (IPv6), BSD: since long ago, IPv4 only. | |
3167 | Note that full (ICMP protection, for example) <rfc id="5082"> support is | |
3168 | provided by Linux only. Default: disabled. | |
3169 | ||
3170 | <tag><label id="bgp-authentication">authentication none|md5|ao</tag> | |
3171 | Selects authentication method to be used. <cf/none/ means that the BGP | |
3172 | session is not authenticated at all. <cf/md5/ means that the TCP MD5 | |
3173 | authentication of BGP sessions (<rfc id="2385">) is used, in that case | |
3174 | the option <ref id="bgp-password" name="password"> is used to specify | |
3175 | the (single) password. Finally, <cf/ao/ means to use TCP Authentication | |
3176 | Option (TCP-AO, <rfc id="5925">), allowing multiple keys and different | |
3177 | cryptographic algorithms. These are specified using the option | |
3178 | <ref id="bgp-keys" name="keys">. Note that TCP-AO authentication is not | |
3179 | supported on dynamic BGP sessions. Default: none. | |
3180 | ||
3181 | <tag><label id="bgp-password">password "<m/text/"</tag> | |
3182 | Use this password for MD5 authentication of BGP sessions (<rfc id="2385">). When | |
3183 | used on BSD systems, see also <cf/setkey/ option below. Default: no | |
3184 | authentication. | |
3185 | ||
3186 | <tag><label id="bgp-setkey">setkey <m/switch/</tag> | |
3187 | On BSD systems, keys for TCP MD5 authentication are stored in the global | |
3188 | SA/SP database, which can be accessed by external utilities (e.g. | |
3189 | setkey(8)). BIRD configures security associations in the SA/SP database | |
3190 | automatically based on <cf/password/ options (see above), this option | |
3191 | allows to disable automatic updates by BIRD when manual configuration by | |
3192 | external utilities is preferred. Note that automatic SA/SP database | |
3193 | updates are currently implemented only for FreeBSD. Passwords have to be | |
3194 | set manually by an external utility on NetBSD and OpenBSD. Default: | |
3195 | enabled (ignored on non-FreeBSD). | |
3196 | ||
3197 | <tag><label id="bgp-keys">keys { key { [<m/.../] }; [<m/.../] }</tag> | |
3198 | Define a set of cryptographic keys that are used for TCP-AO | |
3199 | authentication of BGP sessions (<rfc id="5925">). Each key has a | |
3200 | configuration block with its own sub-options ([<cf/send/ | <cf/recv/] | |
3201 | <cf/id/, <cf/secret/, <cf/algorithm/, <cf/preferred/, <cf/deprecated/). | |
3202 | ||
3203 | TCP-AO key has two IDs - for outgoing and incoming direction (Send / | |
3204 | Recv ID). Among keys on one protocol all Send IDs must be unique and all | |
3205 | Recv IDs must be unique. They must be in range 0-255 and they can be set | |
3206 | independently with key options <cf/send id/ and <cf/recv id/, or | |
3207 | together with option <cf/id/. Note that specifying these IDs is | |
3208 | mandatory. | |
3209 | ||
3210 | Of course, TCP-AO key contains a shared secret key. It is specified by | |
3211 | the option <cf/secret/ as a text string or as a sequence of hexadecimal | |
3212 | digit pairs (<ref id="type-bytestring" name="bytestring">). | |
3213 | ||
3214 | Used cryptographic algorithm can be specified for each key with the | |
3215 | option <cf/algorithm/. Possible values are: <cf/hmac md5/, <cf/hmac sha1/, | |
3216 | <cf/hmac sha224/, <cf/hmac sha256/, <cf/hmac sha384/, <cf/hmac sha512/, | |
3217 | and <cf/cmac aes128/. Default value is <cf/hmac sha1/. | |
3218 | ||
3219 | When multiple keys are available, BIRD selects one to advertise as RNext | |
3220 | key (the key it prefers to be used to sign incoming traffic). Keys | |
3221 | marked as <cf/preferred/ are selected before unmarked keys, while keys | |
3222 | marked as <cf/deprecated/ are never selected (but still could be used | |
3223 | when the other side asks for them). Therefore, there must be always at | |
3224 | least one non-deprecated key. | |
3225 | ||
3226 | Currently, only the selected key is used during the initial handshake of | |
3227 | session establishment (and therefore must be known by the other side). | |
3228 | This may change in the future. | |
3229 | ||
3230 | It is possible to add, remove, or modify keys during reconfiguration | |
3231 | without breaking the BGP session. The recommended way is to refrain from | |
3232 | removing a key that is in active use (as reported by <cf/Current key/ | |
3233 | and <cf/RNext key/ in <cf/show protocols all/), instead marking the key | |
3234 | as <cf/deprecated/ on both sides of the session. It is possible to | |
3235 | remove an active key directly, BIRD would forcibly switch to another key | |
3236 | (as long as there is a non-deprecated key that is not added, removed or | |
3237 | modified during this reconfiguration). This is not recommended as it | |
3238 | skips the proper key change mechanism and may switch to a key that is | |
3239 | not available to the other side. | |
3240 | ||
3241 | Modification of existing keys (except of marking them <cf/preferred/ or | |
3242 | <cf/deprecated/) is equivalent to removing and then adding them, with | |
3243 | the same issues related to removing of active keys. | |
3244 | ||
3245 | <tag><label id="bgp-passive">passive <m/switch/</tag> | |
3246 | Standard BGP behavior is both initiating outgoing connections and | |
3247 | accepting incoming connections. In passive mode, outgoing connections | |
3248 | are not initiated. Default: off. | |
3249 | ||
3250 | <tag><label id="bgp-confederation">confederation <m/number/</tag> | |
3251 | BGP confederations (<rfc id="5065">) are collections of autonomous | |
3252 | systems that act as one entity to external systems, represented by one | |
3253 | confederation identifier (instead of AS numbers). This option allows to | |
3254 | enable BGP confederation behavior and to specify the local confederation | |
3255 | identifier. When BGP confederations are used, all BGP speakers that are | |
3256 | members of the BGP confederation should have the same confederation | |
3257 | identifier configured. Default: 0 (no confederation). | |
3258 | ||
3259 | <tag><label id="bgp-confederation-member">confederation member <m/switch/</tag> | |
3260 | When BGP confederations are used, this option allows to specify whether | |
3261 | the BGP neighbor is a member of the same confederation as the local BGP | |
3262 | speaker. The option is unnecessary (and ignored) for IBGP sessions, as | |
3263 | the same AS number implies the same confederation. Default: no. | |
3264 | ||
3265 | <tag><label id="bgp-rr-client">rr client <m/switch/</tag> | |
3266 | Be a route reflector and treat the neighbor as a route reflection | |
3267 | client. Default: disabled. | |
3268 | ||
3269 | <tag><label id="bgp-rr-cluster-id">rr cluster id <m/number/ | <m/IPv4 address/</tag> | |
3270 | Route reflectors use cluster id to avoid route reflection loops. When | |
3271 | there is one route reflector in a cluster it usually uses its router id | |
3272 | as a cluster id, but when there are more route reflectors in a cluster, | |
3273 | these need to be configured (using this option) to use a common cluster | |
3274 | id. Clients in a cluster need not know their cluster id and this option | |
3275 | is not allowed for them. Default: the same as router id. | |
3276 | ||
3277 | <tag><label id="bgp-rs-client">rs client <m/switch/</tag> | |
3278 | Be a route server and treat the neighbor as a route server client. | |
3279 | A route server is used as a replacement for full mesh EBGP routing in | |
3280 | Internet exchange points in a similar way to route reflectors used in | |
3281 | IBGP routing. BIRD does not implement obsoleted <rfc id="1863">, but | |
3282 | uses ad-hoc implementation, which behaves like plain EBGP but reduces | |
3283 | modifications to advertised route attributes to be transparent (for | |
3284 | example does not prepend its AS number to AS PATH attribute and | |
3285 | keeps MED attribute). Default: disabled. | |
3286 | ||
3287 | <tag><label id="bgp-allow-local-pref">allow bgp_local_pref <m/switch/</tag> | |
3288 | Standard BGP implementations do not send the Local Preference attribute | |
3289 | to EBGP neighbors and ignore this attribute if received from EBGP | |
3290 | neighbors, as per <rfc id="4271">. When this option is enabled on an | |
3291 | EBGP session, this attribute will be sent to and accepted from the peer, | |
3292 | which is useful for example if you have a setup like in <rfc id="7938">. | |
3293 | The option does not affect IBGP sessions. Default: off. | |
3294 | ||
3295 | <tag><label id="bgp-allow-med">allow bgp_med <m/switch/</tag> | |
3296 | Standard BGP implementations do not propagate the MULTI_EXIT_DESC | |
3297 | attribute unless it is configured locally. When this option is enabled | |
3298 | on an EBGP session, this attribute will be sent to the peer regardless, | |
3299 | which is useful for example if you have a setup like in <rfc id="7938">. | |
3300 | The option does not affect IBGP sessions. Default: off. | |
3301 | ||
3302 | <tag><label id="bgp-allow-local-as">allow local as [<m/number/]</tag> | |
3303 | BGP prevents routing loops by rejecting received routes with the local | |
3304 | AS number in the AS path. This option allows to loose or disable the | |
3305 | check. Optional <cf/number/ argument can be used to specify the maximum | |
3306 | number of local ASNs in the AS path that is allowed for received | |
3307 | routes. When the option is used without the argument, the check is | |
3308 | completely disabled and you should ensure loop-free behavior by some | |
3309 | other means. Default: 0 (no local AS number allowed). | |
3310 | ||
3311 | <tag><label id="bgp-allow-as-sets">allow as sets <m/switch/</tag> | |
3312 | Historically, AS path attribute received with BGP routes may have | |
3313 | contained not only sequences of AS numbers, but also sets of AS numbers. | |
3314 | These rarely used artifacts were results of inter-AS route aggregation. | |
3315 | AS sets are deprecated (<rfc id="6472">, <rfc id="9774">) and AS paths | |
3316 | containing them (or AS confed sets) are considered malformed. | |
3317 | Corresponding BGP updates are therefore treated as withdraws. | |
3318 | When this option is enabled, then received AS paths containing these | |
3319 | deprecated AS sets or AS confed sets are accepted. | |
3320 | Default: off (since 2.18 and 3.2). | |
3321 | ||
3322 | <tag><label id="bgp-enforce-first-as">enforce first as <m/switch/</tag> | |
3323 | Routes received from an EBGP neighbor are generally expected to have the | |
3324 | first (leftmost) AS number in their AS path equal to the neighbor AS | |
3325 | number. This is not enforced by default as there are legitimate cases | |
3326 | where it is not true, e.g. connections to route servers. When this | |
3327 | option is enabled, routes with non-matching first AS number are rejected | |
3328 | and corresponding updates are treated as withdraws. The option is valid | |
3329 | on EBGP sessions only. Default: off. | |
3330 | ||
3331 | <tag><label id="bgp-enable-route-refresh">enable route refresh <m/switch/</tag> | |
3332 | After the initial route exchange, BGP protocol uses incremental updates | |
3333 | to keep BGP speakers synchronized. Sometimes (e.g., if BGP speaker | |
3334 | changes its import filter, or if there is suspicion of inconsistency) it | |
3335 | is necessary to do a new complete route exchange. BGP protocol extension | |
3336 | Route Refresh (<rfc id="2918">) allows BGP speaker to request | |
3337 | re-advertisement of all routes from its neighbor. This option | |
3338 | specifies whether BIRD advertises this capability and supports | |
3339 | related procedures. Note that even when disabled, BIRD can send route | |
3340 | refresh requests. Disabling Route Refresh also disables Enhanced Route Refresh. | |
3341 | Default: on. | |
3342 | ||
3343 | <tag><label id="bgp-require-route-refresh">require route refresh <m/switch/</tag> | |
3344 | If enabled, the BGP Route Refresh capability (<rfc id="2918">) must be | |
3345 | announced by the BGP neighbor, otherwise the BGP session will not be | |
3346 | established. Default: off. | |
3347 | ||
3348 | <tag><label id="bgp-enable-enhanced-route-refresh">enable enhanced route refresh <m/switch/</tag> | |
3349 | BGP protocol extension Enhanced Route Refresh (<rfc id="7313">) | |
3350 | specifies explicit begin and end for Route Refresh (see previous | |
3351 | option), therefore the receiver can remove stale routes that were not | |
3352 | advertised during the exchange. This option specifies whether BIRD | |
3353 | advertises this capability and supports related procedures. Default: on. | |
3354 | ||
3355 | <tag><label id="bgp-require-enhanced-route-refresh">require enhanced route refresh <m/switch/</tag> | |
3356 | If enabled, the BGP Enhanced Route Refresh capability (<rfc id="7313">) | |
3357 | must be announced by the BGP neighbor, otherwise the BGP session | |
3358 | will not be established. Default: off. | |
3359 | ||
3360 | <tag><label id="bgp-graceful-restart">graceful restart <m/switch/|aware</tag> | |
3361 | When a BGP speaker restarts or crashes, neighbors will discard all | |
3362 | received paths from the speaker, which disrupts packet forwarding even | |
3363 | when the forwarding plane of the speaker remains intact. <rfc id="4724"> | |
3364 | specifies an optional graceful restart mechanism to alleviate this | |
3365 | issue. This option controls the mechanism. It has three states: | |
3366 | Disabled, when no support is provided. Aware, when the graceful restart | |
3367 | support is announced and the support for restarting neighbors is | |
3368 | provided, but no local graceful restart is allowed (i.e. receiving-only | |
3369 | role). Enabled, when the full graceful restart support is provided | |
3370 | (i.e. both restarting and receiving role). Restarting role could be also | |
3371 | configured per-channel. Note that proper support for local graceful | |
3372 | restart requires also configuration of other protocols. Default: aware. | |
3373 | ||
3374 | <tag><label id="bgp-graceful-restart-time">graceful restart time <m/number/</tag> | |
3375 | The restart time is announced in the BGP Graceful Restart capability | |
3376 | and specifies how long the neighbor would wait for the BGP session to | |
3377 | re-establish after a restart before deleting stale routes. Default: | |
3378 | 120 seconds. | |
3379 | ||
3380 | <tag><label id="bgp-min-graceful-restart-time">min graceful restart time <m/number/</tag> | |
3381 | The lower bound for the graceful restart time to override the value | |
3382 | received in the BGP Graceful Restart capability announced by the | |
3383 | neighbor. Default: no lower bound. | |
3384 | ||
3385 | <tag><label id="bgp-max-graceful-restart-time">max graceful restart time <m/number/</tag> | |
3386 | The upper bound for the graceful restart time to override the value | |
3387 | received in the BGP Graceful Restart capability announced by the | |
3388 | neighbor. Default: no upper bound. | |
3389 | ||
3390 | <tag><label id="bgp-require-graceful-restart">require graceful restart <m/switch/</tag> | |
3391 | If enabled, the BGP Graceful Restart capability (<rfc id="4724">) | |
3392 | must be announced by the BGP neighbor, otherwise the BGP session | |
3393 | will not be established. Default: off. | |
3394 | ||
3395 | <tag><label id="bgp-long-lived-graceful-restart">long lived graceful restart <m/switch/|aware</tag> | |
3396 | The long-lived graceful restart is an extension of the traditional | |
3397 | <ref id="bgp-graceful-restart" name="BGP graceful restart">, where stale | |
3398 | routes are kept even after the <ref id="bgp-graceful-restart-time" | |
3399 | name="restart time"> expires for additional long-lived stale time, but | |
3400 | they are marked with the LLGR_STALE community, depreferenced, and | |
3401 | withdrawn from routers not supporting LLGR. Like traditional BGP | |
3402 | graceful restart, it has three states: disabled, aware (receiving-only), | |
3403 | and enabled. Note that long-lived graceful restart requires at least | |
3404 | aware level of traditional BGP graceful restart. Default: aware, unless | |
3405 | graceful restart is disabled. | |
3406 | ||
3407 | <tag><label id="bgp-long-lived-stale-time">long lived stale time <m/number/</tag> | |
3408 | The long-lived stale time is announced in the BGP Long-lived Graceful | |
3409 | Restart capability and specifies how long the neighbor would keep stale | |
3410 | routes depreferenced during long-lived graceful restart until either the | |
3411 | session is re-stablished and synchronized or the stale time expires and | |
3412 | routes are removed. Default: 3600 seconds. | |
3413 | ||
3414 | <tag><label id="bgp-min-long-lived-stale-time">min long lived stale time <m/number/</tag> | |
3415 | The lower bound for the long-lived stale time to override the value | |
3416 | received in the BGP Long-lived Graceful Restart capability announced | |
3417 | by the neighbor. Default: no lower bound. | |
3418 | ||
3419 | <tag><label id="bgp-max-long-lived-stale-time">max long lived stale time <m/number/</tag> | |
3420 | The upper bound for the long-lived stale time to override the value | |
3421 | received in the BGP Long-lived Graceful Restart capability announced | |
3422 | by the neighbor. Default: no upper bound. | |
3423 | ||
3424 | <tag><label id="bgp-require-long-lived-graceful-restart">require long lived graceful restart <m/switch/</tag> | |
3425 | If enabled, the BGP Long-lived Graceful Restart capability (<rfc id="9494">) | |
3426 | must be announced by the BGP neighbor, otherwise the BGP session | |
3427 | will not be established. Default: off. | |
3428 | ||
3429 | <tag><label id="bgp-interpret-communities">interpret communities <m/switch/</tag> | |
3430 | <rfc id="1997"> demands that BGP speaker should process well-known | |
3431 | communities like no-export (65535, 65281) or no-advertise (65535, | |
3432 | 65282). For example, received route carrying a no-advertise community | |
3433 | should not be advertised to any of its neighbors. If this option is | |
3434 | enabled (which is by default), BIRD has such behavior automatically (it | |
3435 | is evaluated when a route is exported to the BGP protocol just before | |
3436 | the export filter). Otherwise, this integrated processing of | |
3437 | well-known communities is disabled. In that case, similar behavior can | |
3438 | be implemented in the export filter. Default: on. | |
3439 | ||
3440 | <tag><label id="bgp-enable-as4">enable as4 <m/switch/</tag> | |
3441 | BGP protocol was designed to use 2B AS numbers and was extended later to | |
3442 | allow 4B AS number. BIRD supports 4B AS extension, but by disabling this | |
3443 | option it can be persuaded not to advertise it and to maintain old-style | |
3444 | sessions with its neighbors. This might be useful for circumventing bugs | |
3445 | in neighbor's implementation of 4B AS extension. Even when disabled | |
3446 | (off), BIRD behaves internally as AS4-aware BGP router. Default: on. | |
3447 | ||
3448 | <tag><label id="bgp-require-as4">require as4 <m/switch/</tag> | |
3449 | If enabled, the BGP 4B AS number capability (<rfc id="6793">) must be | |
3450 | announced by the BGP neighbor, otherwise the BGP session will not be | |
3451 | established. Default: off. | |
3452 | ||
3453 | <tag><label id="bgp-enable-extended-messages">enable extended messages <m/switch/</tag> | |
3454 | The BGP protocol uses maximum message length of 4096 bytes. This option | |
3455 | provides an extension (<rfc id="8654">) to allow extended messages with | |
3456 | length up to 65535 bytes. Default: off. | |
3457 | ||
3458 | <tag><label id="bgp-require-extended-messages">require extended messages <m/switch/</tag> | |
3459 | If enabled, the BGP Extended Message capability (<rfc id="8654">) must | |
3460 | be announced by the BGP neighbor, otherwise the BGP session will not be | |
3461 | established. Default: off. | |
3462 | ||
3463 | <tag><label id="bgp-capabilities">capabilities <m/switch/</tag> | |
3464 | Use capability advertisement to advertise optional capabilities. This is | |
3465 | standard behavior for newer BGP implementations, but there might be some | |
3466 | older BGP implementations that reject such connection attempts. When | |
3467 | disabled (off), features that request it (4B AS support) are also | |
3468 | disabled. Default: on, with automatic fallback to off when received | |
3469 | capability-related error. | |
3470 | ||
3471 | <tag><label id="bgp-advertise-hostname">advertise hostname <m/switch/</tag> | |
3472 | Advertise the hostname capability along with the hostname. Default: off. | |
3473 | ||
3474 | <tag><label id="bgp-require-hostname">require hostname <m/switch/</tag> | |
3475 | If enabled, the hostname capability must be announced by the BGP | |
3476 | neighbor, otherwise the BGP session negotiation fails. Default: off. | |
3477 | ||
3478 | <tag><label id="bgp-disable-after-error">disable after error <m/switch/</tag> | |
3479 | When an error is encountered (either locally or by the other side), | |
3480 | disable the instance automatically and wait for an administrator to fix | |
3481 | the problem manually. Default: off. | |
3482 | ||
3483 | <tag><label id="bgp-disable-after-cease">disable after cease <m/switch/|<m/set-of-flags/</tag> | |
3484 | When a Cease notification is received, disable the instance | |
3485 | automatically and wait for an administrator to fix the problem manually. | |
3486 | When used with <m/switch/ argument, it means handle every Cease subtype | |
3487 | with the exception of <cf/connection collision/. Default: off. | |
3488 | ||
3489 | The <m/set-of-flags/ allows to narrow down relevant Cease subtypes. The | |
3490 | syntax is <cf>{<m/flag/ [, <m/.../] }</cf>, where flags are: <cf/cease/, | |
3491 | <cf/prefix limit hit/, <cf/administrative shutdown/, | |
3492 | <cf/peer deconfigured/, <cf/administrative reset/, | |
3493 | <cf/connection rejected/, <cf/configuration change/, | |
3494 | <cf/connection collision/, <cf/out of resources/. | |
3495 | ||
3496 | <tag><label id="bgp-hold-time">hold time <m/number/</tag> | |
3497 | Time in seconds to wait for a Keepalive message from the other side | |
3498 | before considering the connection stale. The effective value is | |
3499 | negotiated during session establishment and it is a minimum of this | |
3500 | configured value and the value proposed by the peer. The zero value has | |
3501 | a special meaning, signifying that no keepalives are used. Default: 240 | |
3502 | seconds. | |
3503 | ||
3504 | <tag><label id="bgp-min-hold-time">min hold time <m/number/</tag> | |
3505 | Minimum value of the hold time that is accepted during session negotiation. | |
3506 | If the peer proposes a lower value, the session is rejected with error. | |
3507 | Default: none. | |
3508 | ||
3509 | <tag><label id="bgp-startup-hold-time">startup hold time <m/number/</tag> | |
3510 | Value of the hold timer used before the routers have a chance to exchange | |
3511 | open messages and agree on the real value. Default: 240 seconds. | |
3512 | ||
3513 | <tag><label id="bgp-keepalive-time">keepalive time <m/number/</tag> | |
3514 | Delay in seconds between sending of two consecutive Keepalive messages. | |
3515 | The effective value depends on the negotiated hold time, as it is scaled | |
3516 | to maintain proportion between the keepalive time and the hold time. | |
3517 | Default: One third of the hold time. | |
3518 | ||
3519 | <tag><label id="bgp-min-keepalive-time">min keepalive time <m/number/</tag> | |
3520 | Minimum value of the keepalive time that is accepted during session | |
3521 | negotiation. If the proposed hold time would lead to a lower value of | |
3522 | the keepalive time, the session is rejected with error. Default: none. | |
3523 | ||
3524 | <tag><label id="bgp-send-hold-time">send hold time <m/number/</tag> | |
3525 | Maximum time in seconds betweeen successfull transmissions of BGP messages. | |
3526 | Send hold timer drops the session if the neighbor is sending keepalives, | |
3527 | but does not receive our messages, causing the TCP connection to stall. | |
3528 | This may happen due to malfunctioning or overwhelmed neighbor. See | |
3529 | <rfc id="9687"> for more details. | |
3530 | ||
3531 | Like the option <cf/keepalive time/, the effective value depends on the | |
3532 | negotiated hold time, as it is scaled to maintain proportion between the | |
3533 | send hold time and the keepalive time. If it is set to zero, the timer | |
3534 | is disabled. Default: double of the hold timer limit. | |
3535 | ||
3536 | The option <cf/disable rx/ is intended only for testing this feature and | |
3537 | should not be used anywhere else. It discards received messages and | |
3538 | disables the hold timer. | |
3539 | ||
3540 | <tag><label id="bgp-connect-delay-time">connect delay time <m/number/</tag> | |
3541 | Delay in seconds between protocol startup and the first attempt to | |
3542 | connect. Default: 5 seconds. | |
3543 | ||
3544 | <tag><label id="bgp-connect-retry-time">connect retry time <m/number/</tag> | |
3545 | Time in seconds to wait before retrying a failed attempt to connect. | |
3546 | Default: 120 seconds. | |
3547 | ||
3548 | <tag><label id="bgp-error-wait-time">error wait time <m/number/, <m/number/</tag> | |
3549 | Minimum and maximum delay in seconds between a protocol failure (either | |
3550 | local or reported by the peer) and automatic restart. Does not apply | |
3551 | when <cf/disable after error/ is configured. If consecutive errors | |
3552 | happen, the delay is increased exponentially until it reaches the | |
3553 | maximum. Default: 60, 300. | |
3554 | ||
3555 | <tag><label id="bgp-error-forget-time">error forget time <m/number/</tag> | |
3556 | Maximum time in seconds between two protocol failures to treat them as a | |
3557 | error sequence which makes <cf/error wait time/ increase exponentially. | |
3558 | Default: 300 seconds. | |
3559 | ||
3560 | <tag><label id="bgp-path-metric">path metric <m/switch/</tag> | |
3561 | Enable comparison of path lengths when deciding which BGP route is the | |
3562 | best one. Default: on. | |
3563 | ||
3564 | <tag><label id="bgp-med-metric">med metric <m/switch/</tag> | |
3565 | Enable comparison of MED attributes (during best route selection) even | |
3566 | between routes received from different ASes. This may be useful if all | |
3567 | MED attributes contain some consistent metric, perhaps enforced in | |
3568 | import filters of AS boundary routers. If this option is disabled, MED | |
3569 | attributes are compared only if routes are received from the same AS | |
3570 | (which is the standard behavior). Default: off. | |
3571 | ||
3572 | <tag><label id="bgp-deterministic-med">deterministic med <m/switch/</tag> | |
3573 | BGP route selection algorithm is often viewed as a comparison between | |
3574 | individual routes (e.g. if a new route appears and is better than the | |
3575 | current best one, it is chosen as the new best one). But the proper | |
3576 | route selection, as specified by <rfc id="4271">, cannot be fully | |
3577 | implemented in that way. The problem is mainly in handling the MED | |
3578 | attribute. BIRD, by default, uses an simplification based on individual | |
3579 | route comparison, which in some cases may lead to temporally dependent | |
3580 | behavior (i.e. the selection is dependent on the order in which routes | |
3581 | appeared). This option enables a different (and slower) algorithm | |
3582 | implementing proper <rfc id="4271"> route selection, which is | |
3583 | deterministic. Alternative way how to get deterministic behavior is to | |
3584 | use <cf/med metric/ option. This option is incompatible with <ref | |
3585 | id="dsc-table-sorted" name="sorted tables">. Default: off. | |
3586 | ||
3587 | <tag><label id="bgp-igp-metric">igp metric <m/switch/</tag> | |
3588 | Enable comparison of internal distances to boundary routers during best | |
3589 | route selection. Default: on. | |
3590 | ||
3591 | <tag><label id="bgp-prefer-older">prefer older <m/switch/</tag> | |
3592 | Standard route selection algorithm breaks ties by comparing router IDs. | |
3593 | This changes the behavior to prefer older routes (when both are external | |
3594 | and from different peer). For details, see <rfc id="5004">. Default: off. | |
3595 | ||
3596 | <tag><label id="bgp-default-med">default bgp_med <m/number/</tag> | |
3597 | Value of the Multiple Exit Discriminator to be used during route | |
3598 | selection when the MED attribute is missing. Default: 0. | |
3599 | ||
3600 | <tag><label id="bgp-default-local-pref">default bgp_local_pref <m/number/</tag> | |
3601 | A default value for the Local Preference attribute. It is used when | |
3602 | a new Local Preference attribute is attached to a route by the BGP | |
3603 | protocol itself (for example, if a route is received through eBGP and | |
3604 | therefore does not have such attribute). Default: 100 (0 in pre-1.2.0 | |
3605 | versions of BIRD). | |
3606 | ||
3607 | <tag><label id="bgp-local-role">local role <m/role-name/</tag> | |
3608 | BGP roles are a mechanism for route leak prevention and automatic route | |
3609 | filtering based on common BGP topology relationships. They are defined | |
3610 | in <rfc id="9234">. Instead of manually configuring filters and | |
3611 | communities, automatic filtering is done with the help of the OTC | |
3612 | attribute - a flag for routes that should be sent only to customers. | |
3613 | The same attribute is also used to automatically detect and filter route | |
3614 | leaks created by third parties. | |
3615 | ||
3616 | This option is valid for EBGP sessions, but it is not recommended to be | |
3617 | used within AS confederations (which would require manual filtering of | |
3618 | <cf/bgp_otc/ attribute on confederation boundaries). | |
3619 | ||
3620 | Possible <cf><m/role-name/</cf> values are: <cf/provider/, | |
3621 | <cf/rs_server/, <cf/rs_client/, <cf/customer/ and <cf/peer/. | |
3622 | Default: No local role assigned. | |
3623 | ||
3624 | <tag><label id="bgp-require-roles">require roles <m/switch/</tag> | |
3625 | If this option is set, the BGP roles must be defined on both sides, | |
3626 | otherwise the session will not be established. This behavior is defined | |
3627 | in <rfc id="9234"> as "strict mode" and is used to enforce corresponding | |
3628 | configuration at your conterpart side. Default: disabled. | |
3629 | </descrip> | |
3630 | ||
3631 | <sect1>Channel configuration | |
3632 | <label id="bgp-channel-config"> | |
3633 | ||
3634 | <p>BGP supports several AFIs and SAFIs over one connection. Every AFI/SAFI | |
3635 | announced to the peer corresponds to one channel. The table of supported AFI/SAFIs | |
3636 | together with their appropriate channels follows. | |
3637 | ||
3638 | <table loc="h"> | |
3639 | <tabular ca="l|l|l|r|r"> | |
3640 | <bf/Channel name/ | <bf/Table nettype/ | <bf/IGP table allowed/ | <bf/AFI/ | <bf/SAFI/ | |
3641 | @<hline> | |
3642 | <cf/ipv4/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 1 | |
3643 | @ <cf/ipv6/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 1 | |
3644 | @ <cf/ipv4 multicast/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 2 | |
3645 | @ <cf/ipv6 multicast/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 2 | |
3646 | @ <cf/ipv4 mpls/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 4 | |
3647 | @ <cf/ipv6 mpls/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 4 | |
3648 | @ <cf/vpn4 mpls/ | <cf/vpn4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 128 | |
3649 | @ <cf/vpn6 mpls/ | <cf/vpn6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 128 | |
3650 | @ <cf/vpn4 multicast/ | <cf/vpn4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 129 | |
3651 | @ <cf/vpn6 multicast/ | <cf/vpn6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 129 | |
3652 | @ <cf/flow4/ | <cf/flow4/ | --- | 1 | 133 | |
3653 | @ <cf/flow6/ | <cf/flow6/ | --- | 2 | 133 | |
3654 | </tabular> | |
3655 | </table> | |
3656 | ||
3657 | <p>The BGP protocol can be configured as MPLS-aware (by defining both AFI/SAFI | |
3658 | channels and the MPLS channel). In such case the BGP protocol assigns labels to | |
3659 | routes imported from MPLS-aware SAFIs (i.e. <cf/ipvX mpls/ and <cf/vpnX mpls/) | |
3660 | and automatically announces corresponding MPLS route for each labeled route. As | |
3661 | BGP generally processes a large amount of routes, it is suggested to set MPLS | |
3662 | label policy to <cf/aggregate/. | |
3663 | ||
3664 | <p>Note that even BGP instances without MPLS channel and without local MPLS | |
3665 | configuration can still propagate third-party MPLS labels, e.g. as route | |
3666 | reflectors, they just will not assign local labels to imported routes and will | |
3667 | not announce MPLS routes for local MPLS forwarding. | |
3668 | ||
3669 | <p>Due to <rfc id="8212">, external BGP protocol requires explicit configuration | |
3670 | of import and export policies (in contrast to other protocols, where default | |
3671 | policies of <cf/import all/ and <cf/export none/ are used in absence of explicit | |
3672 | configuration). Note that blanket policies like <cf/all/ or <cf/none/ can still | |
3673 | be used in explicit configuration. | |
3674 | ||
3675 | <p>BGP channels have additional config options (together with the common ones): | |
3676 | ||
3677 | <descrip> | |
3678 | <tag><label id="bgp-mandatory">mandatory <m/switch/</tag> | |
3679 | When local and neighbor sets of configured AFI/SAFI pairs differ, | |
3680 | capability negotiation ensures that a common subset is used. For | |
3681 | mandatory channels their associated AFI/SAFI must be negotiated | |
3682 | (i.e., also announced by the neighbor), otherwise BGP session | |
3683 | negotiation fails with <it/'Required capability missing'/ error. | |
3684 | Regardless, at least one AFI/SAFI must be negotiated in order to BGP | |
3685 | session be successfully established. Default: off. | |
3686 | ||
3687 | <tag><label id="bgp-next-hop-keep">next hop keep <m/switch/|ibgp|ebgp</tag> | |
3688 | Do not modify the Next Hop attribute and advertise the current one | |
3689 | unchanged even in cases where our own local address should be used | |
3690 | instead. This is necessary when the BGP speaker does not forward network | |
3691 | traffic (route servers and some route reflectors) and also can be useful | |
3692 | in some other cases (e.g. multihop EBGP sessions). Can be enabled for | |
3693 | all routes, or just for routes received from IBGP / EBGP neighbors. | |
3694 | Default: disabled for regular BGP, enabled for route servers, | |
3695 | <cf/ibgp/ for route reflectors. | |
3696 | ||
3697 | <tag><label id="bgp-next-hop-self">next hop self <m/switch/|ibgp|ebgp</tag> | |
3698 | Always advertise our own local address as a next hop, even in cases | |
3699 | where the current Next Hop attribute should be used unchanged. This is | |
3700 | sometimes used for routes propagated from EBGP to IBGP when IGP routing | |
3701 | does not cover inter-AS links, therefore IP addreses of EBGP neighbors | |
3702 | are not resolvable through IGP. Can be enabled for all routes, or just | |
3703 | for routes received from IBGP / EBGP neighbors. Default: disabled. | |
3704 | ||
3705 | <tag><label id="bgp-next-hop-address">next hop address <m/ip/</tag> | |
3706 | Specify which address to use when our own local address should be | |
3707 | announced in the Next Hop attribute. Default: the source address of the | |
3708 | BGP session (if acceptable), or the preferred address of an associated | |
3709 | interface. | |
3710 | ||
3711 | <tag><label id="bgp-next-hop-prefer">next hop prefer global|local</tag> | |
3712 | For IPv6 routes, the Next Hop attribute may contain both a global IP | |
3713 | address and a link-local IP address. For IBGP sessions, the global IP | |
3714 | address is resolved (<ref id="bgp-gateway" name="gateway recursive">) | |
3715 | through an IGP routing table (<ref id="bgp-igp-table" name="igp table">) | |
3716 | to get an immediate next hop. If the resulting IGP route is a direct | |
3717 | route (i.e., the next hop is a direct neighbor), then the link-local | |
3718 | IP address from the Next Hop attribute is used as the immediate next hop. | |
3719 | This option changes it to prefer global or link-local IP address, | |
3720 | respectively. Note that even with this option set to global, route may | |
3721 | end with a link-local immediate next hop when the IGP route has one. | |
3722 | ||
3723 | When set to <cf/local/, prefer link-local IPv6 addresses over global | |
3724 | addresses for immediate next hops of received routes. When set to | |
3725 | <cf/global/, prefer global IPv6 address to link-local IPv6 address for | |
3726 | immediate next hops of received routes. Default: global in direct mode | |
3727 | (EBGP), local in recursive mode (IBGP). | |
3728 | ||
3729 | <tag><label id="bgp-link-local-next-hop-format">link local next hop format native|single|double</tag> | |
3730 | For IPv6 routes, BGP assumes that the Next Hop attribute contains a | |
3731 | global IPv6 address (in the first position) and an optional link-local | |
3732 | IPv6 address (in the second position): [<m/global/, <m/link-local/]. | |
3733 | When a BGP session is established using just link-local addresses, there | |
3734 | may be no global IPv6 address for the next hop. BGP implementations | |
3735 | differ on how to encode such next hops. BIRD <cf/native/ format is to | |
3736 | send [zero, <m/link-local/], <cf/single/ format is [<m/link-local/], | |
3737 | <cf/double/ format is [<m/link-local/, <m/link-local/]. BIRD accepts all | |
3738 | these variants when decoding received routes, but this option controls | |
3739 | which one it uses to encode such next hops. Default: native. | |
3740 | ||
3741 | <tag><label id="bgp-gateway">gateway direct|recursive</tag> | |
3742 | For received routes, their <cf/gw/ (immediate next hop) attribute is | |
3743 | computed from received <cf/bgp_next_hop/ attribute. This option | |
3744 | specifies how it is computed. Direct mode means that the IP address from | |
3745 | <cf/bgp_next_hop/ is used and must be directly reachable. Recursive mode | |
3746 | means that the gateway is computed by an IGP routing table lookup for | |
3747 | the IP address from <cf/bgp_next_hop/. Note that there is just one level | |
3748 | of indirection in recursive mode - the route obtained by the lookup must | |
3749 | not be recursive itself, to prevent mutually recursive routes. | |
3750 | ||
3751 | Recursive mode is the behavior specified by the BGP | |
3752 | standard. Direct mode is simpler, does not require any routes in a | |
3753 | routing table, and was used in older versions of BIRD, but does not | |
3754 | handle well nontrivial iBGP setups and multihop. Recursive mode is | |
3755 | incompatible with <ref id="dsc-table-sorted" name="sorted tables">. Default: | |
3756 | <cf/direct/ for direct sessions, <cf/recursive/ for multihop sessions. | |
3757 | ||
3758 | <tag><label id="bgp-igp-table">igp table <m/name/</tag> | |
3759 | Specifies a table that is used as an IGP routing table. The type of this | |
3760 | table must be as allowed in the table above. This option is allowed once | |
3761 | for every allowed table type. Default: the same as the main table | |
3762 | the channel is connected to (if eligible). | |
3763 | ||
3764 | <tag><label id="bgp-import-table">import table <m/switch/</tag> | |
3765 | A BGP import table contains all received routes from given BGP neighbor, | |
3766 | before application of import filters. It is also called <em/Adj-RIB-In/ | |
3767 | in BGP terminology. BIRD BGP by default operates without import tables, | |
3768 | in which case received routes are just processed by import filters, | |
3769 | accepted ones are stored in the master table, and the rest is forgotten. | |
3770 | Enabling <cf/import table/ allows to store unprocessed routes, which can | |
3771 | be examined later by <cf/show route/, and can be used to reconfigure | |
3772 | import filters without full route refresh. Default: off. | |
3773 | ||
3774 | Note that currently the import table breaks routes with recursive | |
3775 | nexthops (e.g. ones from IBGP, see <ref id="bgp-gateway" name="gateway | |
3776 | recursive">), they are not properly updated after next hop change. For | |
3777 | the same reason, it also breaks re-evaluation of flowspec routes with | |
3778 | <ref id="bgp-validate" name="flowspec validation"> option enabled on | |
3779 | flowspec channels. | |
3780 | ||
3781 | <tag><label id="bgp-export-table">export table <m/switch/</tag> | |
3782 | A BGP export table contains all routes sent to given BGP neighbor, after | |
3783 | application of export filters. It is also called <em/Adj-RIB-Out/ in BGP | |
3784 | terminology. BIRD BGP by default operates without export tables, in | |
3785 | which case routes from master table are just processed by export filters | |
3786 | and then announced by BGP. Enabling <cf/export table/ allows to store | |
3787 | routes after export filter processing, so they can be examined later by | |
3788 | <cf/show route/, and can be used to eliminate unnecessary updates or | |
3789 | withdraws. Default: off. | |
3790 | ||
3791 | <tag><label id="bgp-secondary">secondary <m/switch/</tag> | |
3792 | Usually, if an export filter rejects a selected route, no other route is | |
3793 | propagated for that network. This option allows to try the next route in | |
3794 | order until one that is accepted is found or all routes for that network | |
3795 | are rejected. This can be used for route servers that need to propagate | |
3796 | different tables to each client but do not want to have these tables | |
3797 | explicitly (to conserve memory). This option requires that the connected | |
3798 | routing table is <ref id="dsc-table-sorted" name="sorted">. Default: off. | |
3799 | ||
3800 | <tag><label id="bgp-validate">validate <m/switch/</tag> | |
3801 | Apply flowspec validation procedure as described in <rfc id="8955"> | |
3802 | section 6 and <rfc id="9117">. The Validation procedure enforces that | |
3803 | only routers in the forwarding path for a network can originate flowspec | |
3804 | rules for that network. The validation procedure should be used for EBGP | |
3805 | to prevent injection of malicious flowspec rules from outside, but it | |
3806 | should also be used for IBGP to ensure that selected flowspec rules are | |
3807 | consistent with selected IP routes. The validation procedure uses an IP | |
3808 | routing table (<ref id="bgp-base-table" name="base table">, see below) | |
3809 | against which flowspec rules are validated. This option is limited to | |
3810 | flowspec channels. Default: off (for compatibility reasons). | |
3811 | ||
3812 | Note that currently the flowspec validation does not work reliably | |
3813 | together with <ref id="bgp-import-table" name="import table"> option | |
3814 | enabled on flowspec channels. | |
3815 | ||
3816 | <tag><label id="bgp-base-table">base table <m/name/</tag> | |
3817 | Specifies an IP table used for the flowspec validation procedure. The | |
3818 | table must have enabled <cf/trie/ option, otherwise the validation | |
3819 | procedure would not work. The type of the table must be <cf/ipv4/ for | |
3820 | <cf/flow4/ channels and <cf/ipv6/ for <cf/flow6/ channels. This option | |
3821 | is limited to flowspec channels. Default: the main table of the | |
3822 | <cf/ipv4/ / <cf/ipv6/ channel of the same BGP instance, or the | |
3823 | <cf/master4/ / <cf/master6/ table if there is no such channel. | |
3824 | ||
3825 | <tag><label id="bgp-extended-next-hop">extended next hop <m/switch/</tag> | |
3826 | BGP expects that announced next hops have the same address family as | |
3827 | associated network prefixes. This option provides an extension to use | |
3828 | IPv4 next hops with IPv6 prefixes and vice versa. For IPv4 / VPNv4 | |
3829 | channels, the behavior is controlled by the Extended Next Hop Encoding | |
3830 | capability, as described in <rfc id="8950">. For IPv6 / VPNv6 channels, | |
3831 | just IPv4-mapped IPv6 addresses are used, as described in | |
3832 | <rfc id="4798"> and <rfc id="4659">. Default: off. | |
3833 | ||
3834 | <tag><label id="bgp-require-extended-next-hop">require extended next hop <m/switch/</tag> | |
3835 | If enabled, the BGP Extended Next Hop Encoding capability (<rfc id="8950">) | |
3836 | must be announced by the BGP neighbor, otherwise the BGP session will | |
3837 | not be established. Note that this option is relevant just for IPv4 / | |
3838 | VPNv4 channels, as IPv6 / VPNv6 channels use a different mechanism not | |
3839 | signalled by a capability. Default: off. | |
3840 | ||
3841 | <tag><label id="bgp-add-paths">add paths <m/switch/|rx|tx</tag> | |
3842 | Standard BGP can propagate only one path (route) per destination network | |
3843 | (usually the selected one). This option controls the ADD-PATH protocol | |
3844 | extension, which allows to advertise any number of paths to a | |
3845 | destination. Note that to be active, ADD-PATH has to be enabled on both | |
3846 | sides of the BGP session, but it could be enabled separately for RX and | |
3847 | TX direction. When active, all available routes accepted by the export | |
3848 | filter are advertised to the neighbor. Default: off. | |
3849 | ||
3850 | <tag><label id="bgp-require-add-paths">require add paths <m/switch/</tag> | |
3851 | If enabled, the BGP ADD-PATH capability (<rfc id="7911">) must be | |
3852 | announced by the BGP neighbor, otherwise the BGP session will not be | |
3853 | established. Announced directions in the capability must be compatible | |
3854 | with locally configured directions. E.g., If <cf/add path tx/ is | |
3855 | configured locally, then the neighbor capability must announce RX. | |
3856 | Default: off. | |
3857 | ||
3858 | <tag><label id="bgp-aigp">aigp <m/switch/|originate</tag> | |
3859 | The BGP protocol does not use a common metric like other routing | |
3860 | protocols, instead it uses a set of criteria for route selection | |
3861 | consisting both overall AS path length and a distance to the nearest AS | |
3862 | boundary router. Assuming that metrics of different autonomous systems | |
3863 | are incomparable, once a route is propagated from an AS to a next one, | |
3864 | the distance in the old AS does not matter. | |
3865 | ||
3866 | The AIGP extension (<rfc id="7311">) allows to propagate accumulated | |
3867 | IGP metric (in the AIGP attribute) through both IBGP and EBGP links, | |
3868 | computing total distance through multiple autonomous systems (assuming | |
3869 | they use comparable IGP metric). The total AIGP metric is compared in | |
3870 | the route selection process just after Local Preference comparison (and | |
3871 | before AS path length comparison). | |
3872 | ||
3873 | This option controls whether AIGP attribute propagation is allowed on | |
3874 | the session. Optionally, it can be set to <cf/originate/, which not only | |
3875 | allows AIGP attribute propagation, but also new AIGP attributes are | |
3876 | automatically attached to non-BGP routes with valid IGP metric (e.g. | |
3877 | <cf/ospf_metric1/) as they are exported to the BGP session. Default: | |
3878 | enabled for IBGP (and intra-confederation EBGP), disabled for regular | |
3879 | EBGP. | |
3880 | ||
3881 | <tag><label id="bgp-cost">cost <m/number/</tag> | |
3882 | When BGP <ref id="bgp-gateway" name="gateway mode"> is <cf/recursive/ | |
3883 | (mainly multihop IBGP sessions), then the distance to BGP next hop is | |
3884 | based on underlying IGP metric. This option specifies the distance to | |
3885 | BGP next hop for BGP sessions in direct gateway mode (mainly direct | |
3886 | EBGP sessions). | |
3887 | ||
3888 | <tag><label id="bgp-graceful-restart-c">graceful restart <m/switch/</tag> | |
3889 | Although BGP graceful restart is configured mainly by protocol-wide | |
3890 | <ref id="bgp-graceful-restart" name="options">, it is possible to | |
3891 | configure restarting role per AFI/SAFI pair by this channel option. | |
3892 | The option is ignored if graceful restart is disabled by protocol-wide | |
3893 | option. Default: off in aware mode, on in full mode. | |
3894 | ||
3895 | <tag><label id="bgp-long-lived-graceful-restart-c">long lived graceful restart <m/switch/</tag> | |
3896 | BGP long-lived graceful restart is configured mainly by protocol-wide | |
3897 | <ref id="bgp-long-lived-graceful-restart" name="options">, but the | |
3898 | restarting role can be set per AFI/SAFI pair by this channel option. | |
3899 | The option is ignored if long-lived graceful restart is disabled by | |
3900 | protocol-wide option. Default: off in aware mode, on in full mode. | |
3901 | ||
3902 | <tag><label id="bgp-long-lived-stale-time-c">long lived stale time <m/number/</tag> | |
3903 | Like previous graceful restart channel options, this option allows to | |
3904 | set <ref id="bgp-long-lived-stale-time" name="long lived stale time"> | |
3905 | per AFI/SAFI pair instead of per protocol. Default: set by protocol-wide | |
3906 | option. | |
3907 | ||
3908 | <tag><label id="bgp-min-long-lived-stale-time-c">min long lived stale time <m/number/</tag> | |
3909 | Like previous graceful restart channel options, this option allows to | |
3910 | set <ref id="bgp-min-long-lived-stale-time" name="min long lived stale time"> | |
3911 | per AFI/SAFI pair instead of per protocol. Default: set by protocol-wide | |
3912 | option. | |
3913 | ||
3914 | <tag><label id="bgp-max-long-lived-stale-time-c">max long lived stale time <m/number/</tag> | |
3915 | Like previous graceful restart channel options, this option allows to | |
3916 | set <ref id="bgp-max-long-lived-stale-time" name="max long lived stale time"> | |
3917 | per AFI/SAFI pair instead of per protocol. Default: set by protocol-wide | |
3918 | option. | |
3919 | </descrip> | |
3920 | ||
3921 | <sect1>Reconfiguration | |
3922 | <label id="bgp-reconfiguration"> | |
3923 | ||
3924 | <p>Running the <cf/configure/ command with a changed configuration file will | |
3925 | trigger a reconfiguration. This may cause a reload of the affected channel or | |
3926 | a restart of the BGP protocol. A change in options that just affect route | |
3927 | processing generally causes a reload, while a change in setting of BGP | |
3928 | capabilities or other properties negotiated during session establishment always | |
3929 | leads to a restart. | |
3930 | ||
3931 | <p>With the <cf/configure soft/ command, configuration changes do not trigger | |
3932 | a reload, but instead just log a message about the change, suggesting manual | |
3933 | reload of the channel. However, changes demanding restart still trigger a | |
3934 | restart of the protocol. See <ref id="cli-configure" name="configure"> and | |
3935 | <ref id="cli-reload" name="reload"> commands for more details. In the rest of | |
3936 | the section, we assume the usage of the <cf/configure/ command without the | |
3937 | <cf/soft/ option. | |
3938 | ||
3939 | <p>Changes in these channel options cause a reload of the channel in the import | |
3940 | direction (re-import of routes from the BGP neighbor): | |
3941 | ||
3942 | <itemize> | |
3943 | <item><cf/import/ | |
3944 | <item><cf/preference/ | |
3945 | <item><cf/gateway/ | |
3946 | <item><cf/next hop prefer/ | |
3947 | <item><cf/aigp/ | |
3948 | <item><cf/cost/ | |
3949 | </itemize> | |
3950 | ||
3951 | <p>Note: Reload in the import direction requires either the <cf/route refresh/ | |
3952 | capability negotiated or the <cf/import table/ option enabled. If neither one is | |
3953 | available, the reconfiguration will trigger a restart instead of a reload. This | |
3954 | does not apply for export direction. | |
3955 | ||
3956 | <p>Changes in these channel options cause a reload of the channel in the export | |
3957 | direction (re-export of routes to the BGP neighbor): | |
3958 | ||
3959 | <itemize> | |
3960 | <item><cf/export/ | |
3961 | <item><cf/next hop address/ | |
3962 | <item><cf/next hop self/ | |
3963 | <item><cf/next hop keep/ | |
3964 | <item><cf/link local next hop format/ | |
3965 | <item><cf/aigp/ | |
3966 | <item><cf/aigp originate/ | |
3967 | </itemize> | |
3968 | ||
3969 | ||
3970 | <p>Protocol options that cause a restart when changed: | |
3971 | <itemize> | |
3972 | <item><cf/router id/ | |
3973 | <item><cf/hostname/ | |
3974 | <item><cf/vrf/ | |
3975 | </itemize> | |
3976 | ||
3977 | <p><bf/All/ BGP-specific protocol options cause a restart when changed <bf/except/ for these: | |
3978 | <itemize> | |
3979 | <item><cf/bfd/ | |
3980 | <item><cf/check link/ | |
3981 | <item><cf/require route refresh/ | |
3982 | <item><cf/require enhanced route refresh/ | |
3983 | <item><cf/require AS4/ | |
3984 | <item><cf/require extended messages/ | |
3985 | <item><cf/require hostname/ | |
3986 | <item><cf/require graceful restart/ | |
3987 | <item><cf/require long lived graceful restart/ | |
3988 | </itemize> | |
3989 | ||
3990 | <p>Channel options that cause a restart when changed: | |
3991 | <itemize> | |
3992 | <item><cf/table/ | |
3993 | <item><cf/secondary/ | |
3994 | <item><cf/validate/ | |
3995 | <item><cf/graceful restart/ | |
3996 | <item><cf/long lived graceful restart/ | |
3997 | <item><cf/long lived stale time/ | |
3998 | <item><cf/extended next hop/ | |
3999 | <item><cf/add paths/ | |
4000 | <item><cf/import table/ | |
4001 | <item><cf/export table/ | |
4002 | <item><cf/igp table/ | |
4003 | <item><cf/base table/ | |
4004 | </itemize> | |
4005 | ||
4006 | <p>Channel options that may cause a restart (when changed to a value | |
4007 | incompatible with the current protocol state): | |
4008 | <itemize> | |
4009 | <item><cf/mandatory/ | |
4010 | <item><cf/min long lived stale time/ | |
4011 | <item><cf/max long lived stale time/ | |
4012 | </itemize> | |
4013 | ||
4014 | <sect1>Attributes | |
4015 | <label id="bgp-attr"> | |
4016 | ||
4017 | <p>BGP defines several route attributes. Some of them (those marked with | |
4018 | `<tt/I/' in the table below) are available on internal BGP connections only, | |
4019 | some of them (marked with `<tt/O/') are optional. | |
4020 | ||
4021 | <descrip> | |
4022 | <tag><label id="rta-bgp-path">bgppath bgp_path</tag> | |
4023 | Sequence of AS numbers describing the AS path the packet will travel | |
4024 | through when forwarded according to the particular route. In case of | |
4025 | internal BGP it doesn't contain the number of the local AS. | |
4026 | ||
4027 | <tag><label id="rta-bgp-local-pref">int bgp_local_pref [I]</tag> | |
4028 | Local preference value used for selection among multiple BGP routes (see | |
4029 | the selection rules above). It's used as an additional metric which is | |
4030 | propagated through the whole local AS. | |
4031 | ||
4032 | <tag><label id="rta-bgp-med">int bgp_med [O]</tag> | |
4033 | The Multiple Exit Discriminator of the route is an optional attribute | |
4034 | which is used on external (inter-AS) links to convey to an adjacent AS | |
4035 | the optimal entry point into the local AS. The received attribute is | |
4036 | also propagated over internal BGP links. The attribute value is zeroed | |
4037 | when a route is exported to an external BGP instance to ensure that the | |
4038 | attribute received from a neighboring AS is not propagated to other | |
4039 | neighboring ASes. A new value might be set in the export filter of an | |
4040 | external BGP instance. See <rfc id="4451"> for further discussion of | |
4041 | BGP MED attribute. | |
4042 | ||
4043 | <tag><label id="rta-bgp-origin">enum bgp_origin</tag> | |
4044 | Origin of the route: either <cf/ORIGIN_IGP/ if the route has originated | |
4045 | in an interior routing protocol or <cf/ORIGIN_EGP/ if it's been imported | |
4046 | from the <tt>EGP</tt> protocol (nowadays it seems to be obsolete) or | |
4047 | <cf/ORIGIN_INCOMPLETE/ if the origin is unknown. | |
4048 | ||
4049 | <tag><label id="rta-bgp-next-hop">ip bgp_next_hop</tag> | |
4050 | Next hop to be used for forwarding of packets to this destination. On | |
4051 | internal BGP connections, it's an address of the originating router if | |
4052 | it's inside the local AS or a boundary router the packet will leave the | |
4053 | AS through if it's an exterior route, so each BGP speaker within the AS | |
4054 | has a chance to use the shortest interior path possible to this point. | |
4055 | ||
4056 | <tag><label id="rta-bgp-atomic-aggr">void bgp_atomic_aggr [O]</tag> | |
4057 | This is an optional attribute which carries no value, but the sole | |
4058 | presence of which indicates that the route has been aggregated from | |
4059 | multiple routes by some router on the path from the originator. | |
4060 | ||
4061 | <tag><label id="rta-bgp-aggregator">void bgp_aggregator [O]</tag> | |
4062 | This is an optional attribute specifying AS number and IP address of the | |
4063 | BGP router that created the route by aggregating multiple BGP routes. | |
4064 | Currently, the attribute is not accessible from filters. | |
4065 | ||
4066 | <tag><label id="rta-bgp-community">clist bgp_community [O]</tag> | |
4067 | List of community values associated with the route. Each such value is a | |
4068 | pair (represented as a <cf/pair/ data type inside the filters) of 16-bit | |
4069 | integers, the first of them containing the number of the AS which | |
4070 | defines the community and the second one being a per-AS identifier. | |
4071 | There are lots of uses of the community mechanism, but generally they | |
4072 | are used to carry policy information like "don't export to USA peers". | |
4073 | As each AS can define its own routing policy, it also has a complete | |
4074 | freedom about which community attributes it defines and what will their | |
4075 | semantics be. | |
4076 | ||
4077 | <tag><label id="rta-bgp-ext-community">eclist bgp_ext_community [O]</tag> | |
4078 | List of extended community values associated with the route. Extended | |
4079 | communities have similar usage as plain communities, but they have an | |
4080 | extended range (to allow 4B ASNs) and a nontrivial structure with a type | |
4081 | field. Individual community values are represented using an <cf/ec/ data | |
4082 | type inside the filters. | |
4083 | ||
4084 | <tag><label id="rta-bgp-large-community">lclist bgp_large_community [O]</tag> | |
4085 | List of large community values associated with the route. Large BGP | |
4086 | communities is another variant of communities, but contrary to extended | |
4087 | communities they behave very much the same way as regular communities, | |
4088 | just larger -- they are uniform untyped triplets of 32bit numbers. | |
4089 | Individual community values are represented using an <cf/lc/ data type | |
4090 | inside the filters. | |
4091 | ||
4092 | <tag><label id="rta-bgp-originator-id">quad bgp_originator_id [I, O]</tag> | |
4093 | This attribute is created by the route reflector when reflecting the | |
4094 | route and contains the router ID of the originator of the route in the | |
4095 | local AS. | |
4096 | ||
4097 | <tag><label id="rta-bgp-cluster-list">clist bgp_cluster_list [I, O]</tag> | |
4098 | This attribute contains a list of cluster IDs of route reflectors. Each | |
4099 | route reflector prepends its cluster ID when reflecting the route. | |
4100 | ||
4101 | <tag><label id="rta-bgp-aigp">void bgp_aigp [O]</tag> | |
4102 | This attribute contains accumulated IGP metric, which is a total | |
4103 | distance to the destination through multiple autonomous systems. | |
4104 | Currently, the attribute is not accessible from filters. | |
4105 | ||
4106 | <tag><label id="bgp-otc">int bgp_otc [O]</tag> | |
4107 | This attribute is defined in <rfc id="9234">. OTC is a flag that marks | |
4108 | routes that should be sent only to customers. If <ref id="bgp-local-role" | |
4109 | name="local role"> is configured it set automatically. | |
4110 | </descrip> | |
4111 | ||
4112 | <p>For attributes unknown by BIRD, the user can assign a name (on top level) to | |
4113 | an attribute by its number. This defined name can be used then to get, set (as a | |
4114 | bytestring, transitive) or unset the given attribute even though BIRD knows | |
4115 | nothing about it. | |
4116 | ||
4117 | <p>Note that it is not possible to define an attribute with the same number | |
4118 | as one known by BIRD, therefore use of this statement carries a risk of | |
4119 | incompatibility with future BIRD versions. | |
4120 | ||
4121 | <p><cf><label id="bgp-attribute-custom">attribute bgp <m/number/ bytestring <m/name/;</cf> | |
4122 | ||
4123 | <sect1>Example | |
4124 | <label id="bgp-exam"> | |
4125 | ||
4126 | <p><code> | |
4127 | protocol bgp { | |
4128 | local 198.51.100.14 as 65000; # Use a private AS number | |
4129 | neighbor 198.51.100.130 as 64496; # Our neighbor ... | |
4130 | multihop; # ... which is connected indirectly | |
4131 | authentication ao; # We use TCP-AO authentication | |
4132 | keys { | |
4133 | key { | |
4134 | id 0; | |
4135 | secret "hello321"; | |
4136 | algorithm hmac sha256; | |
4137 | preferred; | |
4138 | }; | |
4139 | key { | |
4140 | send id 2; | |
4141 | recv id 1; | |
4142 | secret "bye123"; | |
4143 | algorithm cmac aes128; | |
4144 | }; | |
4145 | }; | |
4146 | ipv4 { | |
4147 | export filter { # We use non-trivial export rules | |
4148 | if source = RTS_STATIC then { # Export only static routes | |
4149 | # Assign our community | |
4150 | bgp_community.add((65000,64501)); | |
4151 | # Artificially increase path length | |
4152 | # by advertising local AS number twice | |
4153 | if bgp_path ~ [= 65000 =] then | |
4154 | bgp_path.prepend(65000); | |
4155 | accept; | |
4156 | } | |
4157 | reject; | |
4158 | }; | |
4159 | import all; | |
4160 | next hop self; # advertise this router as next hop | |
4161 | igp table myigptable4; # IGP table for routes with IPv4 nexthops | |
4162 | igp table myigptable6; # IGP table for routes with IPv6 nexthops | |
4163 | }; | |
4164 | ipv6 { | |
4165 | export filter mylargefilter; # We use a named filter | |
4166 | import all; | |
4167 | missing lladdr self; | |
4168 | igp table myigptable4; # IGP table for routes with IPv4 nexthops | |
4169 | igp table myigptable6; # IGP table for routes with IPv6 nexthops | |
4170 | }; | |
4171 | ipv4 multicast { | |
4172 | import all; | |
4173 | export filter someotherfilter; | |
4174 | table mymulticasttable4; # Another IPv4 table, dedicated for multicast | |
4175 | igp table myigptable4; | |
4176 | }; | |
4177 | } | |
4178 | </code> | |
4179 | ||
4180 | ||
4181 | <sect>BMP | |
4182 | <label id="bmp"> | |
4183 | ||
4184 | <p>The BGP Monitoring Protocol is used for monitoring BGP sessions and obtaining | |
4185 | routing table data. The current implementation in BIRD is a preliminary release | |
4186 | with a limited feature set, it will be subject to significant changes in the | |
4187 | future. It is not ready for production usage and therefore it is not compiled | |
4188 | by default and have to be enabled during installation by the configure option | |
4189 | <tt/--with-protocols=/. | |
4190 | ||
4191 | <p>The implementation supports monitoring protocol state changes, pre-policy | |
4192 | routes (in <ref id="bgp-import-table" name="BGP import tables">) and post-policy | |
4193 | routes (in regular routing tables). All BGP protocols are monitored automatically. | |
4194 | ||
4195 | <sect1>Configuration (incomplete) | |
4196 | <label id="bmp-config"> | |
4197 | ||
4198 | <p><descrip> | |
4199 | <tag><label id="bmp-tx-buffer-limit">tx buffer limit <m/number/</tag> | |
4200 | How much data we are going to queue before we call the session stuck | |
4201 | and restart it, in megabytes. Default value: 1024 (effectively 1 gigabyte). | |
4202 | </descrip> | |
4203 | ||
4204 | <sect1>Example | |
4205 | <label id="bmp-exam"> | |
4206 | ||
4207 | <p><code> | |
4208 | protocol bmp { | |
4209 | # The monitoring station to connect to | |
4210 | station address ip 198.51.100.10 port 1790; | |
4211 | ||
4212 | # Monitor received routes (in import table) | |
4213 | monitoring rib in pre_policy; | |
4214 | ||
4215 | # Monitor accepted routes (passed import filters) | |
4216 | monitoring rib in post_policy; | |
4217 | ||
4218 | # Allow only 64M of pending data | |
4219 | tx buffer limit 64; | |
4220 | } | |
4221 | </code> | |
4222 | ||
4223 | ||
4224 | <sect>Device | |
4225 | <label id="device"> | |
4226 | ||
4227 | <p>The Device protocol is not a real routing protocol. It doesn't generate any | |
4228 | routes and it only serves as a module for getting information about network | |
4229 | interfaces from the kernel. This protocol supports no channel. | |
4230 | ||
4231 | <p>Except for very unusual circumstances, you probably should include this | |
4232 | protocol in the configuration since almost all other protocols require network | |
4233 | interfaces to be defined for them to work with. | |
4234 | ||
4235 | <sect1>Configuration | |
4236 | <label id="device-config"> | |
4237 | ||
4238 | <p><descrip> | |
4239 | <tag><label id="device-scan-time">scan time <m/number/</tag> | |
4240 | Time in seconds between two scans of the network interface list. On | |
4241 | systems where we are notified about interface status changes | |
4242 | asynchronously (such as newer versions of Linux), we need to scan the | |
4243 | list only in order to avoid confusion by lost notification messages, | |
4244 | so the default time is set to a large value. | |
4245 | ||
4246 | <tag><label id="device-iface">interface <m/pattern/ [, <m/.../]</tag> | |
4247 | By default, the Device protocol handles all interfaces without any | |
4248 | configuration. Interface definitions allow to specify optional | |
4249 | parameters for specific interfaces. See <ref id="proto-iface" | |
4250 | name="interface"> common option for detailed description. Currently only | |
4251 | one interface option is available: | |
4252 | ||
4253 | <tag><label id="device-preferred">preferred <m/ip/</tag> | |
4254 | If a network interface has more than one IP address, BIRD chooses one of | |
4255 | them as a preferred one. Preferred IP address is used as source address | |
4256 | for packets or announced next hop by routing protocols. Precisely, BIRD | |
4257 | chooses one preferred IPv4 address, one preferred IPv6 address and one | |
4258 | preferred link-local IPv6 address. By default, BIRD chooses the first | |
4259 | found IP address as the preferred one. | |
4260 | ||
4261 | This option allows to specify which IP address should be preferred. May | |
4262 | be used multiple times for different address classes (IPv4, IPv6, IPv6 | |
4263 | link-local). In all cases, an address marked by operating system as | |
4264 | secondary cannot be chosen as the primary one. | |
4265 | </descrip> | |
4266 | ||
4267 | <p>As the Device protocol doesn't generate any routes, it cannot have | |
4268 | any attributes. Example configuration looks like this: | |
4269 | ||
4270 | <p><code> | |
4271 | protocol device { | |
4272 | scan time 10; # Scan the interfaces often | |
4273 | interface "eth0" { | |
4274 | preferred 192.168.1.1; | |
4275 | preferred 2001:db8:1:10::1; | |
4276 | }; | |
4277 | } | |
4278 | </code> | |
4279 | ||
4280 | ||
4281 | <sect>Direct | |
4282 | <label id="direct"> | |
4283 | ||
4284 | <p>The Direct protocol is a simple generator of device routes for all the | |
4285 | directly connected networks according to the list of interfaces provided by the | |
4286 | kernel via the Device protocol. The Direct protocol supports both IPv4 and IPv6 | |
4287 | channels; both can be configured simultaneously. It can also be configured with | |
4288 | <ref id="ip-sadr-routes" name="IPv6 SADR"> channel instead of regular IPv6 | |
4289 | channel in order to be used together with SADR-enabled Babel protocol. | |
4290 | ||
4291 | <p>The question is whether it is a good idea to have such device routes in BIRD | |
4292 | routing table. OS kernel usually handles device routes for directly connected | |
4293 | networks by itself so we don't need (and don't want) to export these routes to | |
4294 | the kernel protocol. OSPF protocol creates device routes for its interfaces | |
4295 | itself and BGP protocol is usually used for exporting aggregate routes. But the | |
4296 | Direct protocol is necessary for distance-vector protocols like RIP or Babel to | |
4297 | announce local networks. | |
4298 | ||
4299 | <p>There are just few configuration options for the Direct protocol: | |
4300 | ||
4301 | <p><descrip> | |
4302 | <tag><label id="direct-iface">interface <m/pattern/ [, <m/.../]</tag> | |
4303 | By default, the Direct protocol will generate device routes for all the | |
4304 | interfaces available. If you want to restrict it to some subset of | |
4305 | interfaces or addresses (e.g. if you're using multiple routing tables | |
4306 | for policy routing and some of the policy domains don't contain all | |
4307 | interfaces), just use this clause. See <ref id="proto-iface" name="interface"> | |
4308 | common option for detailed description. The Direct protocol uses | |
4309 | extended interface clauses. | |
4310 | ||
4311 | <tag><label id="direct-check-link">check link <m/switch/</tag> | |
4312 | If enabled, a hardware link state (reported by OS) is taken into | |
4313 | consideration. Routes for directly connected networks are generated only | |
4314 | if link up is reported and they are withdrawn when link disappears | |
4315 | (e.g., an ethernet cable is unplugged). Default value is no. | |
4316 | </descrip> | |
4317 | ||
4318 | <p>Direct device routes don't contain any specific attributes. | |
4319 | ||
4320 | <p>Example config might look like this: | |
4321 | ||
4322 | <p><code> | |
4323 | protocol direct { | |
4324 | ipv4; | |
4325 | ipv6; | |
4326 | interface -"arc*", "*"; # Exclude the ARCnets | |
4327 | } | |
4328 | </code> | |
4329 | ||
4330 | ||
4331 | <sect>Kernel | |
4332 | <label id="krt"> | |
4333 | ||
4334 | <p>The Kernel protocol is not a real routing protocol. Instead of communicating | |
4335 | with other routers in the network, it performs synchronization of BIRD's routing | |
4336 | tables with the OS kernel. Basically, it sends all routing table updates to the | |
4337 | kernel and from time to time it scans the kernel tables to see whether some | |
4338 | routes have disappeared (for example due to unnoticed up/down transition of an | |
4339 | interface) or whether an `alien' route has been added by someone else (depending | |
4340 | on the <cf/learn/ switch, such routes are either ignored or accepted to our | |
4341 | table). | |
4342 | ||
4343 | <p>Note that routes created by OS kernel itself, namely direct routes | |
4344 | representing IP subnets of associated interfaces, are imported only with | |
4345 | <cf/learn all/ enabled. | |
4346 | ||
4347 | <p>If your OS supports only a single routing table, you can configure only one | |
4348 | instance of the Kernel protocol. If it supports multiple tables (in order to | |
4349 | allow policy routing; such an OS is for example Linux), you can run as many | |
4350 | instances as you want, but each of them must be connected to a different BIRD | |
4351 | routing table and to a different kernel table. | |
4352 | ||
4353 | <p>Because the kernel protocol is partially integrated with the connected | |
4354 | routing table, there are two limitations - it is not possible to connect more | |
4355 | kernel protocols to the same routing table and changing route destination | |
4356 | (gateway) in an export filter of a kernel protocol does not work. Both | |
4357 | limitations can be overcome using another routing table and the pipe protocol. | |
4358 | ||
4359 | <p>The Kernel protocol supports both IPv4 and IPv6 channels; only one channel | |
4360 | can be configured in each protocol instance. On Linux, it also supports <ref | |
4361 | id="ip-sadr-routes" name="IPv6 SADR"> and <ref id="mpls-routes" name="MPLS"> | |
4362 | channels. | |
4363 | ||
4364 | <sect1>Configuration | |
4365 | <label id="krt-config"> | |
4366 | ||
4367 | <p><descrip> | |
4368 | <tag><label id="krt-persist">persist <m/switch/</tag> | |
4369 | Tell BIRD to leave all its routes in the routing tables when it exits | |
4370 | (instead of cleaning them up). | |
4371 | ||
4372 | <tag><label id="krt-scan-time">scan time <m/number/</tag> | |
4373 | Time in seconds between two consecutive scans of the kernel routing | |
4374 | table. | |
4375 | ||
4376 | <tag><label id="krt-learn">learn <m/switch/|all</tag> | |
4377 | Enable learning of routes added to the kernel routing tables by other | |
4378 | routing daemons or by the system administrator. This is possible only on | |
4379 | systems which support identification of route authorship. By default, | |
4380 | routes created by kernel (marked as "proto kernel") are not imported. | |
4381 | Use <cf/learn all/ option to import even these routes. | |
4382 | ||
4383 | <tag><label id="krt-kernel-table">kernel table <m/number/</tag> | |
4384 | Select which kernel table should this particular instance of the Kernel | |
4385 | protocol work with. Available only on systems supporting multiple | |
4386 | routing tables. | |
4387 | ||
4388 | <tag><label id="krt-metric">metric <m/number/</tag> (Linux) | |
4389 | Use specified value as a kernel metric (priority) for all routes sent to | |
4390 | the kernel. When multiple routes for the same network are in the kernel | |
4391 | routing table, the Linux kernel chooses one with lower metric. Also, | |
4392 | routes with different metrics do not clash with each other, therefore | |
4393 | using dedicated metric value is a reliable way to avoid overwriting | |
4394 | routes from other sources (e.g. kernel device routes). Metric 0 has a | |
4395 | special meaning of undefined metric, in which either OS default is used, | |
4396 | or per-route metric can be set using <cf/krt_metric/ attribute. Default: | |
4397 | 32. | |
4398 | ||
4399 | <tag><label id="krt-graceful-restart">graceful restart <m/switch/</tag> | |
4400 | Participate in graceful restart recovery. If this option is enabled and | |
4401 | a graceful restart recovery is active, the Kernel protocol will defer | |
4402 | synchronization of routing tables until the end of the recovery. Note | |
4403 | that import of kernel routes to BIRD is not affected. | |
4404 | ||
4405 | <tag><label id="krt-merge-paths">merge paths <m>switch</m> [limit <m>number</m>]</tag> | |
4406 | Usually, only best routes are exported to the kernel protocol. With path | |
4407 | merging enabled, both best routes and equivalent non-best routes are | |
4408 | merged during export to generate one ECMP (equal-cost multipath) route | |
4409 | for each network. This is useful e.g. for BGP multipath. Note that best | |
4410 | routes are still pivotal for route export (responsible for most | |
4411 | properties of resulting ECMP routes), while exported non-best routes are | |
4412 | responsible just for additional multipath next hops. This option also | |
4413 | allows to specify a limit on maximal number of nexthops in one route. By | |
4414 | default, multipath merging is disabled. If enabled, default value of the | |
4415 | limit is 16. | |
4416 | ||
4417 | <tag><label id="krt-netlink-rx-buffer">netlink rx buffer <m/number/</tag> (Linux) | |
4418 | Set kernel receive buffer size (in bytes) for the netlink socket. The default | |
4419 | value is OS-dependent (from the <file>/proc/sys/net/core/rmem_default</file> | |
4420 | file), If you get some "Kernel dropped some netlink message ..." warnings, | |
4421 | you may increase this value. | |
4422 | </descrip> | |
4423 | ||
4424 | <sect1>Attributes | |
4425 | <label id="krt-attr"> | |
4426 | ||
4427 | <p>The Kernel protocol defines several attributes. These attributes are | |
4428 | translated to appropriate system (and OS-specific) route attributes. We support | |
4429 | these attributes: | |
4430 | ||
4431 | <descrip> | |
4432 | <tag><label id="rta-krt-source">int krt_source</tag> | |
4433 | The original source of the imported kernel route. The value is | |
4434 | system-dependent. On Linux, it is a value of the protocol field of the | |
4435 | route. See /etc/iproute2/rt_protos for common values. On BSD, it is | |
4436 | based on STATIC and PROTOx flags. The attribute is read-only. | |
4437 | ||
4438 | <tag><label id="rta-krt-metric">int krt_metric</tag> (Linux) | |
4439 | The kernel metric of the route. When multiple same routes are in a | |
4440 | kernel routing table, the Linux kernel chooses one with lower metric. | |
4441 | Note that preferred way to set kernel metric is to use protocol option | |
4442 | <cf/metric/, unless per-route metric values are needed. | |
4443 | ||
4444 | <tag><label id="rta-krt-prefsrc">ip krt_prefsrc</tag> (Linux) | |
4445 | The preferred source address. Used in source address selection for | |
4446 | outgoing packets. Has to be one of the IP addresses of the router. | |
4447 | ||
4448 | <tag><label id="rta-krt-realm">int krt_realm</tag> (Linux) | |
4449 | The realm of the route. Can be used for traffic classification. | |
4450 | ||
4451 | <tag><label id="rta-krt-scope">int krt_scope</tag> (Linux IPv4) | |
4452 | The scope of the route. Valid values are 0-254, although Linux kernel | |
4453 | may reject some values depending on route type and nexthop. It is | |
4454 | supposed to represent `indirectness' of the route, where nexthops of | |
4455 | routes are resolved through routes with a higher scope, but in current | |
4456 | kernels anything below <it/link/ (253) is treated as <it/global/ (0). | |
4457 | When not present, global scope is implied for all routes except device | |
4458 | routes, where link scope is used by default. | |
4459 | </descrip> | |
4460 | ||
4461 | <p>In Linux, there is also a plenty of obscure route attributes mostly focused | |
4462 | on tuning TCP performance of local connections. BIRD supports most of these | |
4463 | attributes, see Linux or iproute2 documentation for their meaning. Attributes | |
4464 | <cf/krt_lock_*/ and <cf/krt_feature_*/ have type bool, <cf/krt_congctl/ has type | |
4465 | string, others have type int. Supported attributes are: | |
4466 | ||
4467 | <cf/krt_mtu/, <cf/krt_lock_mtu/, <cf/krt_window/, <cf/krt_lock_window/, | |
4468 | <cf/krt_rtt/, <cf/krt_lock_rtt/, <cf/krt_rttvar/, <cf/krt_lock_rttvar/, | |
4469 | <cf/krt_ssthresh/, <cf/krt_lock_ssthresh/, <cf/krt_cwnd/, <cf/krt_lock_cwnd/, | |
4470 | <cf/krt_advmss/, <cf/krt_lock_advmss/, <cf/krt_reordering/, <cf/krt_lock_reordering/, | |
4471 | <cf/krt_hoplimit/, <cf/krt_lock_hoplimit/, <cf/krt_rto_min/, <cf/krt_lock_rto_min/, | |
4472 | <cf/krt_initcwnd/, <cf/krt_lock_initcwnd/, <cf/krt_initrwnd/, <cf/krt_lock_initrwnd/, | |
4473 | <cf/krt_quickack/, <cf/krt_lock_quickack/, <cf/krt_congctl/, <cf/krt_lock_congctl/, | |
4474 | <cf/krt_fastopen_no_cookie/, <cf/krt_lock_fastopen_no_cookie/, | |
4475 | <cf/krt_feature_ecn/, <cf/krt_feature_allfrag/ | |
4476 | ||
4477 | <sect1>Example | |
4478 | <label id="krt-exam"> | |
4479 | ||
4480 | <p>A simple configuration can look this way: | |
4481 | ||
4482 | <p><code> | |
4483 | protocol kernel { | |
4484 | export all; | |
4485 | } | |
4486 | </code> | |
4487 | ||
4488 | <p>Or for a system with two routing tables: | |
4489 | ||
4490 | <p><code> | |
4491 | protocol kernel { # Primary routing table | |
4492 | learn; # Learn alien routes from the kernel | |
4493 | persist; # Do not remove routes on bird shutdown | |
4494 | scan time 10; # Scan kernel routing table every 10 seconds | |
4495 | ipv4 { | |
4496 | import all; | |
4497 | export all; | |
4498 | }; | |
4499 | } | |
4500 | ||
4501 | protocol kernel { # Secondary routing table | |
4502 | kernel table 100; | |
4503 | ipv4 { | |
4504 | table auxtable; | |
4505 | export all; | |
4506 | }; | |
4507 | } | |
4508 | </code> | |
4509 | ||
4510 | ||
4511 | <sect>L3VPN | |
4512 | <label id="l3vpn"> | |
4513 | ||
4514 | <sect1>Introduction | |
4515 | <label id="l3vpn-intro"> | |
4516 | ||
4517 | <p>The L3VPN protocol serves as a translator between IP routes and VPN | |
4518 | routes. It is a component for BGP/MPLS IP VPNs (<rfc id="4364">) and implements | |
4519 | policies defined there. In import direction (VPN -> IP), VPN routes matching | |
4520 | import target specification are stripped of route distinguisher and MPLS labels | |
4521 | and announced as IP routes, In export direction (IP -> VPN), IP routes are | |
4522 | expanded with specific route distinguisher, export target communities and MPLS | |
4523 | label and announced as labeled VPN routes. Unlike the Pipe protocol, the L3VPN | |
4524 | protocol propagates just the best route for each network. | |
4525 | ||
4526 | <p>In BGP/MPLS IP VPNs, route distribution is controlled by Route Targets (RT). | |
4527 | VRFs are associated with one or more RTs. Routes are also associated with one or | |
4528 | more RTs, which are encoded as route target extended communities | |
4529 | in <ref id="rta-bgp-ext-community" name="bgp_ext_community">. A route is then | |
4530 | imported into each VRF that shares an associated Route Target. The L3VPN | |
4531 | protocol implements this mechanism through mandatory <cf/import target/ and | |
4532 | <cf/export target/ protocol options. | |
4533 | ||
4534 | <sect1>Configuration | |
4535 | <label id="l3vpn-config"> | |
4536 | ||
4537 | <p>L3VPN configuration consists of a few mandatory options and multiple channel | |
4538 | definitions. For convenience, the default export filter in L3VPN channels is | |
4539 | <cf/all/, as the primary way to control import and export of routes is through | |
4540 | protocol options <cf/import target/ and <cf/export target/. If custom filters | |
4541 | are used, note that the export filter of the input channel is applied before | |
4542 | the route translation, while the import filter of the output channel is applied | |
4543 | after that. | |
4544 | ||
4545 | <p>In contrast to the Pipe protocol, the L3VPN protocol can handle both IPv4 and | |
4546 | IPv6 routes in one instance, also both IP side and VPN side are represented as | |
4547 | separate channels, although that may change in the future. The L3VPN is always | |
4548 | MPLS-aware protocol, therefore a MPLS channel is mandatory. Altogether, L3VPN | |
4549 | could have up to 5 channels: <cf/ipv4/, <cf/ipv6/, <cf/vpn4/, <cf/vpn6/, and | |
4550 | <cf/mpls/. | |
4551 | ||
4552 | <p><descrip> | |
4553 | <tag><label id="l3vpn-route-distinguisher">route distinguisher <m/rd/</tag> | |
4554 | The route distinguisher that is attached to routes in the export | |
4555 | direction. Mandatory. | |
4556 | ||
4557 | <tag><label id="l3vpn-rd">rd <m/rd/</tag> | |
4558 | A shorthand for the option <cf/route distinguisher/. | |
4559 | ||
4560 | <tag><label id="l3vpn-import-target">import target <m/ec/|<m/ec-set/</tag> | |
4561 | Route target extended communities specifying which routes should be | |
4562 | imported. Either one community or a set. A route is imported if there is | |
4563 | non-empty intersection between extended communities of the route and the | |
4564 | import target of the L3VPN protocol. Mandatory. | |
4565 | ||
4566 | <tag><label id="l3vpn-export-target">export target <m/ec/|<m/ec-set/</tag> | |
4567 | Route target extended communities that are attached to the route in the | |
4568 | export direction. Either one community or a set. Other route target | |
4569 | extended communities are removed. Mandatory. | |
4570 | ||
4571 | <tag><label id="l3vpn-route-target">route target <m/ec/|<m/ec-set/</tag> | |
4572 | A shorthand for both <cf/import target/ and <cf/export target/. | |
4573 | </descrip> | |
4574 | ||
4575 | <sect1>Attributes | |
4576 | <label id="l3vpn-attr"> | |
4577 | ||
4578 | <p>The L3VPN protocol does not define any route attributes. | |
4579 | ||
4580 | <sect1>Example | |
4581 | <label id="l3vpn-exam"> | |
4582 | ||
4583 | <p>Here is an example of L3VPN setup with one VPN and BGP uplink. IP routes | |
4584 | learned from a customer in the VPN are stored in <cf/vrf0vX/ tables, which are | |
4585 | mapped to kernel VRF vrf0. Routes can also be exchanged through BGP with | |
4586 | different sites hosting that VPN. Forwarding of VPN traffic through the network | |
4587 | is handled by MPLS. | |
4588 | ||
4589 | <p>Omitted from the example are some routing protocol to exchange routes with | |
4590 | the customer and some sort of MPLS-aware IGP to resolve next hops for BGP VPN | |
4591 | routes. | |
4592 | ||
4593 | <code> | |
4594 | # MPLS basics | |
4595 | mpls domain mdom; | |
4596 | mpls table mtab; | |
4597 | ||
4598 | protocol kernel krt_mpls { | |
4599 | mpls { table mtab; export all; }; | |
4600 | } | |
4601 | ||
4602 | vpn4 table vpntab4; | |
4603 | vpn6 table vpntab6; | |
4604 | ||
4605 | # Exchange VPN routes through BGP | |
4606 | protocol bgp { | |
4607 | vpn4 { table vpntab4; import all; export all; }; | |
4608 | vpn6 { table vpntab6; import all; export all; }; | |
4609 | mpls { label policy aggregate; }; | |
4610 | local 10.0.0.1 as 10; | |
4611 | neighbor 10.0.0.2 as 10; | |
4612 | } | |
4613 | ||
4614 | # VRF 0 | |
4615 | ipv4 table vrf0v4; | |
4616 | ipv6 table vrf0v6; | |
4617 | ||
4618 | protocol kernel kernel0v4 { | |
4619 | vrf "vrf0"; | |
4620 | ipv4 { table vrf0v4; export all; }; | |
4621 | kernel table 100; | |
4622 | } | |
4623 | ||
4624 | protocol kernel kernel0v6 { | |
4625 | vrf "vrf0"; | |
4626 | ipv6 { table vrf0v6; export all; }; | |
4627 | kernel table 100; | |
4628 | } | |
4629 | ||
4630 | protocol l3vpn l3vpn0 { | |
4631 | vrf "vrf0"; | |
4632 | ipv4 { table vrf0v4; }; | |
4633 | ipv6 { table vrf0v6; }; | |
4634 | vpn4 { table vpntab4; }; | |
4635 | vpn6 { table vpntab6; }; | |
4636 | mpls { label policy vrf; }; | |
4637 | ||
4638 | rd 10:12; | |
4639 | import target [(rt, 10, 32..40)]; | |
4640 | export target [(rt, 10, 30), (rt, 10, 31)]; | |
4641 | } | |
4642 | </code> | |
4643 | ||
4644 | ||
4645 | <sect>MRT | |
4646 | <label id="mrt"> | |
4647 | ||
4648 | <sect1>Introduction | |
4649 | <label id="mrt-intro"> | |
4650 | ||
4651 | <p>The MRT protocol is a component responsible for handling the Multi-Threaded | |
4652 | Routing Toolkit (MRT) routing information export format, which is mainly used | |
4653 | for collecting and analyzing of routing information from BGP routers. The MRT | |
4654 | protocol can be configured to do periodic dumps of routing tables, created MRT | |
4655 | files can be analyzed later by other tools. Independent MRT table dumps can also | |
4656 | be requested from BIRD client. There is also a feature to save incoming BGP | |
4657 | messages in MRT files, but it is controlled by <ref id="proto-mrtdump" | |
4658 | name="mrtdump"> options independently of MRT protocol, although that might | |
4659 | change in the future. | |
4660 | ||
4661 | BIRD implements the main MRT format specification as defined in <rfc id="6396"> | |
4662 | and the ADD_PATH extension (<rfc id="8050">). | |
4663 | ||
4664 | <sect1>Configuration | |
4665 | <label id="mrt-config"> | |
4666 | ||
4667 | <p>MRT configuration consists of several statements describing routing table | |
4668 | dumps. Multiple independent periodic dumps can be done as multiple MRT protocol | |
4669 | instances. The MRT protocol does not use channels. There are two mandatory | |
4670 | statements: <cf/filename/ and <cf/period/. | |
4671 | ||
4672 | The behavior can be modified by following configuration parameters: | |
4673 | ||
4674 | <descrip> | |
4675 | <tag><label id="mrt-table">table <m/name/ | "<m/pattern/"</tag> | |
4676 | Specify a routing table (or a set of routing tables described by a | |
4677 | wildcard pattern) that are to be dumped by the MRT protocol instance. | |
4678 | Default: the master table. | |
4679 | ||
4680 | <tag><label id="mrt-filter">filter { <m/filter commands/ }</tag> | |
4681 | The MRT protocol allows to specify a filter that is applied to routes as | |
4682 | they are dumped. Rejected routes are ignored and not saved to the MRT | |
4683 | dump file. Default: no filter. | |
4684 | ||
4685 | <tag><label id="mrt-where">where <m/filter expression/</tag> | |
4686 | An alternative way to specify a filter for the MRT protocol. | |
4687 | ||
4688 | <tag><label id="mrt-filename">filename "<m/filename/"</tag> | |
4689 | Specify a filename for MRT dump files. The filename may contain time | |
4690 | format sequences with <it/strftime(3)/ notation (see <it/man strftime/ | |
4691 | for details), there is also a sequence "%N" that is expanded to the name | |
4692 | of dumped table. Therefore, each periodic dump of each table can be | |
4693 | saved to a different file. Mandatory, see example below. | |
4694 | ||
4695 | <tag><label id="mrt-period">period <m/number/</tag> | |
4696 | Specify the time interval (in seconds) between periodic dumps. | |
4697 | Mandatory. | |
4698 | ||
4699 | <tag><label id="mrt-always-add-path">always add path <m/switch/</tag> | |
4700 | The MRT format uses special records (specified in <rfc id="8050">) for | |
4701 | routes received using BGP ADD_PATH extension to keep Path ID, while | |
4702 | other routes use regular records. This has advantage of better | |
4703 | compatibility with tools that do not know special records, but it loses | |
4704 | information about which route is the best route. When this option is | |
4705 | enabled, both ADD_PATH and non-ADD_PATH routes are stored in ADD_PATH | |
4706 | records and order of routes for network is preserved. Default: disabled. | |
4707 | </descrip> | |
4708 | ||
4709 | <sect1>Example | |
4710 | <label id="mrt-exam"> | |
4711 | ||
4712 | <p><code> | |
4713 | protocol mrt { | |
4714 | table "tab*"; | |
4715 | where source = RTS_BGP; | |
4716 | filename "/var/log/bird/%N_%F_%T.mrt"; | |
4717 | period 300; | |
4718 | } | |
4719 | </code> | |
4720 | ||
4721 | ||
4722 | <sect>OSPF | |
4723 | <label id="ospf"> | |
4724 | ||
4725 | <sect1>Introduction | |
4726 | <label id="ospf-intro"> | |
4727 | ||
4728 | <p>Open Shortest Path First (OSPF) is a quite complex interior gateway | |
4729 | protocol. The current IPv4 version (OSPFv2) is defined in <rfc id="2328"> and | |
4730 | the current IPv6 version (OSPFv3) is defined in <rfc id="5340"> It's a link | |
4731 | state (a.k.a. shortest path first) protocol -- each router maintains a database | |
4732 | describing the autonomous system's topology. Each participating router has an | |
4733 | identical copy of the database and all routers run the same algorithm | |
4734 | calculating a shortest path tree with themselves as a root. OSPF chooses the | |
4735 | least cost path as the best path. | |
4736 | ||
4737 | <p>In OSPF, the autonomous system can be split to several areas in order to | |
4738 | reduce the amount of resources consumed for exchanging the routing information | |
4739 | and to protect the other areas from incorrect routing data. Topology of the area | |
4740 | is hidden to the rest of the autonomous system. | |
4741 | ||
4742 | <p>Another very important feature of OSPF is that it can keep routing information | |
4743 | from other protocols (like Static or BGP) in its link state database as external | |
4744 | routes. Each external route can be tagged by the advertising router, making it | |
4745 | possible to pass additional information between routers on the boundary of the | |
4746 | autonomous system. | |
4747 | ||
4748 | <p>OSPF quickly detects topological changes in the autonomous system (such as | |
4749 | router interface failures) and calculates new loop-free routes after a short | |
4750 | period of convergence. Only a minimal amount of routing traffic is involved. | |
4751 | ||
4752 | <p>Each router participating in OSPF routing periodically sends Hello messages | |
4753 | to all its interfaces. This allows neighbors to be discovered dynamically. Then | |
4754 | the neighbors exchange theirs parts of the link state database and keep it | |
4755 | identical by flooding updates. The flooding process is reliable and ensures that | |
4756 | each router detects all changes. | |
4757 | ||
4758 | <sect1>Configuration | |
4759 | <label id="ospf-config"> | |
4760 | ||
4761 | <p>First, the desired OSPF version can be specified by using <cf/ospf v2/ or | |
4762 | <cf/ospf v3/ as a protocol type. By default, OSPFv2 is used. In the main part of | |
4763 | configuration, there can be multiple definitions of OSPF areas, each with a | |
4764 | different id. These definitions includes many other switches and multiple | |
4765 | definitions of interfaces. Definition of interface may contain many switches and | |
4766 | constant definitions and list of neighbors on nonbroadcast networks. | |
4767 | ||
4768 | <p>OSPFv2 needs one IPv4 channel. OSPFv3 needs either one IPv6 channel, or one | |
4769 | IPv4 channel (<rfc id="5838">). Therefore, it is possible to use OSPFv3 for both | |
4770 | IPv4 and Pv6 routing, but it is necessary to have two protocol instances anyway. | |
4771 | If no channel is configured, appropriate channel is defined with default | |
4772 | parameters. | |
4773 | ||
4774 | <code> | |
4775 | protocol ospf [v2|v3] <name> { | |
4776 | rfc1583compat <switch>; | |
4777 | rfc5838 <switch>; | |
4778 | instance id <number>; | |
4779 | stub router <switch>; | |
4780 | tick <number>; | |
4781 | ecmp <switch> [limit <number>]; | |
4782 | merge external <switch>; | |
4783 | graceful restart <switch>|aware; | |
4784 | graceful restart time <number>; | |
4785 | area <id> { | |
4786 | stub; | |
4787 | nssa; | |
4788 | summary <switch>; | |
4789 | default nssa <switch>; | |
4790 | default cost <number>; | |
4791 | default cost2 <number>; | |
4792 | translator <switch>; | |
4793 | translator stability <number>; | |
4794 | ||
4795 | networks { | |
4796 | <prefix>; | |
4797 | <prefix> hidden; | |
4798 | }; | |
4799 | external { | |
4800 | <prefix>; | |
4801 | <prefix> hidden; | |
4802 | <prefix> tag <number>; | |
4803 | }; | |
4804 | stubnet <prefix>; | |
4805 | stubnet <prefix> { | |
4806 | hidden <switch>; | |
4807 | summary <switch>; | |
4808 | cost <number>; | |
4809 | }; | |
4810 | interface <interface pattern> [instance <number>] { | |
4811 | cost <number>; | |
4812 | stub <switch>; | |
4813 | hello <number>; | |
4814 | poll <number>; | |
4815 | retransmit <number>; | |
4816 | priority <number>; | |
4817 | wait <number>; | |
4818 | dead count <number>; | |
4819 | dead <number>; | |
4820 | secondary <switch>; | |
4821 | rx buffer [normal|large|<number>]; | |
4822 | tx length <number>; | |
4823 | type [broadcast|bcast|pointopoint|ptp| | |
4824 | nonbroadcast|nbma|pointomultipoint|ptmp]; | |
4825 | link lsa suppression <switch>; | |
4826 | strict nonbroadcast <switch>; | |
4827 | real broadcast <switch>; | |
4828 | ptp netmask <switch>; | |
4829 | ptp address <switch>; | |
4830 | check link <switch>; | |
4831 | bfd <switch>; | |
4832 | ecmp weight <number>; | |
4833 | ttl security [<switch>; | tx only] | |
4834 | tx class|dscp <number>; | |
4835 | tx priority <number>; | |
4836 | authentication none|simple|cryptographic; | |
4837 | password "<text>"; | |
4838 | password "<text>" { | |
4839 | id <number>; | |
4840 | generate from "<date>"; | |
4841 | generate to "<date>"; | |
4842 | accept from "<date>"; | |
4843 | accept to "<date>"; | |
4844 | from "<date>"; | |
4845 | to "<date>"; | |
4846 | algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 ); | |
4847 | }; | |
4848 | neighbors { | |
4849 | <ip>; | |
4850 | <ip> eligible; | |
4851 | }; | |
4852 | }; | |
4853 | virtual link <id> [instance <number>] { | |
4854 | hello <number>; | |
4855 | retransmit <number>; | |
4856 | wait <number>; | |
4857 | dead count <number>; | |
4858 | dead <number>; | |
4859 | authentication none|simple|cryptographic; | |
4860 | password "<text>"; | |
4861 | password "<text>" { | |
4862 | id <number>; | |
4863 | generate from "<date>"; | |
4864 | generate to "<date>"; | |
4865 | accept from "<date>"; | |
4866 | accept to "<date>"; | |
4867 | from "<date>"; | |
4868 | to "<date>"; | |
4869 | algorithm ( keyed md5 | keyed sha1 | hmac sha1 | hmac sha256 | hmac sha384 | hmac sha512 ); | |
4870 | }; | |
4871 | }; | |
4872 | }; | |
4873 | } | |
4874 | </code> | |
4875 | ||
4876 | <descrip> | |
4877 | <tag><label id="ospf-rfc1583compat">rfc1583compat <m>switch</m></tag> | |
4878 | This option controls compatibility of routing table calculation with | |
4879 | <rfc id="1583">. Default value is no. | |
4880 | ||
4881 | <tag><label id="ospf-rfc5838">rfc5838 <m/switch/</tag> | |
4882 | Basic OSPFv3 is limited to IPv6 unicast routing. The <rfc id="5838"> | |
4883 | extension defines support for more address families (IPv4, IPv6, both | |
4884 | unicast and multicast). The extension is enabled by default, but can be | |
4885 | disabled if necessary, as it restricts the range of available instance | |
4886 | IDs. Default value is yes. | |
4887 | ||
4888 | <tag><label id="ospf-instance-id">instance id <m/number/</tag> | |
4889 | When multiple OSPF protocol instances are active on the same links, they | |
4890 | should use different instance IDs to distinguish their packets. Although | |
4891 | it could be done on per-interface basis, it is often preferred to set | |
4892 | one instance ID to whole OSPF domain/topology (e.g., when multiple | |
4893 | instances are used to represent separate logical topologies on the same | |
4894 | physical network). This option specifies the instance ID for all | |
4895 | interfaces of the OSPF instance, but can be overridden by | |
4896 | <cf/interface/ option. Default value is 0 unless OSPFv3-AF extended | |
4897 | address families are used, see <rfc id="5838"> for that case. | |
4898 | ||
4899 | <tag><label id="ospf-stub-router">stub router <m>switch</m></tag> | |
4900 | This option configures the router to be a stub router, i.e., a router | |
4901 | that participates in the OSPF topology but does not allow transit | |
4902 | traffic. In OSPFv2, this is implemented by advertising maximum metric | |
4903 | for outgoing links. In OSPFv3, the stub router behavior is announced by | |
4904 | clearing the R-bit in the router LSA. See <rfc id="6987"> for details. | |
4905 | Default value is no. | |
4906 | ||
4907 | <tag><label id="ospf-tick">tick <m>number</m></tag> | |
4908 | The routing table calculation and clean-up of areas' databases is not | |
4909 | performed when a single link state change arrives. To lower the CPU | |
4910 | utilization, it's processed later at periodical intervals of <m/number/ | |
4911 | seconds. The default value is 1. | |
4912 | ||
4913 | <tag><label id="ospf-ecmp">ecmp <m>switch</m> [limit <m>number</m>]</tag> | |
4914 | This option specifies whether OSPF is allowed to generate ECMP | |
4915 | (equal-cost multipath) routes. Such routes are used when there are | |
4916 | several directions to the destination, each with the same (computed) | |
4917 | cost. This option also allows to specify a limit on maximum number of | |
4918 | nexthops in one route. By default, ECMP is enabled if supported by | |
4919 | Kernel. Default value of the limit is 16. | |
4920 | ||
4921 | <tag><label id="ospf-merge-external">merge external <m>switch</m></tag> | |
4922 | This option specifies whether OSPF should merge external routes from | |
4923 | different routers/LSAs for the same destination. When enabled together | |
4924 | with <cf/ecmp/, equal-cost external routes will be combined to multipath | |
4925 | routes in the same way as regular routes. When disabled, external routes | |
4926 | from different LSAs are treated as separate even if they represents the | |
4927 | same destination. Default value is no. | |
4928 | ||
4929 | <tag><label id="ospf-graceful-restart">graceful restart <m/switch/|aware</tag> | |
4930 | When an OSPF instance is restarted, neighbors break adjacencies and | |
4931 | recalculate their routing tables, which disrupts packet forwarding even | |
4932 | when the forwarding plane of the restarting router remains intact. | |
4933 | <rfc id="3623"> specifies a graceful restart mechanism to alleviate this | |
4934 | issue. For OSPF graceful restart, restarting router originates | |
4935 | Grace-LSAs, announcing intent to do graceful restart. Neighbors | |
4936 | receiving these LSAs enter helper mode, in which they ignore breakdown | |
4937 | of adjacencies, behave as if nothing is happening and keep old routes. | |
4938 | When adjacencies are reestablished, the restarting router flushes | |
4939 | Grace-LSAs and graceful restart is ended. | |
4940 | ||
4941 | This option controls the graceful restart mechanism. It has three | |
4942 | states: Disabled, when no support is provided. Aware, when graceful | |
4943 | restart helper mode is supported, but no local graceful restart is | |
4944 | allowed (i.e. helper-only role). Enabled, when the full graceful restart | |
4945 | support is provided (i.e. both restarting and helper role). Note that | |
4946 | proper support for local graceful restart requires also configuration of | |
4947 | other protocols. Default: aware. | |
4948 | ||
4949 | <tag><label id="ospf-graceful-restart-time">graceful restart time <m/number/</tag> | |
4950 | The restart time is announced in the Grace-LSA and specifies how long | |
4951 | neighbors should wait for proper end of the graceful restart before | |
4952 | exiting helper mode prematurely. Default: 120 seconds. | |
4953 | ||
4954 | <tag><label id="ospf-area">area <m>id</m></tag> | |
4955 | This defines an OSPF area with given area ID (an integer or an IPv4 | |
4956 | address, similarly to a router ID). The most important area is the | |
4957 | backbone (ID 0) to which every other area must be connected. | |
4958 | ||
4959 | <tag><label id="ospf-stub">stub</tag> | |
4960 | This option configures the area to be a stub area. External routes are | |
4961 | not flooded into stub areas. Also summary LSAs can be limited in stub | |
4962 | areas (see option <cf/summary/). By default, the area is not a stub | |
4963 | area. | |
4964 | ||
4965 | <tag><label id="ospf-nssa">nssa</tag> | |
4966 | This option configures the area to be a NSSA (Not-So-Stubby Area). NSSA | |
4967 | is a variant of a stub area which allows a limited way of external route | |
4968 | propagation. Global external routes are not propagated into a NSSA, but | |
4969 | an external route can be imported into NSSA as a (area-wide) NSSA-LSA | |
4970 | (and possibly translated and/or aggregated on area boundary). By | |
4971 | default, the area is not NSSA. | |
4972 | ||
4973 | <tag><label id="ospf-summary">summary <m>switch</m></tag> | |
4974 | This option controls propagation of summary LSAs into stub or NSSA | |
4975 | areas. If enabled, summary LSAs are propagated as usual, otherwise just | |
4976 | the default summary route (0.0.0.0/0) is propagated (this is sometimes | |
4977 | called totally stubby area). If a stub area has more area boundary | |
4978 | routers, propagating summary LSAs could lead to more efficient routing | |
4979 | at the cost of larger link state database. Default value is no. | |
4980 | ||
4981 | <tag><label id="ospf-default-nssa">default nssa <m>switch</m></tag> | |
4982 | When <cf/summary/ option is enabled, default summary route is no longer | |
4983 | propagated to the NSSA. In that case, this option allows to originate | |
4984 | default route as NSSA-LSA to the NSSA. Default value is no. | |
4985 | ||
4986 | <tag><label id="ospf-default-cost">default cost <m>number</m></tag> | |
4987 | This option controls the cost of a default route propagated to stub and | |
4988 | NSSA areas. Default value is 1000. | |
4989 | ||
4990 | <tag><label id="ospf-default-cost2">default cost2 <m>number</m></tag> | |
4991 | When a default route is originated as NSSA-LSA, its cost can use either | |
4992 | type 1 or type 2 metric. This option allows to specify the cost of a | |
4993 | default route in type 2 metric. By default, type 1 metric (option | |
4994 | <cf/default cost/) is used. | |
4995 | ||
4996 | <tag><label id="ospf-translator">translator <m>switch</m></tag> | |
4997 | This option controls translation of NSSA-LSAs into external LSAs. By | |
4998 | default, one translator per NSSA is automatically elected from area | |
4999 | boundary routers. If enabled, this area boundary router would | |
5000 | unconditionally translate all NSSA-LSAs regardless of translator | |
5001 | election. Default value is no. | |
5002 | ||
5003 | <tag><label id="ospf-translator-stability">translator stability <m>number</m></tag> | |
5004 | This option controls the translator stability interval (in seconds). | |
5005 | When the new translator is elected, the old one keeps translating until | |
5006 | the interval is over. Default value is 40. | |
5007 | ||
5008 | <tag><label id="ospf-networks">networks { <m/set/ }</tag> | |
5009 | Definition of area IP ranges. This is used in summary LSA origination. | |
5010 | Hidden networks are not propagated into other areas. | |
5011 | ||
5012 | <tag><label id="ospf-external">external { <m/set/ }</tag> | |
5013 | Definition of external area IP ranges for NSSAs. This is used for | |
5014 | NSSA-LSA translation. Hidden networks are not translated into external | |
5015 | LSAs. Networks can have configured route tag. | |
5016 | ||
5017 | <tag><label id="ospf-stubnet">stubnet <m/prefix/ { <m/options/ }</tag> | |
5018 | Stub networks are networks that are not transit networks between OSPF | |
5019 | routers. They are also propagated through an OSPF area as a part of a | |
5020 | link state database. By default, BIRD generates a stub network record | |
5021 | for each primary network address on each OSPF interface that does not | |
5022 | have any OSPF neighbors, and also for each non-primary network address | |
5023 | on each OSPF interface. This option allows to alter a set of stub | |
5024 | networks propagated by this router. | |
5025 | ||
5026 | Each instance of this option adds a stub network with given network | |
5027 | prefix to the set of propagated stub network, unless option <cf/hidden/ | |
5028 | is used. It also suppresses default stub networks for given network | |
5029 | prefix. When option <cf/summary/ is used, also default stub networks | |
5030 | that are subnetworks of given stub network are suppressed. This might be | |
5031 | used, for example, to aggregate generated stub networks. | |
5032 | ||
5033 | <tag><label id="ospf-iface">interface <m>pattern</m> [instance <m/number/]</tag> | |
5034 | Defines that the specified interfaces belong to the area being defined. | |
5035 | See <ref id="proto-iface" name="interface"> common option for detailed | |
5036 | description. In OSPFv2, extended interface clauses are used, because | |
5037 | each network prefix is handled as a separate virtual interface. | |
5038 | ||
5039 | You can specify alternative instance ID for the interface definition, | |
5040 | therefore it is possible to have several instances of that interface | |
5041 | with different options or even in different areas. For OSPFv2, instance | |
5042 | ID support is an extension (<rfc id="6549">) and is supposed to be set | |
5043 | per-protocol. For OSPFv3, it is an integral feature. | |
5044 | ||
5045 | <tag><label id="ospf-virtual-link">virtual link <m>id</m> [instance <m/number/]</tag> | |
5046 | Virtual link to router with the router id. Virtual link acts as a | |
5047 | point-to-point interface belonging to backbone. The actual area is used | |
5048 | as a transport area. This item cannot be in the backbone. Like with | |
5049 | <cf/interface/ option, you could also use several virtual links to one | |
5050 | destination with different instance IDs. | |
5051 | ||
5052 | <tag><label id="ospf-cost">cost <m>number</m></tag> | |
5053 | Specifies output cost (metric) of an interface. Default value is 10. | |
5054 | ||
5055 | <tag><label id="ospf-stub-iface">stub <m>switch</m></tag> | |
5056 | If set to interface it does not listen to any packet and does not send | |
5057 | any hello. Default value is no. | |
5058 | ||
5059 | <tag><label id="ospf-hello">hello <m>number</m></tag> | |
5060 | Specifies interval in seconds between sending of Hello messages. Beware, | |
5061 | all routers on the same network need to have the same hello interval. | |
5062 | Default value is 10. | |
5063 | ||
5064 | <tag><label id="ospf-poll">poll <m>number</m></tag> | |
5065 | Specifies interval in seconds between sending of Hello messages for some | |
5066 | neighbors on NBMA network. Default value is 20. | |
5067 | ||
5068 | <tag><label id="ospf-retransmit">retransmit <m>number</m></tag> | |
5069 | Specifies interval in seconds between retransmissions of unacknowledged | |
5070 | updates. Default value is 5. | |
5071 | ||
5072 | <tag><label id="ospf-transmit-delay">transmit delay <m>number</m></tag> | |
5073 | Specifies estimated transmission delay of link state updates send over | |
5074 | the interface. The value is added to LSA age of LSAs propagated through | |
5075 | it. Default value is 1. | |
5076 | ||
5077 | <tag><label id="ospf-priority">priority <m>number</m></tag> | |
5078 | On every multiple access network (e.g., the Ethernet) Designated Router | |
5079 | and Backup Designated router are elected. These routers have some special | |
5080 | functions in the flooding process. Higher priority increases preferences | |
5081 | in this election. Routers with priority 0 are not eligible. Default | |
5082 | value is 1. | |
5083 | ||
5084 | <tag><label id="ospf-wait">wait <m>number</m></tag> | |
5085 | After start, router waits for the specified number of seconds between | |
5086 | starting election and building adjacency. Default value is 4*<m/hello/. | |
5087 | ||
5088 | <tag><label id="ospf-dead-count">dead count <m>number</m></tag> | |
5089 | When the router does not receive any messages from a neighbor in | |
5090 | <m/dead count/*<m/hello/ seconds, it will consider the neighbor down. | |
5091 | ||
5092 | <tag><label id="ospf-dead">dead <m>number</m></tag> | |
5093 | When the router does not receive any messages from a neighbor in | |
5094 | <m/dead/ seconds, it will consider the neighbor down. If both directives | |
5095 | <cf/dead count/ and <cf/dead/ are used, <cf/dead/ has precedence. | |
5096 | ||
5097 | <tag><label id="ospf-rx-buffer">rx buffer <m>number</m></tag> | |
5098 | This option allows to specify the size of buffers used for packet | |
5099 | processing. The buffer size should be bigger than maximal size of any | |
5100 | packets. By default, buffers are dynamically resized as needed, but a | |
5101 | fixed value could be specified. Value <cf/large/ means maximal allowed | |
5102 | packet size - 65535. | |
5103 | ||
5104 | <tag><label id="ospf-tx-length">tx length <m>number</m></tag> | |
5105 | Transmitted OSPF messages that contain large amount of information are | |
5106 | segmented to separate OSPF packets to avoid IP fragmentation. This | |
5107 | option specifies the soft ceiling for the length of generated OSPF | |
5108 | packets. Default value is the MTU of the network interface. Note that | |
5109 | larger OSPF packets may still be generated if underlying OSPF messages | |
5110 | cannot be splitted (e.g. when one large LSA is propagated). | |
5111 | ||
5112 | <tag><label id="ospf-type-bcast">type broadcast|bcast</tag> | |
5113 | BIRD detects a type of a connected network automatically, but sometimes | |
5114 | it's convenient to force use of a different type manually. On broadcast | |
5115 | networks (like ethernet), flooding and Hello messages are sent using | |
5116 | multicasts (a single packet for all the neighbors). A designated router | |
5117 | is elected and it is responsible for synchronizing the link-state | |
5118 | databases and originating network LSAs. This network type cannot be used | |
5119 | on physically NBMA networks and on unnumbered networks (networks without | |
5120 | proper IP prefix). | |
5121 | ||
5122 | <tag><label id="ospf-type-ptp">type pointopoint|ptp</tag> | |
5123 | Point-to-point networks connect just 2 routers together. No election is | |
5124 | performed and no network LSA is originated, which makes it simpler and | |
5125 | faster to establish. This network type is useful not only for physically | |
5126 | PtP ifaces (like PPP or tunnels), but also for broadcast networks used | |
5127 | as PtP links. This network type cannot be used on physically NBMA | |
5128 | networks. | |
5129 | ||
5130 | <tag><label id="ospf-type-nbma">type nonbroadcast|nbma</tag> | |
5131 | On NBMA networks, the packets are sent to each neighbor separately | |
5132 | because of lack of multicast capabilities. Like on broadcast networks, | |
5133 | a designated router is elected, which plays a central role in propagation | |
5134 | of LSAs. This network type cannot be used on unnumbered networks. | |
5135 | ||
5136 | <tag><label id="ospf-type-ptmp">type pointomultipoint|ptmp</tag> | |
5137 | This is another network type designed to handle NBMA networks. In this | |
5138 | case the NBMA network is treated as a collection of PtP links. This is | |
5139 | useful if not every pair of routers on the NBMA network has direct | |
5140 | communication, or if the NBMA network is used as an (possibly | |
5141 | unnumbered) PtP link. | |
5142 | ||
5143 | <tag><label id="ospf-link-lsa-suppression">link lsa suppression <m/switch/</tag> | |
5144 | In OSPFv3, link LSAs are generated for each link, announcing link-local | |
5145 | IPv6 address of the router to its local neighbors. These are useless on | |
5146 | PtP or PtMP networks and this option allows to suppress the link LSA | |
5147 | origination for such interfaces. The option is ignored on other than PtP | |
5148 | or PtMP interfaces. Default value is no. | |
5149 | ||
5150 | <tag><label id="ospf-strict-nonbroadcast">strict nonbroadcast <m/switch/</tag> | |
5151 | If set, don't send hello to any undefined neighbor. This switch is | |
5152 | ignored on other than NBMA or PtMP interfaces. Default value is no. | |
5153 | ||
5154 | <tag><label id="ospf-real-broadcast">real broadcast <m/switch/</tag> | |
5155 | In <cf/type broadcast/ or <cf/type ptp/ network configuration, OSPF | |
5156 | packets are sent as IP multicast packets. This option changes the | |
5157 | behavior to using old-fashioned IP broadcast packets. This may be useful | |
5158 | as a workaround if IP multicast for some reason does not work or does | |
5159 | not work reliably. This is a non-standard option and probably is not | |
5160 | interoperable with other OSPF implementations. Default value is no. | |
5161 | ||
5162 | <tag><label id="ospf-ptp-netmask">ptp netmask <m/switch/</tag> | |
5163 | In <cf/type ptp/ network configurations, OSPFv2 implementations should | |
5164 | ignore received netmask field in hello packets and should send hello | |
5165 | packets with zero netmask field on unnumbered PtP links. But some OSPFv2 | |
5166 | implementations perform netmask checking even for PtP links. | |
5167 | ||
5168 | This option specifies whether real netmask will be used in hello packets | |
5169 | on <cf/type ptp/ interfaces. You should ignore this option unless you | |
5170 | meet some compatibility problems related to this issue. Default value is | |
5171 | no for unnumbered PtP links, yes otherwise. | |
5172 | ||
5173 | <tag><label id="ospf-ptp-address">ptp address <m/switch/</tag> | |
5174 | In <cf/type ptp/ network configurations, OSPFv2 implementations should | |
5175 | use IP address for regular PtP links and interface id for unnumbered PtP | |
5176 | links in data field of link description records in router LSA. This data | |
5177 | field has only local meaning for PtP links, but some broken OSPFv2 | |
5178 | implementations assume there is an IP address and use it as a next hop | |
5179 | in SPF calculations. Note that interface id for unnumbered PtP links is | |
5180 | necessary when graceful restart is enabled to distinguish PtP links with | |
5181 | the same local IP address. | |
5182 | ||
5183 | This option specifies whether an IP address will be used in data field | |
5184 | for <cf/type ptp/ interfaces, it is ignored for other interfaces. You | |
5185 | should ignore this option unless you meet some compatibility problems | |
5186 | related to this issue. Default value is no for unnumbered PtP links when | |
5187 | graceful restart is enabled, yes otherwise. | |
5188 | ||
5189 | <tag><label id="ospf-check-link">check link <m>switch</m></tag> | |
5190 | If set, a hardware link state (reported by OS) is taken into consideration. | |
5191 | When a link disappears (e.g. an ethernet cable is unplugged), neighbors | |
5192 | are immediately considered unreachable and only the address of the iface | |
5193 | (instead of whole network prefix) is propagated. It is possible that | |
5194 | some hardware drivers or platforms do not implement this feature. | |
5195 | Default value is yes. | |
5196 | ||
5197 | <tag><label id="ospf-bfd">bfd <m>switch</m></tag> | |
5198 | OSPF could use BFD protocol as an advisory mechanism for neighbor | |
5199 | liveness and failure detection. If enabled, BIRD setups a BFD session | |
5200 | for each OSPF neighbor and tracks its liveness by it. This has an | |
5201 | advantage of an order of magnitude lower detection times in case of | |
5202 | failure. Note that BFD protocol also has to be configured, see | |
5203 | <ref id="bfd" name="BFD"> section for details. Default value is no. | |
5204 | ||
5205 | <tag><label id="ospf-ttl-security">ttl security [<m/switch/ | tx only]</tag> | |
5206 | TTL security is a feature that protects routing protocols from remote | |
5207 | spoofed packets by using TTL 255 instead of TTL 1 for protocol packets | |
5208 | destined to neighbors. Because TTL is decremented when packets are | |
5209 | forwarded, it is non-trivial to spoof packets with TTL 255 from remote | |
5210 | locations. Note that this option would interfere with OSPF virtual | |
5211 | links. | |
5212 | ||
5213 | If this option is enabled, the router will send OSPF packets with TTL | |
5214 | 255 and drop received packets with TTL less than 255. If this option si | |
5215 | set to <cf/tx only/, TTL 255 is used for sent packets, but is not | |
5216 | checked for received packets. Default value is no. | |
5217 | ||
5218 | <tag><label id="ospf-tx-class">tx class|dscp|priority <m/number/</tag> | |
5219 | These options specify the ToS/DiffServ/Traffic class/Priority of the | |
5220 | outgoing OSPF packets. See <ref id="proto-tx-class" name="tx class"> common | |
5221 | option for detailed description. | |
5222 | ||
5223 | <tag><label id="ospf-ecmp-weight">ecmp weight <m>number</m></tag> | |
5224 | When ECMP (multipath) routes are allowed, this value specifies a | |
5225 | relative weight used for nexthops going through the iface. Allowed | |
5226 | values are 1-256. Default value is 1. | |
5227 | ||
5228 | <tag><label id="ospf-auth-none">authentication none</tag> | |
5229 | No passwords are sent in OSPF packets. This is the default value. | |
5230 | ||
5231 | <tag><label id="ospf-auth-simple">authentication simple</tag> | |
5232 | Every packet carries 8 bytes of password. Received packets lacking this | |
5233 | password are ignored. This authentication mechanism is very weak. | |
5234 | This option is not available in OSPFv3. | |
5235 | ||
5236 | <tag><label id="ospf-auth-cryptographic">authentication cryptographic</tag> | |
5237 | An authentication code is appended to every packet. The specific | |
5238 | cryptographic algorithm is selected by option <cf/algorithm/ for each | |
5239 | key. The default cryptographic algorithm for OSPFv2 keys is Keyed-MD5 | |
5240 | and for OSPFv3 keys is HMAC-SHA-256. Passwords are not sent open via | |
5241 | network, so this mechanism is quite secure. Packets can still be read by | |
5242 | an attacker. | |
5243 | ||
5244 | <tag><label id="ospf-pass">password "<m>text</m>"</tag> | |
5245 | Specifies a password used for authentication. See | |
5246 | <ref id="proto-pass" name="password"> common option for detailed | |
5247 | description. | |
5248 | ||
5249 | <tag><label id="ospf-neighbors">neighbors { <m/set/ } </tag> | |
5250 | A set of neighbors to which Hello messages on NBMA or PtMP networks are | |
5251 | to be sent. For NBMA networks, some of them could be marked as eligible. | |
5252 | In OSPFv3, link-local addresses should be used, using global ones is | |
5253 | possible, but it is nonstandard and might be problematic. And definitely, | |
5254 | link-local and global addresses should not be mixed. | |
5255 | </descrip> | |
5256 | ||
5257 | <sect1>Attributes | |
5258 | <label id="ospf-attr"> | |
5259 | ||
5260 | <p>OSPF defines four route attributes. Each internal route has a <cf/metric/. | |
5261 | ||
5262 | <p>Metric is ranging from 1 to infinity (65535). External routes use | |
5263 | <cf/metric type 1/ or <cf/metric type 2/. A <cf/metric of type 1/ is comparable | |
5264 | with internal <cf/metric/, a <cf/metric of type 2/ is always longer than any | |
5265 | <cf/metric of type 1/ or any <cf/internal metric/. <cf/Internal metric/ or | |
5266 | <cf/metric of type 1/ is stored in attribute <cf/ospf_metric1/, <cf/metric type | |
5267 | 2/ is stored in attribute <cf/ospf_metric2/. | |
5268 | ||
5269 | When both metrics are specified then <cf/metric of type 2/ is used. This is | |
5270 | relevant e.g. when a type 2 external route is propagated from one OSPF domain to | |
5271 | another and <cf/ospf_metric1/ is an internal distance to the original ASBR, | |
5272 | while <cf/ospf_metric2/ stores the type 2 metric. Note that in such cases if | |
5273 | <cf/ospf_metric1/ is non-zero then <cf/ospf_metric2/ is increased by one to | |
5274 | ensure monotonicity of metric, as internal distance is reset to zero when an | |
5275 | external route is announced. | |
5276 | ||
5277 | <p>Each external route can also carry attribute <cf/ospf_tag/ which is a 32-bit | |
5278 | integer which is used when exporting routes to other protocols; otherwise, it | |
5279 | doesn't affect routing inside the OSPF domain at all. The fourth attribute | |
5280 | <cf/ospf_router_id/ is a router ID of the router advertising that route / | |
5281 | network. This attribute is read-only. Default is <cf/ospf_metric2 = 10000/ and | |
5282 | <cf/ospf_tag = 0/. | |
5283 | ||
5284 | <sect1>Example | |
5285 | <label id="ospf-exam"> | |
5286 | ||
5287 | <p><code> | |
5288 | protocol ospf MyOSPF { | |
5289 | ipv4 { | |
5290 | export filter { | |
5291 | if source = RTS_BGP then { | |
5292 | ospf_metric1 = 100; | |
5293 | accept; | |
5294 | } | |
5295 | reject; | |
5296 | }; | |
5297 | }; | |
5298 | area 0.0.0.0 { | |
5299 | interface "eth*" { | |
5300 | cost 11; | |
5301 | hello 15; | |
5302 | priority 100; | |
5303 | retransmit 7; | |
5304 | authentication simple; | |
5305 | password "aaa"; | |
5306 | }; | |
5307 | interface "ppp*" { | |
5308 | cost 100; | |
5309 | authentication cryptographic; | |
5310 | password "abc" { | |
5311 | id 1; | |
5312 | generate to "2023-04-22 11:00:06"; | |
5313 | accept from "2021-01-17 12:01:05"; | |
5314 | algorithm hmac sha384; | |
5315 | }; | |
5316 | password "def" { | |
5317 | id 2; | |
5318 | generate to "2025-07-22"; | |
5319 | accept from "2021-02-22"; | |
5320 | algorithm hmac sha512; | |
5321 | }; | |
5322 | }; | |
5323 | interface "arc0" { | |
5324 | cost 10; | |
5325 | stub yes; | |
5326 | }; | |
5327 | interface "arc1"; | |
5328 | }; | |
5329 | area 120 { | |
5330 | stub yes; | |
5331 | networks { | |
5332 | 172.16.1.0/24; | |
5333 | 172.16.2.0/24 hidden; | |
5334 | }; | |
5335 | interface "-arc0" , "arc*" { | |
5336 | type nonbroadcast; | |
5337 | authentication none; | |
5338 | strict nonbroadcast yes; | |
5339 | wait 120; | |
5340 | poll 40; | |
5341 | dead count 8; | |
5342 | neighbors { | |
5343 | 192.168.120.1 eligible; | |
5344 | 192.168.120.2; | |
5345 | 192.168.120.10; | |
5346 | }; | |
5347 | }; | |
5348 | }; | |
5349 | } | |
5350 | </code> | |
5351 | ||
5352 | <sect>Perf | |
5353 | <label id="perf"> | |
5354 | ||
5355 | <sect1>Introduction | |
5356 | <label id="perf-intro"> | |
5357 | ||
5358 | <p>The Perf protocol is a generator of fake routes together with a time measurement | |
5359 | framework. Its purpose is to check BIRD performance and to benchmark filters. | |
5360 | ||
5361 | <p>Import mode of this protocol runs in several steps. In each step, it generates 2^x routes, | |
5362 | imports them into the appropriate table and withdraws them. The exponent x is configurable. | |
5363 | It runs the benchmark several times for the same x, then it increases x by one | |
5364 | until it gets too high, then it stops. | |
5365 | ||
5366 | <p>Export mode of this protocol repeats route refresh from table and measures how long it takes. | |
5367 | ||
5368 | <p>Output data is logged on info level. There is a Perl script <cf>proto/perf/parse.pl</cf> | |
5369 | which may be handy to parse the data and draw some plots. | |
5370 | ||
5371 | <p>Implementation of this protocol is experimental. Use with caution and do not keep | |
5372 | any instance of Perf in production configs for long time. The config interface is also unstable | |
5373 | and may change in future versions without warning. | |
5374 | ||
5375 | <sect1>Configuration | |
5376 | <label id="perf-config"> | |
5377 | ||
5378 | <p><descrip> | |
5379 | <tag><label id="perf-mode">mode import|export</tag> | |
5380 | Set perf mode. Default: import | |
5381 | ||
5382 | <tag><label id="perf-repeat">repeat <m/number/</tag> | |
5383 | Run this amount of iterations of the benchmark for every amount step. Default: 4 | |
5384 | ||
5385 | <tag><label id="perf-from">exp from <m/number/</tag> | |
5386 | Begin benchmarking on this exponent for number of generated routes in one step. | |
5387 | Default: 10 | |
5388 | ||
5389 | <tag><label id="perf-to">exp to <m/number/</tag> | |
5390 | Stop benchmarking on this exponent. Default: 20 | |
5391 | ||
5392 | <tag><label id="perf-threshold-min">threshold min <m/time/</tag> | |
5393 | If a run for the given exponent took less than this time for route import, | |
5394 | increase the exponent immediately. Default: 1 ms | |
5395 | ||
5396 | <tag><label id="perf-threshold-max">threshold max <m/time/</tag> | |
5397 | If every run for the given exponent took at least this time for route import, | |
5398 | stop benchmarking. Default: 500 ms | |
5399 | </descrip> | |
5400 | ||
5401 | <sect>Pipe | |
5402 | <label id="pipe"> | |
5403 | ||
5404 | <sect1>Introduction | |
5405 | <label id="pipe-intro"> | |
5406 | ||
5407 | <p>The Pipe protocol serves as a link between two routing tables, allowing | |
5408 | routes to be passed from a table declared as primary (i.e., the one the pipe is | |
5409 | connected to using the <cf/table/ configuration keyword) to the secondary one | |
5410 | (declared using <cf/peer table/) and vice versa, depending on what's allowed by | |
5411 | the filters. Export filters control export of routes from the primary table to | |
5412 | the secondary one, import filters control the opposite direction. Both tables | |
5413 | must be of the same nettype. | |
5414 | ||
5415 | <p>The Pipe protocol retransmits all routes from one table to the other table, | |
5416 | retaining their original source and attributes. If import and export filters | |
5417 | are set to accept, then both tables would have the same content. | |
5418 | ||
5419 | <p>The primary use of multiple routing tables and the Pipe protocol is for | |
5420 | policy routing, where handling of a single packet doesn't depend only on its | |
5421 | destination address, but also on its source address, source interface, protocol | |
5422 | type and other similar parameters. In many systems (Linux being a good example), | |
5423 | the kernel allows to enforce routing policies by defining routing rules which | |
5424 | choose one of several routing tables to be used for a packet according to its | |
5425 | parameters. Setting of these rules is outside the scope of BIRD's work (on | |
5426 | Linux, you can use the <tt/ip/ command), but you can create several routing | |
5427 | tables in BIRD, connect them to the kernel ones, use filters to control which | |
5428 | routes appear in which tables and also you can employ the Pipe protocol for | |
5429 | exporting a selected subset of one table to another one. | |
5430 | ||
5431 | <sect1>Configuration | |
5432 | <label id="pipe-config"> | |
5433 | ||
5434 | <p>Essentially, the Pipe protocol is just a channel connected to a table on both | |
5435 | sides. Therefore, the configuration block for <cf/protocol pipe/ shall directly | |
5436 | include standard channel config options; see the example below. | |
5437 | ||
5438 | <p><descrip> | |
5439 | <tag><label id="pipe-peer-table">peer table <m/table/</tag> | |
5440 | Defines secondary routing table to connect to. The primary one is | |
5441 | selected by the <cf/table/ keyword. | |
5442 | </descrip> | |
5443 | ||
5444 | <sect1>Attributes | |
5445 | <label id="pipe-attr"> | |
5446 | ||
5447 | <p>The Pipe protocol doesn't define any route attributes. | |
5448 | ||
5449 | <sect1>Example | |
5450 | <label id="pipe-exam"> | |
5451 | ||
5452 | <p>Let's consider a router which serves as a boundary router of two different | |
5453 | autonomous systems, each of them connected to a subset of interfaces of the | |
5454 | router, having its own exterior connectivity and wishing to use the other AS as | |
5455 | a backup connectivity in case of outage of its own exterior line. | |
5456 | ||
5457 | <p>Probably the simplest solution to this situation is to use two routing tables | |
5458 | (we'll call them <cf/as1/ and <cf/as2/) and set up kernel routing rules, so that | |
5459 | packets having arrived from interfaces belonging to the first AS will be routed | |
5460 | according to <cf/as1/ and similarly for the second AS. Thus we have split our | |
5461 | router to two logical routers, each one acting on its own routing table, having | |
5462 | its own routing protocols on its own interfaces. In order to use the other AS's | |
5463 | routes for backup purposes, we can pass the routes between the tables through a | |
5464 | Pipe protocol while decreasing their preferences and correcting their BGP paths | |
5465 | to reflect the AS boundary crossing. | |
5466 | ||
5467 | <code> | |
5468 | ipv4 table as1; # Define the tables | |
5469 | ipv4 table as2; | |
5470 | ||
5471 | protocol kernel kern1 { # Synchronize them with the kernel | |
5472 | ipv4 { table as1; export all; }; | |
5473 | kernel table 1; | |
5474 | } | |
5475 | ||
5476 | protocol kernel kern2 { | |
5477 | ipv4 { table as2; export all; }; | |
5478 | kernel table 2; | |
5479 | } | |
5480 | ||
5481 | protocol bgp bgp1 { # The outside connections | |
5482 | ipv4 { table as1; import all; export all; }; | |
5483 | local as 1; | |
5484 | neighbor 192.168.0.1 as 1001; | |
5485 | } | |
5486 | ||
5487 | protocol bgp bgp2 { | |
5488 | ipv4 { table as2; import all; export all; }; | |
5489 | local as 2; | |
5490 | neighbor 10.0.0.1 as 1002; | |
5491 | } | |
5492 | ||
5493 | protocol pipe { # The Pipe | |
5494 | table as1; | |
5495 | peer table as2; | |
5496 | export filter { | |
5497 | if net ~ [ 1.0.0.0/8+] then { # Only AS1 networks | |
5498 | if preference>10 then preference = preference-10; | |
5499 | if source=RTS_BGP then bgp_path.prepend(1); | |
5500 | accept; | |
5501 | } | |
5502 | reject; | |
5503 | }; | |
5504 | import filter { | |
5505 | if net ~ [ 2.0.0.0/8+] then { # Only AS2 networks | |
5506 | if preference>10 then preference = preference-10; | |
5507 | if source=RTS_BGP then bgp_path.prepend(2); | |
5508 | accept; | |
5509 | } | |
5510 | reject; | |
5511 | }; | |
5512 | } | |
5513 | </code> | |
5514 | ||
5515 | ||
5516 | <sect>RAdv | |
5517 | <label id="radv"> | |
5518 | ||
5519 | <sect1>Introduction | |
5520 | <label id="radv-intro"> | |
5521 | ||
5522 | <p>The RAdv protocol is an implementation of Router Advertisements, which are | |
5523 | used in the IPv6 stateless autoconfiguration. IPv6 routers send (in irregular | |
5524 | time intervals or as an answer to a request) advertisement packets to connected | |
5525 | networks. These packets contain basic information about a local network (e.g. a | |
5526 | list of network prefixes), which allows network hosts to autoconfigure network | |
5527 | addresses and choose a default route. BIRD implements router behavior as defined | |
5528 | in <rfc id="4861">, router preferences and specific routes (<rfc id="4191">), | |
5529 | and DNS extensions (<rfc id="6106">). | |
5530 | ||
5531 | <p>The RAdv protocols supports just IPv6 channel. | |
5532 | ||
5533 | <sect1>Configuration | |
5534 | <label id="radv-config"> | |
5535 | ||
5536 | <p>There are several classes of definitions in RAdv configuration -- interface | |
5537 | definitions, prefix definitions and DNS definitions: | |
5538 | ||
5539 | <descrip> | |
5540 | <tag><label id="radv-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag> | |
5541 | Interface definitions specify a set of interfaces on which the | |
5542 | protocol is activated and contain interface specific options. | |
5543 | See <ref id="proto-iface" name="interface"> common options for | |
5544 | detailed description. | |
5545 | ||
5546 | <tag><label id="radv-prefix">prefix <m/prefix/ { <m/options/ }</tag> | |
5547 | Prefix definitions allow to modify a list of advertised prefixes. By | |
5548 | default, the advertised prefixes are the same as the network prefixes | |
5549 | assigned to the interface. For each network prefix, the matching prefix | |
5550 | definition is found and its options are used. If no matching prefix | |
5551 | definition is found, the prefix is used with default options. | |
5552 | ||
5553 | Prefix definitions can be either global or interface-specific. The | |
5554 | second ones are part of interface options. The prefix definition | |
5555 | matching is done in the first-match style, when interface-specific | |
5556 | definitions are processed before global definitions. As expected, the | |
5557 | prefix definition is matching if the network prefix is a subnet of the | |
5558 | prefix in prefix definition. | |
5559 | ||
5560 | <tag><label id="radv-rdnss">rdnss { <m/options/ }</tag> | |
5561 | RDNSS definitions allow to specify a list of advertised recursive DNS | |
5562 | servers together with their options. As options are seldom necessary, | |
5563 | there is also a short variant <cf>rdnss <m/address/</cf> that just | |
5564 | specifies one DNS server. Multiple definitions are cumulative. RDNSS | |
5565 | definitions may also be interface-specific when used inside interface | |
5566 | options. By default, interface uses both global and interface-specific | |
5567 | options, but that can be changed by <cf/rdnss local/ option. | |
5568 | ||
5569 | <tag><label id="radv-dnssl">dnssl { <m/options/ }</tag> | |
5570 | DNSSL definitions allow to specify a list of advertised DNS search | |
5571 | domains together with their options. Like <cf/rdnss/ above, multiple | |
5572 | definitions are cumulative, they can be used also as interface-specific | |
5573 | options and there is a short variant <cf>dnssl <m/domain/</cf> that just | |
5574 | specifies one DNS search domain. | |
5575 | ||
5576 | <tag><label id="radv-custom-option">custom option type <m/number/ value <m/bytestring/</tag> | |
5577 | Custom option definitions allow to define an arbitrary option to | |
5578 | advertise. You need to specify the option type number and the binary | |
5579 | payload of the option. The length field is calculated automatically. | |
5580 | Like <cf/rdnss/ above, multiple definitions are cumulative, they can | |
5581 | be used also as interface-specific options. | |
5582 | ||
5583 | The following example advertises PREF64 option (<rfc id="8781">) with | |
5584 | prefix <cf>2001:db8:a:b::/96</cf> and the lifetime of <cf/1 hour/: | |
5585 | ||
5586 | <label id="radv-custom-option-exam"> | |
5587 | <p><code> | |
5588 | custom option type 38 value hex:0e:10:20:01:0d:b8:00:0a:00:0b:00:00:00:00; | |
5589 | </code> | |
5590 | ||
5591 | <tag><label id="radv-trigger">trigger <m/prefix/</tag> | |
5592 | RAdv protocol could be configured to change its behavior based on | |
5593 | availability of routes. When this option is used, the protocol waits in | |
5594 | suppressed state until a <it/trigger route/ (for the specified network) | |
5595 | is exported to the protocol, the protocol also returns to suppressed | |
5596 | state if the <it/trigger route/ disappears. Note that route export | |
5597 | depends on specified export filter, as usual. This option could be used, | |
5598 | e.g., for handling failover in multihoming scenarios. | |
5599 | ||
5600 | During suppressed state, router advertisements are generated, but with | |
5601 | some fields zeroed. Exact behavior depends on which fields are zeroed, | |
5602 | this can be configured by <cf/sensitive/ option for appropriate | |
5603 | fields. By default, just <cf/default lifetime/ (also called <cf/router | |
5604 | lifetime/) is zeroed, which means hosts cannot use the router as a | |
5605 | default router. <cf/preferred lifetime/ and <cf/valid lifetime/ could | |
5606 | also be configured as <cf/sensitive/ for a prefix, which would cause | |
5607 | autoconfigured IPs to be deprecated or even removed. | |
5608 | ||
5609 | <tag><label id="radv-propagate-routes">propagate routes <m/switch/</tag> | |
5610 | This option controls propagation of more specific routes, as defined in | |
5611 | <rfc id="4191">. If enabled, all routes exported to the RAdv protocol, | |
5612 | with the exception of the trigger prefix, are added to advertisments as | |
5613 | additional options. The lifetime and preference of advertised routes can | |
5614 | be set individually by <cf/ra_lifetime/ and <cf/ra_preference/ route | |
5615 | attributes, or per interface by <cf/route lifetime/ and | |
5616 | <cf/route preference/ options. Default: disabled. | |
5617 | ||
5618 | Note that the RFC discourages from sending more than 17 routes and | |
5619 | recommends the routes to be configured manually. | |
5620 | </descrip> | |
5621 | ||
5622 | <p>Interface specific options: | |
5623 | ||
5624 | <descrip> | |
5625 | <tag><label id="radv-iface-max-ra-interval">max ra interval <m/expr/</tag> | |
5626 | Unsolicited router advertisements are sent in irregular time intervals. | |
5627 | This option specifies the maximum length of these intervals, in seconds. | |
5628 | Valid values are 4-1800. Default: 600 | |
5629 | ||
5630 | <tag><label id="radv-iface-min-ra-interval">min ra interval <m/expr/</tag> | |
5631 | This option specifies the minimum length of that intervals, in seconds. | |
5632 | Must be at least 3 and at most 3/4 * <cf/max ra interval/. Default: | |
5633 | about 1/3 * <cf/max ra interval/. | |
5634 | ||
5635 | <tag><label id="radv-iface-min-delay">min delay <m/expr/</tag> | |
5636 | The minimum delay between two consecutive router advertisements, in | |
5637 | seconds. Default: 3 | |
5638 | ||
5639 | <tag><label id="radv-solicited-ra-unicast">solicited ra unicast <m/switch/</tag> | |
5640 | Solicited router advertisements are usually sent to all-nodes multicast | |
5641 | group like unsolicited ones, but the router can be configured to send | |
5642 | them as unicast directly to soliciting nodes instead. This is especially | |
5643 | useful on wireless networks (see <rfc id="7772">). Default: no | |
5644 | ||
5645 | <tag><label id="radv-iface-managed">managed <m/switch/</tag> | |
5646 | This option specifies whether hosts should use DHCPv6 for IP address | |
5647 | configuration. Default: no | |
5648 | ||
5649 | <tag><label id="radv-iface-other-config">other config <m/switch/</tag> | |
5650 | This option specifies whether hosts should use DHCPv6 to receive other | |
5651 | configuration information. Default: no | |
5652 | ||
5653 | <tag><label id="radv-iface-link-mtu">link mtu <m/expr/</tag> | |
5654 | This option specifies which value of MTU should be used by hosts. 0 | |
5655 | means unspecified. Default: 0 | |
5656 | ||
5657 | <tag><label id="radv-iface-reachable-time">reachable time <m/expr/</tag> | |
5658 | This option specifies the time (in milliseconds) how long hosts should | |
5659 | assume a neighbor is reachable (from the last confirmation). Maximum is | |
5660 | 3600000, 0 means unspecified. Default 0. | |
5661 | ||
5662 | <tag><label id="radv-iface-retrans-timer">retrans timer <m/expr/</tag> | |
5663 | This option specifies the time (in milliseconds) how long hosts should | |
5664 | wait before retransmitting Neighbor Solicitation messages. 0 means | |
5665 | unspecified. Default 0. | |
5666 | ||
5667 | <tag><label id="radv-iface-current-hop-limit">current hop limit <m/expr/</tag> | |
5668 | This option specifies which value of Hop Limit should be used by | |
5669 | hosts. Valid values are 0-255, 0 means unspecified. Default: 64 | |
5670 | ||
5671 | <tag><label id="radv-iface-default-lifetime">default lifetime <m/expr/ [sensitive <m/switch/]</tag> | |
5672 | This option specifies the time (in seconds) how long (since the receipt | |
5673 | of RA) hosts may use the router as a default router. 0 means do not use | |
5674 | as a default router. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">. | |
5675 | Default: 3 * <cf/max ra interval/, <cf/sensitive/ yes. | |
5676 | ||
5677 | <tag><label id="radv-iface-default-preference">default preference low|medium|high</tag> | |
5678 | This option specifies the Default Router Preference value to advertise | |
5679 | to hosts. Default: medium. | |
5680 | ||
5681 | <tag><label id="radv-iface-route-lifetime">route lifetime <m/expr/ [sensitive <m/switch/]</tag> | |
5682 | This option specifies the default value of advertised lifetime for | |
5683 | specific routes; i.e., the time (in seconds) for how long (since the | |
5684 | receipt of RA) hosts should consider these routes valid. A special value | |
5685 | 0xffffffff represents infinity. The lifetime can be overriden on a per | |
5686 | route basis by the <ref id="rta-ra-lifetime" name="ra_lifetime"> route | |
5687 | attribute. Default: 3 * <cf/max ra interval/, <cf/sensitive/ no. | |
5688 | ||
5689 | For the <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">. | |
5690 | If <cf/sensitive/ is enabled, even the routes with the <cf/ra_lifetime/ | |
5691 | attribute become sensitive to the trigger. | |
5692 | ||
5693 | <tag><label id="radv-iface-route-preference">route preference low|medium|high</tag> | |
5694 | This option specifies the default value of advertised route preference | |
5695 | for specific routes. The value can be overriden on a per route basis by | |
5696 | the <ref id="rta-ra-preference" name="ra_preference"> route attribute. | |
5697 | Default: medium. | |
5698 | ||
5699 | <tag><label id="radv-prefix-linger-time">prefix linger time <m/expr/</tag> | |
5700 | When a prefix or a route disappears, it is advertised for some time with | |
5701 | zero lifetime, to inform clients it is no longer valid. This option | |
5702 | specifies the time (in seconds) for how long prefixes are advertised | |
5703 | that way. Default: 3 * <cf/max ra interval/. | |
5704 | ||
5705 | <tag><label id="radv-route-linger-time">route linger time <m/expr/</tag> | |
5706 | When a prefix or a route disappears, it is advertised for some time with | |
5707 | zero lifetime, to inform clients it is no longer valid. This option | |
5708 | specifies the time (in seconds) for how long routes are advertised | |
5709 | that way. Default: 3 * <cf/max ra interval/. | |
5710 | ||
5711 | <tag><label id="radv-iface-rdnss-local">rdnss local <m/switch/</tag> | |
5712 | Use only local (interface-specific) RDNSS definitions for this | |
5713 | interface. Otherwise, both global and local definitions are used. Could | |
5714 | also be used to disable RDNSS for given interface if no local definitons | |
5715 | are specified. Default: no. | |
5716 | ||
5717 | <tag><label id="radv-iface-dnssl-local">dnssl local <m/switch/</tag> | |
5718 | Use only local DNSSL definitions for this interface. See <cf/rdnss local/ | |
5719 | option above. Default: no. | |
5720 | ||
5721 | <tag><label id="radv-iface-custom-local">custom option local <m/switch/</tag> | |
5722 | Use only local custom option definitions for this interface. See <cf/rdnss local/ | |
5723 | option above. Default: no. | |
5724 | </descrip> | |
5725 | ||
5726 | <p>Prefix specific options | |
5727 | ||
5728 | <descrip> | |
5729 | <tag><label id="radv-prefix-skip">skip <m/switch/</tag> | |
5730 | This option allows to specify that given prefix should not be | |
5731 | advertised. This is useful for making exceptions from a default policy | |
5732 | of advertising all prefixes. Note that for withdrawing an already | |
5733 | advertised prefix it is more useful to advertise it with zero valid | |
5734 | lifetime. Default: no | |
5735 | ||
5736 | <tag><label id="radv-prefix-onlink">onlink <m/switch/</tag> | |
5737 | This option specifies whether hosts may use the advertised prefix for | |
5738 | onlink determination. Default: yes | |
5739 | ||
5740 | <tag><label id="radv-prefix-autonomous">autonomous <m/switch/</tag> | |
5741 | This option specifies whether hosts may use the advertised prefix for | |
5742 | stateless autoconfiguration. Default: yes | |
5743 | ||
5744 | <tag><label id="radv-prefix-valid-lifetime">valid lifetime <m/expr/ [sensitive <m/switch/]</tag> | |
5745 | This option specifies the time (in seconds) how long (after the | |
5746 | receipt of RA) the prefix information is valid, i.e., autoconfigured | |
5747 | IP addresses can be assigned and hosts with that IP addresses are | |
5748 | considered directly reachable. 0 means the prefix is no longer | |
5749 | valid. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">. | |
5750 | Default: 86400 (1 day), <cf/sensitive/ no. | |
5751 | ||
5752 | <tag><label id="radv-prefix-preferred-lifetime">preferred lifetime <m/expr/ [sensitive <m/switch/]</tag> | |
5753 | This option specifies the time (in seconds) how long (after the | |
5754 | receipt of RA) IP addresses generated from the prefix using stateless | |
5755 | autoconfiguration remain preferred. For <cf/sensitive/ option, | |
5756 | see <ref id="radv-trigger" name="trigger">. Default: 14400 (4 hours), | |
5757 | <cf/sensitive/ no. | |
5758 | </descrip> | |
5759 | ||
5760 | <p>RDNSS specific options: | |
5761 | ||
5762 | <descrip> | |
5763 | <tag><label id="radv-rdnss-ns">ns <m/address/</tag> | |
5764 | This option specifies one recursive DNS server. Can be used multiple | |
5765 | times for multiple servers. It is mandatory to have at least one | |
5766 | <cf/ns/ option in <cf/rdnss/ definition. | |
5767 | ||
5768 | <tag><label id="radv-rdnss-lifetime">lifetime [mult] <m/expr/</tag> | |
5769 | This option specifies the time how long the RDNSS information may be | |
5770 | used by clients after the receipt of RA. It is expressed either in | |
5771 | seconds or (when <cf/mult/ is used) in multiples of <cf/max ra | |
5772 | interval/. Note that RDNSS information is also invalidated when | |
5773 | <cf/default lifetime/ expires. 0 means these addresses are no longer | |
5774 | valid DNS servers. Default: 3 * <cf/max ra interval/. | |
5775 | </descrip> | |
5776 | ||
5777 | <p>DNSSL specific options: | |
5778 | ||
5779 | <descrip> | |
5780 | <tag><label id="radv-dnssl-domain">domain <m/address/</tag> | |
5781 | This option specifies one DNS search domain. Can be used multiple times | |
5782 | for multiple domains. It is mandatory to have at least one <cf/domain/ | |
5783 | option in <cf/dnssl/ definition. | |
5784 | ||
5785 | <tag><label id="radv-dnssl-lifetime">lifetime [mult] <m/expr/</tag> | |
5786 | This option specifies the time how long the DNSSL information may be | |
5787 | used by clients after the receipt of RA. Details are the same as for | |
5788 | RDNSS <cf/lifetime/ option above. Default: 3 * <cf/max ra interval/. | |
5789 | </descrip> | |
5790 | ||
5791 | <sect1>Attributes | |
5792 | <label id="radv-attr"> | |
5793 | ||
5794 | <p>RAdv defines two route attributes: | |
5795 | ||
5796 | <descrip> | |
5797 | <tag><label id="rta-ra-preference">enum ra_preference</tag> | |
5798 | The preference of the route. The value can be <it/RA_PREF_LOW/, | |
5799 | <it/RA_PREF_MEDIUM/ or <it/RA_PREF_HIGH/. If the attribute is not set, | |
5800 | the <ref id="radv-iface-route-preference" name="route preference"> | |
5801 | option is used. | |
5802 | ||
5803 | <tag><label id="rta-ra-lifetime">int ra_lifetime</tag> | |
5804 | The advertised lifetime of the route, in seconds. The special value of | |
5805 | 0xffffffff represents infinity. If the attribute is not set, the | |
5806 | <ref id="radv-iface-route-lifetime" name="route lifetime"> | |
5807 | option is used. | |
5808 | </descrip> | |
5809 | ||
5810 | <sect1>Example | |
5811 | <label id="radv-exam"> | |
5812 | ||
5813 | <p><code> | |
5814 | ipv6 table radv_routes; # Manually configured routes go here | |
5815 | ||
5816 | protocol static { | |
5817 | ipv6 { table radv_routes; }; | |
5818 | ||
5819 | route 2001:0DB8:4000::/48 unreachable; | |
5820 | route 2001:0DB8:4010::/48 unreachable; | |
5821 | ||
5822 | route 2001:0DB8:4020::/48 unreachable { | |
5823 | ra_preference = RA_PREF_HIGH; | |
5824 | ra_lifetime = 3600; | |
5825 | }; | |
5826 | } | |
5827 | ||
5828 | protocol radv { | |
5829 | propagate routes yes; # Propagate the routes from the radv_routes table | |
5830 | ipv6 { table radv_routes; export all; }; | |
5831 | ||
5832 | interface "eth2" { | |
5833 | max ra interval 5; # Fast failover with more routers | |
5834 | managed yes; # Using DHCPv6 on eth2 | |
5835 | prefix ::/0 { | |
5836 | autonomous off; # So do not autoconfigure any IP | |
5837 | }; | |
5838 | }; | |
5839 | ||
5840 | interface "eth*"; # No need for any other options | |
5841 | ||
5842 | prefix 2001:0DB8:1234::/48 { | |
5843 | preferred lifetime 0; # Deprecated address range | |
5844 | }; | |
5845 | ||
5846 | prefix 2001:0DB8:2000::/48 { | |
5847 | autonomous off; # Do not autoconfigure | |
5848 | }; | |
5849 | ||
5850 | rdnss 2001:0DB8:1234::10; # Short form of RDNSS | |
5851 | ||
5852 | rdnss { | |
5853 | lifetime mult 10; | |
5854 | ns 2001:0DB8:1234::11; | |
5855 | ns 2001:0DB8:1234::12; | |
5856 | }; | |
5857 | ||
5858 | dnssl { | |
5859 | lifetime 3600; | |
5860 | domain "abc.com"; | |
5861 | domain "xyz.com"; | |
5862 | }; | |
5863 | } | |
5864 | </code> | |
5865 | ||
5866 | ||
5867 | <sect>RIP | |
5868 | <label id="rip"> | |
5869 | ||
5870 | <sect1>Introduction | |
5871 | <label id="rip-intro"> | |
5872 | ||
5873 | <p>The RIP protocol (also sometimes called Rest In Pieces) is a simple protocol, | |
5874 | where each router broadcasts (to all its neighbors) distances to all networks it | |
5875 | can reach. When a router hears distance to another network, it increments it and | |
5876 | broadcasts it back. Broadcasts are done in regular intervals. Therefore, if some | |
5877 | network goes unreachable, routers keep telling each other that its distance is | |
5878 | the original distance plus 1 (actually, plus interface metric, which is usually | |
5879 | one). After some time, the distance reaches infinity (that's 15 in RIP) and all | |
5880 | routers know that network is unreachable. RIP tries to minimize situations where | |
5881 | counting to infinity is necessary, because it is slow. Due to infinity being 16, | |
5882 | you can't use RIP on networks where maximal distance is higher than 15 | |
5883 | hosts. | |
5884 | ||
5885 | <p>BIRD supports RIPv1 (<rfc id="1058">), RIPv2 (<rfc id="2453">), RIPng (<rfc | |
5886 | id="2080">), Triggered RIP for demand circuits (<rfc id="2091">), and RIP | |
5887 | cryptographic authentication (<rfc id="4822">). | |
5888 | ||
5889 | <p>RIP is a very simple protocol, and it has a lot of shortcomings. Slow | |
5890 | convergence, big network load and inability to handle larger networks makes it | |
5891 | pretty much obsolete. It is still usable on very small networks. | |
5892 | ||
5893 | <sect1>Configuration | |
5894 | <label id="rip-config"> | |
5895 | ||
5896 | <p>RIP configuration consists mainly of common protocol options and interface | |
5897 | definitions, most RIP options are interface specific. RIPng (RIP for IPv6) | |
5898 | protocol instance can be configured by using <cf/rip ng/ instead of just | |
5899 | <cf/rip/ as a protocol type. | |
5900 | ||
5901 | <p>RIP needs one IPv4 channel. RIPng needs one IPv6 channel. If no channel is | |
5902 | configured, appropriate channel is defined with default parameters. | |
5903 | ||
5904 | <code> | |
5905 | protocol rip [ng] [<name>] { | |
5906 | infinity <number>; | |
5907 | ecmp <switch> [limit <number>]; | |
5908 | interface <interface pattern> { | |
5909 | metric <number>; | |
5910 | mode multicast|broadcast; | |
5911 | passive <switch>; | |
5912 | address <ip>; | |
5913 | port <number>; | |
5914 | version 1|2; | |
5915 | split horizon <switch>; | |
5916 | poison reverse <switch>; | |
5917 | demand circuit <switch>; | |
5918 | check zero <switch>; | |
5919 | update time <number>; | |
5920 | timeout time <number>; | |
5921 | garbage time <number>; | |
5922 | ecmp weight <number>; | |
5923 | ttl security <switch>; | tx only; | |
5924 | tx class|dscp <number>; | |
5925 | tx priority <number>; | |
5926 | rx buffer <number>; | |
5927 | tx length <number>; | |
5928 | check link <switch>; | |
5929 | authentication none|plaintext|cryptographic; | |
5930 | password "<text>"; | |
5931 | password "<text>" { | |
5932 | id <number>; | |
5933 | generate from "<date>"; | |
5934 | generate to "<date>"; | |
5935 | accept from "<date>"; | |
5936 | accept to "<date>"; | |
5937 | from "<date>"; | |
5938 | to "<date>"; | |
5939 | algorithm ( keyed md5 | keyed sha1 | hmac sha1 | | |
5940 | hmac sha256 | hmac sha384 | hmac sha512 ); | |
5941 | }; | |
5942 | }; | |
5943 | } | |
5944 | </code> | |
5945 | ||
5946 | <descrip> | |
5947 | <tag><label id="rip-infinity">infinity <m>number</m></tag> | |
5948 | Selects the distance of infinity. Bigger values will make | |
5949 | protocol convergence even slower. The default value is 16. | |
5950 | ||
5951 | <tag><label id="rip-ecmp">ecmp <m>switch</m> [limit <m>number</m>]</tag> | |
5952 | This option specifies whether RIP is allowed to generate ECMP | |
5953 | (equal-cost multipath) routes. Such routes are used when there are | |
5954 | several directions to the destination, each with the same (computed) | |
5955 | cost. This option also allows to specify a limit on maximum number of | |
5956 | nexthops in one route. By default, ECMP is enabled if supported by | |
5957 | Kernel. Default value of the limit is 16. | |
5958 | ||
5959 | <tag><label id="rip-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag> | |
5960 | Interface definitions specify a set of interfaces on which the | |
5961 | protocol is activated and contain interface specific options. | |
5962 | See <ref id="proto-iface" name="interface"> common options for | |
5963 | detailed description. | |
5964 | </descrip> | |
5965 | ||
5966 | <p>Interface specific options: | |
5967 | ||
5968 | <descrip> | |
5969 | <tag><label id="rip-iface-metric">metric <m/number/</tag> | |
5970 | This option specifies the metric of the interface. When a route is | |
5971 | received from the interface, its metric is increased by this value | |
5972 | before further processing. Valid values are 1-255, but values higher | |
5973 | than infinity has no further meaning. Default: 1. | |
5974 | ||
5975 | <tag><label id="rip-iface-mode">mode multicast|broadcast</tag> | |
5976 | This option selects the mode for RIP to use on the interface. The | |
5977 | default is multicast mode for RIPv2 and broadcast mode for RIPv1. | |
5978 | RIPng always uses the multicast mode. | |
5979 | ||
5980 | <tag><label id="rip-iface-passive">passive <m/switch/</tag> | |
5981 | Passive interfaces receive routing updates but do not transmit any | |
5982 | messages. Default: no. | |
5983 | ||
5984 | <tag><label id="rip-iface-address">address <m/ip/</tag> | |
5985 | This option specifies a destination address used for multicast or | |
5986 | broadcast messages, the default is the official RIP (224.0.0.9) or RIPng | |
5987 | (ff02::9) multicast address, or an appropriate broadcast address in the | |
5988 | broadcast mode. | |
5989 | ||
5990 | <tag><label id="rip-iface-port">port <m/number/</tag> | |
5991 | This option selects an UDP port to operate on, the default is the | |
5992 | official RIP (520) or RIPng (521) port. | |
5993 | ||
5994 | <tag><label id="rip-iface-version">version 1|2</tag> | |
5995 | This option selects the version of RIP used on the interface. For RIPv1, | |
5996 | automatic subnet aggregation is not implemented, only classful network | |
5997 | routes and host routes are propagated. Note that BIRD allows RIPv1 to be | |
5998 | configured with features that are defined for RIPv2 only, like | |
5999 | authentication or using multicast sockets. The default is RIPv2 for IPv4 | |
6000 | RIP, the option is not supported for RIPng, as no further versions are | |
6001 | defined. | |
6002 | ||
6003 | <tag><label id="rip-iface-version-only">version only <m/switch/</tag> | |
6004 | Regardless of RIP version configured for the interface, BIRD accepts | |
6005 | incoming packets of any RIP version. This option restrict accepted | |
6006 | packets to the configured version. Default: no. | |
6007 | ||
6008 | <tag><label id="rip-iface-split-horizon">split horizon <m/switch/</tag> | |
6009 | Split horizon is a scheme for preventing routing loops. When split | |
6010 | horizon is active, routes are not regularly propagated back to the | |
6011 | interface from which they were received. They are either not propagated | |
6012 | back at all (plain split horizon) or propagated back with an infinity | |
6013 | metric (split horizon with poisoned reverse). Therefore, other routers | |
6014 | on the interface will not consider the router as a part of an | |
6015 | independent path to the destination of the route. Default: yes. | |
6016 | ||
6017 | <tag><label id="rip-iface-poison-reverse">poison reverse <m/switch/</tag> | |
6018 | When split horizon is active, this option specifies whether the poisoned | |
6019 | reverse variant (propagating routes back with an infinity metric) is | |
6020 | used. The poisoned reverse has some advantages in faster convergence, | |
6021 | but uses more network traffic. Default: yes. | |
6022 | ||
6023 | <tag><label id="rip-iface-demand-circuit">demand circuit <m/switch/</tag> | |
6024 | Regular RIP sends periodic full updates on an interface. There is the | |
6025 | Triggered RIP extension for demand circuits (<rfc id="2091">), which | |
6026 | removes periodic updates and introduces update acknowledgments. When | |
6027 | enabled, there is no RIP communication in steady-state network. Note | |
6028 | that in order to work, it must be enabled on both sides. As there are | |
6029 | no hello packets, it depends on hardware link state to detect neighbor | |
6030 | failures. Also, it is designed for PtP links and it does not work | |
6031 | properly with multiple RIP neighbors on an interface. Default: no. | |
6032 | ||
6033 | <tag><label id="rip-iface-check-zero">check zero <m/switch/</tag> | |
6034 | Received RIPv1 packets with non-zero values in reserved fields should | |
6035 | be discarded. This option specifies whether the check is performed or | |
6036 | such packets are just processed as usual. Default: yes. | |
6037 | ||
6038 | <tag><label id="rip-iface-update-time">update time <m/number/</tag> | |
6039 | Specifies the number of seconds between periodic updates. A lower number | |
6040 | will mean faster convergence but bigger network load. Default: 30. | |
6041 | ||
6042 | <tag><label id="rip-iface-timeout-time">timeout time <m/number/</tag> | |
6043 | Specifies the time interval (in seconds) between the last received route | |
6044 | announcement and the route expiration. After that, the network is | |
6045 | considered unreachable, but still is propagated with infinity distance. | |
6046 | Default: 180. | |
6047 | ||
6048 | <tag><label id="rip-iface-garbage-time">garbage time <m/number/</tag> | |
6049 | Specifies the time interval (in seconds) between the route expiration | |
6050 | and the removal of the unreachable network entry. The garbage interval, | |
6051 | when a route with infinity metric is propagated, is used for both | |
6052 | internal (after expiration) and external (after withdrawal) routes. | |
6053 | Default: 120. | |
6054 | ||
6055 | <tag><label id="rip-iface-ecmp-weight">ecmp weight <m/number/</tag> | |
6056 | When ECMP (multipath) routes are allowed, this value specifies a | |
6057 | relative weight used for nexthops going through the iface. Valid | |
6058 | values are 1-256. Default value is 1. | |
6059 | ||
6060 | <tag><label id="rip-iface-auth">authentication none|plaintext|cryptographic</tag> | |
6061 | Selects authentication method to be used. <cf/none/ means that packets | |
6062 | are not authenticated at all, <cf/plaintext/ means that a plaintext | |
6063 | password is embedded into each packet, and <cf/cryptographic/ means that | |
6064 | packets are authenticated using some cryptographic hash function | |
6065 | selected by option <cf/algorithm/ for each key. The default | |
6066 | cryptographic algorithm for RIP keys is Keyed-MD5. If you set | |
6067 | authentication to not-none, it is a good idea to add <cf>password</cf> | |
6068 | section. Default: none. | |
6069 | ||
6070 | <tag><label id="rip-iface-pass">password "<m/text/"</tag> | |
6071 | Specifies a password used for authentication. See <ref id="proto-pass" | |
6072 | name="password"> common option for detailed description. | |
6073 | ||
6074 | <tag><label id="rip-iface-ttl-security">ttl security [<m/switch/ | tx only]</tag> | |
6075 | TTL security is a feature that protects routing protocols from remote | |
6076 | spoofed packets by using TTL 255 instead of TTL 1 for protocol packets | |
6077 | destined to neighbors. Because TTL is decremented when packets are | |
6078 | forwarded, it is non-trivial to spoof packets with TTL 255 from remote | |
6079 | locations. | |
6080 | ||
6081 | If this option is enabled, the router will send RIP packets with TTL 255 | |
6082 | and drop received packets with TTL less than 255. If this option si set | |
6083 | to <cf/tx only/, TTL 255 is used for sent packets, but is not checked | |
6084 | for received packets. Such setting does not offer protection, but offers | |
6085 | compatibility with neighbors regardless of whether they use ttl | |
6086 | security. | |
6087 | ||
6088 | For RIPng, TTL security is a standard behavior (required by <rfc | |
6089 | id="2080">) and therefore default value is yes. For IPv4 RIP, default | |
6090 | value is no. | |
6091 | ||
6092 | <tag><label id="rip-iface-tx-class">tx class|dscp|priority <m/number/</tag> | |
6093 | These options specify the ToS/DiffServ/Traffic class/Priority of the | |
6094 | outgoing RIP packets. See <ref id="proto-tx-class" name="tx class"> common | |
6095 | option for detailed description. | |
6096 | ||
6097 | <tag><label id="rip-iface-rx-buffer">rx buffer <m/number/</tag> | |
6098 | This option specifies the size of buffers used for packet processing. | |
6099 | The buffer size should be bigger than maximal size of received packets. | |
6100 | The default value is 532 for IPv4 RIP and interface MTU value for RIPng. | |
6101 | ||
6102 | <tag><label id="rip-iface-tx-length">tx length <m/number/</tag> | |
6103 | This option specifies the maximum length of generated RIP packets. To | |
6104 | avoid IP fragmentation, it should not exceed the interface MTU value. | |
6105 | The default value is 532 for IPv4 RIP and interface MTU value for RIPng. | |
6106 | ||
6107 | <tag><label id="rip-iface-check-link">check link <m/switch/</tag> | |
6108 | If set, the hardware link state (as reported by OS) is taken into | |
6109 | consideration. When the link disappears (e.g. an ethernet cable is | |
6110 | unplugged), neighbors are immediately considered unreachable and all | |
6111 | routes received from them are withdrawn. It is possible that some | |
6112 | hardware drivers or platforms do not implement this feature. | |
6113 | Default: yes. | |
6114 | </descrip> | |
6115 | ||
6116 | <sect1>Attributes | |
6117 | <label id="rip-attr"> | |
6118 | ||
6119 | <p>RIP defines two route attributes: | |
6120 | ||
6121 | <descrip> | |
6122 | <tag><label id="rta-rip-metric">int rip_metric</tag> | |
6123 | RIP metric of the route (ranging from 0 to <cf/infinity/). When routes | |
6124 | from different RIP instances are available and all of them have the same | |
6125 | preference, BIRD prefers the route with lowest <cf/rip_metric/. When a | |
6126 | non-RIP route is exported to RIP, the default metric is 1. | |
6127 | ||
6128 | <tag><label id="rta-rip-tag">int rip_tag</tag> | |
6129 | RIP route tag: a 16-bit number which can be used to carry additional | |
6130 | information with the route (for example, an originating AS number in | |
6131 | case of external routes). When a non-RIP route is exported to RIP, the | |
6132 | default tag is 0. | |
6133 | </descrip> | |
6134 | ||
6135 | <sect1>Example | |
6136 | <label id="rip-exam"> | |
6137 | ||
6138 | <p><code> | |
6139 | protocol rip { | |
6140 | ipv4 { | |
6141 | import all; | |
6142 | export all; | |
6143 | }; | |
6144 | interface "eth*" { | |
6145 | metric 2; | |
6146 | port 1520; | |
6147 | mode multicast; | |
6148 | update time 12; | |
6149 | timeout time 60; | |
6150 | authentication cryptographic; | |
6151 | password "secret" { algorithm hmac sha256; }; | |
6152 | }; | |
6153 | } | |
6154 | </code> | |
6155 | ||
6156 | ||
6157 | <sect>RPKI | |
6158 | <label id="rpki"> | |
6159 | ||
6160 | <sect1>Introduction | |
6161 | <label id="rpki-introduction"> | |
6162 | ||
6163 | <p>The Resource Public Key Infrastructure (RPKI) is mechanism for origin | |
6164 | validation of BGP routes (<rfc id="6480">). BIRD supports only so-called | |
6165 | RPKI-based origin validation. There is implemented RPKI to Router (RPKI-RTR) | |
6166 | protocol (<rfc id="6810">). It uses some of the RPKI data to allow a router to | |
6167 | verify that the autonomous system announcing an IP address prefix is in fact | |
6168 | authorized to do so. This is not crypto checked so can be violated. But it | |
6169 | should prevent the vast majority of accidental hijackings on the Internet today, | |
6170 | e.g. the famous Pakistani accidental announcement of YouTube's address space. | |
6171 | ||
6172 | <p>The RPKI-RTR protocol receives and maintains a set of ROAs from a cache | |
6173 | server (also called validator). You can validate routes (<rfc id="6483">, | |
6174 | <rfc id="6811">) using function <cf/roa_check()/ in filter and set it as import | |
6175 | filter at the BGP protocol. BIRD offers crude automatic re-validating of | |
6176 | affected routes after RPKI update, see option <ref id="proto-rpki-reload" | |
6177 | name="rpki reload">. Or you can use a BIRD client command <cf>reload in | |
6178 | <m/bgp_protocol_name/</cf> for manual call of revalidation of all routes. | |
6179 | ||
6180 | <p>The same protocol, since version 2, also receives and maintains a set | |
6181 | of ASPAs. You can then validate AS paths using function <cf/aspa_check()/ | |
6182 | in (import) filters. | |
6183 | ||
6184 | <sect1>Supported transports | |
6185 | <label id="rpki-transport"> | |
6186 | <p><itemize> | |
6187 | <item>Unprotected transport over TCP uses a port 323. The cache server | |
6188 | and BIRD router should be on the same trusted and controlled network | |
6189 | for security reasons. | |
6190 | <item>SSHv2 encrypted transport connection uses the normal SSH port | |
6191 | 22. | |
6192 | </itemize> | |
6193 | ||
6194 | <sect1>Configuration overview | |
6195 | <label id="rpki-configuration"> | |
6196 | ||
6197 | <p>We currently support just one cache server per protocol. However you can | |
6198 | define more RPKI protocols generally. | |
6199 | ||
6200 | <code> | |
6201 | protocol rpki [<name>] { | |
6202 | roa4 { table <tab>; }; | |
6203 | roa6 { table <tab>; }; | |
6204 | aspa { table <tab>; }; | |
6205 | remote <ip> | "<domain>" [port <number>]; | |
6206 | port <number>; | |
6207 | local address <ip>; | |
6208 | refresh [keep] <number>; | |
6209 | retry [keep] <number>; | |
6210 | expire [keep] <number>; | |
6211 | ignore max length <switch>; | |
6212 | min version <number>; | |
6213 | max version <number>; | |
6214 | transport tcp { | |
6215 | authentication none|md5; | |
6216 | password "<text>"; | |
6217 | }; | |
6218 | transport ssh { | |
6219 | bird private key "</path/to/id_rsa>"; | |
6220 | remote public key "</path/to/known_host>"; | |
6221 | user "<name>"; | |
6222 | }; | |
6223 | } | |
6224 | </code> | |
6225 | ||
6226 | <p>Alse note that you have to specify the ROA and ASPA channels. If you want to import | |
6227 | only IPv4 prefixes you have to specify only roa4 channel. Similarly with IPv6 | |
6228 | prefixes only. If you want to fetch both IPv4 and even IPv6 ROAs you have to | |
6229 | specify both channels. | |
6230 | ||
6231 | <sect2>RPKI protocol options | |
6232 | <label id="rpki-common-options"> | |
6233 | <p> | |
6234 | <descrip> | |
6235 | <tag><label id="rpki-remote">remote <m/ip/ | "<m/hostname/" [port <m/number/]</tag> Specifies | |
6236 | a destination address of the cache server. Can be specified by an IP | |
6237 | address or by full domain name string. Only one cache can be specified | |
6238 | per protocol. This option is required. | |
6239 | ||
6240 | <tag><label id="rpki-port">port <m/number/</tag> Specifies the port number. The default port | |
6241 | number is 323 for transport without any encryption and 22 for transport | |
6242 | with SSH encryption. | |
6243 | ||
6244 | <tag><label id="rpki-local-address">local address <m/ip/</tag> | |
6245 | Define local address we should use as a source address for the RTR session. | |
6246 | ||
6247 | <tag><label id="rpki-refresh">refresh [keep] <m/number/</tag> Time period in seconds. Tells how | |
6248 | long to wait before next attempting to poll the cache using a Serial | |
6249 | Query or a Reset Query packet. Must be lower than 86400 seconds (one | |
6250 | day). Too low value can caused a false positive detection of | |
6251 | network connection problems. A keyword <cf/keep/ suppresses updating | |
6252 | this value by a cache server. | |
6253 | Default: 3600 seconds | |
6254 | ||
6255 | <tag><label id="rpki-retry">retry [keep] <m/number/</tag> Time period in seconds between a failed | |
6256 | Serial/Reset Query and a next attempt. Maximum allowed value is 7200 | |
6257 | seconds (two hours). Too low value can caused a false positive | |
6258 | detection of network connection problems. A keyword <cf/keep/ | |
6259 | suppresses updating this value by a cache server. | |
6260 | Default: 600 seconds | |
6261 | ||
6262 | <tag><label id="rpki-expire">expire [keep] <m/number/</tag> Time period in seconds. Received | |
6263 | records are deleted if the client was unable to successfully refresh | |
6264 | data for this time period. Must be in range from 600 seconds (ten | |
6265 | minutes) to 172800 seconds (two days). A keyword <cf/keep/ | |
6266 | suppresses updating this value by a cache server. | |
6267 | Default: 7200 seconds | |
6268 | ||
6269 | <tag><label id="rpki-ignore-max-length">ignore max length <m/switch/</tag> | |
6270 | Ignore received max length in ROA records and use max value (32 or 128) | |
6271 | instead. This may be useful for implementing loose RPKI check for | |
6272 | blackholes. Default: disabled. | |
6273 | ||
6274 | <tag><label id="rpki-min-version">min version <m/number/</tag> | |
6275 | Minimal allowed version of the RTR protocol. BIRD will refuse to | |
6276 | downgrade a connection below this version and drop the session instead. | |
6277 | Default: 0 | |
6278 | ||
6279 | <tag><label id="rpki-max-version">max version <m/number/</tag> | |
6280 | Maximal allowed version of the RTR protocol. BIRD will start with this | |
6281 | version. Use this option if sending version 2 to your cache causes | |
6282 | problems. Default: 2 | |
6283 | ||
6284 | <tag><label id="rpki-transport-tcp">transport tcp { <m/TCP transport options.../ }</tag> Transport over | |
6285 | TCP, it's the default transport. Cannot be combined with a SSH transport. | |
6286 | Default: TCP, no authentication. | |
6287 | ||
6288 | <tag><label id="rpki-transport-ssh">transport ssh { <m/SSH transport options.../ }</tag> It enables a | |
6289 | SSHv2 transport encryption. Cannot be combined with a TCP transport. | |
6290 | Default: off | |
6291 | </descrip> | |
6292 | ||
6293 | <sect3>TCP transport options | |
6294 | <label id="rpki-tcp-transport-options"> | |
6295 | <p><descrip> | |
6296 | <tag><label id="rpki-tcp-authentication">authentication none|md5</tag> | |
6297 | Select authentication method to be used. <cf/none/ means no | |
6298 | authentication, <cf/md5/ is TCP-MD5 authentication (<rfc id="2385">). | |
6299 | Default: no authentication. | |
6300 | ||
6301 | <tag><label id="rpki-tcp-password">password "<m>text</m>"</tag> | |
6302 | Use this password for TCP-MD5 authentication of the RPKI-To-Router session. | |
6303 | </descrip> | |
6304 | ||
6305 | <sect3>SSH transport options | |
6306 | <label id="ssh-tcp-transport-options"> | |
6307 | <p><descrip> | |
6308 | <tag><label id="rpki-ssh-private-key">bird private key "<m>/path/to/id_rsa</m>"</tag> | |
6309 | A path to the BIRD's private SSH key for authentication. | |
6310 | It can be a <cf><m>id_rsa</m></cf> file. | |
6311 | ||
6312 | <tag><label id="rpki-ssh-remote-public-key">remote public key "<m>/path/to/known_host</m>"</tag> | |
6313 | A path to the cache's public SSH key for verification identity | |
6314 | of the cache server. It could be a path to <cf><m>known_host</m></cf> file. | |
6315 | ||
6316 | <tag><label id="rpki-ssh-user">user "<m/name/"</tag> | |
6317 | A SSH user name for authentication. This option is required. | |
6318 | </descrip> | |
6319 | ||
6320 | <sect1>Examples | |
6321 | <label id="rpki-examples"> | |
6322 | ||
6323 | <sect2>BGP origin validation | |
6324 | <label id="rpki-example-bgp-origin-validation"> | |
6325 | ||
6326 | <p>Policy: Don't import <cf/ROA_INVALID/ routes. | |
6327 | <code> | |
6328 | roa4 table r4; | |
6329 | roa6 table r6; | |
6330 | ||
6331 | protocol rpki { | |
6332 | debug all; | |
6333 | ||
6334 | roa4 { table r4; }; | |
6335 | roa6 { table r6; }; | |
6336 | ||
6337 | # Please, do not use rpki-validator.realmv6.org in production | |
6338 | remote "rpki-validator.realmv6.org" port 8282; | |
6339 | ||
6340 | retry keep 5; | |
6341 | refresh keep 30; | |
6342 | expire 600; | |
6343 | } | |
6344 | ||
6345 | filter peer_in_v4 { | |
6346 | if (roa_check(r4, net, bgp_path.last) = ROA_INVALID) then | |
6347 | { | |
6348 | print "Ignore RPKI invalid ", net, " for ASN ", bgp_path.last; | |
6349 | reject; | |
6350 | } | |
6351 | accept; | |
6352 | } | |
6353 | ||
6354 | protocol bgp { | |
6355 | debug all; | |
6356 | local as 65000; | |
6357 | neighbor 192.168.2.1 as 65001; | |
6358 | ipv4 { | |
6359 | import filter peer_in_v4; | |
6360 | export none; | |
6361 | }; | |
6362 | } | |
6363 | </code> | |
6364 | ||
6365 | <sect2>SSHv2 transport encryption | |
6366 | <label id="rpki-example-sshv2-transport-encryption"> | |
6367 | ||
6368 | <p> | |
6369 | <code> | |
6370 | roa4 table r4; | |
6371 | roa6 table r6; | |
6372 | ||
6373 | protocol rpki { | |
6374 | debug all; | |
6375 | ||
6376 | roa4 { table r4; }; | |
6377 | roa6 { table r6; }; | |
6378 | ||
6379 | remote 127.0.0.1 port 2345; | |
6380 | transport ssh { | |
6381 | bird private key "/home/birdgeek/.ssh/id_rsa"; | |
6382 | remote public key "/home/birdgeek/.ssh/known_hosts"; | |
6383 | user "birdgeek"; | |
6384 | }; | |
6385 | ||
6386 | # Default interval values | |
6387 | } | |
6388 | </code> | |
6389 | ||
6390 | ||
6391 | <sect>Static | |
6392 | <label id="static"> | |
6393 | ||
6394 | <p>The Static protocol doesn't communicate with other routers in the network, | |
6395 | but instead it allows you to define routes manually. This is often used for | |
6396 | specifying how to forward packets to parts of the network which don't use | |
6397 | dynamic routing at all and also for defining sink routes (i.e., those telling to | |
6398 | return packets as undeliverable if they are in your IP block, you don't have any | |
6399 | specific destination for them and you don't want to send them out through the | |
6400 | default route to prevent routing loops). | |
6401 | ||
6402 | <p>There are three classes of definitions in Static protocol configuration -- | |
6403 | global options, static route definitions, and per-route options. Usually, the | |
6404 | definition of the protocol contains mainly a list of static routes. Static | |
6405 | routes have no specific attributes, but <ref id="rta-igp-metric" name="igp_metric"> | |
6406 | attribute is used to compare static routes with the same preference. | |
6407 | ||
6408 | <p>The list of static routes may contain multiple routes for the same network | |
6409 | (usually, but not necessary, distinquished by <cf/preference/ or <cf/igp_metric/), | |
6410 | but only routes of the same network type are allowed, as the static protocol | |
6411 | has just one channel. E.g., to have both IPv4 and IPv6 static routes, define two | |
6412 | static protocols, each with appropriate routes and channel. | |
6413 | ||
6414 | <p>The Static protocol can be configured as MPLS-aware (by defining both the | |
6415 | primary channel and MPLS channel). In that case the Static protocol assigns | |
6416 | labels to IP routes and automatically announces corresponding MPLS route for | |
6417 | each labeled route. | |
6418 | ||
6419 | <p>Global options: | |
6420 | ||
6421 | <descrip> | |
6422 | <tag><label id="static-check-link">check link <m/switch/</tag> | |
6423 | If set, hardware link states of network interfaces are taken into | |
6424 | consideration. When link disappears (e.g. ethernet cable is unplugged), | |
6425 | static routes directing to that interface are removed. It is possible | |
6426 | that some hardware drivers or platforms do not implement this feature. | |
6427 | Default: off. | |
6428 | ||
6429 | <tag><label id="static-igp-table">igp table <m/name/</tag> | |
6430 | Specifies a table that is used for route table lookups of recursive | |
6431 | routes. Default: the same table as the protocol is connected to. | |
6432 | </descrip> | |
6433 | ||
6434 | <p>Route definitions (each may also contain a block of per-route options): | |
6435 | ||
6436 | <sect1>Regular routes; MPLS switching rules | |
6437 | <label id="static-mpls-rules"> | |
6438 | ||
6439 | <p>There exist several types of routes; keep in mind that <m/prefix/ syntax is | |
6440 | <ref id="type-prefix" name="dependent on network type">. | |
6441 | ||
6442 | <descrip> | |
6443 | <tag><label id="static-route-regular">route <m/prefix/ [mpls <m/number/] via <m/ip/|<m/"interface"/ [<m/per-nexthop options/] [via ...]</tag> | |
6444 | Regular routes may bear one or more <ref id="route-next-hop" name="next | |
6445 | hops">. Every next hop is preceded by <cf/via/ and configured as shown. | |
6446 | ||
6447 | When the Static protocol is MPLS-aware, the optional <cf/mpls/ statement | |
6448 | after <m/prefix/ specifies a static label for the labeled route, instead | |
6449 | of using dynamically allocated label. | |
6450 | ||
6451 | <tag><label id="static-route-recursive">route <m/prefix/ [mpls <m/number/] recursive <m/ip/ [mpls <m/number/[/<m/number/[/<m/number/[...]]]]</tag> | |
6452 | Recursive nexthop resolves the given IP in the configured IGP table and | |
6453 | uses that route's next hop. The MPLS stacks are concatenated; on top is | |
6454 | the IGP's nexthop stack and on bottom is this route's stack. | |
6455 | ||
6456 | <tag><label id="static-route-special">route <m/prefix/ [mpls <m/number/] blackhole|unreachable|prohibit</tag> | |
6457 | Special routes specifying to silently drop the packet, return it as | |
6458 | unreachable or return it as administratively prohibited. First two | |
6459 | targets are also known as <cf/drop/ and <cf/reject/. | |
6460 | </descrip> | |
6461 | ||
6462 | <p>When the particular destination is not available (the interface is down or | |
6463 | the next hop of the route is not a neighbor at the moment), Static just | |
6464 | uninstalls the route from the table it is connected to and adds it again as soon | |
6465 | as the destination becomes adjacent again. | |
6466 | ||
6467 | <sect2>Per-nexthop options | |
6468 | <label id="static-per-nexthop-options"> | |
6469 | ||
6470 | <p>There are several options that in a case of multipath route are per-nexthop | |
6471 | (i.e., they can be used multiple times for a route, one time for each nexthop). | |
6472 | Syntactically, they are not separate options but just parts of <cf/route/ | |
6473 | statement after each <cf/via/ statement, not separated by semicolons. E.g., | |
6474 | statement <cf>route 10.0.0.0/8 via 192.0.2.1 bfd weight 1 via 192.0.2.2 weight | |
6475 | 2;</cf> describes a route with two nexthops, the first nexthop has two per-nexthop | |
6476 | options (<cf/bfd/ and <cf/weight 1/), the second nexthop has just <cf/weight 2/. | |
6477 | ||
6478 | <descrip> | |
6479 | <tag><label id="static-route-bfd">bfd <m/switch/</tag> | |
6480 | The Static protocol could use BFD protocol for next hop liveness | |
6481 | detection. If enabled, a BFD session to the route next hop is created | |
6482 | and the static route is BFD-controlled -- the static route is announced | |
6483 | only if the next hop liveness is confirmed by BFD. If the BFD session | |
6484 | fails, the static route (or just the affected nexthop from multiple | |
6485 | ones) is removed. Note that this is a bit different compared to other | |
6486 | protocols, which may use BFD as an advisory mechanism for fast failure | |
6487 | detection but ignore it if a BFD session is not even established. Note | |
6488 | that BFD protocol also has to be configured, see <ref id="bfd" name="BFD"> | |
6489 | section for details. Default value is no. | |
6490 | ||
6491 | <tag><label id="static-route-dev">dev <m/text/</tag> | |
6492 | The outgoing interface associated with the nexthop. Useful for | |
6493 | link-local nexthop addresses or when multiple interfaces use the same | |
6494 | network prefix. By default, the outgoing interface is resolved from the | |
6495 | nexthop address. | |
6496 | ||
6497 | <tag><label id="static-route-mpls">mpls <m/number/[/<m/number/[/<m/number/[...]]]</tag> | |
6498 | MPLS labels that should be pushed to packets forwarded by the route. | |
6499 | The option could be used for both IP routes (on MPLS ingress routers) | |
6500 | and MPLS switching rules (on MPLS transit routers). Default value is | |
6501 | no labels. | |
6502 | ||
6503 | <tag><label id="static-route-onlink">onlink <m/switch/</tag> | |
6504 | Onlink flag means that the specified nexthop is accessible on the | |
6505 | (specified) interface regardless of IP prefixes of the interface. The | |
6506 | interface must be attached to nexthop IP address using link-local-scope | |
6507 | format (e.g. <cf/192.0.2.1%eth0/). Default value is no. | |
6508 | ||
6509 | <tag><label id="static-route-weight">weight <m/switch/</tag> | |
6510 | For multipath routes, this value specifies a relative weight of the | |
6511 | nexthop. Allowed values are 1-256. Default value is 1. | |
6512 | </descrip> | |
6513 | ||
6514 | <sect1>Route Origin Authorization | |
6515 | <label id="static-route-origin-authorization"> | |
6516 | ||
6517 | <p>The ROA config is just <cf>route <m/prefix/ max <m/int/ as <m/int/</cf> with no nexthop. | |
6518 | ||
6519 | <sect1>Autonomous System Provider Authorization | |
6520 | <label id="static-autonomous-system-provider-authorization"> | |
6521 | ||
6522 | <p>The ASPA config is <cf>route aspa <m/int/ providers <m/int/ [, <m/int/ ...]</cf> with no nexthop. | |
6523 | The first ASN is client and the following are a list of providers. | |
6524 | For a transit, you can also write <cf>route aspa <m/int/ transit</cf> to get | |
6525 | the no-provider ASPA. | |
6526 | ||
6527 | <sect1>Flowspec Network Type | |
6528 | <label id="static-flowspec-network-type"> | |
6529 | ||
6530 | <p>The flow specification are rules for routers and firewalls for filtering | |
6531 | purpose. It is described by <rfc id="8955"> and <rfc id="8956">. There are 3 types of arguments: | |
6532 | <m/inet4/ or <m/inet6/ prefixes, numeric matching expressions and bitmask | |
6533 | matching expressions. | |
6534 | ||
6535 | <p>Numeric matching is a matching sequence of numbers and ranges separeted by a | |
6536 | commas (<cf/,/) (e.g. <cf/10,20,30/). Ranges can be written using double dots | |
6537 | <cf/../ notation (e.g. <cf/80..90,120..124/). An alternative notation are | |
6538 | sequence of one or more pairs of relational operators and values separated by | |
6539 | logical operators <cf/&&/ or <cf/||/. Allowed relational operators are <cf/=/, | |
6540 | <cf/!=/, <cf/</, <cf/<=/, <cf/>/, <cf/>=/, <cf/true/ and <cf/false/. | |
6541 | ||
6542 | <p>Bitmask matching is written using <m/value/<cf>/</cf><m/mask/ or | |
6543 | <cf/!/<m/value/<cf>/</cf><m/mask/ pairs. It means that <cf/(/<m/data/ <cf/&/ | |
6544 | <m/mask/<cf/)/ is or is not equal to <m/value/. It is also possible to use | |
6545 | multiple value/mask pairs connected by logical operators <cf/&&/ or <cf/||/. | |
6546 | Note that for negated matches, value must be either zero or equal to bitmask | |
6547 | (e.g. <cf>!0x0/0xf</cf> or <cf>!0xf/0xf</cf>, but not <cf>!0x3/0xf</cf>). | |
6548 | ||
6549 | <sect2>IPv4 Flowspec | |
6550 | <label id="static-flowspec-ipv4"> | |
6551 | ||
6552 | <p><descrip> | |
6553 | <tag><label id="flow-dst">dst <m/inet4/</tag> | |
6554 | Set a matching destination prefix (e.g. <cf>dst 192.168.0.0/16</cf>). | |
6555 | Only this option is mandatory in IPv4 Flowspec. | |
6556 | ||
6557 | <tag><label id="flow-src">src <m/inet4/</tag> | |
6558 | Set a matching source prefix (e.g. <cf>src 10.0.0.0/8</cf>). | |
6559 | ||
6560 | <tag><label id="flow-proto">proto <m/numbers-match/</tag> | |
6561 | Set a matching IP protocol numbers (e.g. <cf/proto 6/). | |
6562 | ||
6563 | <tag><label id="flow-port">port <m/numbers-match/</tag> | |
6564 | Set a matching source or destination TCP/UDP port numbers (e.g. | |
6565 | <cf>port 1..1023,1194,3306</cf>). | |
6566 | ||
6567 | <tag><label id="flow-dport">dport <m/numbers-match/</tag> | |
6568 | Set a matching destination port numbers (e.g. <cf>dport 49151</cf>). | |
6569 | ||
6570 | <tag><label id="flow-sport">sport <m/numbers-match/</tag> | |
6571 | Set a matching source port numbers (e.g. <cf>sport = 0</cf>). | |
6572 | ||
6573 | <tag><label id="flow-icmp-type">icmp type <m/numbers-match/</tag> | |
6574 | Set a matching type field number of an ICMP packet (e.g. <cf>icmp type | |
6575 | 3</cf>) | |
6576 | ||
6577 | <tag><label id="flow-icmp-code">icmp code <m/numbers-match/</tag> | |
6578 | Set a matching code field number of an ICMP packet (e.g. <cf>icmp code | |
6579 | 1</cf>) | |
6580 | ||
6581 | <tag><label id="flow-tcp-flags">tcp flags <m/bitmask-match/</tag> | |
6582 | Set a matching bitmask for TCP header flags (aka control bits) (e.g. | |
6583 | <cf>tcp flags 0x03/0x0f;</cf>). The maximum length of mask is 12 bits | |
6584 | (0xfff). | |
6585 | ||
6586 | <tag><label id="flow-length">length <m/numbers-match/</tag> | |
6587 | Set a matching packet length (e.g. <cf>length > 1500</cf>) | |
6588 | ||
6589 | <tag><label id="flow-dscp">dscp <m/numbers-match/</tag> | |
6590 | Set a matching DiffServ Code Point number (e.g. <cf>dscp 8..15</cf>). | |
6591 | ||
6592 | <tag><label id="flow-fragment">fragment <m/fragmentation-type/</tag> | |
6593 | Set a matching type of packet fragmentation. Allowed fragmentation | |
6594 | types are <cf/dont_fragment/, <cf/is_fragment/, <cf/first_fragment/, | |
6595 | <cf/last_fragment/ (e.g. <cf>fragment is_fragment && | |
6596 | !dont_fragment</cf>). | |
6597 | </descrip> | |
6598 | ||
6599 | <p><code> | |
6600 | protocol static { | |
6601 | flow4; | |
6602 | ||
6603 | route flow4 { | |
6604 | dst 10.0.0.0/8; | |
6605 | port > 24 && < 30 || 40..50,60..70,80 && >= 90; | |
6606 | tcp flags 0x03/0x0f; | |
6607 | length > 1024; | |
6608 | dscp = 63; | |
6609 | fragment dont_fragment, is_fragment || !first_fragment; | |
6610 | }; | |
6611 | } | |
6612 | </code> | |
6613 | ||
6614 | <sect2>Differences for IPv6 Flowspec | |
6615 | <label id="static-flowspec-ipv6"> | |
6616 | ||
6617 | <p>Flowspec IPv6 are same as Flowspec IPv4 with a few exceptions. | |
6618 | <itemize> | |
6619 | <item>Prefixes <m/inet6/ can be specified not only with prefix length, | |
6620 | but with prefix <cf/offset/ <m/number/ too (e.g. | |
6621 | <cf>::1234:5678:9800:0000/101 offset 64</cf>). Offset means to don't | |
6622 | care of <m/number/ first bits. | |
6623 | <item>IPv6 Flowspec hasn't mandatory any flowspec component. | |
6624 | <item>In IPv6 packets, there is a matching the last next header value | |
6625 | for a matching IP protocol number (e.g. <cf>next header 6</cf>). | |
6626 | <item>It is not possible to set <cf>dont_fragment</cf> as a type of | |
6627 | packet fragmentation. | |
6628 | </itemize> | |
6629 | ||
6630 | <p><descrip> | |
6631 | <tag><label id="flow6-dst">dst <m/inet6/ [offset <m/number/]</tag> | |
6632 | Set a matching destination IPv6 prefix (e.g. <cf>dst | |
6633 | ::1c77:3769:27ad:a11a/128 offset 64</cf>). | |
6634 | ||
6635 | <tag><label id="flow6-src">src <m/inet6/ [offset <m/number/]</tag> | |
6636 | Set a matching source IPv6 prefix (e.g. <cf>src fe80::/64</cf>). | |
6637 | ||
6638 | <tag><label id="flow6-next-header">next header <m/numbers-match/</tag> | |
6639 | Set a matching IP protocol numbers (e.g. <cf>next header != 6</cf>). | |
6640 | ||
6641 | <tag><label id="flow6-label">label <m/numbers-match/</tag> | |
6642 | Set numbers for matching the 20-bit Flow Label field in IPv6 packets | |
6643 | (e.g. <cf>label != 1234</cf>). | |
6644 | </descrip> | |
6645 | ||
6646 | <p><code> | |
6647 | protocol static { | |
6648 | flow6 { table myflow6; }; | |
6649 | ||
6650 | route flow6 { | |
6651 | dst fec0:1122:3344:5566:7788:99aa:bbcc:ddee/128; | |
6652 | src 0000:0000:0000:0001:1234:5678:9800:0000/101 offset 63; | |
6653 | next header = 23; | |
6654 | sport > 24 && < 30 || = 40 || 50,60,70..80; | |
6655 | dport = 50; | |
6656 | tcp flags 0x03/0x0f && !0/0xff || 0x33/0x33; | |
6657 | fragment !is_fragment || !first_fragment; | |
6658 | label > 1111 && != 1234; | |
6659 | }; | |
6660 | } | |
6661 | </code> | |
6662 | ||
6663 | <sect1>Per-route options | |
6664 | <label id="static-per-route-options"> | |
6665 | <p> | |
6666 | <descrip> | |
6667 | <tag><label id="static-route-filter"><m/filter expression/</tag> | |
6668 | This is a special option that allows filter expressions to be configured | |
6669 | on per-route basis. Can be used multiple times. These expressions are | |
6670 | evaluated when the route is originated, similarly to the import filter | |
6671 | of the static protocol. This is especially useful for configuring route | |
6672 | attributes, e.g., <cf/ospf_metric1 = 100;/ for a route that will be | |
6673 | exported to the OSPF protocol. | |
6674 | </descrip> | |
6675 | ||
6676 | <sect1>Example static configs | |
6677 | <label id="static-example"> | |
6678 | ||
6679 | <p><code> | |
6680 | protocol static { | |
6681 | ipv4 { table testable; }; # Connect to a non-default routing table | |
6682 | check link; # Advertise routes only if link is up | |
6683 | route 0.0.0.0/0 via 198.51.100.130; # Default route | |
6684 | route 10.0.0.0/8 # Multipath route | |
6685 | via 198.51.100.10 weight 2 | |
6686 | via 198.51.100.20 bfd # BFD-controlled next hop | |
6687 | via 192.0.2.1; | |
6688 | route 203.0.113.0/24 blackhole; # Sink route | |
6689 | route 10.2.0.0/24 via "arc0"; # Direct route | |
6690 | route 10.2.2.0/24 via 192.0.2.1 dev "eth0" onlink; # Route with both nexthop and iface | |
6691 | route 192.168.10.0/24 via 198.51.100.100 { | |
6692 | ospf_metric1 = 20; # Set extended attribute | |
6693 | }; | |
6694 | route 192.168.11.0/24 via 198.51.100.100 { | |
6695 | ospf_metric2 = 100; # Set extended attribute | |
6696 | ospf_tag = 2; # Set extended attribute | |
6697 | }; | |
6698 | route 192.168.12.0/24 via 198.51.100.100 { | |
6699 | bgp_community.add((65535, 65281)); # Set extended BGP attribute | |
6700 | bgp_large_community.add((64512, 1, 1)); # Set extended BGP attribute | |
6701 | }; | |
6702 | } | |
6703 | ||
6704 | protocol static { | |
6705 | ipv6; # Channel is mandatory | |
6706 | route 2001:db8:10::/48 via 2001:db8:1::1; # Route with global nexthop | |
6707 | route 2001:db8:20::/48 via fe80::10%eth0; # Route with link-local nexthop | |
6708 | route 2001:db8:30::/48 via fe80::20%'eth1.60'; # Iface with non-alphanumeric characters | |
6709 | route 2001:db8:40::/48 via fe80::30 dev "eth1"; # Another link-local nexthop | |
6710 | route 2001:db8:50::/48 via "eth2"; # Direct route to eth2 | |
6711 | route 2001:db8::/32 unreachable; # Unreachable route | |
6712 | route ::/0 via 2001:db8:1::1 bfd; # BFD-controlled default route | |
6713 | } | |
6714 | </code> | |
6715 | ||
6716 | ||
6717 | <chapt>Conclusions | |
6718 | <label id="conclusion"> | |
6719 | ||
6720 | <sect>Future work | |
6721 | <label id="future-work"> | |
6722 | ||
6723 | <p>Although BIRD supports all the commonly used routing protocols, there are | |
6724 | still some features which would surely deserve to be implemented in future | |
6725 | versions of BIRD: | |
6726 | ||
6727 | <itemize> | |
6728 | <item>Opaque LSA's | |
6729 | <item>Route aggregation and flap dampening | |
6730 | <item>Multicast routing protocols | |
6731 | <item>Ports to other systems | |
6732 | </itemize> | |
6733 | ||
6734 | ||
6735 | <sect>Getting more help | |
6736 | <label id="help"> | |
6737 | ||
6738 | <p>If you use BIRD, you're welcome to join the bird-users mailing list | |
6739 | (<HTMLURL URL="mailto:bird-users@network.cz" name="bird-users@network.cz">) | |
6740 | where you can share your experiences with the other users and consult | |
6741 | your problems with the authors. To subscribe to the list, visit | |
6742 | <HTMLURL URL="http://bird.network.cz/?m_list" name="http://bird.network.cz/?m_list">. | |
6743 | The home page of BIRD can be found at <HTMLURL URL="http://bird.network.cz/" name="http://bird.network.cz/">. | |
6744 | ||
6745 | <p>BIRD is a relatively young system and it probably contains some bugs. You can | |
6746 | report any problems to the bird-users list and the authors will be glad to solve | |
6747 | them, but before you do so, please make sure you have read the available | |
6748 | documentation and that you are running the latest version (available at | |
6749 | <HTMLURL URL="ftp://bird.network.cz/pub/bird" name="bird.network.cz:/pub/bird">). | |
6750 | (Of course, a patch which fixes the bug is always welcome as an attachment.) | |
6751 | ||
6752 | <p>If you want to understand what is going inside, Internet standards are a good | |
6753 | and interesting reading. You can get them from | |
6754 | <HTMLURL URL="ftp://ftp.rfc-editor.org/" name="ftp.rfc-editor.org"> (or a | |
6755 | nicely sorted version from <HTMLURL URL="ftp://atrey.karlin.mff.cuni.cz/pub/rfc" | |
6756 | name="atrey.karlin.mff.cuni.cz:/pub/rfc">). | |
6757 | ||
6758 | <p><it/Good luck!/ | |
6759 | ||
6760 | </book> | |
6761 | ||
6762 | <!-- | |
6763 | LocalWords: GPL IPv GateD BGPv RIPv OSPFv Linux sgml html dvi sgmltools | |
6764 | LocalWords: linuxdoc dtd descrip config conf syslog stderr auth ospf bgp Mbps | |
6765 | LocalWords: router's eval expr num birdc ctl UNIX if's enums bool int ip GCC | |
6766 | LocalWords: len ipaddress pxlen netmask enum bgppath bgpmask clist gw md eth | |
6767 | LocalWords: RTS printn quitbird iBGP AS'es eBGP RFC multiprotocol IGP | |
6768 | LocalWords: EGP misconfigurations keepalive pref aggr aggregator BIRD's RTC | |
6769 | LocalWords: OS'es AS's multicast nolisten misconfigured UID blackhole MRTD MTU | |
6770 | LocalWords: uninstalls ethernets IP binutils ANYCAST anycast dest RTD ICMP rfc | |
6771 | LocalWords: compat multicasts nonbroadcast pointopoint loopback sym stats | |
6772 | LocalWords: Perl SIGHUP dd mm yy HH MM SS EXT IA UNICAST multihop Discriminator txt | |
6773 | LocalWords: proto wildcard | |
6774 | --> |