summaryrefslogtreecommitdiffstats
path: root/bird-openwrt/DOCUMENTATION
blob: a55e27108d627768d32255d3f09b2d36a1758c27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
---------------------------------------------------------------------

Copyright (C) 2014 - Eloi Carbó Solé (GSoC2014) 
BGP/Bird integration with OpenWRT

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

---------------------------------------------------------------------

*** Original documentation for BIRD Daemon can be found here: http://bird.network.cz/?get_doc
*** Some interesting examples are placed in BIRD daemon Gitlab page: https://gitlab.labs.nic.cz/labs/bird/wikis/home
*** If you want to add new options to bird*-openwrt packages,
*** feel free to make a pull request it in: https://github.com/openwrt-routing/packages/bird-openwrt
*** or email me and ask for it: eloicaso@openmailbox.org

- Options used in /etc/config/birdX -

---------------------------------------------------------------------
CONFIGURATION SECTION 1: 'bird'
---------------------------------------------------------------------

Example 
--
config bird 'bird'
    option use_UCI_config '1'
    option UCI_config_file '/tmp/bird4.conf'
--

* use_UCI_config: Boolean
This option allows you to use UCI configuration translation file instead of the original Bird one. If true/1, birdX init.d script will use the translation placed in "UCI_config_file". Otherwise, it will use the default "/etc/birdX.conf" configuration.
[Hint] This could be used to allow multiple configurations and swap them easily.
Default: 0

* UCI_config_file: String (File path)
This option sets where will be placed the translation of the UCI configuration file. 
Default: /tmp/birdX.conf



---------------------------------------------------------------------
CONFIGURATION SECTION 2: 'global NAME'
---------------------------------------------------------------------

Example
--
config global 'global'
    option log_file '/tmp/bird4.log'
    option log 'all'
    option debug 'off'
    option router_id '172.16.1.6'
--

* log_file: String (File path)
This option sets the path of the file used to save Bird Log and Debug's information.
Default: /tmp/birdX.log

* log: String/Enumeration (all/off, info, warning, error, fatal, debug, trace, remote, auth, bug)
This option allows you to set which information you want to save in the 
[HINT] Use the enumeration like: { info, waning, error }
Default: all

* debug: String/Enumeration ( all/off, states, routes, filters, interfaces, events, packets)
This option allows you to set which debug information will be saved in the "log_file" file.
[HINT] Use the enumeration like: { info, waning, error }
Default: off

* router_id: IP Address
This option sets which will be the Router ID. Usually is the lowest IP address (not loopback) among the existing interfaces.
[HINT] In IPv4 this field is optional. In IPv6 is mandatory.

* listen_bgp_addr: IP Address
This option sets the IP address that Bird BGP instances will listen by default.
Default: 0.0.0.0

* listen_bgp_port: Integer (Port)
This option sets the port that Bird BGP instances will listen by default.
Default: 179

[IPv6 only]
* listen_bgp_dual: Boolean
This option sets if Bird6 BGP instances will listen only to IPv6 or IPv4/6 BGP routes.



---------------------------------------------------------------------
CONFIGURATION SECTION 3: 'table'
---------------------------------------------------------------------

Example
--
config table
    option name 'aux'
--

* name: String
This option allows you to set the name of the auxiliar kernel tables used for Bird.



---------------------------------------------------------------------
CONFIGURATION SECTION 4: 'kernel NAME'
---------------------------------------------------------------------

Example
--
config kernel kernel1
    option table 'aux'
    option import 'all'
    option export 'all'
    option kernel_table '100'
    option scan_time '10'
    option learn '1'
    option persist '0'
    option disabled '0'
--

* table: String
Set an auxiliary table for the current kernel routing instance. This table MUST exist as a SECTION 3 instance.
[HINT] If there is an Kernel protocol instance that uses the "main" kernel table (not using table/kernel_table options), this should be included before the rest of Kernel instances (which will use auxiliary tables).

* import: String/Filter function
This option delimits which routes coming from other protocols will be accepted. This option allows filters in different manners:
1. All/none: allows to import all the routes or none of them.
2. Filter name: [import 'bgp_filter_in'] the protocol will use the filter with the Filter name. (Needs an existing filter declared in the UCI configuration file)

* export: String/Filter function
This option delimits which routes going out from the protocol. This option allows filters in different manners:
1. All/none: allows to export all the routes or none of them.
2. Filter name: [export 'bgp_filter_out'] the protocol will use the filter with the 'Filter name'. (Needs an existing filter declared in the UCI configuration file)

* kernel_table: Integer
This option sets the identification number of the Kernel table that will be used instead of the main one.
Default: main table (254)

* scan_time: Integer
This option sets the time between checks to the selected kernel table.

* learn: Boolean
Set if the kernel table will add the routes from other routing protocols or the system administrator.

* persist: Boolean
Set if Bird Daemon will save the known routes when exiting or if it will clean the routing table.

* disable: Boolean
This option sets if the protocol will be used or dismissed.
Default: 0



---------------------------------------------------------------------
CONFIGURATION SECTION 5: 'device NAME'
---------------------------------------------------------------------

Example
--
config device device1
    option scan_time '10'
    option disabled '0'
--

* scan_time: Integer
This option sets the time between checks to the selected kernel table.

* disable: Boolean
This option sets if the protocol will be used or dismissed.
Default: 0



CONFIGURATION SECTION 6: 'static NAME'

Example
--
config static static1
    option table 'aux'
    option disabled '0'
--

* table: String
Set an auxiliary table for the current static instance. This table MUST exist as a SECTION 3 instance.
[HINT] If there is an static instance that uses the "main" kernel table (not using table/kernel_table options), this should be included before the rest of static instances (which will use auxiliary tables).

* disable: Boolean
This option sets if the protocol will be used or dismissed.
Default: 0



---------------------------------------------------------------------
CONFIGURATION SECTION 7 & 8: 'bgp NAME' & 'bgp_template NAME'
---------------------------------------------------------------------

This section merges two different configuration sections: bgp instances and templates. The first one is the basic bgp configuration part and the second one is the template used to minimize the number of options written in the configuration file. Both configuration sections has the same options, but when Bird found duplicities, the bgp instance has priority over the template.

Examples

-- instance --
config bgp bgp1
    option template 'bgp_common'
    option description 'Description of the BGP instance'
    option neighbor_address '172.16.1.5'
    option neighbor_as '65530'
    option source_address '172.16.1.6'
    option next_hop_self '0'
    option next_hop_keep '0'
    option rr_client '1'
    option rr_cluster_id '172.16.1.6'
--
-- template --
config bgp_template bgp_common
    option table 'aux'
    option import 'all'
    option export 'all'
    option local_address '172.16.1.6'
    option local_as '65001'
    option import_limit '100'
    option import_limit_action 'warn'
    option export_limit '100'
    option export_limit_action 'warn'
    option receive_limit '100'
    option receive_limit_action 'warn'
    option disabled '0'
--

* template: String
This option states the template used for current BGP instance. This template MUST exist as a SECTION 8 instance.

* description: String
This option allows to add a description of the bgp instance and its function

* local_addr: IP address
This optional option allows to set the IP source of our Autonomous System (AS).

* local_as: Integer
This option allows to set the identification number of our AS number. This option is mandatory for each BGP instance.

* neighbor_addr: IP address 
Each BGP instance has a neighbor connected to. This option allows to set its IP address

* neighbor_as: Integer
Each BGP instance has a neighbor connected to. This option allows to set its AS ID.

* next_hop_self: Boolean
If this option is true, BGP protocol will avoid to calculate the next hop and always advertise own "Router id" IP .
Default: 0

* next_hop_keep: Boolean
If this option is true, BGP will always use the received next_hop information to redirect the route.
Default: 0

* rr_client: Boolean
IF this option is true, the router will be set as Route Reflector and will treat the rest of the routers as RR clients.
Default: 0

* rr_cluster_id: Integer
This option sets the identification number of the RR cluster. All the nodes in a cluster needs this option and share the same number.
Default: Router id

* import_limit: Integer
This option sets the limit of routes that a protocol can import until take the action indicated in the import_limit_action.
import_limit also counts filtered routes (even dropped).
Default: 0 (no limit)

* import_limit_action: String
This option allows to decide the action to take when reached the limit of imported routes.
Actions are: warn, block, restart, disable

* export_limit: Integer
This option sets the limit of routes that a protocol can export until take the action indicated in the export_limit_action.
Default: 0 (no limit)

* export_limit_action: String
This option allows to decide the action to take when reached the limit of exported routes.
Actions are: warn, block, restart, disable

* receive_limit: Integer
This option sets the limit of routes that a protocol can receive until take the action indicated in the receive_limit_action. receive_limit only counts accepted routes from the protocol.
Default: 0 (no limit)

* receive_limit_action: String
This option allows to decide the action to take when reached the limit of received routes.
Actions are: warn, block, restart, disable

* disable: Boolean
This option sets if the protocol will be used or dismissed.
Default: 0



---------------------------------------------------------------------
CONFIGURATION SECTION 9: 'route' 
---------------------------------------------------------------------

Example
--
config route
    option instance 'static1'
    option type 'router'
    option prefix '192.168.9.0/24'
    option via '10.99.105.159'

config route
    option instance 'static1'
    option type 'special'
    option prefix '192.168.2.0/24'
    option attribute 'unreachable'

config route
    option instance 'static1'
    option type 'iface'
    option prefix '192.168.3.0/24'
    option iface 'mgmt0'

config route
    option instance 'static1'
    option type 'recursive'
    option prefix '192.168.4.0/24'
    option ip '192.168.1.1'

config route
    option instance 'static1'
    option type 'multipath'
    option prefix '192.168.30.0/24'
    list l_via '172.16.1.5'
    list l_via '172.16.1.6'
--

* instance: String
This option indicates the route that the static protocol instance will apply.

* type: String
This option states the type of route that will be applied. Also defines the options available for it.
Types are: 'router', 'special', 'iface', 'recursive' or 'multipath'.

* prefix: IP address/network
This option allows to define the network that you want to define.

[router only]
* via: IP Address
This option indicates the IP address of the neighbor router where the routes will pass through.

[special only]
* attribute: String
This option will mark the behaviour of the route.
Attribures are: 'blackhole', 'unreachable' or 'prohibit'.

[iface only]
* iface: String
This option indicates the interface used to redirect the BGP routes. Careful, the interface MUST exist, or Bird will fail to start.

[recursive only]
* ip: IP address
This option states the IP address which the next hop will depend on.

[multipath only][This is a list, not an option. Use it as in the example, or check the UCI configuration documentation.]
* l_via: IP address
This list of IPs specifies the list (following the sequence) of routers that the route will follow as next hops.



---------------------------------------------------------------------
CONFIGURATION SECTION 10: 'filter NAME' 
---------------------------------------------------------------------

Filters are written in separated files. Its syntax can be found in http://bird.network.cz/?get_doc&f=bird-5.html
The content of each filter file is copied in the birdX.conf file without checking its syntax.

Example
--
config filter 'firstFilter'
    option type 'bgp'
    option instance 'bgp1'
    option file_path '/var/filters/f1'
--

* type: String
The type indicates to which routing protocol is the filter directed to. Currently only BGP is available.

* instance: String
This option indicates the filter that the routing protocol instance will apply.

* file_path: String (File path)
This option specifies the path to the filter file to be used in the routing protocol.



---------------------------------------------------------------------
COMPLETE CONFIGURATION EXAMPLE:
---------------------------------------------------------------------

config bird 'bird'
    option use_UCI_config '1'
        #Caution! Enabling this option, Bird will translate this
        #UCI file and use it instead of /etc/bird4.conf
    option UCI_config_file '/tmp/bird4.conf'
        #If you enable useUCIconfig, UCIconfigFile will be Bird's
        #configuration file location.

config global 'global'
    option log_file '/tmp/bird4.log'
    option log 'all'
    option debug 'off'
    option router_id '172.16.1.6'

config table
    option name 'aux'
    
config kernel kernel1
    option table 'aux'
    option import 'all'
    option export 'all'
    option kernel_table '100'
    option scan_time '10'
    option learn '1'
    option persist '0'
    option disabled '0'

config device device1
    option scan_time '10'
    option disabled '0'

config static static1
    option table 'aux'
    option disabled '0'

config bgp bgp1
    option template 'bgp_common'
    option description 'Description of the BGP instance'
    option neighbor_address '172.16.1.5'
    option neighbor_as '65530'
    option source_address '172.16.1.6'
    option next_hop_self '0'
    option next_hop_keep '0'
    option rr_client '1'
    option rr_cluster_id '172.16.1.6'

config bgp_template bgp_common
    option table 'aux'
    option import 'all'
    option export 'all'
    option local_address '172.16.1.6'
    option local_as '65001'
    option import_limit '100'
    option import_limit_action 'warn'
    option export_limit '100'
    option export_limit_action 'warn'
    option receive_limit '100'
    option receive_limit_action 'warn'
    option disabled '0'

#config ospf ospf1
#    option cfg1583compat '1'
#
#config ospf_area '0.0.0.0'
#    option instance 'ospf1'
#    option stub '0'
#
#config ospf_interface '*'
#    option area '0.0.0.0'
#    option cost '100'
#    option type 'broadcast'
#    option hello '5'
#    option password '1'
#
#config ospf_password '1'
#    option authentication 'cryptographic'
#    option passphrase '1234'
#
#config ospf_networks
#    option area '0.0.0.0'
#    list prefix '10.0.0.0/24'
#
#config ospf_hidden_networks
#    option area '0.0.0.0'
#    option prefix '12.0.0.0/24'
#
#config ospf_stubnet '11.0.0.0/24'
#    option area '0.0.0.0'
#    option hidden '0'
#    option summary '0'
#    option cost '101'
#

config route
    option instance 'static1'
    option type 'router'
    option prefix '192.168.9.0/24'
    option via '10.99.105.159'

config route
    option instance 'static1'
    option type 'special'
    option prefix '192.168.2.0/24'
    option attribute 'unreachable'

config route
    option instance 'static1'
    option type 'iface'
    option prefix '192.168.3.0/24'
    option iface 'mgmt0'

config route
    option instance 'static1'
    option type 'recursive'
    option prefix '192.168.4.0/24'
    option ip '192.168.1.1'

config route
    option instance 'static1'
    option type 'multipath'
    option prefix '192.168.30.0/24'
    list l_via '172.16.1.5'
    list l_via '172.16.1.6'

config filter 'firstFilter'
    option type 'bgp'
    option instance 'bgp1'
    option file_path '/var/filters/f1'