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