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