]> git.proxmox.com Git - mirror_frr.git/blob - doc/user/bgp.rst
doc: remove trailing whitespace
[mirror_frr.git] / doc / user / bgp.rst
1 .. _BGP:
2
3 ***
4 BGP
5 ***
6
7 :abbr:`BGP` stands for a Border Gateway Protocol. The lastest BGP version is 4.
8 It is referred as BGP-4. BGP-4 is one of the Exterior Gateway Protocols and
9 de-fact standard of Inter Domain routing protocol. BGP-4 is described in
10 :rfc:`1771`.
11
12 Many extensions have been added to :rfc:`1771`. :rfc:`2858` provides
13 multiprotocol support to BGP-4.
14
15 .. _Starting_BGP:
16
17 Starting BGP
18 ============
19
20 Default configuration file of *bgpd* is :file:`bgpd.conf`. *bgpd* searches the
21 current directory first then |INSTALL_PREFIX_ETC|/bgpd.conf. All of bgpd's
22 command must be configured in :file:`bgpd.conf`.
23
24 *bgpd* specific invocation options are described below. Common options may also
25 be specified (:ref:`Common_Invocation_Options`).
26
27 .. program:: bgpd
28
29 .. option:: -p <port>
30 .. option:: --bgp_port <port>
31
32 Set the bgp protocol's port number.
33
34 .. option:: -r
35 .. option:: --retain
36
37 When program terminates, retain BGP routes added by zebra.
38
39 .. option:: -l
40 .. option:: --listenon
41
42 Specify a specific IP address for bgpd to listen on, rather than its
43 default of INADDR_ANY / IN6ADDR_ANY. This can be useful to constrain bgpd
44 to an internal address, or to run multiple bgpd processes on one host.
45
46
47 .. _BGP_router:
48
49 BGP router
50 ==========
51
52 First of all you must configure BGP router with *router bgp* command. To
53 configure BGP router, you need AS number. AS number is an identification of
54 autonomous system. BGP protocol uses the AS number for detecting whether the
55 BGP connection is internal one or external one.
56
57 .. index:: router bgp ASN
58 .. clicmd:: router bgp ASN
59
60 Enable a BGP protocol process with the specified ASN. After
61 this statement you can input any `BGP Commands`. You can not
62 create different BGP process under different ASN without
63 specifying `multiple-instance` (:ref:`Multiple_instance`).
64
65 .. index:: no router bgp ASN
66 .. clicmd:: no router bgp ASN
67
68 Destroy a BGP protocol process with the specified ASN.
69
70 .. index:: bgp router-id A.B.C.D
71 .. clicmd:: bgp router-id A.B.C.D
72
73 This command specifies the router-ID. If *bgpd* connects to *zebra* it gets
74 interface and address information. In that case default router ID value is
75 selected as the largest IP Address of the interfaces. When `router zebra` is
76 not enabled *bgpd* can't get interface information so `router-id` is set to
77 0.0.0.0. So please set router-id by hand.
78
79 .. _BGP_distance:
80
81 BGP distance
82 ------------
83
84 .. index:: distance bgp (1-255) (1-255) (1-255)
85 .. clicmd:: distance bgp (1-255) (1-255) (1-255)
86
87 This command change distance value of BGP. Each argument is distance value
88 for external routes, internal routes and local routes.
89
90 .. index:: distance (1-255) A.B.C.D/M
91 .. clicmd:: distance (1-255) A.B.C.D/M
92
93 .. index:: distance (1-255) A.B.C.D/M word
94 .. clicmd:: distance (1-255) A.B.C.D/M word
95
96 .. _BGP_decision_process:
97
98 BGP decision process
99 --------------------
100
101 The decision process FRR BGP uses to select routes is as follows:
102
103 1. Weight check
104
105
106 Prefer higher local weight routes to lower routes.
107
108 2. Local preference check
109
110
111 Prefer higher local preference routes to lower.
112
113 3. Local route check
114
115 Prefer local routes (statics, aggregates, redistributed) to received routes.
116
117 4. AS path length check
118
119 Prefer shortest hop-count AS_PATHs.
120
121 5. Origin check
122
123 Prefer the lowest origin type route. That is, prefer IGP origin routes to
124 EGP, to Incomplete routes.
125
126 6. MED check
127
128 Where routes with a MED were received from the same AS, prefer the route
129 with the lowest MED. :ref:`BGP_MED`.
130
131 7. External check
132
133 Prefer the route received from an external, eBGP peer over routes received
134 from other types of peers.
135
136 8. IGP cost check
137
138 Prefer the route with the lower IGP cost.
139
140 9. Multi-path check
141
142 If multi-pathing is enabled, then check whether the routes not yet
143 distinguished in preference may be considered equal. If
144 :ref:`bgp_bestpath_as-path_multipath-relax` is set, all such routes are
145 considered equal, otherwise routes received via iBGP with identical AS_PATHs
146 or routes received from eBGP neighbours in the same AS are considered equal.
147
148 10. Already-selected external check
149
150 Where both routes were received from eBGP peers, then prefer the route
151 which is already selected. Note that this check is not applied if
152 :ref:`bgp_bestpath_compare-routerid` is configured. This check can prevent
153 some cases of oscillation.
154
155 11. Router-ID check
156
157 Prefer the route with the lowest `router-ID`. If the route has an
158 `ORIGINATOR_ID` attribute, through iBGP reflection, then that router ID is
159 used, otherwise the `router-ID` of the peer the route was received from is
160 used.
161
162 12. Cluster-List length check
163
164 The route with the shortest cluster-list length is used. The cluster-list
165 reflects the iBGP reflection path the route has taken.
166
167
168 13. Peer address
169
170 Prefer the route received from the peer with the higher
171 transport layer address, as a last-resort tie-breaker.
172
173
174 .. index:: bgp bestpath as-path confed
175 .. clicmd:: bgp bestpath as-path confed
176
177 This command specifies that the length of confederation path sets and
178 sequences should should be taken into account during the BGP best path
179 decision process.
180
181 .. _bgp_bestpath_as-path_multipath-relax:
182 .. index:: bgp bestpath as-path multipath-relax
183 .. clicmd:: bgp bestpath as-path multipath-relax
184
185 This command specifies that BGP decision process should consider paths
186 of equal AS_PATH length candidates for multipath computation. Without
187 the knob, the entire AS_PATH must match for multipath computation.
188
189 .. _bgp_bestpath_compare-routerid:
190 .. clicmd:: bgp bestpath compare-routerid
191
192 Ensure that when comparing routes where both are equal on most metrics,
193 including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken
194 based on router-ID.
195
196 If this option is enabled, then the already-selected check, where
197 already selected eBGP routes are preferred, is skipped.
198
199 If a route has an `ORIGINATOR_ID` attribute because it has been reflected,
200 that `ORIGINATOR_ID` will be used. Otherwise, the router-ID of the peer the
201 route was received from will be used.
202
203 The advantage of this is that the route-selection (at this point) will be
204 more deterministic. The disadvantage is that a few or even one lowest-ID
205 router may attract all trafic to otherwise-equal paths because of this
206 check. It may increase the possibility of MED or IGP oscillation, unless
207 other measures were taken to avoid these. The exact behaviour will be
208 sensitive to the iBGP and reflection topology.
209
210
211 .. _BGP_route_flap_dampening:
212
213 BGP route flap dampening
214 ------------------------
215
216 .. clicmd:: bgp dampening (1-45) (1-20000) (1-20000) (1-255)
217
218
219 This command enables BGP route-flap dampening and specifies dampening parameters.
220
221
222 half-life
223 Half-life time for the penalty
224
225 reuse-threshold
226 Value to start reusing a route
227
228 suppress-threshold
229 Value to start suppressing a route
230
231 max-suppress
232 Maximum duration to suppress a stable route
233
234 The route-flap damping algorithm is compatible with :rfc:`2439`. The use of
235 this command is not recommended nowadays.
236
237 .. seealso::
238
239 `http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378 <http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378>`_
240
241 .. _BGP_MED:
242
243 BGP MED
244 =======
245
246 The BGP :abbr:`MED (Multi Exit Discriminator)` attribute has properties which
247 can cause subtle convergence problems in BGP. These properties and problems
248 have proven to be hard to understand, at least historically, and may still not
249 be widely understood. The following attempts to collect together and present
250 what is known about MED, to help operators and FRR users in designing and
251 configuring their networks.
252
253 The BGP :abbr:`MED` attribute is intended to allow one AS to indicate its
254 preferences for its ingress points to another AS. The MED attribute will not be
255 propagated on to another AS by the receiving AS - it is 'non-transitive' in the
256 BGP sense.
257
258 E.g., if AS X and AS Y have 2 different BGP peering points, then AS X might set
259 a MED of 100 on routes advertised at one and a MED of 200 at the other. When AS
260 Y selects between otherwise equal routes to or via AS X, AS Y should prefer to
261 take the path via the lower MED peering of 100 with AS X. Setting the MED
262 allows an AS to influence the routing taken to it within another, neighbouring
263 AS.
264
265 In this use of MED it is not really meaningful to compare the MED value on
266 routes where the next AS on the paths differs. E.g., if AS Y also had a route
267 for some destination via AS Z in addition to the routes from AS X, and AS Z had
268 also set a MED, it wouldn't make sense for AS Y to compare AS Z's MED values to
269 those of AS X. The MED values have been set by different administrators, with
270 different frames of reference.
271
272 The default behaviour of BGP therefore is to not compare MED values across
273 routes received from different neighbouring ASes. In FRR this is done by
274 comparing the neighbouring, left-most AS in the received AS_PATHs of the routes
275 and only comparing MED if those are the same.
276
277 Unfortunately, this behaviour of MED, of sometimes being compared across routes
278 and sometimes not, depending on the properties of those other routes, means MED
279 can cause the order of preference over all the routes to be undefined. That is,
280 given routes A, B, and C, if A is preferred to B, and B is preferred to C, then
281 a well-defined order should mean the preference is transitive (in the sense of
282 orders @footnote{For some set of objects to have an order, there *must* be some
283 binary ordering relation that is defined for *every* combination of those
284 objects, and that relation *must* be transitive. I.e.@:, if the relation
285 operator is <, and if a < b and b < c then that relation
286 must carry over and it *must* be that a < c for the objects to have an
287 order. The ordering relation may allow for equality, i.e. a < b and b
288 < a may both be true amd imply that a and b are equal in the order and
289 not distinguished by it, in which case the set has a partial order. Otherwise,
290 if there is an order, all the objects have a distinct place in the order and
291 the set has a total order) and that A would be preferred to C.
292
293 However, when MED is involved this need not be the case. With MED it is
294 possible that C is actually preferred over A. So A is preferred to B, B is
295 preferred to C, but C is preferred to A. This can be true even where BGP
296 defines a deterministic 'most preferred' route out of the full set of A,B,C.
297 With MED, for any given set of routes there may be a deterministically
298 preferred route, but there need not be any way to arrange them into any order
299 of preference. With unmodified MED, the order of preference of routes literally
300 becomes undefined.
301
302 That MED can induce non-transitive preferences over routes can cause issues.
303 Firstly, it may be perceived to cause routing table churn locally at speakers;
304 secondly, and more seriously, it may cause routing instability in iBGP
305 topologies, where sets of speakers continually oscillate between different
306 paths.
307
308 The first issue arises from how speakers often implement routing decisions.
309 Though BGP defines a selection process that will deterministically select the
310 same route as best at any given speaker, even with MED, that process requires
311 evaluating all routes together. For performance and ease of implementation
312 reasons, many implementations evaluate route preferences in a pair-wise fashion
313 instead. Given there is no well-defined order when MED is involved, the best
314 route that will be chosen becomes subject to implementation details, such as
315 the order the routes are stored in. That may be (locally) non-deterministic,
316 e.g.: it may be the order the routes were received in.
317
318 This indeterminism may be considered undesirable, though it need not cause
319 problems. It may mean additional routing churn is perceived, as sometimes more
320 updates may be produced than at other times in reaction to some event .
321
322 This first issue can be fixed with a more deterministic route selection that
323 ensures routes are ordered by the neighbouring AS during selection.
324 :ref:`bgp_deterministic-med`. This may reduce the number of updates as routes
325 are received, and may in some cases reduce routing churn. Though, it could
326 equally deterministically produce the largest possible set of updates in
327 response to the most common sequence of received updates.
328
329 A deterministic order of evaluation tends to imply an additional overhead of
330 sorting over any set of n routes to a destination. The implementation of
331 deterministic MED in FRR scales significantly worse than most sorting
332 algorithms at present, with the number of paths to a given destination. That
333 number is often low enough to not cause any issues, but where there are many
334 paths, the deterministic comparison may quickly become increasingly expensive
335 in terms of CPU.
336
337 Deterministic local evaluation can *not* fix the second, more major, issue of
338 MED however. Which is that the non-transitive preference of routes MED can
339 cause may lead to routing instability or oscillation across multiple speakers
340 in iBGP topologies. This can occur with full-mesh iBGP, but is particularly
341 problematic in non-full-mesh iBGP topologies that further reduce the routing
342 information known to each speaker. This has primarily been documented with iBGP
343 route-reflection topologies. However, any route-hiding technologies potentially
344 could also exacerbate oscillation with MED.
345
346 This second issue occurs where speakers each have only a subset of routes, and
347 there are cycles in the preferences between different combinations of routes -
348 as the undefined order of preference of MED allows - and the routes are
349 distributed in a way that causes the BGP speakers to 'chase' those cycles. This
350 can occur even if all speakers use a deterministic order of evaluation in route
351 selection.
352
353 E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and from
354 speaker 3 in AS Y; while speaker 5 in AS A might receive that route from
355 speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 at speaker
356 3. I.e, using ASN:ID:MED to label the speakers:
357
358 ::
359
360 .
361 /---------------\\
362 X:2------|--A:4-------A:5--|-Y:1:200
363 Y:3:100--|-/ |
364 \\---------------/
365
366
367
368 Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then based
369 on the RFC4271 decision process speaker 4 will choose X:2 over Y:3:100, based
370 on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. Speaker 5 will
371 continue to prefer Y:1:200 based on the ID, and advertise this to speaker 4.
372 Speaker 4 will now have the full set of routes, and the Y:1:200 it receives
373 from 5 will beat X:2, but when speaker 4 compares Y:1:200 to Y:3:100 the MED
374 check now becomes active as the ASes match, and now Y:3:100 is preferred.
375 Speaker 4 therefore now advertises Y:3:100 to 5, which will also agrees that
376 Y:3:100 is preferred to Y:1:200, and so withdraws the latter route from 4.
377 Speaker 4 now has only X:2 and Y:3:100, and X:2 beats Y:3:100, and so speaker 4
378 implicitly updates its route to speaker 5 to X:2. Speaker 5 sees that Y:1:200
379 beats X:2 based on the ID, and advertises Y:1:200 to speaker 4, and the cycle
380 continues.
381
382 The root cause is the lack of a clear order of preference caused by how MED
383 sometimes is and sometimes is not compared, leading to this cycle in the
384 preferences between the routes:
385
386 ::
387
388 .
389 /---> X:2 ---beats---> Y:3:100 --\\
390 | |
391 | |
392 \\---beats--- Y:1:200 <---beats---/
393
394
395
396 This particular type of oscillation in full-mesh iBGP topologies can be
397 avoided by speakers preferring already selected, external routes rather than
398 choosing to update to new a route based on a post-MED metric (e.g. router-ID),
399 at the cost of a non-deterministic selection process. FRR implements this, as
400 do many other implementations, so long as it is not overridden by setting
401 :ref:`bgp_bestpath_compare-routerid`, and see also :ref:`BGP_decision_process`,
402 .
403
404 However, more complex and insidious cycles of oscillation are possible with
405 iBGP route-reflection, which are not so easily avoided. These have been
406 documented in various places. See, e.g.:
407
408 - [bgp-route-osci-cond]_
409 - [stable-flexible-ibgp]_
410 - [ibgp-correctness]_
411
412 for concrete examples and further references.
413
414 There is as of this writing *no* known way to use MED for its original purpose;
415 *and* reduce routing information in iBGP topologies; *and* be sure to avoid the
416 instability problems of MED due the non-transitive routing preferences it can
417 induce; in general on arbitrary networks.
418
419 There may be iBGP topology specific ways to reduce the instability risks, even
420 while using MED, e.g.: by constraining the reflection topology and by tuning
421 IGP costs between route-reflector clusters, see RFC3345 for details. In the
422 near future, the Add-Path extension to BGP may also solve MED oscillation while
423 still allowing MED to be used as intended, by distributing "best-paths per
424 neighbour AS". This would be at the cost of distributing at least as many
425 routes to all speakers as a full-mesh iBGP would, if not more, while also
426 imposing similar CPU overheads as the "Deterministic MED" feature at each
427 Add-Path reflector.
428
429 More generally, the instability problems that MED can introduce on more
430 complex, non-full-mesh, iBGP topologies may be avoided either by:
431
432 - Setting :ref:`bgp_always-compare-med`, however this allows MED to be compared
433 across values set by different neighbour ASes, which may not produce
434 coherent desirable results, of itself.
435 - Effectively ignoring MED by setting MED to the same value (e.g.@: 0) using
436 :ref:`routemap_set_metric` on all received routes, in combination with
437 setting :ref:`bgp_always-compare-med` on all speakers. This is the simplest
438 and most performant way to avoid MED oscillation issues, where an AS is happy
439 not to allow neighbours to inject this problematic metric.
440
441 As MED is evaluated after the AS_PATH length check, another possible use for
442 MED is for intra-AS steering of routes with equal AS_PATH length, as an
443 extension of the last case above. As MED is evaluated before IGP metric, this
444 can allow cold-potato routing to be implemented to send traffic to preferred
445 hand-offs with neighbours, rather than the closest hand-off according to the
446 IGP metric.
447
448 Note that even if action is taken to address the MED non-transitivity issues,
449 other oscillations may still be possible. E.g., on IGP cost if iBGP and IGP
450 topologies are at cross-purposes with each other - see the Flavel and Roughan
451 paper above for an example. Hence the guideline that the iBGP topology should
452 follow the IGP topology.
453
454 .. _bgp_deterministic-med:
455 .. index:: bgp deterministic-med
456 .. clicmd:: bgp deterministic-med
457
458 Carry out route-selection in way that produces deterministic answers
459 locally, even in the face of MED and the lack of a well-defined order of
460 preference it can induce on routes. Without this option the preferred route
461 with MED may be determined largely by the order that routes were received
462 in.
463
464 Setting this option will have a performance cost that may be noticeable when
465 there are many routes for each destination. Currently in FRR it is
466 implemented in a way that scales poorly as the number of routes per
467 destination increases.
468
469 The default is that this option is not set.
470
471 Note that there are other sources of indeterminism in the route selection
472 process, specifically, the preference for older and already selected routes
473 from eBGP peers, :ref:`BGP_decision_process`.
474
475 .. index:: bgp always-compare-med
476 .. clicmd:: bgp always-compare-med
477
478 .. _bgp_always-compare-med:
479
480 Always compare the MED on routes, even when they were received from
481 different neighbouring ASes. Setting this option makes the order of
482 preference of routes more defined, and should eliminate MED induced
483 oscillations.
484
485 If using this option, it may also be desirable to use
486 :ref:`routemap_set_metric` to set MED to 0 on routes received from external
487 neighbours.
488
489 This option can be used, together with :ref:`routemap_set_metric` to use MED
490 as an intra-AS metric to steer equal-length AS_PATH routes to, e.g., desired
491 exit points.
492
493 .. _BGP_network:
494
495 BGP network
496 ===========
497
498
499 .. _BGP_route:
500
501 BGP route
502 ---------
503
504 .. index:: network A.B.C.D/M
505 .. clicmd:: network A.B.C.D/M
506
507 This command adds the announcement network.::
508
509 router bgp 1
510 address-family ipv4 unicast
511 network 10.0.0.0/8
512 exit-address-family
513
514 This configuration example says that network 10.0.0.0/8 will be
515 announced to all neighbors. Some vendors' routers don't advertise
516 routes if they aren't present in their IGP routing tables; `bgpd`
517 doesn't care about IGP routes when announcing its routes.
518
519 .. index:: no network A.B.C.D/M
520 .. clicmd:: no network A.B.C.D/M
521
522
523 .. _Route_Aggregation:
524
525 Route Aggregation
526 -----------------
527
528 .. index:: aggregate-address A.B.C.D/M
529 .. clicmd:: aggregate-address A.B.C.D/M
530
531 This command specifies an aggregate address.
532
533 .. index:: aggregate-address A.B.C.D/M as-set
534 .. clicmd:: aggregate-address A.B.C.D/M as-set
535
536 This command specifies an aggregate address. Resulting routes include
537 AS set.
538
539 .. index:: aggregate-address A.B.C.D/M summary-only
540 .. clicmd:: aggregate-address A.B.C.D/M summary-only
541
542 This command specifies an aggregate address. Aggreated routes will
543 not be announce.
544
545 .. index:: no aggregate-address A.B.C.D/M
546 .. clicmd:: no aggregate-address A.B.C.D/M
547
548
549
550 .. _Redistribute_to_BGP:
551
552 Redistribute to BGP
553 -------------------
554
555 .. index:: redistribute kernel
556 .. clicmd:: redistribute kernel
557
558 Redistribute kernel route to BGP process.
559
560 .. index:: redistribute static
561 .. clicmd:: redistribute static
562
563 Redistribute static route to BGP process.
564
565 .. index:: redistribute connected
566 .. clicmd:: redistribute connected
567
568 Redistribute connected route to BGP process.
569
570 .. index:: redistribute rip
571 .. clicmd:: redistribute rip
572
573 Redistribute RIP route to BGP process.
574
575 .. index:: redistribute ospf
576 .. clicmd:: redistribute ospf
577
578 Redistribute OSPF route to BGP process.
579
580 .. index:: redistribute vpn
581 .. clicmd:: redistribute vpn
582
583 Redistribute VNC routes to BGP process.
584
585 .. index:: update-delay MAX-DELAY
586 .. clicmd:: update-delay MAX-DELAY
587
588 .. index:: update-delay MAX-DELAY ESTABLISH-WAIT
589 .. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT
590
591 This feature is used to enable read-only mode on BGP process restart or when
592 BGP process is cleared using 'clear ip bgp \*'. When applicable, read-only
593 mode would begin as soon as the first peer reaches Established status and a
594 timer for max-delay seconds is started.
595
596 During this mode BGP doesn't run any best-path or generate any updates to its
597 peers. This mode continues until:
598
599 1. All the configured peers, except the shutdown peers, have sent explicit EOR
600 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
601 Established is considered an implicit-EOR.
602 If the establish-wait optional value is given, then BGP will wait for
603 peers to reach established from the begining of the update-delay till the
604 establish-wait period is over, i.e. the minimum set of established peers for
605 which EOR is expected would be peers established during the establish-wait
606 window, not necessarily all the configured neighbors.
607 2. max-delay period is over.
608
609 On hitting any of the above two conditions, BGP resumes the decision process
610 and generates updates to its peers.
611
612 Default max-delay is 0, i.e. the feature is off by default.
613
614 .. index:: table-map ROUTE-MAP-NAME
615 .. clicmd:: table-map ROUTE-MAP-NAME
616
617 This feature is used to apply a route-map on route updates from BGP to
618 Zebra. All the applicable match operations are allowed, such as match on
619 prefix, next-hop, communities, etc. Set operations for this attach-point are
620 limited to metric and next-hop only. Any operation of this feature does not
621 affect BGPs internal RIB.
622
623 Supported for ipv4 and ipv6 address families. It works on multi-paths as
624 well, however, metric setting is based on the best-path only.
625
626 .. _BGP_Peer:
627
628 BGP Peer
629 ========
630
631 .. _Defining_Peer:
632
633 Defining Peer
634 -------------
635
636 .. index:: neighbor PEER remote-as ASN
637 .. clicmd:: neighbor PEER remote-as ASN
638
639
640 Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address
641 or an IPv6 address.::
642
643 router bgp 1
644 neighbor 10.0.0.1 remote-as 2
645
646 In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1.
647
648 This command must be the first command used when configuring a neighbor. If
649 the remote-as is not specified, *bgpd* will complain like this:::
650
651 can't find neighbor 10.0.0.1
652
653
654 .. _BGP_Peer_commands:
655
656 BGP Peer commands
657 -----------------
658
659 In a `router bgp` clause there are neighbor specific configurations
660 required.
661
662 .. index:: neighbor PEER shutdown
663 .. clicmd:: neighbor PEER shutdown
664
665 .. index:: no neighbor PEER shutdown
666 .. clicmd:: no neighbor PEER shutdown
667
668 Shutdown the peer. We can delete the neighbor's configuration by
669 ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor
670 will be deleted. When you want to preserve the configuration, but want to
671 drop the BGP peer, use this syntax.
672
673 .. index:: neighbor PEER ebgp-multihop
674 .. clicmd:: neighbor PEER ebgp-multihop
675
676 .. index:: no neighbor PEER ebgp-multihop
677 .. clicmd:: no neighbor PEER ebgp-multihop
678
679
680 .. index:: neighbor PEER description ...
681 .. clicmd:: neighbor PEER description ...
682
683
684 .. index:: no neighbor PEER description ...
685 .. clicmd:: no neighbor PEER description ...
686
687 Set description of the peer.
688
689 .. index:: neighbor PEER version VERSION
690 .. clicmd:: neighbor PEER version VERSION
691
692 Set up the neighbor's BGP version. `version` can be `4`,
693 `4+` or `4-`. BGP version `4` is the default value used for
694 BGP peering. BGP version `4+` means that the neighbor supports
695 Multiprotocol Extensions for BGP-4. BGP version `4-` is similar but
696 the neighbor speaks the old Internet-Draft revision 00's Multiprotocol
697 Extensions for BGP-4. Some routing software is still using this
698 version.
699
700 .. index:: neighbor PEER interface IFNAME
701 .. clicmd:: neighbor PEER interface IFNAME
702
703
704 .. index:: no neighbor PEER interface IFNAME
705 .. clicmd:: no neighbor PEER interface IFNAME
706
707 When you connect to a BGP peer over an IPv6 link-local address, you have to
708 specify the IFNAME of the interface used for the connection. To specify
709 IPv4 session addresses, see the ``neighbor PEER update-source`` command
710 below.
711
712 This command is deprecated and may be removed in a future release. Its use
713 should be avoided.
714
715 .. index:: neighbor PEER next-hop-self [all]
716 .. clicmd:: neighbor PEER next-hop-self [all]
717
718
719 .. index:: no neighbor PEER next-hop-self [all]
720 .. clicmd:: no neighbor PEER next-hop-self [all]
721
722 This command specifies an announced route's nexthop as being equivalent to
723 the address of the bgp router if it is learned via eBGP. If the optional
724 keyword `all` is specified the modifiation is done also for routes learned
725 via iBGP.
726
727 .. index:: neighbor PEER update-source <IFNAME|ADDRESS>
728 .. clicmd:: neighbor PEER update-source <IFNAME|ADDRESS>
729
730
731 .. index:: no neighbor PEER update-source
732 .. clicmd:: no neighbor PEER update-source
733
734 Specify the IPv4 source address to use for the :abbr:`BGP` session to this
735 neighbour, may be specified as either an IPv4 address directly or as an
736 interface name (in which case the *zebra* daemon MUST be running in order
737 for *bgpd* to be able to retrieve interface state).::
738
739 router bgp 64555
740 neighbor foo update-source 192.168.0.1
741 neighbor bar update-source lo0
742
743
744 .. index:: neighbor PEER default-originate
745 .. clicmd:: neighbor PEER default-originate
746
747 .. index:: no neighbor PEER default-originate
748 .. clicmd:: no neighbor PEER default-originate
749
750 *bgpd*'s default is to not announce the default route (0.0.0.0/0) even it
751 is in routing table. When you want to announce default routes to the
752 peer, use this command.
753
754 .. index:: neighbor PEER port PORT
755 .. clicmd:: neighbor PEER port PORT
756
757 .. index:: neighbor PEER send-community
758 .. clicmd:: neighbor PEER send-community
759
760 .. index:: neighbor PEER weight WEIGHT
761 .. clicmd:: neighbor PEER weight WEIGHT
762
763
764 .. index:: no neighbor PEER weight WEIGHT
765 .. clicmd:: no neighbor PEER weight WEIGHT
766
767 This command specifies a default `weight` value for the neighbor's routes.
768
769 .. index:: neighbor PEER maximum-prefix NUMBER
770 .. clicmd:: neighbor PEER maximum-prefix NUMBER
771
772
773 .. index:: no neighbor PEER maximum-prefix NUMBER
774 .. clicmd:: no neighbor PEER maximum-prefix NUMBER
775
776
777 .. index:: neighbor PEER local-as AS-NUMBER
778 .. clicmd:: neighbor PEER local-as AS-NUMBER
779
780
781 .. index:: neighbor PEER local-as AS-NUMBER no-prepend
782 .. clicmd:: neighbor PEER local-as AS-NUMBER no-prepend
783
784
785 .. index:: neighbor PEER local-as AS-NUMBER no-prepend replace-as
786 .. clicmd:: neighbor PEER local-as AS-NUMBER no-prepend replace-as
787
788
789 .. index:: no neighbor PEER local-as
790 .. clicmd:: no neighbor PEER local-as
791
792 Specify an alternate AS for this BGP process when interacting with the
793 specified peer. With no modifiers, the specified local-as is prepended to
794 the received AS_PATH when receiving routing updates from the peer, and
795 prepended to the outgoing AS_PATH (after the process local AS) when
796 transmitting local routes to the peer.
797
798 If the no-prepend attribute is specified, then the supplied local-as is not
799 prepended to the received AS_PATH.
800
801 If the replace-as attribute is specified, then only the supplied local-as is
802 prepended to the AS_PATH when transmitting local-route updates to this peer.
803
804 Note that replace-as can only be specified if no-prepend is.
805
806 This command is only allowed for eBGP peers.
807
808 .. index:: neighbor PEER ttl-security hops NUMBER
809 .. clicmd:: neighbor PEER ttl-security hops NUMBER
810
811
812 .. index:: no neighbor PEER ttl-security hops NUMBER
813 .. clicmd:: no neighbor PEER ttl-security hops NUMBER
814
815 This command enforces Generalized TTL Security Mechanism (GTSM), as
816 specified in RFC 5082. With this command, only neighbors that are the
817 specified number of hops away will be allowed to become neighbors. This
818 command is mututally exclusive with *ebgp-multihop*.
819
820 .. _Peer_filtering:
821
822 Peer filtering
823 --------------
824
825 .. index:: neighbor PEER distribute-list NAME [in|out]
826 .. clicmd:: neighbor PEER distribute-list NAME [in|out]
827
828 This command specifies a distribute-list for the peer. `direct` is
829 ``in`` or ``out``.
830
831 .. index:: neighbor PEER prefix-list NAME [in|out]
832 .. clicmd:: neighbor PEER prefix-list NAME [in|out]
833
834 .. index:: neighbor PEER filter-list NAME [in|out]
835 .. clicmd:: neighbor PEER filter-list NAME [in|out]
836
837 .. index:: neighbor PEER route-map NAME [in|out]
838 .. clicmd:: neighbor PEER route-map NAME [in|out]
839
840 Apply a route-map on the neighbor. `direct` must be `in` or `out`.
841
842 .. index:: bgp route-reflector allow-outbound-policy
843 .. clicmd:: bgp route-reflector allow-outbound-policy
844
845 By default, attribute modification via route-map policy out is not reflected
846 on reflected routes. This option allows the modifications to be reflected as
847 well. Once enabled, it affects all reflected routes.
848
849 .. _BGP_Peer_Group:
850
851 BGP Peer Group
852 ==============
853
854 .. index:: neighbor WORD peer-group
855 .. clicmd:: neighbor WORD peer-group
856
857 This command defines a new peer group.
858
859 .. index:: neighbor PEER peer-group WORD
860 .. clicmd:: neighbor PEER peer-group WORD
861
862 This command bind specific peer to peer group WORD.
863
864 .. _BGP_Address_Family:
865
866 BGP Address Family
867 ==================
868
869 Multiprotocol BGP enables BGP to carry routing information for multiple Network
870 Layer protocols. BGP supports multiple Address Family Identifier (AFI), namely
871 IPv4 and IPv6. Support is also provided for multiple sets of per-AFI
872 information via Subsequent Address Family Identifiers (SAFI). In addition to
873 unicast information, VPN information :rfc:`4364` and :rfc:`4659`, and
874 Encapsulation attribute :rfc:`5512` is supported.
875
876 .. index:: show ip bgp ipv4 vpn
877 .. clicmd:: show ip bgp ipv4 vpn
878
879 .. index:: show ipv6 bgp ipv6 vpn
880 .. clicmd:: show ipv6 bgp ipv6 vpn
881
882 Print active IPV4 or IPV6 routes advertised via the VPN SAFI.
883
884 .. index:: show bgp ipv4 vpn summary
885 .. clicmd:: show bgp ipv4 vpn summary
886
887 .. index:: show bgp ipv6 vpn summary
888 .. clicmd:: show bgp ipv6 vpn summary
889
890 Print a summary of neighbor connections for the specified AFI/SAFI combination.
891
892 .. _Autonomous_System:
893
894 Autonomous System
895 =================
896
897 The :abbr:`AS (Autonomous System)` number is one of the essential element of
898 BGP. BGP is a distance vector routing protocol, and the AS-Path framework
899 provides distance vector metric and loop detection to BGP. :rfc:`1930` provides
900 some background on the concepts of an AS.
901
902 The AS number is a two octet value, ranging in value from 1 to 65535. The AS
903 numbers 64512 through 65535 are defined as private AS numbers. Private AS
904 numbers must not to be advertised in the global Internet.
905
906 .. _Display_BGP_Routes_by_AS_Path:
907
908 Display BGP Routes by AS Path
909 -----------------------------
910
911 To show BGP routes which has specific AS path information `show ip bgp` command
912 can be used.
913
914 .. index:: show bgp ipv4|ipv6 regexp LINE
915 .. clicmd:: show bgp ipv4|ipv6 regexp LINE
916
917 This commands displays BGP routes that matches a regular
918 expression `line` (:ref:`BGP_Regular_Expressions`).
919
920 .. _AS_Path_Access_List:
921
922 AS Path Access List
923 -------------------
924
925 AS path access list is user defined AS path.
926
927 .. index:: ip as-path access-list WORD permit|deny LINE
928 .. clicmd:: ip as-path access-list WORD permit|deny LINE
929
930 This command defines a new AS path access list.
931
932 .. index:: no ip as-path access-list WORD
933 .. clicmd:: no ip as-path access-list WORD
934
935 .. index:: no ip as-path access-list WORD permit|deny LINE
936 .. clicmd:: no ip as-path access-list WORD permit|deny LINE
937
938 .. _Using_AS_Path_in_Route_Map:
939
940 Using AS Path in Route Map
941 --------------------------
942
943 .. index:: match as-path WORD
944 .. clicmd:: match as-path WORD
945
946
947 .. index:: set as-path prepend AS-PATH
948 .. clicmd:: set as-path prepend AS-PATH
949
950 Prepend the given string of AS numbers to the AS_PATH.
951
952 .. index:: set as-path prepend last-as NUM
953 .. clicmd:: set as-path prepend last-as NUM
954
955 Prepend the existing last AS number (the leftmost ASN) to the AS_PATH.
956
957 .. _Private_AS_Numbers:
958
959 Private AS Numbers
960 ------------------
961
962 .. _BGP_Communities_Attribute:
963
964 BGP Communities Attribute
965 =========================
966
967 BGP communities attribute is widely used for implementing policy routing.
968 Network operators can manipulate BGP communities attribute based on their
969 network policy. BGP communities attribute is defined in :rfc:`1997` and
970 :rfc:`1998`. It is an optional transitive attribute, therefore local policy can
971 travel through different autonomous system.
972
973 Communities attribute is a set of communities values. Each communities value is
974 4 octet long. The following format is used to define communities value.
975
976
977 AS:VAL
978 This format represents 4 octet communities value. ``AS`` is high order 2
979 octet in digit format. ``VAL`` is low order 2 octet in digit format. This
980 format is useful to define AS oriented policy value. For example,
981 ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
982 neighboring peer.
983
984 internet
985 `internet` represents well-known communities value 0.
986
987 no-export
988 ``no-export`` represents well-known communities value ``NO_EXPORT``
989 ``0xFFFFFF01``. All routes carry this value must not be advertised to
990 outside a BGP confederation boundary. If neighboring BGP peer is part of BGP
991 confederation, the peer is considered as inside a BGP confederation
992 boundary, so the route will be announced to the peer.
993
994 no-advertise
995 ``no-advertise`` represents well-known communities value ``NO_ADVERTISE``
996 ``0xFFFFFF02``. All routes carry this value must not be advertise to other
997 BGP peers.
998
999 local-AS
1000 ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED``
1001 ``0xFFFFFF03``. All routes carry this value must not be advertised to
1002 external BGP peers. Even if the neighboring router is part of confederation,
1003 it is considered as external BGP peer, so the route will not be announced to
1004 the peer.
1005
1006 When BGP communities attribute is received, duplicated communities value in the
1007 communities attribute is ignored and each communities values are sorted in
1008 numerical order.
1009
1010 .. _BGP_Community_Lists:
1011
1012 BGP Community Lists
1013 -------------------
1014
1015 BGP community list is a user defined BGP communites attribute list. BGP
1016 community list can be used for matching or manipulating BGP communities
1017 attribute in updates.
1018
1019 There are two types of community list. One is standard community list and
1020 another is expanded community list. Standard community list defines communities
1021 attribute. Expanded community list defines communities attribute string with
1022 regular expression. Standard community list is compiled into binary format when
1023 user define it. Standard community list will be directly compared to BGP
1024 communities attribute in BGP updates. Therefore the comparison is faster than
1025 expanded community list.
1026
1027 .. index:: ip community-list standard NAME permit|deny COMMUNITY
1028 .. clicmd:: ip community-list standard NAME permit|deny COMMUNITY
1029
1030 This command defines a new standard community list. COMUNITY is
1031 communities value. The COMUNITY is compiled into community structure. We
1032 can define multiple community list under same name. In that case match will
1033 happen user defined order. Once the community list matches to communities
1034 attribute in BGP updates it return permit or deny by the community list
1035 definition. When there is no matched entry, deny will be returned. When
1036 COMUNITY is empty it matches to any routes.
1037
1038 .. index:: ip community-list expanded NAME permit|deny LINE
1039 .. clicmd:: ip community-list expanded NAME permit|deny LINE
1040
1041 This command defines a new expanded community list. COMUNITY is a
1042 string expression of communities attribute. COMUNITY can be a
1043 regular expression (:ref:`BGP_Regular_Expressions`) to match
1044 the communities attribute in BGP updates.
1045
1046 .. index:: no ip community-list NAME
1047 .. clicmd:: no ip community-list NAME
1048
1049 .. index:: no ip community-list standard NAME
1050 .. clicmd:: no ip community-list standard NAME
1051
1052 .. index:: no ip community-list expanded NAME
1053 .. clicmd:: no ip community-list expanded NAME
1054
1055 These commands delete community lists specified by NAME. All of
1056 community lists shares a single name space. So community lists can be
1057 removed simpley specifying community lists name.
1058
1059 .. index:: show ip community-list
1060 .. clicmd:: show ip community-list
1061
1062 .. index:: show ip community-list NAME
1063 .. clicmd:: show ip community-list NAME
1064
1065 This command displays current community list information. When NAME is
1066 specified the specified community list's information is shown.
1067
1068 ::
1069
1070 # show ip community-list
1071 Named Community standard list CLIST
1072 permit 7675:80 7675:100 no-export
1073 deny internet
1074 Named Community expanded list EXPAND
1075 permit :
1076
1077 # show ip community-list CLIST
1078 Named Community standard list CLIST
1079 permit 7675:80 7675:100 no-export
1080 deny internet
1081
1082
1083 .. _Numbered_BGP_Community_Lists:
1084
1085 Numbered BGP Community Lists
1086 ----------------------------
1087
1088 When number is used for BGP community list name, the number has
1089 special meanings. Community list number in the range from 1 and 99 is
1090 standard community list. Community list number in the range from 100
1091 to 199 is expanded community list. These community lists are called
1092 as numbered community lists. On the other hand normal community lists
1093 is called as named community lists.
1094
1095 .. index:: ip community-list (1-99) permit|deny COMMUNITY
1096 .. clicmd:: ip community-list (1-99) permit|deny COMMUNITY
1097
1098 This command defines a new community list. (1-99) is standard
1099 community list number. Community list name within this range defines
1100 standard community list. When `community` is empty it matches to
1101 any routes.
1102
1103 .. index:: ip community-list (100-199) permit|deny COMMUNITY
1104 .. clicmd:: ip community-list (100-199) permit|deny COMMUNITY
1105
1106 This command defines a new community list. (100-199) is expanded
1107 community list number. Community list name within this range defines
1108 expanded community list.
1109
1110 .. index:: ip community-list NAME permit|deny COMMUNITY
1111 .. clicmd:: ip community-list NAME permit|deny COMMUNITY
1112
1113 When community list type is not specifed, the community list type is
1114 automatically detected. If COMMUNITY can be compiled into communities
1115 attribute, the community list is defined as a standard community list.
1116 Otherwise it is defined as an expanded community list. This feature is left
1117 for backward compability. Use of this feature is not recommended.
1118
1119 .. _BGP_Community_in_Route_Map:
1120
1121 BGP Community in Route Map
1122 --------------------------
1123
1124 In Route Map (:ref:`Route_Map`), we can match or set BGP
1125 communities attribute. Using this feature network operator can
1126 implement their network policy based on BGP communities attribute.
1127
1128 Following commands can be used in Route Map.
1129
1130 .. index:: match community WORD
1131 .. clicmd:: match community WORD
1132
1133 .. index:: match community WORD exact-match
1134 .. clicmd:: match community WORD exact-match
1135
1136 This command perform match to BGP updates using community list WORD. When
1137 the one of BGP communities value match to the one of communities value in
1138 community list, it is match. When `exact-match` keyword is spcified, match
1139 happen only when BGP updates have completely same communities value
1140 specified in the community list.
1141
1142 .. index:: set community none
1143 .. clicmd:: set community none
1144
1145 .. index:: set community COMMUNITY
1146 .. clicmd:: set community COMMUNITY
1147
1148 .. index:: set community COMMUNITY additive
1149 .. clicmd:: set community COMMUNITY additive
1150
1151 This command manipulate communities value in BGP updates. When
1152 `none` is specified as communities value, it removes entire
1153 communities attribute from BGP updates. When `community` is not
1154 `none`, specified communities value is set to BGP updates. If
1155 BGP updates already has BGP communities value, the existing BGP
1156 communities value is replaced with specified `community` value.
1157 When `additive` keyword is specified, `community` is appended
1158 to the existing communities value.
1159
1160 .. index:: set comm-list WORD delete
1161 .. clicmd:: set comm-list WORD delete
1162
1163 This command remove communities value from BGP communities attribute.
1164 The `word` is community list name. When BGP route's communities
1165 value matches to the community list `word`, the communities value
1166 is removed. When all of communities value is removed eventually, the
1167 BGP update's communities attribute is completely removed.
1168
1169 .. _Display_BGP_Routes_by_Community:
1170
1171 Display BGP Routes by Community
1172 -------------------------------
1173
1174 To show BGP routes which has specific BGP communities attribute,
1175 `show bgp {ipv4|ipv6}` command can be used. The
1176 `community` and `community-list` subcommand can be used.
1177
1178 .. index:: show bgp ipv4|ipv6 community
1179 .. clicmd:: show bgp ipv4|ipv6 community
1180
1181 .. index:: show bgp ipv4|ipv6 community COMMUNITY
1182 .. clicmd:: show bgp ipv4|ipv6 community COMMUNITY
1183
1184 .. index:: show bgp ipv4|ipv6 community COMMUNITY exact-match
1185 .. clicmd:: show bgp ipv4|ipv6 community COMMUNITY exact-match
1186
1187 `show bgp {ipv4|ipv6} community` displays BGP routes which has communities
1188 attribute. Where the address family can be IPv4 or IPv6 among others. When
1189 `community` is specified, BGP routes that matches `community` value is
1190 displayed. For this command, `internet` keyword can't be used for
1191 `community` value. When `exact-match` is specified, it display only
1192 routes that have an exact match.
1193
1194 .. index:: show bgp ipv4|ipv6 community-list WORD
1195 .. clicmd:: show bgp ipv4|ipv6 community-list WORD
1196
1197 .. index:: show bgp ipv4|ipv6 community-list WORD exact-match
1198 .. clicmd:: show bgp ipv4|ipv6 community-list WORD exact-match
1199
1200 This commands display BGP routes for the address family specified that matches
1201 community list `word`. When `exact-match` is specified, display only
1202 routes that have an exact match.
1203
1204 .. _Using_BGP_Communities_Attribute:
1205
1206 Using BGP Communities Attribute
1207 -------------------------------
1208
1209 Following configuration is the most typical usage of BGP communities
1210 attribute. AS 7675 provides upstream Internet connection to AS 100.
1211 When following configuration exists in AS 7675, AS 100 networks
1212 operator can set local preference in AS 7675 network by setting BGP
1213 communities attribute to the updates.::
1214
1215 router bgp 7675
1216 neighbor 192.168.0.1 remote-as 100
1217 address-family ipv4 unicast
1218 neighbor 192.168.0.1 route-map RMAP in
1219 exit-address-family
1220 !
1221 ip community-list 70 permit 7675:70
1222 ip community-list 70 deny
1223 ip community-list 80 permit 7675:80
1224 ip community-list 80 deny
1225 ip community-list 90 permit 7675:90
1226 ip community-list 90 deny
1227 !
1228 route-map RMAP permit 10
1229 match community 70
1230 set local-preference 70
1231 !
1232 route-map RMAP permit 20
1233 match community 80
1234 set local-preference 80
1235 !
1236 route-map RMAP permit 30
1237 match community 90
1238 set local-preference 90
1239
1240
1241 Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675.
1242 The route has communities value 7675:80 so when above configuration
1243 exists in AS 7675, announced route's local preference will be set to
1244 value 80.::
1245
1246 router bgp 100
1247 network 10.0.0.0/8
1248 neighbor 192.168.0.2 remote-as 7675
1249 address-family ipv4 unicast
1250 neighbor 192.168.0.2 route-map RMAP out
1251 exit-address-family
1252 !
1253 ip prefix-list PLIST permit 10.0.0.0/8
1254 !
1255 route-map RMAP permit 10
1256 match ip address prefix-list PLIST
1257 set community 7675:80
1258
1259
1260 Following configuration is an example of BGP route filtering using
1261 communities attribute. This configuration only permit BGP routes
1262 which has BGP communities value 0:80 or 0:90. Network operator can
1263 put special internal communities value at BGP border router, then
1264 limit the BGP routes announcement into the internal network.::
1265
1266 router bgp 7675
1267 neighbor 192.168.0.1 remote-as 100
1268 address-family ipv4 unicast
1269 neighbor 192.168.0.1 route-map RMAP in
1270 exit-address-family
1271 !
1272 ip community-list 1 permit 0:80 0:90
1273 !
1274 route-map RMAP permit in
1275 match community 1
1276
1277
1278 Following exmaple filter BGP routes which has communities value 1:1.
1279 When there is no match community-list returns deny. To avoid
1280 filtering all of routes, we need to define permit any at last.::
1281
1282 router bgp 7675
1283 neighbor 192.168.0.1 remote-as 100
1284 address-family ipv4 unicast
1285 neighbor 192.168.0.1 route-map RMAP in
1286 exit-address-family
1287 !
1288 ip community-list standard FILTER deny 1:1
1289 ip community-list standard FILTER permit
1290 !
1291 route-map RMAP permit 10
1292 match community FILTER
1293
1294
1295 Communities value keyword `internet` has special meanings in
1296 standard community lists. In below example `internet` act as
1297 match any. It matches all of BGP routes even if the route does not
1298 have communities attribute at all. So community list ``INTERNET``
1299 is same as above example's ``FILTER``.::
1300
1301 ip community-list standard INTERNET deny 1:1
1302 ip community-list standard INTERNET permit internet
1303
1304
1305 Following configuration is an example of communities value deletion.
1306 With this configuration communities value 100:1 and 100:2 is removed
1307 from BGP updates. For communities value deletion, only `permit`
1308 community-list is used. `deny` community-list is ignored.::
1309
1310 router bgp 7675
1311 neighbor 192.168.0.1 remote-as 100
1312 address-family ipv4 unicast
1313 neighbor 192.168.0.1 route-map RMAP in
1314 exit-address-family
1315 !
1316 ip community-list standard DEL permit 100:1 100:2
1317 !
1318 route-map RMAP permit 10
1319 set comm-list DEL delete
1320
1321
1322 .. _BGP_Extended_Communities_Attribute:
1323
1324 BGP Extended Communities Attribute
1325 ==================================
1326
1327 BGP extended communities attribute is introduced with MPLS VPN/BGP technology.
1328 MPLS VPN/BGP expands capability of network infrastructure to provide VPN
1329 functionality. At the same time it requires a new framework for policy routing.
1330 With BGP Extended Communities Attribute we can use Route Target or Site of
1331 Origin for implementing network policy for MPLS VPN/BGP.
1332
1333 BGP Extended Communities Attribute is similar to BGP Communities Attribute. It
1334 is an optional transitive attribute. BGP Extended Communities Attribute can
1335 carry multiple Extended Community value. Each Extended Community value is
1336 eight octet length.
1337
1338 BGP Extended Communities Attribute provides an extended range compared with BGP
1339 Communities Attribute. Adding to that there is a type field in each value to
1340 provides community space structure.
1341
1342 There are two format to define Extended Community value. One is AS based format
1343 the other is IP address based format.
1344
1345 *AS:VAL*
1346 This is a format to define AS based Extended Community value.
1347 `AS` part is 2 octets Global Administrator subfield in Extended
1348 Community value. `VAL` part is 4 octets Local Administrator
1349 subfield. `7675:100` represents AS 7675 policy value 100.
1350
1351 *IP-Address:VAL*
1352 This is a format to define IP address based Extended Community value.
1353 `IP-Address` part is 4 octets Global Administrator subfield.
1354 `VAL` part is 2 octets Local Administrator subfield.
1355 `10.0.0.1:100` represents
1356
1357 .. _BGP_Extended_Community_Lists:
1358
1359 BGP Extended Community Lists
1360 ----------------------------
1361
1362 Expanded Community Lists is a user defined BGP Expanded Community
1363 Lists.
1364
1365 .. index:: ip extcommunity-list standard NAME permit|deny EXTCOMMUNITY
1366 .. clicmd:: ip extcommunity-list standard NAME permit|deny EXTCOMMUNITY
1367
1368 This command defines a new standard extcommunity-list.
1369 `extcommunity` is extended communities value. The
1370 `extcommunity` is compiled into extended community structure. We
1371 can define multiple extcommunity-list under same name. In that case
1372 match will happen user defined order. Once the extcommunity-list
1373 matches to extended communities attribute in BGP updates it return
1374 permit or deny based upon the extcommunity-list definition. When
1375 there is no matched entry, deny will be returned. When
1376 `extcommunity` is empty it matches to any routes.
1377
1378 .. index:: ip extcommunity-list expanded NAME permit|deny LINE
1379 .. clicmd:: ip extcommunity-list expanded NAME permit|deny LINE
1380
1381 This command defines a new expanded extcommunity-list. `line` is
1382 a string expression of extended communities attribute. `line` can
1383 be a regular expression (:ref:`BGP_Regular_Expressions`) to match an
1384 extended communities attribute in BGP updates.
1385
1386 .. index:: no ip extcommunity-list NAME
1387 .. clicmd:: no ip extcommunity-list NAME
1388
1389 .. index:: no ip extcommunity-list standard NAME
1390 .. clicmd:: no ip extcommunity-list standard NAME
1391
1392 .. index:: no ip extcommunity-list expanded NAME
1393 .. clicmd:: no ip extcommunity-list expanded NAME
1394
1395 These commands delete extended community lists specified by
1396 `name`. All of extended community lists shares a single name
1397 space. So extended community lists can be removed simpley specifying
1398 the name.
1399
1400 .. index:: show ip extcommunity-list
1401 .. clicmd:: show ip extcommunity-list
1402
1403 .. index:: show ip extcommunity-list NAME
1404 .. clicmd:: show ip extcommunity-list NAME
1405
1406 This command displays current extcommunity-list information. When
1407 `name` is specified the community list's information is shown.
1408
1409 ::
1410
1411 # show ip extcommunity-list
1412
1413
1414 .. _BGP_Extended_Communities_in_Route_Map:
1415
1416 BGP Extended Communities in Route Map
1417 -------------------------------------
1418
1419 .. index:: match extcommunity WORD
1420 .. clicmd:: match extcommunity WORD
1421
1422
1423 .. index:: set extcommunity rt EXTCOMMUNITY
1424 .. clicmd:: set extcommunity rt EXTCOMMUNITY
1425
1426 This command set Route Target value.
1427
1428 .. index:: set extcommunity soo EXTCOMMUNITY
1429 .. clicmd:: set extcommunity soo EXTCOMMUNITY
1430
1431 This command set Site of Origin value.
1432
1433 .. _BGP_Large_Communities_Attribute:
1434
1435 BGP Large Communities Attribute
1436 ===============================
1437
1438 The BGP Large Communities attribute was introduced in Feb 2017 with
1439 :rfc:`8092`.
1440
1441 The BGP Large Communities Attribute is similar to the BGP Communities
1442 Attribute except that it has 3 components instead of two and each of
1443 which are 4 octets in length. Large Communities bring additional
1444 functionality and convenience over traditional communities, specifically
1445 the fact that the `GLOBAL` part below is now 4 octets wide allowing
1446 AS4 operators seamless use.
1447
1448
1449 *GLOBAL:LOCAL1:LOCAL2*
1450 This is the format to define Large Community values. Referencing
1451 :t:`RFC8195, Use of BGP Large Communities` the values are commonly
1452 referred to as follows.
1453 The `GLOBAL` part is a 4 octet Global Administrator field, common
1454 use of this field is the operators AS number.
1455 The `LOCAL1` part is a 4 octet Local Data Part 1 subfield referred
1456 to as a function.
1457 The `LOCAL2` part is a 4 octet Local Data Part 2 field and referred
1458 to as the parameter subfield. `65551:1:10` represents AS 65551
1459 function 1 and parameter 10.
1460 The referenced RFC above gives some guidelines on recommended usage.
1461
1462 .. _BGP_Large_Community_Lists:
1463
1464 BGP Large Community Lists
1465 -------------------------
1466
1467 Two types of large community lists are supported, namely `standard` and
1468 `expanded`.
1469
1470 .. index:: ip large-community-list standard NAME permit|deny LARGE-COMMUNITY
1471 .. clicmd:: ip large-community-list standard NAME permit|deny LARGE-COMMUNITY
1472
1473 This command defines a new standard large-community-list.
1474 `large-community` is the Large Community value. We
1475 can add multiple large communities under same name. In that case
1476 the match will happen in the user defined order. Once the large-community-list
1477 matches the Large Communities attribute in BGP updates it will return
1478 permit or deny based upon the large-community-list definition. When
1479 there is no matched entry, a deny will be returned. When `large-community`
1480 is empty it matches any routes.
1481
1482 .. index:: ip large-community-list expanded NAME permit|deny LINE
1483 .. clicmd:: ip large-community-list expanded NAME permit|deny LINE
1484
1485 This command defines a new expanded large-community-list. Where `line` is
1486 a string matching expression, it will be compared to the entire Large Communities
1487 attribute as a string, with each large-community in order from lowest to highest.
1488 `line` can also be a regular expression which matches this Large
1489 Community attribute.
1490
1491 .. index:: no ip large-community-list NAME
1492 .. clicmd:: no ip large-community-list NAME
1493
1494 .. index:: no ip large-community-list standard NAME
1495 .. clicmd:: no ip large-community-list standard NAME
1496
1497 .. index:: no ip large-community-list expanded NAME
1498 .. clicmd:: no ip large-community-list expanded NAME
1499
1500 These commands delete Large Community lists specified by
1501 `name`. All Large Community lists share a single namespace.
1502 This means Large Community lists can be removed by simply specifying the name.
1503
1504 .. index:: show ip large-community-list
1505 .. clicmd:: show ip large-community-list
1506
1507 .. index:: show ip large-community-list NAME
1508 .. clicmd:: show ip large-community-list NAME
1509
1510 This command display current large-community-list information. When
1511 `name` is specified the community list information is shown.
1512
1513 .. index:: show ip bgp large-community-info
1514 .. clicmd:: show ip bgp large-community-info
1515
1516 This command displays the current large communities in use.
1517
1518 .. _BGP_Large_Communities_in_Route_Map:
1519
1520 BGP Large Communities in Route Map
1521 ----------------------------------
1522
1523 .. index:: match large-community LINE
1524 .. clicmd:: match large-community LINE
1525
1526 Where `line` can be a simple string to match, or a regular expression.
1527 It is very important to note that this match occurs on the entire
1528 large-community string as a whole, where each large-community is ordered
1529 from lowest to highest.
1530
1531 .. index:: set large-community LARGE-COMMUNITY
1532 .. clicmd:: set large-community LARGE-COMMUNITY
1533
1534 .. index:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
1535 .. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
1536
1537 .. index:: set large-community LARGE-COMMUNITY additive
1538 .. clicmd:: set large-community LARGE-COMMUNITY additive
1539
1540 These commands are used for setting large-community values. The first
1541 command will overwrite any large-communities currently present.
1542 The second specifies two large-communities, which overwrites the current
1543 large-community list. The third will add a large-community value without
1544 overwriting other values. Multiple large-community values can be specified.
1545
1546 .. _Displaying_BGP_information:
1547
1548 Displaying BGP information
1549 ==========================
1550
1551
1552 .. _Showing_BGP_information:
1553
1554 Showing BGP information
1555 -----------------------
1556
1557 .. index:: show ip bgp
1558 .. clicmd:: show ip bgp
1559
1560 .. index:: show ip bgp A.B.C.D
1561 .. clicmd:: show ip bgp A.B.C.D
1562
1563 .. index:: show ip bgp X:X::X:X
1564 .. clicmd:: show ip bgp X:X::X:X
1565
1566 This command displays BGP routes. When no route is specified it
1567 display all of IPv4 BGP routes.
1568
1569 ::
1570
1571 BGP table version is 0, local router ID is 10.1.1.1
1572 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
1573 Origin codes: i - IGP, e - EGP, ? - incomplete
1574
1575 Network Next Hop Metric LocPrf Weight Path
1576 \*> 1.1.1.1/32 0.0.0.0 0 32768 i
1577
1578 Total number of prefixes 1
1579
1580
1581 .. index:: show ip bgp regexp LINE
1582 .. clicmd:: show ip bgp regexp LINE
1583
1584 This command displays BGP routes using AS path regular expression
1585 (:ref:`BGP_Regular_Expressions`).
1586
1587 .. index:: show ip bgp community COMMUNITY
1588 .. clicmd:: show ip bgp community COMMUNITY
1589
1590 .. index:: show ip bgp community COMMUNITY exact-match
1591 .. clicmd:: show ip bgp community COMMUNITY exact-match
1592
1593 This command displays BGP routes using `community` (:ref:`Display_BGP_Routes_by_Community`).
1594
1595 .. index:: show ip bgp community-list WORD
1596 .. clicmd:: show ip bgp community-list WORD
1597
1598 .. index:: show ip bgp community-list WORD exact-match
1599 .. clicmd:: show ip bgp community-list WORD exact-match
1600
1601 This command displays BGP routes using community list (:ref:`Display_BGP_Routes_by_Community`).
1602
1603 .. index:: show bgp ipv4|ipv6 summary
1604 .. clicmd:: show bgp ipv4|ipv6 summary
1605
1606 Show a bgp peer summary for the specified address family.
1607
1608 .. index:: show bgp ipv4|ipv6 neighbor [PEER]
1609 .. clicmd:: show bgp ipv4|ipv6 neighbor [PEER]
1610
1611 This command shows information on a specific BGP `peer`.
1612
1613 .. index:: show bgp ipv4|ipv6 dampening dampened-paths
1614 .. clicmd:: show bgp ipv4|ipv6 dampening dampened-paths
1615
1616 Display paths suppressed due to dampening.
1617
1618 .. index:: show bgp ipv4|ipv6 dampening flap-statistics
1619 .. clicmd:: show bgp ipv4|ipv6 dampening flap-statistics
1620
1621 Display flap statistics of routes.
1622
1623 .. _Other_BGP_commands:
1624
1625 Other BGP commands
1626 ------------------
1627
1628 .. index:: clear bgp ipv4|ipv6 \*
1629 .. clicmd:: clear bgp ipv4|ipv6 \*
1630
1631 Clear all address family peers.
1632
1633 .. index:: clear bgp ipv4|ipv6 PEER
1634 .. clicmd:: clear bgp ipv4|ipv6 PEER
1635
1636 Clear peers which have addresses of X.X.X.X
1637
1638 .. index:: clear bgp ipv4|ipv6 PEER soft in
1639 .. clicmd:: clear bgp ipv4|ipv6 PEER soft in
1640
1641 Clear peer using soft reconfiguration.
1642
1643 .. index:: show debug
1644 .. clicmd:: show debug
1645
1646 .. index:: debug event
1647 .. clicmd:: debug event
1648
1649 .. index:: debug update
1650 .. clicmd:: debug update
1651
1652 .. index:: debug keepalive
1653 .. clicmd:: debug keepalive
1654
1655 .. index:: no debug event
1656 .. clicmd:: no debug event
1657
1658 .. index:: no debug update
1659 .. clicmd:: no debug update
1660
1661 .. index:: no debug keepalive
1662 .. clicmd:: no debug keepalive
1663
1664
1665 .. _Capability_Negotiation:
1666
1667 Capability Negotiation
1668 ======================
1669
1670 When adding IPv6 routing information exchange feature to BGP. There
1671 were some proposals. :abbr:`IETF (Internet Engineering Task Force)`
1672 :abbr:`IDR ( Inter Domain Routing)` :abbr:`IDR ( Inter Domain Routing)` adopted
1673 a proposal called Multiprotocol Extension for BGP. The specification
1674 is described in :rfc:`2283`. The protocol does not define new protocols.
1675 It defines new attributes to existing BGP. When it is used exchanging
1676 IPv6 routing information it is called BGP-4+. When it is used for
1677 exchanging multicast routing information it is called MBGP.
1678
1679 *bgpd* supports Multiprotocol Extension for BGP. So if remote
1680 peer supports the protocol, *bgpd* can exchange IPv6 and/or
1681 multicast routing information.
1682
1683 Traditional BGP did not have the feature to detect remote peer's
1684 capabilities, e.g. whether it can handle prefix types other than IPv4
1685 unicast routes. This was a big problem using Multiprotocol Extension
1686 for BGP to operational network. @cite{RFC2842, Capabilities
1687 Advertisement with BGP-4} adopted a feature called Capability
1688 Negotiation. *bgpd* use this Capability Negotiation to detect
1689 the remote peer's capabilities. If the peer is only configured as IPv4
1690 unicast neighbor, *bgpd* does not send these Capability
1691 Negotiation packets (at least not unless other optional BGP features
1692 require capability negotation).
1693
1694 By default, FRR will bring up peering with minimal common capability
1695 for the both sides. For example, local router has unicast and
1696 multicast capabilitie and remote router has unicast capability. In
1697 this case, the local router will establish the connection with unicast
1698 only capability. When there are no common capabilities, FRR sends
1699 Unsupported Capability error and then resets the connection.
1700
1701 If you want to completely match capabilities with remote peer. Please
1702 use *strict-capability-match* command.
1703
1704 .. index:: neighbor PEER strict-capability-match
1705 .. clicmd:: neighbor PEER strict-capability-match
1706
1707 .. index:: no neighbor PEER strict-capability-match
1708 .. clicmd:: no neighbor PEER strict-capability-match
1709
1710 Strictly compares remote capabilities and local capabilities. If capabilities
1711 are different, send Unsupported Capability error then reset connection.
1712
1713 You may want to disable sending Capability Negotiation OPEN message
1714 optional parameter to the peer when remote peer does not implement
1715 Capability Negotiation. Please use *dont-capability-negotiate*
1716 command to disable the feature.
1717
1718 .. index:: neighbor PEER dont-capability-negotiate
1719 .. clicmd:: neighbor PEER dont-capability-negotiate
1720
1721 .. index:: no neighbor PEER dont-capability-negotiate
1722 .. clicmd:: no neighbor PEER dont-capability-negotiate
1723
1724 Suppress sending Capability Negotiation as OPEN message optional
1725 parameter to the peer. This command only affects the peer is configured
1726 other than IPv4 unicast configuration.
1727
1728 When remote peer does not have capability negotiation feature, remote
1729 peer will not send any capabilities at all. In that case, bgp
1730 configures the peer with configured capabilities.
1731
1732 You may prefer locally configured capabilities more than the negotiated
1733 capabilities even though remote peer sends capabilities. If the peer
1734 is configured by *override-capability*, *bgpd* ignores
1735 received capabilities then override negotiated capabilities with
1736 configured values.
1737
1738 .. index:: neighbor PEER override-capability
1739 .. clicmd:: neighbor PEER override-capability
1740
1741 .. index:: no neighbor PEER override-capability
1742 .. clicmd:: no neighbor PEER override-capability
1743
1744 Override the result of Capability Negotiation with local configuration.
1745 Ignore remote peer's capability value.
1746
1747 .. _Route_Reflector:
1748
1749 Route Reflector
1750 ===============
1751
1752 .. index:: bgp cluster-id A.B.C.D
1753 .. clicmd:: bgp cluster-id A.B.C.D
1754
1755 .. index:: neighbor PEER route-reflector-client
1756 .. clicmd:: neighbor PEER route-reflector-client
1757
1758 .. index:: no neighbor PEER route-reflector-client
1759 .. clicmd:: no neighbor PEER route-reflector-client
1760
1761
1762 .. _Route_Server:
1763
1764 Route Server
1765 ============
1766
1767 At an Internet Exchange point, many ISPs are connected to each other by the
1768 "full mesh method". As with internal BGP full mesh formation,
1769
1770 this method has a scaling problem.
1771
1772 This scaling problem is well known. Route Server is a method to resolve the
1773 problem. Each ISP's BGP router only peers to Route Server. Route Server serves
1774 as BGP information exchange to other BGP routers. By applying this method,
1775 numbers of BGP connections is reduced from O(n*(n-1)/2) to O(n).
1776
1777 Unlike normal BGP router, Route Server must have several routing tables for
1778 managing different routing policies for each BGP speaker. We call the routing
1779 tables as different "views". *bgpd* can work as normal BGP router or Route
1780 Server or both at the same time.
1781
1782 .. _Multiple_instance:
1783
1784 Multiple instance
1785 -----------------
1786
1787 To enable multiple view function of *bgpd*, you must turn on multiple instance
1788 feature beforehand.
1789
1790 .. index:: bgp multiple-instance
1791 .. clicmd:: bgp multiple-instance
1792
1793 Enable BGP multiple instance feature. After this feature is enabled,
1794 you can make multiple BGP instances or multiple BGP views.
1795
1796 .. index:: no bgp multiple-instance
1797 .. clicmd:: no bgp multiple-instance
1798
1799 Disable BGP multiple instance feature. You can not disable this feature
1800 when BGP multiple instances or views exist.
1801
1802 When you want to make configuration more Cisco like one,
1803
1804 .. index:: bgp config-type cisco
1805 .. clicmd:: bgp config-type cisco
1806
1807 Cisco compatible BGP configuration output.
1808
1809 When bgp config-type cisco is specified,
1810
1811 'no synchronization' is displayed.
1812 'no auto-summary' is displayed.
1813
1814 'network' and 'aggregate-address' argument is displayed as
1815 'A.B.C.D M.M.M.M'
1816
1817 FRR: network 10.0.0.0/8
1818 Cisco: network 10.0.0.0
1819
1820 FRR: aggregate-address 192.168.0.0/24
1821 Cisco: aggregate-address 192.168.0.0 255.255.255.0
1822
1823 Community attribute handling is also different. If there is no
1824 configuration is specified community attribute and extended community
1825 attribute are sent to neighbor. When user manually disable the
1826 feature community attribute is not sent to the neighbor. In case of
1827 *bgp config-type cisco* is specified, community attribute is not
1828 sent to the neighbor by default. To send community attribute user has
1829 to specify *neighbor A.B.C.D send-community* command.::
1830
1831 !
1832 router bgp 1
1833 neighbor 10.0.0.1 remote-as 1
1834 address-family ipv4 unicast
1835 no neighbor 10.0.0.1 send-community
1836 exit-address-family
1837 !
1838 router bgp 1
1839 neighbor 10.0.0.1 remote-as 1
1840 address-family ipv4 unicast
1841 neighbor 10.0.0.1 send-community
1842 exit-address-family
1843 !
1844
1845
1846 .. index:: bgp config-type zebra
1847 .. clicmd:: bgp config-type zebra
1848
1849 FRR style BGP configuration. This is default.
1850
1851 .. _BGP_instance_and_view:
1852
1853 BGP instance and view
1854 ---------------------
1855
1856 BGP instance is a normal BGP process. The result of route selection
1857 goes to the kernel routing table. You can setup different AS at the
1858 same time when BGP multiple instance feature is enabled.
1859
1860 .. index:: router bgp AS-NUMBER
1861 .. clicmd:: router bgp AS-NUMBER
1862
1863 Make a new BGP instance. You can use arbitrary word for the `name`.
1864
1865 ::
1866
1867 bgp multiple-instance
1868 !
1869 router bgp 1
1870 neighbor 10.0.0.1 remote-as 2
1871 neighbor 10.0.0.2 remote-as 3
1872 !
1873 router bgp 2
1874 neighbor 10.0.0.3 remote-as 4
1875 neighbor 10.0.0.4 remote-as 5
1876
1877
1878 BGP view is almost same as normal BGP process. The result of
1879 route selection does not go to the kernel routing table. BGP view is
1880 only for exchanging BGP routing information.
1881
1882 .. index:: router bgp AS-NUMBER view NAME
1883 .. clicmd:: router bgp AS-NUMBER view NAME
1884
1885 Make a new BGP view. You can use arbitrary word for the `name`. This view's
1886 route selection result does not go to the kernel routing table.
1887
1888 With this command, you can setup Route Server like below.
1889
1890 ::
1891
1892 bgp multiple-instance
1893 !
1894 router bgp 1 view 1
1895 neighbor 10.0.0.1 remote-as 2
1896 neighbor 10.0.0.2 remote-as 3
1897 !
1898 router bgp 2 view 2
1899 neighbor 10.0.0.3 remote-as 4
1900 neighbor 10.0.0.4 remote-as 5
1901
1902
1903 .. _Routing_policy:
1904
1905 Routing policy
1906 --------------
1907
1908 You can set different routing policy for a peer. For example, you can
1909 set different filter for a peer.::
1910
1911 bgp multiple-instance
1912 !
1913 router bgp 1 view 1
1914 neighbor 10.0.0.1 remote-as 2
1915 address-family ipv4 unicast
1916 neighbor 10.0.0.1 distribute-list 1 in
1917 exit-address-family
1918 !
1919 router bgp 1 view 2
1920 neighbor 10.0.0.1 remote-as 2
1921 address-family ipv4 unicast
1922 neighbor 10.0.0.1 distribute-list 2 in
1923 exit-address-family
1924
1925
1926 This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view
1927 2. When the update is inserted into view 1, distribute-list 1 is
1928 applied. On the other hand, when the update is inserted into view 2,
1929 distribute-list 2 is applied.
1930
1931 .. _Viewing_the_view:
1932
1933 Viewing the view
1934 ----------------
1935
1936 To display routing table of BGP view, you must specify view name.
1937
1938 .. index:: show ip bgp view NAME
1939 .. clicmd:: show ip bgp view NAME
1940
1941 Display routing table of BGP view ``NAME``.
1942
1943 .. _BGP_Regular_Expressions:
1944
1945 BGP Regular Expressions
1946 =======================
1947
1948 BGP regular expressions are based on `POSIX 1003.2` regular
1949 expressions. The following description is just a quick subset of the
1950 `POSIX` regular expressions. Adding to that, the special character
1951 '_' is added.
1952
1953
1954 .*
1955 Matches any single character.
1956
1957 *
1958 Matches 0 or more occurrences of pattern.
1959
1960 +
1961 Matches 1 or more occurrences of pattern.
1962
1963 ?
1964 Match 0 or 1 occurrences of pattern.
1965
1966 ^
1967 Matches the beginning of the line.
1968
1969 $
1970 Matches the end of the line.
1971
1972 _
1973 Character `_` has special meanings in BGP regular expressions. It matches
1974 to space and comma , and AS set delimiter { and } and AS confederation
1975 delimiter `(` and `)`. And it also matches to the beginning of the line and
1976 the end of the line. So `_` can be used for AS value boundaries match. This
1977 character technically evaluates to `(^|[,{}() ]|$)`.
1978
1979 .. _How_to_set_up_a_6-Bone_connection:
1980
1981 How to set up a 6-Bone connection
1982 =================================
1983
1984 ::
1985
1986 zebra configuration
1987 ===================
1988 !
1989 ! Actually there is no need to configure zebra
1990 !
1991
1992 bgpd configuration
1993 ==================
1994 !
1995 ! This means that routes go through zebra and into the kernel.
1996 !
1997 router zebra
1998 !
1999 ! MP-BGP configuration
2000 !
2001 router bgp 7675
2002 bgp router-id 10.0.0.1
2003 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number`
2004 !
2005 address-family ipv6
2006 network 3ffe:506::/32
2007 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
2008 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
2009 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number`
2010 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
2011 exit-address-family
2012 !
2013 ipv6 access-list all permit any
2014 !
2015 ! Set output nexthop address.
2016 !
2017 route-map set-nexthop permit 10
2018 match ipv6 address all
2019 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
2020 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
2021 !
2022 ! logfile FILENAME is obsolete. Please use log file FILENAME
2023
2024 log file bgpd.log
2025 !
2026
2027
2028 .. _Dump_BGP_packets_and_table:
2029
2030 Dump BGP packets and table
2031 ==========================
2032
2033 .. index:: dump bgp all PATH [INTERVAL]
2034 .. clicmd:: dump bgp all PATH [INTERVAL]
2035
2036 .. index:: dump bgp all-et PATH [INTERVAL]
2037 .. clicmd:: dump bgp all-et PATH [INTERVAL]
2038
2039 .. index:: no dump bgp all [PATH] [INTERVAL]
2040 .. clicmd:: no dump bgp all [PATH] [INTERVAL]
2041
2042 Dump all BGP packet and events to `path` file.
2043 If `interval` is set, a new file will be created for echo `interval` of seconds.
2044 The path `path` can be set with date and time formatting (strftime).
2045 The type ‘all-et’ enables support for Extended Timestamp Header (:ref:`Packet_Binary_Dump_Format`).
2046 (:ref:`Packet_Binary_Dump_Format`)
2047
2048 .. index:: dump bgp updates PATH [INTERVAL]
2049 .. clicmd:: dump bgp updates PATH [INTERVAL]
2050
2051 .. index:: dump bgp updates-et PATH [INTERVAL]
2052 .. clicmd:: dump bgp updates-et PATH [INTERVAL]
2053
2054 .. index:: no dump bgp updates [PATH] [INTERVAL]
2055 .. clicmd:: no dump bgp updates [PATH] [INTERVAL]
2056
2057 Dump only BGP updates messages to `path` file.
2058 If `interval` is set, a new file will be created for echo `interval` of seconds.
2059 The path `path` can be set with date and time formatting (strftime).
2060 The type ‘updates-et’ enables support for Extended Timestamp Header (:ref:`Packet_Binary_Dump_Format`).
2061
2062 .. index:: dump bgp routes-mrt PATH
2063 .. clicmd:: dump bgp routes-mrt PATH
2064
2065 .. index:: dump bgp routes-mrt PATH INTERVAL
2066 .. clicmd:: dump bgp routes-mrt PATH INTERVAL
2067
2068 .. index:: no dump bgp route-mrt [PATH] [INTERVAL]
2069 .. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL]
2070
2071 Dump whole BGP routing table to `path`. This is heavy process.
2072 The path `path` can be set with date and time formatting (strftime).
2073 If `interval` is set, a new file will be created for echo `interval` of seconds.
2074
2075 Note: the interval variable can also be set using hours and minutes: 04h20m00.
2076
2077 .. _bgp-configuration-examples:
2078
2079 BGP Configuration Examples
2080 ==========================
2081
2082 Example of a session to an upstream, advertising only one prefix to it.::
2083
2084 router bgp 64512
2085 bgp router-id 10.236.87.1
2086 neighbor upstream peer-group
2087 neighbor upstream remote-as 64515
2088 neighbor upstream capability dynamic
2089 neighbor 10.1.1.1 peer-group upstream
2090 neighbor 10.1.1.1 description ACME ISP
2091
2092 address-family ipv4 unicast
2093 network 10.236.87.0/24
2094 neighbor upstream prefix-list pl-allowed-adv out
2095 exit-address-family
2096 !
2097 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
2098 ip prefix-list pl-allowed-adv seq 10 deny any
2099
2100 A more complex example. With upstream, peer and customer sessions.
2101 Advertising global prefixes and NO_EXPORT prefixes and providing
2102 actions for customer routes based on community values. Extensive use of
2103 route-maps and the 'call' feature to support selective advertising of
2104 prefixes. This example is intended as guidance only, it has NOT been
2105 tested and almost certainly containts silly mistakes, if not serious
2106 flaws.
2107
2108 ::
2109
2110 router bgp 64512
2111 bgp router-id 10.236.87.1
2112 neighbor upstream capability dynamic
2113 neighbor cust capability dynamic
2114 neighbor peer capability dynamic
2115 neighbor 10.1.1.1 remote-as 64515
2116 neighbor 10.1.1.1 peer-group upstream
2117 neighbor 10.2.1.1 remote-as 64516
2118 neighbor 10.2.1.1 peer-group upstream
2119 neighbor 10.3.1.1 remote-as 64517
2120 neighbor 10.3.1.1 peer-group cust-default
2121 neighbor 10.3.1.1 description customer1
2122 neighbor 10.4.1.1 remote-as 64518
2123 neighbor 10.4.1.1 peer-group cust
2124 neighbor 10.4.1.1 description customer2
2125 neighbor 10.5.1.1 remote-as 64519
2126 neighbor 10.5.1.1 peer-group peer
2127 neighbor 10.5.1.1 description peer AS 1
2128 neighbor 10.6.1.1 remote-as 64520
2129 neighbor 10.6.1.1 peer-group peer
2130 neighbor 10.6.1.1 description peer AS 2
2131
2132 address-family ipv4 unicast
2133 network 10.123.456.0/24
2134 network 10.123.456.128/25 route-map rm-no-export
2135 neighbor upstream route-map rm-upstream-out out
2136 neighbor cust route-map rm-cust-in in
2137 neighbor cust route-map rm-cust-out out
2138 neighbor cust send-community both
2139 neighbor peer route-map rm-peer-in in
2140 neighbor peer route-map rm-peer-out out
2141 neighbor peer send-community both
2142 neighbor 10.3.1.1 prefix-list pl-cust1-network in
2143 neighbor 10.4.1.1 prefix-list pl-cust2-network in
2144 neighbor 10.5.1.1 prefix-list pl-peer1-network in
2145 neighbor 10.6.1.1 prefix-list pl-peer2-network in
2146 exit-address-family
2147 !
2148 ip prefix-list pl-default permit 0.0.0.0/0
2149 !
2150 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
2151 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
2152 !
2153 ip prefix-list pl-cust1-network permit 10.3.1.0/24
2154 ip prefix-list pl-cust1-network permit 10.3.2.0/24
2155 !
2156 ip prefix-list pl-cust2-network permit 10.4.1.0/24
2157 !
2158 ip prefix-list pl-peer1-network permit 10.5.1.0/24
2159 ip prefix-list pl-peer1-network permit 10.5.2.0/24
2160 ip prefix-list pl-peer1-network permit 192.168.0.0/24
2161 !
2162 ip prefix-list pl-peer2-network permit 10.6.1.0/24
2163 ip prefix-list pl-peer2-network permit 10.6.2.0/24
2164 ip prefix-list pl-peer2-network permit 192.168.1.0/24
2165 ip prefix-list pl-peer2-network permit 192.168.2.0/24
2166 ip prefix-list pl-peer2-network permit 172.16.1/24
2167 !
2168 ip as-path access-list asp-own-as permit ^$
2169 ip as-path access-list asp-own-as permit _64512_
2170 !
2171 ! #################################################################
2172 ! Match communities we provide actions for, on routes receives from
2173 ! customers. Communities values of <our-ASN>:X, with X, have actions:
2174 !
2175 ! 100 - blackhole the prefix
2176 ! 200 - set no_export
2177 ! 300 - advertise only to other customers
2178 ! 400 - advertise only to upstreams
2179 ! 500 - set no_export when advertising to upstreams
2180 ! 2X00 - set local_preference to X00
2181 !
2182 ! blackhole the prefix of the route
2183 ip community-list standard cm-blackhole permit 64512:100
2184 !
2185 ! set no-export community before advertising
2186 ip community-list standard cm-set-no-export permit 64512:200
2187 !
2188 ! advertise only to other customers
2189 ip community-list standard cm-cust-only permit 64512:300
2190 !
2191 ! advertise only to upstreams
2192 ip community-list standard cm-upstream-only permit 64512:400
2193 !
2194 ! advertise to upstreams with no-export
2195 ip community-list standard cm-upstream-noexport permit 64512:500
2196 !
2197 ! set local-pref to least significant 3 digits of the community
2198 ip community-list standard cm-prefmod-100 permit 64512:2100
2199 ip community-list standard cm-prefmod-200 permit 64512:2200
2200 ip community-list standard cm-prefmod-300 permit 64512:2300
2201 ip community-list standard cm-prefmod-400 permit 64512:2400
2202 ip community-list expanded cme-prefmod-range permit 64512:2...
2203 !
2204 ! Informational communities
2205 !
2206 ! 3000 - learned from upstream
2207 ! 3100 - learned from customer
2208 ! 3200 - learned from peer
2209 !
2210 ip community-list standard cm-learnt-upstream permit 64512:3000
2211 ip community-list standard cm-learnt-cust permit 64512:3100
2212 ip community-list standard cm-learnt-peer permit 64512:3200
2213 !
2214 ! ###################################################################
2215 ! Utility route-maps
2216 !
2217 ! These utility route-maps generally should not used to permit/deny
2218 ! routes, i.e. they do not have meaning as filters, and hence probably
2219 ! should be used with 'on-match next'. These all finish with an empty
2220 ! permit entry so as not interfere with processing in the caller.
2221 !
2222 route-map rm-no-export permit 10
2223 set community additive no-export
2224 route-map rm-no-export permit 20
2225 !
2226 route-map rm-blackhole permit 10
2227 description blackhole, up-pref and ensure it cant escape this AS
2228 set ip next-hop 127.0.0.1
2229 set local-preference 10
2230 set community additive no-export
2231 route-map rm-blackhole permit 20
2232 !
2233 ! Set local-pref as requested
2234 route-map rm-prefmod permit 10
2235 match community cm-prefmod-100
2236 set local-preference 100
2237 route-map rm-prefmod permit 20
2238 match community cm-prefmod-200
2239 set local-preference 200
2240 route-map rm-prefmod permit 30
2241 match community cm-prefmod-300
2242 set local-preference 300
2243 route-map rm-prefmod permit 40
2244 match community cm-prefmod-400
2245 set local-preference 400
2246 route-map rm-prefmod permit 50
2247 !
2248 ! Community actions to take on receipt of route.
2249 route-map rm-community-in permit 10
2250 description check for blackholing, no point continuing if it matches.
2251 match community cm-blackhole
2252 call rm-blackhole
2253 route-map rm-community-in permit 20
2254 match community cm-set-no-export
2255 call rm-no-export
2256 on-match next
2257 route-map rm-community-in permit 30
2258 match community cme-prefmod-range
2259 call rm-prefmod
2260 route-map rm-community-in permit 40
2261 !
2262 ! #####################################################################
2263 ! Community actions to take when advertising a route.
2264 ! These are filtering route-maps,
2265 !
2266 ! Deny customer routes to upstream with cust-only set.
2267 route-map rm-community-filt-to-upstream deny 10
2268 match community cm-learnt-cust
2269 match community cm-cust-only
2270 route-map rm-community-filt-to-upstream permit 20
2271 !
2272 ! Deny customer routes to other customers with upstream-only set.
2273 route-map rm-community-filt-to-cust deny 10
2274 match community cm-learnt-cust
2275 match community cm-upstream-only
2276 route-map rm-community-filt-to-cust permit 20
2277 !
2278 ! ###################################################################
2279 ! The top-level route-maps applied to sessions. Further entries could
2280 ! be added obviously..
2281 !
2282 ! Customers
2283 route-map rm-cust-in permit 10
2284 call rm-community-in
2285 on-match next
2286 route-map rm-cust-in permit 20
2287 set community additive 64512:3100
2288 route-map rm-cust-in permit 30
2289 !
2290 route-map rm-cust-out permit 10
2291 call rm-community-filt-to-cust
2292 on-match next
2293 route-map rm-cust-out permit 20
2294 !
2295 ! Upstream transit ASes
2296 route-map rm-upstream-out permit 10
2297 description filter customer prefixes which are marked cust-only
2298 call rm-community-filt-to-upstream
2299 on-match next
2300 route-map rm-upstream-out permit 20
2301 description only customer routes are provided to upstreams/peers
2302 match community cm-learnt-cust
2303 !
2304 ! Peer ASes
2305 ! outbound policy is same as for upstream
2306 route-map rm-peer-out permit 10
2307 call rm-upstream-out
2308 !
2309 route-map rm-peer-in permit 10
2310 set community additive 64512:3200
2311
2312
2313 .. _Configuring_FRR_as_a_Route_Server:
2314
2315 Configuring FRR as a Route Server
2316 =================================
2317
2318 The purpose of a Route Server is to centralize the peerings between BGP
2319 speakers. For example if we have an exchange point scenario with four BGP
2320 speakers, each of which maintaining a BGP peering with the other three
2321 (:ref:`fig:full-mesh`), we can convert it into a centralized scenario where
2322 each of the four establishes a single BGP peering against the Route Server
2323 (:ref:`fig:route-server`).
2324
2325 We will first describe briefly the Route Server model implemented by FRR.
2326 We will explain the commands that have been added for configuring that
2327 model. And finally we will show a full example of FRR configured as Route
2328 Server.
2329
2330 .. include:: rpki.rst
2331
2332
2333 .. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
2334 .. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
2335 .. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002