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.
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.
22 *bgpd* specific invocation options are described below. Common options may also
23 be specified (:ref:`common-invocation-options`).
27 .. option:: -p, --bgp_port <port>
29 Set the bgp protocol's port number. When port number is 0, that means do not
32 .. option:: -l, --listenon
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.
38 .. option:: -n, --no_kernel
40 Do not install learned routes into the linux kernel. This option is useful
41 for a route-reflector environment or if you are running multiple bgp
42 processes in the same namespace. This option is different than the --no_zebra
43 option in that a ZAPI connection is made.
45 .. option:: -S, --skip_runas
47 Skip the normal process of checking capabilities and changing user and group
50 .. option:: -e, --ecmp
52 Run BGP with a limited ecmp capability, that is different than what BGP
53 was compiled with. The value specified must be greater than 0 and less
54 than or equal to the MULTIPATH_NUM specified on compilation.
56 .. option:: -Z, --no_zebra
58 Do not communicate with zebra at all. This is different than the --no_kernel
59 option in that we do not even open a ZAPI connection to the zebra process.
61 .. option:: -s, --socket_size
63 When opening tcp connections to our peers, set the socket send buffer
64 size that the kernel will use for the peers socket. This option
65 is only really useful at a very large scale. Experimentation should
66 be done to see if this is helping or not at the scale you are running
72 .. option:: -I, --int_num
74 Set zclient id. This is required when using Zebra label manager in proxy mode.
76 .. _bgp-basic-concepts:
81 .. _bgp-autonomous-systems:
88 An AS is a connected group of one or more IP prefixes run by one or more
89 network operators which has a SINGLE and CLEARLY DEFINED routing policy.
91 Each AS has an identifying number associated with it called an :abbr:`ASN
92 (Autonomous System Number)`. This is a two octet value ranging in value from 1
93 to 65535. The AS numbers 64512 through 65535 are defined as private AS numbers.
94 Private AS numbers must not be advertised on the global Internet.
96 The :abbr:`ASN (Autonomous System Number)` is one of the essential elements of
97 BGP. BGP is a distance vector routing protocol, and the AS-Path framework
98 provides distance vector metric and loop detection to BGP.
100 .. seealso:: :rfc:`1930`
102 .. _bgp-address-families:
107 Multiprotocol extensions enable BGP to carry routing information for multiple
108 network layer protocols. BGP supports an Address Family Identifier (AFI) for
109 IPv4 and IPv6. Support is also provided for multiple sets of per-AFI
110 information via the BGP Subsequent Address Family Identifier (SAFI). FRR
111 supports SAFIs for unicast information, labeled information (:rfc:`3107` and
112 :rfc:`8277`), and Layer 3 VPN information (:rfc:`4364` and :rfc:`4659`).
114 .. _bgp-route-selection:
119 The route selection process used by FRR's BGP implementation uses the following
120 decision criterion, starting at the top of the list and going towards the
121 bottom until one of the factors can be used.
125 Prefer higher local weight routes to lower routes.
127 2. **Local preference check**
129 Prefer higher local preference routes to lower.
131 3. **Local route check**
133 Prefer local routes (statics, aggregates, redistributed) to received routes.
135 4. **AS path length check**
137 Prefer shortest hop-count AS_PATHs.
141 Prefer the lowest origin type route. That is, prefer IGP origin routes to
142 EGP, to Incomplete routes.
146 Where routes with a MED were received from the same AS, prefer the route
147 with the lowest MED. :ref:`bgp-med`.
149 7. **External check**
151 Prefer the route received from an external, eBGP peer over routes received
152 from other types of peers.
154 8. **IGP cost check**
156 Prefer the route with the lower IGP cost.
158 9. **Multi-path check**
160 If multi-pathing is enabled, then check whether the routes not yet
161 distinguished in preference may be considered equal. If
162 :clicmd:`bgp bestpath as-path multipath-relax` is set, all such routes are
163 considered equal, otherwise routes received via iBGP with identical AS_PATHs
164 or routes received from eBGP neighbours in the same AS are considered equal.
166 10. **Already-selected external check**
168 Where both routes were received from eBGP peers, then prefer the route
169 which is already selected. Note that this check is not applied if
170 :clicmd:`bgp bestpath compare-routerid` is configured. This check can
171 prevent some cases of oscillation.
173 11. **Router-ID check**
175 Prefer the route with the lowest `router-ID`. If the route has an
176 `ORIGINATOR_ID` attribute, through iBGP reflection, then that router ID is
177 used, otherwise the `router-ID` of the peer the route was received from is
180 12. **Cluster-List length check**
182 The route with the shortest cluster-list length is used. The cluster-list
183 reflects the iBGP reflection path the route has taken.
187 Prefer the route received from the peer with the higher transport layer
188 address, as a last-resort tie-breaker.
190 .. _bgp-capability-negotiation:
192 Capability Negotiation
193 ----------------------
195 When adding IPv6 routing information exchange feature to BGP. There were some
196 proposals. :abbr:`IETF (Internet Engineering Task Force)`
197 :abbr:`IDR (Inter Domain Routing)` adopted a proposal called Multiprotocol
198 Extension for BGP. The specification is described in :rfc:`2283`. The protocol
199 does not define new protocols. It defines new attributes to existing BGP. When
200 it is used exchanging IPv6 routing information it is called BGP-4+. When it is
201 used for exchanging multicast routing information it is called MBGP.
203 *bgpd* supports Multiprotocol Extension for BGP. So if a remote peer supports
204 the protocol, *bgpd* can exchange IPv6 and/or multicast routing information.
206 Traditional BGP did not have the feature to detect a remote peer's
207 capabilities, e.g. whether it can handle prefix types other than IPv4 unicast
208 routes. This was a big problem using Multiprotocol Extension for BGP in an
209 operational network. :rfc:`2842` adopted a feature called Capability
210 Negotiation. *bgpd* use this Capability Negotiation to detect the remote peer's
211 capabilities. If a peer is only configured as an IPv4 unicast neighbor, *bgpd*
212 does not send these Capability Negotiation packets (at least not unless other
213 optional BGP features require capability negotiation).
215 By default, FRR will bring up peering with minimal common capability for the
216 both sides. For example, if the local router has unicast and multicast
217 capabilities and the remote router only has unicast capability the local router
218 will establish the connection with unicast only capability. When there are no
219 common capabilities, FRR sends Unsupported Capability error and then resets the
222 .. _bgp-router-configuration:
224 BGP Router Configuration
225 ========================
230 First of all you must configure BGP router with the :clicmd:`router bgp ASN`
231 command. The AS number is an identifier for the autonomous system. The BGP
232 protocol uses the AS number for detecting whether the BGP connection is
233 internal or external.
235 .. index:: router bgp ASN
236 .. clicmd:: router bgp ASN
238 Enable a BGP protocol process with the specified ASN. After
239 this statement you can input any `BGP Commands`.
241 .. index:: no router bgp ASN
242 .. clicmd:: no router bgp ASN
244 Destroy a BGP protocol process with the specified ASN.
246 .. index:: bgp router-id A.B.C.D
247 .. clicmd:: bgp router-id A.B.C.D
249 This command specifies the router-ID. If *bgpd* connects to *zebra* it gets
250 interface and address information. In that case default router ID value is
251 selected as the largest IP Address of the interfaces. When `router zebra` is
252 not enabled *bgpd* can't get interface information so `router-id` is set to
253 0.0.0.0. So please set router-id by hand.
256 .. _bgp-multiple-autonomous-systems:
258 Multiple Autonomous Systems
259 ---------------------------
261 FRR's BGP implementation is capable of running multiple autonomous systems at
262 once. Each configured AS corresponds to a :ref:`zebra-vrf`. In the past, to get
263 the same functionality the network administrator had to run a new *bgpd*
264 process; using VRFs allows multiple autonomous systems to be handled in a
267 When using multiple autonomous systems, all router config blocks after the
268 first one must specify a VRF to be the target of BGP's route selection. This
269 VRF must be unique within respect to all other VRFs being used for the same
270 purpose, i.e. two different autonomous systems cannot use the same VRF.
271 However, the same AS can be used with different VRFs.
275 The separated nature of VRFs makes it possible to peer a single *bgpd*
276 process to itself, on one machine. Note that this can be done fully within
277 BGP without a corresponding VRF in the kernel or Zebra, which enables some
278 practical use cases such as :ref:`route reflectors <bgp-route-reflector>`
281 Configuration of additional autonomous systems, or of a router that targets a
282 specific VRF, is accomplished with the following command:
284 .. index:: router bgp ASN vrf VRFNAME
285 .. clicmd:: router bgp ASN vrf VRFNAME
287 ``VRFNAME`` is matched against VRFs configured in the kernel. When ``vrf
288 VRFNAME`` is not specified, the BGP protocol process belongs to the default
291 An example configuration with multiple autonomous systems might look like this:
296 neighbor 10.0.0.1 remote-as 20
297 neighbor 10.0.0.2 remote-as 30
299 router bgp 2 vrf blue
300 neighbor 10.0.0.3 remote-as 40
301 neighbor 10.0.0.4 remote-as 50
304 neighbor 10.0.0.5 remote-as 60
305 neighbor 10.0.0.6 remote-as 70
308 .. seealso:: :ref:`bgp-vrf-route-leaking`
309 .. seealso:: :ref:`zebra-vrf`
317 In addition to supporting multiple autonomous systems, FRR's BGP implementation
318 also supports *views*.
320 BGP views are almost the same as normal BGP processes, except that routes
321 selected by BGP are not installed into the kernel routing table. Each BGP view
322 provides an independent set of routing information which is only distributed
323 via BGP. Multiple views can be supported, and BGP view information is always
324 independent from other routing protocols and Zebra/kernel routes. BGP views use
325 the core instance (i.e., default VRF) for communication with peers.
327 .. index:: router bgp AS-NUMBER view NAME
328 .. clicmd:: router bgp AS-NUMBER view NAME
330 Make a new BGP view. You can use an arbitrary word for the ``NAME``. Routes
331 selected by the view are not installed into the kernel routing table.
333 With this command, you can setup Route Server like below.
339 neighbor 10.0.0.1 remote-as 2
340 neighbor 10.0.0.2 remote-as 3
343 neighbor 10.0.0.3 remote-as 4
344 neighbor 10.0.0.4 remote-as 5
346 .. index:: show [ip] bgp view NAME
347 .. clicmd:: show [ip] bgp view NAME
349 Display the routing table of BGP view ``NAME``.
355 .. index:: bgp bestpath as-path confed
356 .. clicmd:: bgp bestpath as-path confed
358 This command specifies that the length of confederation path sets and
359 sequences should should be taken into account during the BGP best path
362 .. index:: bgp bestpath as-path multipath-relax
363 .. clicmd:: bgp bestpath as-path multipath-relax
365 This command specifies that BGP decision process should consider paths
366 of equal AS_PATH length candidates for multipath computation. Without
367 the knob, the entire AS_PATH must match for multipath computation.
369 .. clicmd:: bgp bestpath compare-routerid
371 Ensure that when comparing routes where both are equal on most metrics,
372 including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken
375 If this option is enabled, then the already-selected check, where
376 already selected eBGP routes are preferred, is skipped.
378 If a route has an `ORIGINATOR_ID` attribute because it has been reflected,
379 that `ORIGINATOR_ID` will be used. Otherwise, the router-ID of the peer the
380 route was received from will be used.
382 The advantage of this is that the route-selection (at this point) will be
383 more deterministic. The disadvantage is that a few or even one lowest-ID
384 router may attract all traffic to otherwise-equal paths because of this
385 check. It may increase the possibility of MED or IGP oscillation, unless
386 other measures were taken to avoid these. The exact behaviour will be
387 sensitive to the iBGP and reflection topology.
391 Administrative Distance Metrics
392 -------------------------------
394 .. index:: distance bgp (1-255) (1-255) (1-255)
395 .. clicmd:: distance bgp (1-255) (1-255) (1-255)
397 This command change distance value of BGP. The arguments are the distance
398 values for for external routes, internal routes and local routes
401 .. index:: distance (1-255) A.B.C.D/M
402 .. clicmd:: distance (1-255) A.B.C.D/M
404 .. index:: distance (1-255) A.B.C.D/M WORD
405 .. clicmd:: distance (1-255) A.B.C.D/M WORD
407 Sets the administrative distance for a particular route.
409 .. _bgp-requires-policy:
411 Require policy on EBGP
412 -------------------------------
414 .. index:: [no] bgp ebgp-requires-policy
415 .. clicmd:: [no] bgp ebgp-requires-policy
417 This command requires incoming and outgoing filters to be applied for eBGP sessions. Without the incoming filter, no routes will be accepted. Without the outgoing filter, no routes will be announced.
419 .. _bgp-route-flap-dampening:
424 .. clicmd:: bgp dampening (1-45) (1-20000) (1-20000) (1-255)
426 This command enables BGP route-flap dampening and specifies dampening parameters.
429 Half-life time for the penalty
432 Value to start reusing a route
435 Value to start suppressing a route
438 Maximum duration to suppress a stable route
440 The route-flap damping algorithm is compatible with :rfc:`2439`. The use of
441 this command is not recommended nowadays.
444 https://www.ripe.net/publications/docs/ripe-378
448 Multi-Exit Discriminator
449 ------------------------
451 The BGP :abbr:`MED (Multi-Exit Discriminator)` attribute has properties which
452 can cause subtle convergence problems in BGP. These properties and problems
453 have proven to be hard to understand, at least historically, and may still not
454 be widely understood. The following attempts to collect together and present
455 what is known about MED, to help operators and FRR users in designing and
456 configuring their networks.
458 The BGP :abbr:`MED` attribute is intended to allow one AS to indicate its
459 preferences for its ingress points to another AS. The MED attribute will not be
460 propagated on to another AS by the receiving AS - it is 'non-transitive' in the
463 E.g., if AS X and AS Y have 2 different BGP peering points, then AS X might set
464 a MED of 100 on routes advertised at one and a MED of 200 at the other. When AS
465 Y selects between otherwise equal routes to or via AS X, AS Y should prefer to
466 take the path via the lower MED peering of 100 with AS X. Setting the MED
467 allows an AS to influence the routing taken to it within another, neighbouring
470 In this use of MED it is not really meaningful to compare the MED value on
471 routes where the next AS on the paths differs. E.g., if AS Y also had a route
472 for some destination via AS Z in addition to the routes from AS X, and AS Z had
473 also set a MED, it wouldn't make sense for AS Y to compare AS Z's MED values to
474 those of AS X. The MED values have been set by different administrators, with
475 different frames of reference.
477 The default behaviour of BGP therefore is to not compare MED values across
478 routes received from different neighbouring ASes. In FRR this is done by
479 comparing the neighbouring, left-most AS in the received AS_PATHs of the routes
480 and only comparing MED if those are the same.
482 Unfortunately, this behaviour of MED, of sometimes being compared across routes
483 and sometimes not, depending on the properties of those other routes, means MED
484 can cause the order of preference over all the routes to be undefined. That is,
485 given routes A, B, and C, if A is preferred to B, and B is preferred to C, then
486 a well-defined order should mean the preference is transitive (in the sense of
487 orders [#med-transitivity-rant]_) and that A would be preferred to C.
489 However, when MED is involved this need not be the case. With MED it is
490 possible that C is actually preferred over A. So A is preferred to B, B is
491 preferred to C, but C is preferred to A. This can be true even where BGP
492 defines a deterministic 'most preferred' route out of the full set of A,B,C.
493 With MED, for any given set of routes there may be a deterministically
494 preferred route, but there need not be any way to arrange them into any order
495 of preference. With unmodified MED, the order of preference of routes literally
498 That MED can induce non-transitive preferences over routes can cause issues.
499 Firstly, it may be perceived to cause routing table churn locally at speakers;
500 secondly, and more seriously, it may cause routing instability in iBGP
501 topologies, where sets of speakers continually oscillate between different
504 The first issue arises from how speakers often implement routing decisions.
505 Though BGP defines a selection process that will deterministically select the
506 same route as best at any given speaker, even with MED, that process requires
507 evaluating all routes together. For performance and ease of implementation
508 reasons, many implementations evaluate route preferences in a pair-wise fashion
509 instead. Given there is no well-defined order when MED is involved, the best
510 route that will be chosen becomes subject to implementation details, such as
511 the order the routes are stored in. That may be (locally) non-deterministic,
512 e.g.: it may be the order the routes were received in.
514 This indeterminism may be considered undesirable, though it need not cause
515 problems. It may mean additional routing churn is perceived, as sometimes more
516 updates may be produced than at other times in reaction to some event .
518 This first issue can be fixed with a more deterministic route selection that
519 ensures routes are ordered by the neighbouring AS during selection.
520 :clicmd:`bgp deterministic-med`. This may reduce the number of updates as routes
521 are received, and may in some cases reduce routing churn. Though, it could
522 equally deterministically produce the largest possible set of updates in
523 response to the most common sequence of received updates.
525 A deterministic order of evaluation tends to imply an additional overhead of
526 sorting over any set of n routes to a destination. The implementation of
527 deterministic MED in FRR scales significantly worse than most sorting
528 algorithms at present, with the number of paths to a given destination. That
529 number is often low enough to not cause any issues, but where there are many
530 paths, the deterministic comparison may quickly become increasingly expensive
533 Deterministic local evaluation can *not* fix the second, more major, issue of
534 MED however. Which is that the non-transitive preference of routes MED can
535 cause may lead to routing instability or oscillation across multiple speakers
536 in iBGP topologies. This can occur with full-mesh iBGP, but is particularly
537 problematic in non-full-mesh iBGP topologies that further reduce the routing
538 information known to each speaker. This has primarily been documented with iBGP
539 :ref:`route-reflection <bgp-route-reflector>` topologies. However, any
540 route-hiding technologies potentially could also exacerbate oscillation with MED.
542 This second issue occurs where speakers each have only a subset of routes, and
543 there are cycles in the preferences between different combinations of routes -
544 as the undefined order of preference of MED allows - and the routes are
545 distributed in a way that causes the BGP speakers to 'chase' those cycles. This
546 can occur even if all speakers use a deterministic order of evaluation in route
549 E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and from
550 speaker 3 in AS Y; while speaker 5 in AS A might receive that route from
551 speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 at speaker
552 3. I.e, using ASN:ID:MED to label the speakers:
558 X:2------|--A:4-------A:5--|-Y:1:200
564 Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then based
565 on the RFC4271 decision process speaker 4 will choose X:2 over Y:3:100, based
566 on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. Speaker 5 will
567 continue to prefer Y:1:200 based on the ID, and advertise this to speaker 4.
568 Speaker 4 will now have the full set of routes, and the Y:1:200 it receives
569 from 5 will beat X:2, but when speaker 4 compares Y:1:200 to Y:3:100 the MED
570 check now becomes active as the ASes match, and now Y:3:100 is preferred.
571 Speaker 4 therefore now advertises Y:3:100 to 5, which will also agrees that
572 Y:3:100 is preferred to Y:1:200, and so withdraws the latter route from 4.
573 Speaker 4 now has only X:2 and Y:3:100, and X:2 beats Y:3:100, and so speaker 4
574 implicitly updates its route to speaker 5 to X:2. Speaker 5 sees that Y:1:200
575 beats X:2 based on the ID, and advertises Y:1:200 to speaker 4, and the cycle
578 The root cause is the lack of a clear order of preference caused by how MED
579 sometimes is and sometimes is not compared, leading to this cycle in the
580 preferences between the routes:
585 /---> X:2 ---beats---> Y:3:100 --\\
588 \\---beats--- Y:1:200 <---beats---/
592 This particular type of oscillation in full-mesh iBGP topologies can be
593 avoided by speakers preferring already selected, external routes rather than
594 choosing to update to new a route based on a post-MED metric (e.g. router-ID),
595 at the cost of a non-deterministic selection process. FRR implements this, as
596 do many other implementations, so long as it is not overridden by setting
597 :clicmd:`bgp bestpath compare-routerid`, and see also
598 :ref:`bgp-route-selection`.
600 However, more complex and insidious cycles of oscillation are possible with
601 iBGP route-reflection, which are not so easily avoided. These have been
602 documented in various places. See, e.g.:
604 - [bgp-route-osci-cond]_
605 - [stable-flexible-ibgp]_
606 - [ibgp-correctness]_
608 for concrete examples and further references.
610 There is as of this writing *no* known way to use MED for its original purpose;
611 *and* reduce routing information in iBGP topologies; *and* be sure to avoid the
612 instability problems of MED due the non-transitive routing preferences it can
613 induce; in general on arbitrary networks.
615 There may be iBGP topology specific ways to reduce the instability risks, even
616 while using MED, e.g.: by constraining the reflection topology and by tuning
617 IGP costs between route-reflector clusters, see :rfc:`3345` for details. In the
618 near future, the Add-Path extension to BGP may also solve MED oscillation while
619 still allowing MED to be used as intended, by distributing "best-paths per
620 neighbour AS". This would be at the cost of distributing at least as many
621 routes to all speakers as a full-mesh iBGP would, if not more, while also
622 imposing similar CPU overheads as the "Deterministic MED" feature at each
625 More generally, the instability problems that MED can introduce on more
626 complex, non-full-mesh, iBGP topologies may be avoided either by:
628 - Setting :clicmd:`bgp always-compare-med`, however this allows MED to be compared
629 across values set by different neighbour ASes, which may not produce
630 coherent desirable results, of itself.
631 - Effectively ignoring MED by setting MED to the same value (e.g.: 0) using
632 :clicmd:`set metric METRIC` on all received routes, in combination with
633 setting :clicmd:`bgp always-compare-med` on all speakers. This is the simplest
634 and most performant way to avoid MED oscillation issues, where an AS is happy
635 not to allow neighbours to inject this problematic metric.
637 As MED is evaluated after the AS_PATH length check, another possible use for
638 MED is for intra-AS steering of routes with equal AS_PATH length, as an
639 extension of the last case above. As MED is evaluated before IGP metric, this
640 can allow cold-potato routing to be implemented to send traffic to preferred
641 hand-offs with neighbours, rather than the closest hand-off according to the
644 Note that even if action is taken to address the MED non-transitivity issues,
645 other oscillations may still be possible. E.g., on IGP cost if iBGP and IGP
646 topologies are at cross-purposes with each other - see the Flavel and Roughan
647 paper above for an example. Hence the guideline that the iBGP topology should
648 follow the IGP topology.
650 .. index:: bgp deterministic-med
651 .. clicmd:: bgp deterministic-med
653 Carry out route-selection in way that produces deterministic answers
654 locally, even in the face of MED and the lack of a well-defined order of
655 preference it can induce on routes. Without this option the preferred route
656 with MED may be determined largely by the order that routes were received
659 Setting this option will have a performance cost that may be noticeable when
660 there are many routes for each destination. Currently in FRR it is
661 implemented in a way that scales poorly as the number of routes per
662 destination increases.
664 The default is that this option is not set.
666 Note that there are other sources of indeterminism in the route selection
667 process, specifically, the preference for older and already selected routes
668 from eBGP peers, :ref:`bgp-route-selection`.
670 .. index:: bgp always-compare-med
671 .. clicmd:: bgp always-compare-med
673 Always compare the MED on routes, even when they were received from
674 different neighbouring ASes. Setting this option makes the order of
675 preference of routes more defined, and should eliminate MED induced
678 If using this option, it may also be desirable to use
679 :clicmd:`set metric METRIC` to set MED to 0 on routes received from external
682 This option can be used, together with :clicmd:`set metric METRIC` to use
683 MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g.,
691 .. index:: network A.B.C.D/M
692 .. clicmd:: network A.B.C.D/M
694 This command adds the announcement network.
699 address-family ipv4 unicast
703 This configuration example says that network 10.0.0.0/8 will be
704 announced to all neighbors. Some vendors' routers don't advertise
705 routes if they aren't present in their IGP routing tables; `bgpd`
706 doesn't care about IGP routes when announcing its routes.
708 .. index:: no network A.B.C.D/M
709 .. clicmd:: no network A.B.C.D/M
711 .. _bgp-route-aggregation:
716 .. _bgp-route-aggregation-ipv4:
718 Route Aggregation-IPv4 Address Family
719 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
721 .. index:: aggregate-address A.B.C.D/M
722 .. clicmd:: aggregate-address A.B.C.D/M
724 This command specifies an aggregate address.
726 .. index:: aggregate-address A.B.C.D/M route-map NAME
727 .. clicmd:: aggregate-address A.B.C.D/M route-map NAME
729 Apply a route-map for an aggregated prefix.
731 .. index:: aggregate-address A.B.C.D/M as-set
732 .. clicmd:: aggregate-address A.B.C.D/M as-set
734 This command specifies an aggregate address. Resulting routes include
737 .. index:: aggregate-address A.B.C.D/M summary-only
738 .. clicmd:: aggregate-address A.B.C.D/M summary-only
740 This command specifies an aggregate address. Aggregated routes will
743 .. index:: no aggregate-address A.B.C.D/M
744 .. clicmd:: no aggregate-address A.B.C.D/M
746 This command removes an aggregate address.
749 This configuration example setup the aggregate-address under
755 address-family ipv4 unicast
756 aggregate-address 10.0.0.0/8
757 aggregate-address 20.0.0.0/8 as-set
758 aggregate-address 40.0.0.0/8 summary-only
759 aggregate-address 50.0.0.0/8 route-map aggr-rmap
763 .. _bgp-route-aggregation-ipv6:
765 Route Aggregation-IPv6 Address Family
766 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
768 .. index:: aggregate-address X:X::X:X/M
769 .. clicmd:: aggregate-address X:X::X:X/M
771 This command specifies an aggregate address.
773 .. index:: aggregate-address X:X::X:X/M route-map NAME
774 .. clicmd:: aggregate-address X:X::X:X/M route-map NAME
776 Apply a route-map for an aggregated prefix.
778 .. index:: aggregate-address X:X::X:X/M as-set
779 .. clicmd:: aggregate-address X:X::X:X/M as-set
781 This command specifies an aggregate address. Resulting routes include
784 .. index:: aggregate-address X:X::X:X/M summary-only
785 .. clicmd:: aggregate-address X:X::X:X/M summary-only
787 This command specifies an aggregate address. Aggregated routes will
790 .. index:: no aggregate-address X:X::X:X/M
791 .. clicmd:: no aggregate-address X:X::X:X/M
793 This command removes an aggregate address.
796 This configuration example setup the aggregate-address under
802 address-family ipv6 unicast
803 aggregate-address 10::0/64
804 aggregate-address 20::0/64 as-set
805 aggregate-address 40::0/64 summary-only
806 aggregate-address 50::0/64 route-map aggr-rmap
809 .. _bgp-redistribute-to-bgp:
814 .. index:: redistribute kernel
815 .. clicmd:: redistribute kernel
817 Redistribute kernel route to BGP process.
819 .. index:: redistribute static
820 .. clicmd:: redistribute static
822 Redistribute static route to BGP process.
824 .. index:: redistribute connected
825 .. clicmd:: redistribute connected
827 Redistribute connected route to BGP process.
829 .. index:: redistribute rip
830 .. clicmd:: redistribute rip
832 Redistribute RIP route to BGP process.
834 .. index:: redistribute ospf
835 .. clicmd:: redistribute ospf
837 Redistribute OSPF route to BGP process.
839 .. index:: redistribute vpn
840 .. clicmd:: redistribute vpn
842 Redistribute VNC routes to BGP process.
844 .. index:: update-delay MAX-DELAY
845 .. clicmd:: update-delay MAX-DELAY
847 .. index:: update-delay MAX-DELAY ESTABLISH-WAIT
848 .. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT
850 This feature is used to enable read-only mode on BGP process restart or when
851 BGP process is cleared using 'clear ip bgp \*'. When applicable, read-only
852 mode would begin as soon as the first peer reaches Established status and a
853 timer for max-delay seconds is started.
855 During this mode BGP doesn't run any best-path or generate any updates to its
856 peers. This mode continues until:
858 1. All the configured peers, except the shutdown peers, have sent explicit EOR
859 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
860 Established is considered an implicit-EOR.
861 If the establish-wait optional value is given, then BGP will wait for
862 peers to reach established from the beginning of the update-delay till the
863 establish-wait period is over, i.e. the minimum set of established peers for
864 which EOR is expected would be peers established during the establish-wait
865 window, not necessarily all the configured neighbors.
866 2. max-delay period is over.
868 On hitting any of the above two conditions, BGP resumes the decision process
869 and generates updates to its peers.
871 Default max-delay is 0, i.e. the feature is off by default.
873 .. index:: table-map ROUTE-MAP-NAME
874 .. clicmd:: table-map ROUTE-MAP-NAME
876 This feature is used to apply a route-map on route updates from BGP to
877 Zebra. All the applicable match operations are allowed, such as match on
878 prefix, next-hop, communities, etc. Set operations for this attach-point are
879 limited to metric and next-hop only. Any operation of this feature does not
880 affect BGPs internal RIB.
882 Supported for ipv4 and ipv6 address families. It works on multi-paths as
883 well, however, metric setting is based on the best-path only.
890 .. _bgp-defining-peers:
895 .. index:: neighbor PEER remote-as ASN
896 .. clicmd:: neighbor PEER remote-as ASN
898 Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address
899 or an IPv6 address or an interface to use for the connection.
904 neighbor 10.0.0.1 remote-as 2
906 In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1.
908 This command must be the first command used when configuring a neighbor. If
909 the remote-as is not specified, *bgpd* will complain like this: ::
911 can't find neighbor 10.0.0.1
913 .. index:: neighbor PEER remote-as internal
914 .. clicmd:: neighbor PEER remote-as internal
916 Create a peer as you would when you specify an ASN, except that if the
917 peers ASN is different than mine as specified under the :clicmd:`router bgp ASN`
918 command the connection will be denied.
920 .. index:: neighbor PEER remote-as external
921 .. clicmd:: neighbor PEER remote-as external
923 Create a peer as you would when you specify an ASN, except that if the
924 peers ASN is the same as mine as specified under the :clicmd:`router bgp ASN`
925 command the connection will be denied.
927 .. index:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME
928 .. clicmd:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME
930 Accept connections from any peers in the specified prefix. Configuration
931 from the specified peer-group is used to configure these peers.
935 When using BGP listen ranges, if the associated peer group has TCP MD5
936 authentication configured, your kernel must support this on prefixes. On
937 Linux, this support was added in kernel version 4.14. If your kernel does
938 not support this feature you will get a warning in the log file, and the
939 listen range will only accept connections from peers without MD5 configured.
941 Additionally, we have observed that when using this option at scale (several
942 hundred peers) the kernel may hit its option memory limit. In this situation
943 you will see error messages like:
945 ``bgpd: sockopt_tcp_signature: setsockopt(23): Cannot allocate memory``
947 In this case you need to increase the value of the sysctl
948 ``net.core.optmem_max`` to allow the kernel to allocate the necessary option
951 .. _bgp-configuring-peers:
956 .. index:: [no] neighbor PEER shutdown
957 .. clicmd:: [no] neighbor PEER shutdown
959 Shutdown the peer. We can delete the neighbor's configuration by
960 ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor
961 will be deleted. When you want to preserve the configuration, but want to
962 drop the BGP peer, use this syntax.
964 .. index:: [no] neighbor PEER disable-connected-check
965 .. clicmd:: [no] neighbor PEER disable-connected-check
967 Allow peerings between directly connected eBGP peers using loopback
970 .. index:: [no] neighbor PEER ebgp-multihop
971 .. clicmd:: [no] neighbor PEER ebgp-multihop
973 .. index:: [no] neighbor PEER description ...
974 .. clicmd:: [no] neighbor PEER description ...
976 Set description of the peer.
978 .. index:: [no] neighbor PEER version VERSION
979 .. clicmd:: [no] neighbor PEER version VERSION
981 Set up the neighbor's BGP version. `version` can be `4`, `4+` or `4-`. BGP
982 version `4` is the default value used for BGP peering. BGP version `4+`
983 means that the neighbor supports Multiprotocol Extensions for BGP-4. BGP
984 version `4-` is similar but the neighbor speaks the old Internet-Draft
985 revision 00's Multiprotocol Extensions for BGP-4. Some routing software is
986 still using this version.
988 .. index:: [no] neighbor PEER interface IFNAME
989 .. clicmd:: [no] neighbor PEER interface IFNAME
991 When you connect to a BGP peer over an IPv6 link-local address, you have to
992 specify the IFNAME of the interface used for the connection. To specify
993 IPv4 session addresses, see the ``neighbor PEER update-source`` command
996 This command is deprecated and may be removed in a future release. Its use
999 .. index:: [no] neighbor PEER next-hop-self [all]
1000 .. clicmd:: [no] neighbor PEER next-hop-self [all]
1002 This command specifies an announced route's nexthop as being equivalent to
1003 the address of the bgp router if it is learned via eBGP. If the optional
1004 keyword `all` is specified the modification is done also for routes learned
1007 .. index:: [no] neighbor PEER update-source <IFNAME|ADDRESS>
1008 .. clicmd:: [no] neighbor PEER update-source <IFNAME|ADDRESS>
1010 Specify the IPv4 source address to use for the :abbr:`BGP` session to this
1011 neighbour, may be specified as either an IPv4 address directly or as an
1012 interface name (in which case the *zebra* daemon MUST be running in order
1013 for *bgpd* to be able to retrieve interface state).
1018 neighbor foo update-source 192.168.0.1
1019 neighbor bar update-source lo0
1022 .. index:: [no] neighbor PEER default-originate
1023 .. clicmd:: [no] neighbor PEER default-originate
1025 *bgpd*'s default is to not announce the default route (0.0.0.0/0) even if it
1026 is in routing table. When you want to announce default routes to the peer,
1029 .. index:: neighbor PEER port PORT
1030 .. clicmd:: neighbor PEER port PORT
1032 .. index:: neighbor PEER send-community
1033 .. clicmd:: neighbor PEER send-community
1035 .. index:: [no] neighbor PEER weight WEIGHT
1036 .. clicmd:: [no] neighbor PEER weight WEIGHT
1038 This command specifies a default `weight` value for the neighbor's routes.
1040 .. index:: [no] neighbor PEER maximum-prefix NUMBER
1041 .. clicmd:: [no] neighbor PEER maximum-prefix NUMBER
1043 Sets a maximum number of prefixes we can receive from a given peer. If this
1044 number is exceeded, the BGP session will be destroyed.
1046 In practice, it is generally preferable to use a prefix-list to limit what
1047 prefixes are received from the peer instead of using this knob. Tearing down
1048 the BGP session when a limit is exceeded is far more destructive than merely
1049 rejecting undesired prefixes. The prefix-list method is also much more
1050 granular and offers much smarter matching criterion than number of received
1051 prefixes, making it more suited to implementing policy.
1053 .. index:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as]
1054 .. clicmd:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as]
1056 Specify an alternate AS for this BGP process when interacting with the
1057 specified peer. With no modifiers, the specified local-as is prepended to
1058 the received AS_PATH when receiving routing updates from the peer, and
1059 prepended to the outgoing AS_PATH (after the process local AS) when
1060 transmitting local routes to the peer.
1062 If the no-prepend attribute is specified, then the supplied local-as is not
1063 prepended to the received AS_PATH.
1065 If the replace-as attribute is specified, then only the supplied local-as is
1066 prepended to the AS_PATH when transmitting local-route updates to this peer.
1068 Note that replace-as can only be specified if no-prepend is.
1070 This command is only allowed for eBGP peers.
1072 .. index:: [no] neighbor PEER ttl-security hops NUMBER
1073 .. clicmd:: [no] neighbor PEER ttl-security hops NUMBER
1075 This command enforces Generalized TTL Security Mechanism (GTSM), as
1076 specified in RFC 5082. With this command, only neighbors that are the
1077 specified number of hops away will be allowed to become neighbors. This
1078 command is mutually exclusive with *ebgp-multihop*.
1080 .. index:: [no] neighbor PEER capability extended-nexthop
1081 .. clicmd:: [no] neighbor PEER capability extended-nexthop
1083 Allow bgp to negotiate the extended-nexthop capability with it's peer.
1084 If you are peering over a v6 LL address then this capability is turned
1085 on automatically. If you are peering over a v6 Global Address then
1086 turning on this command will allow BGP to install v4 routes with
1087 v6 nexthops if you do not have v4 configured on interfaces.
1089 .. index:: [no] bgp fast-external-failover
1090 .. clicmd:: [no] bgp fast-external-failover
1092 This command causes bgp to not take down ebgp peers immediately
1093 when a link flaps. `bgp fast-external-failover` is the default
1094 and will not be displayed as part of a `show run`. The no form
1095 of the command turns off this ability.
1097 .. index:: [no] bgp default ipv4-unicast
1098 .. clicmd:: [no] bgp default ipv4-unicast
1100 This command allows the user to specify that v4 peering is turned
1101 on by default or not. This command defaults to on and is not displayed.
1102 The `no bgp default ipv4-unicast` form of the command is displayed.
1104 .. index:: [no] neighbor PEER advertisement-interval (0-600)
1105 .. clicmd:: [no] neighbor PEER advertisement-interval (0-600)
1107 Setup the minimum route advertisement interval(mrai) for the
1108 peer in question. This number is between 0 and 600 seconds,
1109 with the default advertisement interval being 0.
1111 .. _bgp-peer-filtering:
1116 .. index:: neighbor PEER distribute-list NAME [in|out]
1117 .. clicmd:: neighbor PEER distribute-list NAME [in|out]
1119 This command specifies a distribute-list for the peer. `direct` is
1122 .. index:: neighbor PEER prefix-list NAME [in|out]
1123 .. clicmd:: neighbor PEER prefix-list NAME [in|out]
1125 .. index:: neighbor PEER filter-list NAME [in|out]
1126 .. clicmd:: neighbor PEER filter-list NAME [in|out]
1128 .. index:: neighbor PEER route-map NAME [in|out]
1129 .. clicmd:: neighbor PEER route-map NAME [in|out]
1131 Apply a route-map on the neighbor. `direct` must be `in` or `out`.
1133 .. index:: bgp route-reflector allow-outbound-policy
1134 .. clicmd:: bgp route-reflector allow-outbound-policy
1136 By default, attribute modification via route-map policy out is not reflected
1137 on reflected routes. This option allows the modifications to be reflected as
1138 well. Once enabled, it affects all reflected routes.
1145 Peer groups are used to help improve scaling by generating the same
1146 update information to all members of a peer group. Note that this means
1147 that the routes generated by a member of a peer group will be sent back
1148 to that originating peer with the originator identifier attribute set to
1149 indicated the originating peer. All peers not associated with a
1150 specific peer group are treated as belonging to a default peer group,
1151 and will share updates.
1153 .. index:: neighbor WORD peer-group
1154 .. clicmd:: neighbor WORD peer-group
1156 This command defines a new peer group.
1158 .. index:: neighbor PEER peer-group PGNAME
1159 .. clicmd:: neighbor PEER peer-group PGNAME
1161 This command bind specific peer to peer group WORD.
1163 .. index:: neighbor PEER solo
1164 .. clicmd:: neighbor PEER solo
1166 This command is used to indicate that routes advertised by the peer
1167 should not be reflected back to the peer. This command only is only
1168 meaningful when there is a single peer defined in the peer-group.
1170 Capability Negotiation
1171 ^^^^^^^^^^^^^^^^^^^^^^
1173 .. index:: neighbor PEER strict-capability-match
1174 .. clicmd:: neighbor PEER strict-capability-match
1176 .. index:: no neighbor PEER strict-capability-match
1177 .. clicmd:: no neighbor PEER strict-capability-match
1179 Strictly compares remote capabilities and local capabilities. If
1180 capabilities are different, send Unsupported Capability error then reset
1183 You may want to disable sending Capability Negotiation OPEN message optional
1184 parameter to the peer when remote peer does not implement Capability
1185 Negotiation. Please use *dont-capability-negotiate* command to disable the
1188 .. index:: [no] neighbor PEER dont-capability-negotiate
1189 .. clicmd:: [no] neighbor PEER dont-capability-negotiate
1191 Suppress sending Capability Negotiation as OPEN message optional parameter
1192 to the peer. This command only affects the peer is configured other than
1193 IPv4 unicast configuration.
1195 When remote peer does not have capability negotiation feature, remote peer
1196 will not send any capabilities at all. In that case, bgp configures the peer
1197 with configured capabilities.
1199 You may prefer locally configured capabilities more than the negotiated
1200 capabilities even though remote peer sends capabilities. If the peer is
1201 configured by *override-capability*, *bgpd* ignores received capabilities
1202 then override negotiated capabilities with configured values.
1204 Additionally the operator should be reminded that this feature fundamentally
1205 disables the ability to use widely deployed BGP features. BGP unnumbered,
1206 hostname support, AS4, Addpath, Route Refresh, ORF, Dynamic Capabilities,
1207 and graceful restart.
1209 .. index:: neighbor PEER override-capability
1210 .. clicmd:: neighbor PEER override-capability
1212 .. index:: no neighbor PEER override-capability
1213 .. clicmd:: no neighbor PEER override-capability
1215 Override the result of Capability Negotiation with local configuration.
1216 Ignore remote peer's capability value.
1218 .. _bgp-as-path-access-lists:
1220 AS Path Access Lists
1221 --------------------
1223 AS path access list is user defined AS path.
1225 .. index:: bgp as-path access-list WORD permit|deny LINE
1226 .. clicmd:: bgp as-path access-list WORD permit|deny LINE
1228 This command defines a new AS path access list.
1230 .. index:: no bgp as-path access-list WORD
1231 .. clicmd:: no bgp as-path access-list WORD
1233 .. index:: no bgp as-path access-list WORD permit|deny LINE
1234 .. clicmd:: no bgp as-path access-list WORD permit|deny LINE
1236 .. _bgp-using-as-path-in-route-map:
1238 Using AS Path in Route Map
1239 --------------------------
1241 .. index:: [no] match as-path WORD
1242 .. clicmd:: [no] match as-path WORD
1244 For a given as-path, WORD, match it on the BGP as-path given for the prefix
1245 and if it matches do normal route-map actions. The no form of the command
1246 removes this match from the route-map.
1248 .. index:: [no] set as-path prepend AS-PATH
1249 .. clicmd:: [no] set as-path prepend AS-PATH
1251 Prepend the given string of AS numbers to the AS_PATH of the BGP path's NLRI.
1252 The no form of this command removes this set operation from the route-map.
1254 .. index:: [no] set as-path prepend last-as NUM
1255 .. clicmd:: [no] set as-path prepend last-as NUM
1257 Prepend the existing last AS number (the leftmost ASN) to the AS_PATH.
1258 The no form of this command removes this set operation from the route-map.
1260 .. _bgp-communities-attribute:
1262 Communities Attribute
1263 ---------------------
1265 The BGP communities attribute is widely used for implementing policy routing.
1266 Network operators can manipulate BGP communities attribute based on their
1267 network policy. BGP communities attribute is defined in :rfc:`1997` and
1268 :rfc:`1998`. It is an optional transitive attribute, therefore local policy can
1269 travel through different autonomous system.
1271 The communities attribute is a set of communities values. Each community value
1272 is 4 octet long. The following format is used to define the community value.
1275 This format represents 4 octet communities value. ``AS`` is high order 2
1276 octet in digit format. ``VAL`` is low order 2 octet in digit format. This
1277 format is useful to define AS oriented policy value. For example,
1278 ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
1282 ``internet`` represents well-known communities value 0.
1284 ``graceful-shutdown``
1285 ``graceful-shutdown`` represents well-known communities value
1286 ``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements
1287 the purpose Graceful BGP Session Shutdown to reduce the amount of
1288 lost traffic when taking BGP sessions down for maintenance. The use
1289 of the community needs to be supported from your peers side to
1290 actually have any effect.
1293 ``accept-own`` represents well-known communities value ``ACCEPT_OWN``
1294 ``0xFFFF0001`` ``65535:1``. :rfc:`7611` implements a way to signal
1295 to a router to accept routes with a local nexthop address. This
1296 can be the case when doing policing and having traffic having a
1297 nexthop located in another VRF but still local interface to the
1298 router. It is recommended to read the RFC for full details.
1300 ``route-filter-translated-v4``
1301 ``route-filter-translated-v4`` represents well-known communities value
1302 ``ROUTE_FILTER_TRANSLATED_v4`` ``0xFFFF0002`` ``65535:2``.
1305 ``route-filter-v4`` represents well-known communities value
1306 ``ROUTE_FILTER_v4`` ``0xFFFF0003`` ``65535:3``.
1308 ``route-filter-translated-v6``
1309 ``route-filter-translated-v6`` represents well-known communities value
1310 ``ROUTE_FILTER_TRANSLATED_v6`` ``0xFFFF0004`` ``65535:4``.
1313 ``route-filter-v6`` represents well-known communities value
1314 ``ROUTE_FILTER_v6`` ``0xFFFF0005`` ``65535:5``.
1317 ``llgr-stale`` represents well-known communities value ``LLGR_STALE``
1318 ``0xFFFF0006`` ``65535:6``.
1319 Assigned and intended only for use with routers supporting the
1320 Long-lived Graceful Restart Capability as described in
1321 [Draft-IETF-uttaro-idr-bgp-persistence]_.
1322 Routers receiving routes with this community may (depending on
1323 implementation) choose allow to reject or modify routes on the
1324 presence or absence of this community.
1327 ``no-llgr`` represents well-known communities value ``NO_LLGR``
1328 ``0xFFFF0007`` ``65535:7``.
1329 Assigned and intended only for use with routers supporting the
1330 Long-lived Graceful Restart Capability as described in
1331 [Draft-IETF-uttaro-idr-bgp-persistence]_.
1332 Routers receiving routes with this community may (depending on
1333 implementation) choose allow to reject or modify routes on the
1334 presence or absence of this community.
1336 ``accept-own-nexthop``
1337 ``accept-own-nexthop`` represents well-known communities value
1338 ``accept-own-nexthop`` ``0xFFFF0008`` ``65535:8``.
1339 [Draft-IETF-agrewal-idr-accept-own-nexthop]_ describes
1340 how to tag and label VPN routes to be able to send traffic between VRFs
1341 via an internal layer 2 domain on the same PE device. Refer to
1342 [Draft-IETF-agrewal-idr-accept-own-nexthop]_ for full details.
1345 ``blackhole`` represents well-known communities value ``BLACKHOLE``
1346 ``0xFFFF029A`` ``65535:666``. :rfc:`7999` documents sending prefixes to
1347 EBGP peers and upstream for the purpose of blackholing traffic.
1348 Prefixes tagged with the this community should normally not be
1349 re-advertised from neighbors of the originating network. It is
1350 recommended upon receiving prefixes tagged with this community to
1351 add ``NO_EXPORT`` and ``NO_ADVERTISE``.
1354 ``no-export`` represents well-known communities value ``NO_EXPORT``
1355 ``0xFFFFFF01``. All routes carry this value must not be advertised to
1356 outside a BGP confederation boundary. If neighboring BGP peer is part of BGP
1357 confederation, the peer is considered as inside a BGP confederation
1358 boundary, so the route will be announced to the peer.
1361 ``no-advertise`` represents well-known communities value ``NO_ADVERTISE``
1362 ``0xFFFFFF02``. All routes carry this value must not be advertise to other
1366 ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED``
1367 ``0xFFFFFF03``. All routes carry this value must not be advertised to
1368 external BGP peers. Even if the neighboring router is part of confederation,
1369 it is considered as external BGP peer, so the route will not be announced to
1373 ``no-peer`` represents well-known communities value ``NOPEER``
1374 ``0xFFFFFF04`` ``65535:65284``. :rfc:`3765` is used to communicate to
1375 another network how the originating network want the prefix propagated.
1377 When the communities attribute is received duplicate community values in the
1378 attribute are ignored and value is sorted in numerical order.
1380 .. [Draft-IETF-uttaro-idr-bgp-persistence] <https://tools.ietf.org/id/draft-uttaro-idr-bgp-persistence-04.txt>
1381 .. [Draft-IETF-agrewal-idr-accept-own-nexthop] <https://tools.ietf.org/id/draft-agrewal-idr-accept-own-nexthop-00.txt>
1383 .. _bgp-community-lists:
1387 Community lists are user defined lists of community attribute values. These
1388 lists can be used for matching or manipulating the communities attribute in
1391 There are two types of community list:
1394 This type accepts an explicit value for the attribute.
1397 This type accepts a regular expression. Because the regex must be
1398 interpreted on each use expanded community lists are slower than standard
1401 .. index:: bgp community-list standard NAME permit|deny COMMUNITY
1402 .. clicmd:: bgp community-list standard NAME permit|deny COMMUNITY
1404 This command defines a new standard community list. ``COMMUNITY`` is
1405 communities value. The ``COMMUNITY`` is compiled into community structure.
1406 We can define multiple community list under same name. In that case match
1407 will happen user defined order. Once the community list matches to
1408 communities attribute in BGP updates it return permit or deny by the
1409 community list definition. When there is no matched entry, deny will be
1410 returned. When ``COMMUNITY`` is empty it matches to any routes.
1412 .. index:: bgp community-list expanded NAME permit|deny COMMUNITY
1413 .. clicmd:: bgp community-list expanded NAME permit|deny COMMUNITY
1415 This command defines a new expanded community list. ``COMMUNITY`` is a
1416 string expression of communities attribute. ``COMMUNITY`` can be a regular
1417 expression (:ref:`bgp-regular-expressions`) to match the communities
1418 attribute in BGP updates. The expanded community is only used to filter,
1422 It is recommended to use the more explicit versions of this command.
1424 .. index:: bgp community-list NAME permit|deny COMMUNITY
1425 .. clicmd:: bgp community-list NAME permit|deny COMMUNITY
1427 When the community list type is not specified, the community list type is
1428 automatically detected. If ``COMMUNITY`` can be compiled into communities
1429 attribute, the community list is defined as a standard community list.
1430 Otherwise it is defined as an expanded community list. This feature is left
1431 for backward compatibility. Use of this feature is not recommended.
1434 .. index:: no bgp community-list [standard|expanded] NAME
1435 .. clicmd:: no bgp community-list [standard|expanded] NAME
1437 Deletes the community list specified by ``NAME``. All community lists share
1438 the same namespace, so it's not necessary to specify ``standard`` or
1439 ``expanded``; these modifiers are purely aesthetic.
1441 .. index:: show bgp community-list [NAME]
1442 .. clicmd:: show bgp community-list [NAME]
1444 Displays community list information. When ``NAME`` is specified the
1445 specified community list's information is shown.
1449 # show bgp community-list
1450 Named Community standard list CLIST
1451 permit 7675:80 7675:100 no-export
1453 Named Community expanded list EXPAND
1456 # show bgp community-list CLIST
1457 Named Community standard list CLIST
1458 permit 7675:80 7675:100 no-export
1462 .. _bgp-numbered-community-lists:
1464 Numbered Community Lists
1465 ^^^^^^^^^^^^^^^^^^^^^^^^
1467 When number is used for BGP community list name, the number has
1468 special meanings. Community list number in the range from 1 and 99 is
1469 standard community list. Community list number in the range from 100
1470 to 199 is expanded community list. These community lists are called
1471 as numbered community lists. On the other hand normal community lists
1472 is called as named community lists.
1474 .. index:: bgp community-list (1-99) permit|deny COMMUNITY
1475 .. clicmd:: bgp community-list (1-99) permit|deny COMMUNITY
1477 This command defines a new community list. The argument to (1-99) defines
1478 the list identifier.
1480 .. index:: bgp community-list (100-199) permit|deny COMMUNITY
1481 .. clicmd:: bgp community-list (100-199) permit|deny COMMUNITY
1483 This command defines a new expanded community list. The argument to
1484 (100-199) defines the list identifier.
1486 .. _bgp-using-communities-in-route-map:
1488 Using Communities in Route Maps
1489 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1491 In :ref:`route-map` we can match on or set the BGP communities attribute. Using
1492 this feature network operator can implement their network policy based on BGP
1493 communities attribute.
1495 The ollowing commands can be used in route maps:
1497 .. index:: match community WORD exact-match [exact-match]
1498 .. clicmd:: match community WORD exact-match [exact-match]
1500 This command perform match to BGP updates using community list WORD. When
1501 the one of BGP communities value match to the one of communities value in
1502 community list, it is match. When `exact-match` keyword is specified, match
1503 happen only when BGP updates have completely same communities value
1504 specified in the community list.
1506 .. index:: set community <none|COMMUNITY> additive
1507 .. clicmd:: set community <none|COMMUNITY> additive
1509 This command sets the community value in BGP updates. If the attribute is
1510 already configured, the newly provided value replaces the old one unless the
1511 ``additive`` keyword is specified, in which case the new value is appended
1512 to the existing value.
1514 If ``none`` is specified as the community value, the communities attribute
1517 It is not possible to set an expanded community list.
1519 .. index:: set comm-list WORD delete
1520 .. clicmd:: set comm-list WORD delete
1522 This command remove communities value from BGP communities attribute. The
1523 ``word`` is community list name. When BGP route's communities value matches
1524 to the community list ``word``, the communities value is removed. When all
1525 of communities value is removed eventually, the BGP update's communities
1526 attribute is completely removed.
1528 .. _bgp-communities-example:
1530 Example Configuration
1531 ^^^^^^^^^^^^^^^^^^^^^
1533 The following configuration is exemplary of the most typical usage of BGP
1534 communities attribute. In the example, AS 7675 provides an upstream Internet
1535 connection to AS 100. When the following configuration exists in AS 7675, the
1536 network operator of AS 100 can set local preference in AS 7675 network by
1537 setting BGP communities attribute to the updates.
1542 neighbor 192.168.0.1 remote-as 100
1543 address-family ipv4 unicast
1544 neighbor 192.168.0.1 route-map RMAP in
1547 bgp community-list 70 permit 7675:70
1548 bgp community-list 70 deny
1549 bgp community-list 80 permit 7675:80
1550 bgp community-list 80 deny
1551 bgp community-list 90 permit 7675:90
1552 bgp community-list 90 deny
1554 route-map RMAP permit 10
1556 set local-preference 70
1558 route-map RMAP permit 20
1560 set local-preference 80
1562 route-map RMAP permit 30
1564 set local-preference 90
1567 The following configuration announces ``10.0.0.0/8`` from AS 100 to AS 7675.
1568 The route has communities value ``7675:80`` so when above configuration exists
1569 in AS 7675, the announced routes' local preference value will be set to 80.
1575 neighbor 192.168.0.2 remote-as 7675
1576 address-family ipv4 unicast
1577 neighbor 192.168.0.2 route-map RMAP out
1580 ip prefix-list PLIST permit 10.0.0.0/8
1582 route-map RMAP permit 10
1583 match ip address prefix-list PLIST
1584 set community 7675:80
1587 The following configuration is an example of BGP route filtering using
1588 communities attribute. This configuration only permit BGP routes which has BGP
1589 communities value ``0:80`` or ``0:90``. The network operator can set special
1590 internal communities value at BGP border router, then limit the BGP route
1591 announcements into the internal network.
1596 neighbor 192.168.0.1 remote-as 100
1597 address-family ipv4 unicast
1598 neighbor 192.168.0.1 route-map RMAP in
1601 bgp community-list 1 permit 0:80 0:90
1603 route-map RMAP permit in
1607 The following example filters BGP routes which have a community value of
1608 ``1:1``. When there is no match community-list returns ``deny``. To avoid
1609 filtering all routes, a ``permit`` line is set at the end of the
1615 neighbor 192.168.0.1 remote-as 100
1616 address-family ipv4 unicast
1617 neighbor 192.168.0.1 route-map RMAP in
1620 bgp community-list standard FILTER deny 1:1
1621 bgp community-list standard FILTER permit
1623 route-map RMAP permit 10
1624 match community FILTER
1627 The communities value keyword ``internet`` has special meanings in standard
1628 community lists. In the below example ``internet`` matches all BGP routes even
1629 if the route does not have communities attribute at all. So community list
1630 ``INTERNET`` is the same as ``FILTER`` in the previous example.
1634 bgp community-list standard INTERNET deny 1:1
1635 bgp community-list standard INTERNET permit internet
1638 The following configuration is an example of communities value deletion. With
1639 this configuration the community values ``100:1`` and ``100:2`` are removed
1640 from BGP updates. For communities value deletion, only ``permit``
1641 community-list is used. ``deny`` community-list is ignored.
1646 neighbor 192.168.0.1 remote-as 100
1647 address-family ipv4 unicast
1648 neighbor 192.168.0.1 route-map RMAP in
1651 bgp community-list standard DEL permit 100:1 100:2
1653 route-map RMAP permit 10
1654 set comm-list DEL delete
1657 .. _bgp-extended-communities-attribute:
1659 Extended Communities Attribute
1660 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1662 BGP extended communities attribute is introduced with MPLS VPN/BGP technology.
1663 MPLS VPN/BGP expands capability of network infrastructure to provide VPN
1664 functionality. At the same time it requires a new framework for policy routing.
1665 With BGP Extended Communities Attribute we can use Route Target or Site of
1666 Origin for implementing network policy for MPLS VPN/BGP.
1668 BGP Extended Communities Attribute is similar to BGP Communities Attribute. It
1669 is an optional transitive attribute. BGP Extended Communities Attribute can
1670 carry multiple Extended Community value. Each Extended Community value is
1673 BGP Extended Communities Attribute provides an extended range compared with BGP
1674 Communities Attribute. Adding to that there is a type field in each value to
1675 provides community space structure.
1677 There are two format to define Extended Community value. One is AS based format
1678 the other is IP address based format.
1681 This is a format to define AS based Extended Community value. ``AS`` part
1682 is 2 octets Global Administrator subfield in Extended Community value.
1683 ``VAL`` part is 4 octets Local Administrator subfield. ``7675:100``
1684 represents AS 7675 policy value 100.
1687 This is a format to define IP address based Extended Community value.
1688 ``IP-Address`` part is 4 octets Global Administrator subfield. ``VAL`` part
1689 is 2 octets Local Administrator subfield.
1691 .. _bgp-extended-community-lists:
1693 Extended Community Lists
1694 ^^^^^^^^^^^^^^^^^^^^^^^^
1696 .. index:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY
1697 .. clicmd:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY
1699 This command defines a new standard extcommunity-list. `extcommunity` is
1700 extended communities value. The `extcommunity` is compiled into extended
1701 community structure. We can define multiple extcommunity-list under same
1702 name. In that case match will happen user defined order. Once the
1703 extcommunity-list matches to extended communities attribute in BGP updates
1704 it return permit or deny based upon the extcommunity-list definition. When
1705 there is no matched entry, deny will be returned. When `extcommunity` is
1706 empty it matches to any routes.
1708 .. index:: bgp extcommunity-list expanded NAME permit|deny LINE
1709 .. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE
1711 This command defines a new expanded extcommunity-list. `line` is a string
1712 expression of extended communities attribute. `line` can be a regular
1713 expression (:ref:`bgp-regular-expressions`) to match an extended communities
1714 attribute in BGP updates.
1716 .. index:: no bgp extcommunity-list NAME
1717 .. clicmd:: no bgp extcommunity-list NAME
1719 .. index:: no bgp extcommunity-list standard NAME
1720 .. clicmd:: no bgp extcommunity-list standard NAME
1722 .. index:: no bgp extcommunity-list expanded NAME
1723 .. clicmd:: no bgp extcommunity-list expanded NAME
1725 These commands delete extended community lists specified by `name`. All of
1726 extended community lists shares a single name space. So extended community
1727 lists can be removed simply specifying the name.
1729 .. index:: show bgp extcommunity-list
1730 .. clicmd:: show bgp extcommunity-list
1732 .. index:: show bgp extcommunity-list NAME
1733 .. clicmd:: show bgp extcommunity-list NAME
1735 This command displays current extcommunity-list information. When `name` is
1736 specified the community list's information is shown.::
1738 # show bgp extcommunity-list
1741 .. _bgp-extended-communities-in-route-map:
1743 BGP Extended Communities in Route Map
1744 """""""""""""""""""""""""""""""""""""
1746 .. index:: match extcommunity WORD
1747 .. clicmd:: match extcommunity WORD
1749 .. index:: set extcommunity rt EXTCOMMUNITY
1750 .. clicmd:: set extcommunity rt EXTCOMMUNITY
1752 This command set Route Target value.
1754 .. index:: set extcommunity soo EXTCOMMUNITY
1755 .. clicmd:: set extcommunity soo EXTCOMMUNITY
1757 This command set Site of Origin value.
1760 Note that the extended expanded community is only used for `match` rule, not for
1763 .. _bgp-large-communities-attribute:
1765 Large Communities Attribute
1766 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1768 The BGP Large Communities attribute was introduced in Feb 2017 with
1771 The BGP Large Communities Attribute is similar to the BGP Communities Attribute
1772 except that it has 3 components instead of two and each of which are 4 octets
1773 in length. Large Communities bring additional functionality and convenience
1774 over traditional communities, specifically the fact that the ``GLOBAL`` part
1775 below is now 4 octets wide allowing seamless use in networks using 4-byte ASNs.
1777 ``GLOBAL:LOCAL1:LOCAL2``
1778 This is the format to define Large Community values. Referencing :rfc:`8195`
1779 the values are commonly referred to as follows:
1781 - The ``GLOBAL`` part is a 4 octet Global Administrator field, commonly used
1782 as the operators AS number.
1783 - The ``LOCAL1`` part is a 4 octet Local Data Part 1 subfield referred to as
1785 - The ``LOCAL2`` part is a 4 octet Local Data Part 2 field and referred to
1786 as the parameter subfield.
1788 As an example, ``65551:1:10`` represents AS 65551 function 1 and parameter
1789 10. The referenced RFC above gives some guidelines on recommended usage.
1791 .. _bgp-large-community-lists:
1793 Large Community Lists
1794 """""""""""""""""""""
1796 Two types of large community lists are supported, namely `standard` and
1799 .. index:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY
1800 .. clicmd:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY
1802 This command defines a new standard large-community-list. `large-community`
1803 is the Large Community value. We can add multiple large communities under
1804 same name. In that case the match will happen in the user defined order.
1805 Once the large-community-list matches the Large Communities attribute in BGP
1806 updates it will return permit or deny based upon the large-community-list
1807 definition. When there is no matched entry, a deny will be returned. When
1808 `large-community` is empty it matches any routes.
1810 .. index:: bgp large-community-list expanded NAME permit|deny LINE
1811 .. clicmd:: bgp large-community-list expanded NAME permit|deny LINE
1813 This command defines a new expanded large-community-list. Where `line` is a
1814 string matching expression, it will be compared to the entire Large
1815 Communities attribute as a string, with each large-community in order from
1816 lowest to highest. `line` can also be a regular expression which matches
1817 this Large Community attribute.
1819 .. index:: no bgp large-community-list NAME
1820 .. clicmd:: no bgp large-community-list NAME
1822 .. index:: no bgp large-community-list standard NAME
1823 .. clicmd:: no bgp large-community-list standard NAME
1825 .. index:: no bgp large-community-list expanded NAME
1826 .. clicmd:: no bgp large-community-list expanded NAME
1828 These commands delete Large Community lists specified by `name`. All Large
1829 Community lists share a single namespace. This means Large Community lists
1830 can be removed by simply specifying the name.
1832 .. index:: show bgp large-community-list
1833 .. clicmd:: show bgp large-community-list
1835 .. index:: show bgp large-community-list NAME
1836 .. clicmd:: show bgp large-community-list NAME
1838 This command display current large-community-list information. When
1839 `name` is specified the community list information is shown.
1841 .. index:: show ip bgp large-community-info
1842 .. clicmd:: show ip bgp large-community-info
1844 This command displays the current large communities in use.
1846 .. _bgp-large-communities-in-route-map:
1848 Large Communities in Route Map
1849 """"""""""""""""""""""""""""""
1851 .. index:: match large-community LINE [exact-match]
1852 .. clicmd:: match large-community LINE [exact-match]
1854 Where `line` can be a simple string to match, or a regular expression. It
1855 is very important to note that this match occurs on the entire
1856 large-community string as a whole, where each large-community is ordered
1857 from lowest to highest. When `exact-match` keyword is specified, match
1858 happen only when BGP updates have completely same large communities value
1859 specified in the large community list.
1861 .. index:: set large-community LARGE-COMMUNITY
1862 .. clicmd:: set large-community LARGE-COMMUNITY
1864 .. index:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
1865 .. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
1867 .. index:: set large-community LARGE-COMMUNITY additive
1868 .. clicmd:: set large-community LARGE-COMMUNITY additive
1870 These commands are used for setting large-community values. The first
1871 command will overwrite any large-communities currently present.
1872 The second specifies two large-communities, which overwrites the current
1873 large-community list. The third will add a large-community value without
1874 overwriting other values. Multiple large-community values can be specified.
1876 Note that the large expanded community is only used for `match` rule, not for
1884 *bgpd* supports :abbr:`L3VPN (Layer 3 Virtual Private Networks)` :abbr:`VRFs
1885 (Virtual Routing and Forwarding)` for IPv4 :rfc:`4364` and IPv6 :rfc:`4659`.
1886 L3VPN routes, and their associated VRF MPLS labels, can be distributed to VPN
1887 SAFI neighbors in the *default*, i.e., non VRF, BGP instance. VRF MPLS labels
1888 are reached using *core* MPLS labels which are distributed using LDP or BGP
1889 labeled unicast. *bgpd* also supports inter-VRF route leaking.
1892 .. _bgp-vrf-route-leaking:
1897 BGP routes may be leaked (i.e. copied) between a unicast VRF RIB and the VPN
1898 SAFI RIB of the default VRF for use in MPLS-based L3VPNs. Unicast routes may
1899 also be leaked between any VRFs (including the unicast RIB of the default BGP
1900 instanced). A shortcut syntax is also available for specifying leaking from one
1901 VRF to another VRF using the default instance's VPN RIB as the intemediary. A
1902 common application of the VRF-VRF feature is to connect a customer's private
1903 routing domain to a provider's VPN service. Leaking is configured from the
1904 point of view of an individual VRF: ``import`` refers to routes leaked from VPN
1905 to a unicast VRF, whereas ``export`` refers to routes leaked from a unicast VRF
1911 Routes exported from a unicast VRF to the VPN RIB must be augmented by two
1914 - an :abbr:`RD (Route Distinguisher)`
1915 - an :abbr:`RTLIST (Route-target List)`
1917 Configuration for these exported routes must, at a minimum, specify these two
1920 Routes imported from the VPN RIB to a unicast VRF are selected according to
1921 their RTLISTs. Routes whose RTLIST contains at least one route-target in
1922 common with the configured import RTLIST are leaked. Configuration for these
1923 imported routes must specify an RTLIST to be matched.
1925 The RD, which carries no semantic value, is intended to make the route unique
1926 in the VPN RIB among all routes of its prefix that originate from all the
1927 customers and sites that are attached to the provider's VPN service.
1928 Accordingly, each site of each customer is typically assigned an RD that is
1929 unique across the entire provider network.
1931 The RTLIST is a set of route-target extended community values whose purpose is
1932 to specify route-leaking policy. Typically, a customer is assigned a single
1933 route-target value for import and export to be used at all customer sites. This
1934 configuration specifies a simple topology wherein a customer has a single
1935 routing domain which is shared across all its sites. More complex routing
1936 topologies are possible through use of additional route-targets to augment the
1937 leaking of sets of routes in various ways.
1939 When using the shortcut syntax for vrf-to-vrf leaking, the RD and RT are
1942 General configuration
1943 ^^^^^^^^^^^^^^^^^^^^^
1945 Configuration of route leaking between a unicast VRF RIB and the VPN SAFI RIB
1946 of the default VRF is accomplished via commands in the context of a VRF
1949 .. index:: rd vpn export AS:NN|IP:nn
1950 .. clicmd:: rd vpn export AS:NN|IP:nn
1952 Specifies the route distinguisher to be added to a route exported from the
1953 current unicast VRF to VPN.
1955 .. index:: no rd vpn export [AS:NN|IP:nn]
1956 .. clicmd:: no rd vpn export [AS:NN|IP:nn]
1958 Deletes any previously-configured export route distinguisher.
1960 .. index:: rt vpn import|export|both RTLIST...
1961 .. clicmd:: rt vpn import|export|both RTLIST...
1963 Specifies the route-target list to be attached to a route (export) or the
1964 route-target list to match against (import) when exporting/importing between
1965 the current unicast VRF and VPN.
1967 The RTLIST is a space-separated list of route-targets, which are BGP
1968 extended community values as described in
1969 :ref:`bgp-extended-communities-attribute`.
1971 .. index:: no rt vpn import|export|both [RTLIST...]
1972 .. clicmd:: no rt vpn import|export|both [RTLIST...]
1974 Deletes any previously-configured import or export route-target list.
1976 .. index:: label vpn export (0..1048575)|auto
1977 .. clicmd:: label vpn export (0..1048575)|auto
1979 Enables an MPLS label to be attached to a route exported from the current
1980 unicast VRF to VPN. If the value specified is ``auto``, the label value is
1981 automatically assigned from a pool maintained by the Zebra daemon. If Zebra
1982 is not running, or if this command is not configured, automatic label
1983 assignment will not complete, which will block corresponding route export.
1985 .. index:: no label vpn export [(0..1048575)|auto]
1986 .. clicmd:: no label vpn export [(0..1048575)|auto]
1988 Deletes any previously-configured export label.
1990 .. index:: nexthop vpn export A.B.C.D|X:X::X:X
1991 .. clicmd:: nexthop vpn export A.B.C.D|X:X::X:X
1993 Specifies an optional nexthop value to be assigned to a route exported from
1994 the current unicast VRF to VPN. If left unspecified, the nexthop will be set
1995 to 0.0.0.0 or 0:0::0:0 (self).
1997 .. index:: no nexthop vpn export [A.B.C.D|X:X::X:X]
1998 .. clicmd:: no nexthop vpn export [A.B.C.D|X:X::X:X]
2000 Deletes any previously-configured export nexthop.
2002 .. index:: route-map vpn import|export MAP
2003 .. clicmd:: route-map vpn import|export MAP
2005 Specifies an optional route-map to be applied to routes imported or exported
2006 between the current unicast VRF and VPN.
2008 .. index:: no route-map vpn import|export [MAP]
2009 .. clicmd:: no route-map vpn import|export [MAP]
2011 Deletes any previously-configured import or export route-map.
2013 .. index:: import|export vpn
2014 .. clicmd:: import|export vpn
2016 Enables import or export of routes between the current unicast VRF and VPN.
2018 .. index:: no import|export vpn
2019 .. clicmd:: no import|export vpn
2021 Disables import or export of routes between the current unicast VRF and VPN.
2023 .. index:: import vrf VRFNAME
2024 .. clicmd:: import vrf VRFNAME
2026 Shortcut syntax for specifying automatic leaking from vrf VRFNAME to
2027 the current VRF using the VPN RIB as intermediary. The RD and RT
2028 are auto derived and should not be specified explicitly for either the
2029 source or destination VRF's.
2031 This shortcut syntax mode is not compatible with the explicit
2032 `import vpn` and `export vpn` statements for the two VRF's involved.
2033 The CLI will disallow attempts to configure incompatible leaking
2036 .. index:: no import vrf VRFNAME
2037 .. clicmd:: no import vrf VRFNAME
2039 Disables automatic leaking from vrf VRFNAME to the current VRF using
2040 the VPN RIB as intermediary.
2043 .. _bgp-cisco-compatibility:
2048 FRR has commands that change some configuration syntax and default behavior to
2049 behave more closely to Cisco conventions. These are deprecated and will be
2050 removed in a future version of FRR.
2053 Please transition to using the FRR specific syntax for your configuration.
2055 .. index:: bgp config-type cisco
2056 .. clicmd:: bgp config-type cisco
2058 Cisco compatible BGP configuration output.
2060 When this configuration line is specified:
2062 - ``no synchronization`` is displayed. This command does nothing and is for
2063 display purposes only.
2064 - ``no auto-summary`` is displayed.
2065 - The ``network`` and ``aggregate-address`` arguments are displayed as:
2071 FRR: network 10.0.0.0/8
2072 Cisco: network 10.0.0.0
2074 FRR: aggregate-address 192.168.0.0/24
2075 Cisco: aggregate-address 192.168.0.0 255.255.255.0
2077 Community attribute handling is also different. If no configuration is
2078 specified community attribute and extended community attribute are sent to
2079 the neighbor. If a user manually disables the feature, the community
2080 attribute is not sent to the neighbor. When ``bgp config-type cisco`` is
2081 specified, the community attribute is not sent to the neighbor by default.
2082 To send the community attribute user has to specify
2083 :clicmd:`neighbor A.B.C.D send-community` like so:
2089 neighbor 10.0.0.1 remote-as 1
2090 address-family ipv4 unicast
2091 no neighbor 10.0.0.1 send-community
2095 neighbor 10.0.0.1 remote-as 1
2096 address-family ipv4 unicast
2097 neighbor 10.0.0.1 send-community
2102 Please transition to using the FRR specific syntax for your configuration.
2104 .. index:: bgp config-type zebra
2105 .. clicmd:: bgp config-type zebra
2107 FRR style BGP configuration. This is the default.
2114 .. index:: show debug
2115 .. clicmd:: show debug
2117 Show all enabled debugs.
2119 .. index:: [no] debug bgp neighbor-events
2120 .. clicmd:: [no] debug bgp neighbor-events
2122 Enable or disable debugging for neighbor events. This provides general
2123 information on BGP events such as peer connection / disconnection, session
2124 establishment / teardown, and capability negotiation.
2126 .. index:: [no] debug bgp updates
2127 .. clicmd:: [no] debug bgp updates
2129 Enable or disable debugging for BGP updates. This provides information on
2130 BGP UPDATE messages transmitted and received between local and remote
2133 .. index:: [no] debug bgp keepalives
2134 .. clicmd:: [no] debug bgp keepalives
2136 Enable or disable debugging for BGP keepalives. This provides information on
2137 BGP KEEPALIVE messages transmitted and received between local and remote
2140 .. index:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
2141 .. clicmd:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
2143 Enable or disable debugging for bestpath selection on the specified prefix.
2145 .. index:: [no] debug bgp nht
2146 .. clicmd:: [no] debug bgp nht
2148 Enable or disable debugging of BGP nexthop tracking.
2150 .. index:: [no] debug bgp update-groups
2151 .. clicmd:: [no] debug bgp update-groups
2153 Enable or disable debugging of dynamic update groups. This provides general
2154 information on group creation, deletion, join and prune events.
2156 .. index:: [no] debug bgp zebra
2157 .. clicmd:: [no] debug bgp zebra
2159 Enable or disable debugging of communications between *bgpd* and *zebra*.
2161 Dumping Messages and Routing Tables
2162 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2164 .. index:: dump bgp all PATH [INTERVAL]
2165 .. clicmd:: dump bgp all PATH [INTERVAL]
2167 .. index:: dump bgp all-et PATH [INTERVAL]
2168 .. clicmd:: dump bgp all-et PATH [INTERVAL]
2170 .. index:: no dump bgp all [PATH] [INTERVAL]
2171 .. clicmd:: no dump bgp all [PATH] [INTERVAL]
2173 Dump all BGP packet and events to `path` file.
2174 If `interval` is set, a new file will be created for echo `interval` of
2175 seconds. The path `path` can be set with date and time formatting
2176 (strftime). The type ‘all-et’ enables support for Extended Timestamp Header
2177 (:ref:`packet-binary-dump-format`).
2179 .. index:: dump bgp updates PATH [INTERVAL]
2180 .. clicmd:: dump bgp updates PATH [INTERVAL]
2182 .. index:: dump bgp updates-et PATH [INTERVAL]
2183 .. clicmd:: dump bgp updates-et PATH [INTERVAL]
2185 .. index:: no dump bgp updates [PATH] [INTERVAL]
2186 .. clicmd:: no dump bgp updates [PATH] [INTERVAL]
2188 Dump only BGP updates messages to `path` file.
2189 If `interval` is set, a new file will be created for echo `interval` of
2190 seconds. The path `path` can be set with date and time formatting
2191 (strftime). The type ‘updates-et’ enables support for Extended Timestamp
2192 Header (:ref:`packet-binary-dump-format`).
2194 .. index:: dump bgp routes-mrt PATH
2195 .. clicmd:: dump bgp routes-mrt PATH
2197 .. index:: dump bgp routes-mrt PATH INTERVAL
2198 .. clicmd:: dump bgp routes-mrt PATH INTERVAL
2200 .. index:: no dump bgp route-mrt [PATH] [INTERVAL]
2201 .. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL]
2203 Dump whole BGP routing table to `path`. This is heavy process. The path
2204 `path` can be set with date and time formatting (strftime). If `interval` is
2205 set, a new file will be created for echo `interval` of seconds.
2207 Note: the interval variable can also be set using hours and minutes: 04h20m00.
2210 .. _bgp-other-commands:
2215 The following are available in the top level *enable* mode:
2217 .. index:: clear bgp \*
2218 .. clicmd:: clear bgp \*
2222 .. index:: clear bgp ipv4|ipv6 \*
2223 .. clicmd:: clear bgp ipv4|ipv6 \*
2225 Clear all peers with this address-family activated.
2227 .. index:: clear bgp ipv4|ipv6 unicast \*
2228 .. clicmd:: clear bgp ipv4|ipv6 unicast \*
2230 Clear all peers with this address-family and sub-address-family activated.
2232 .. index:: clear bgp ipv4|ipv6 PEER
2233 .. clicmd:: clear bgp ipv4|ipv6 PEER
2235 Clear peers with address of X.X.X.X and this address-family activated.
2237 .. index:: clear bgp ipv4|ipv6 unicast PEER
2238 .. clicmd:: clear bgp ipv4|ipv6 unicast PEER
2240 Clear peer with address of X.X.X.X and this address-family and sub-address-family activated.
2242 .. index:: clear bgp ipv4|ipv6 PEER soft|in|out
2243 .. clicmd:: clear bgp ipv4|ipv6 PEER soft|in|out
2245 Clear peer using soft reconfiguration in this address-family.
2247 .. index:: clear bgp ipv4|ipv6 unicast PEER soft|in|out
2248 .. clicmd:: clear bgp ipv4|ipv6 unicast PEER soft|in|out
2250 Clear peer using soft reconfiguration in this address-family and sub-address-family.
2252 The following are available in the ``router bgp`` mode:
2254 .. index:: write-quanta (1-64)
2255 .. clicmd:: write-quanta (1-64)
2257 BGP message Tx I/O is vectored. This means that multiple packets are written
2258 to the peer socket at the same time each I/O cycle, in order to minimize
2259 system call overhead. This value controls how many are written at a time.
2260 Under certain load conditions, reducing this value could make peer traffic
2261 less 'bursty'. In practice, leave this settings on the default (64) unless
2262 you truly know what you are doing.
2264 .. index:: read-quanta (1-10)
2265 .. clicmd:: read-quanta (1-10)
2267 Unlike Tx, BGP Rx traffic is not vectored. Packets are read off the wire one
2268 at a time in a loop. This setting controls how many iterations the loop runs
2269 for. As with write-quanta, it is best to leave this setting on the default.
2271 .. _bgp-displaying-bgp-information:
2273 Displaying BGP Information
2274 ==========================
2276 The following four commands display the IPv6 and IPv4 routing tables, depending
2277 on whether or not the ``ip`` keyword is used.
2278 Actually, :clicmd:`show ip bgp` command was used on older `Quagga` routing
2279 daemon project, while :clicmd:`show bgp` command is the new format. The choice
2280 has been done to keep old format with IPv4 routing table, while new format
2281 displays IPv6 routing table.
2283 .. index:: show ip bgp
2284 .. clicmd:: show ip bgp
2286 .. index:: show ip bgp A.B.C.D
2287 .. clicmd:: show ip bgp A.B.C.D
2290 .. clicmd:: show bgp
2292 .. index:: show bgp X:X::X:X
2293 .. clicmd:: show bgp X:X::X:X
2295 These commands display BGP routes. When no route is specified, the default
2296 is to display all BGP routes.
2300 BGP table version is 0, local router ID is 10.1.1.1
2301 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
2302 Origin codes: i - IGP, e - EGP, ? - incomplete
2304 Network Next Hop Metric LocPrf Weight Path
2305 \*> 1.1.1.1/32 0.0.0.0 0 32768 i
2307 Total number of prefixes 1
2309 Some other commands provide additional options for filtering the output.
2311 .. index:: show [ip] bgp regexp LINE
2312 .. clicmd:: show [ip] bgp regexp LINE
2314 This command displays BGP routes using AS path regular expression
2315 (:ref:`bgp-regular-expressions`).
2317 .. index:: show [ip] bgp summary
2318 .. clicmd:: show [ip] bgp summary
2320 Show a bgp peer summary for the specified address family.
2322 The old command structure :clicmd:`show ip bgp` may be removed in the future
2323 and should no longer be used. In order to reach the other BGP routing tables
2324 other than the IPv6 routing table given by :clicmd:`show bgp`, the new command
2325 structure is extended with :clicmd:`show bgp [afi] [safi]`.
2327 .. index:: show bgp [afi] [safi]
2328 .. clicmd:: show bgp [afi] [safi]
2330 .. index:: show bgp <ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast>
2331 .. clicmd:: show bgp <ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast>
2333 These commands display BGP routes for the specific routing table indicated by
2334 the selected afi and the selected safi. If no afi and no safi value is given,
2335 the command falls back to the default IPv6 routing table
2337 .. index:: show bgp [afi] [safi] summary
2338 .. clicmd:: show bgp [afi] [safi] summary
2340 Show a bgp peer summary for the specified address family, and subsequent
2343 .. index:: show bgp [afi] [safi] summary failed [json]
2344 .. clicmd:: show bgp [afi] [safi] summary failed [json]
2346 Show a bgp peer summary for peers that are not succesfully exchanging routes
2347 for the specified address family, and subsequent address-family.
2349 .. index:: show bgp [afi] [safi] neighbor [PEER]
2350 .. clicmd:: show bgp [afi] [safi] neighbor [PEER]
2352 This command shows information on a specific BGP peer of the relevant
2353 afi and safi selected.
2355 .. index:: show bgp [afi] [safi] dampening dampened-paths
2356 .. clicmd:: show bgp [afi] [safi] dampening dampened-paths
2358 Display paths suppressed due to dampening of the selected afi and safi
2361 .. index:: show bgp [afi] [safi] dampening flap-statistics
2362 .. clicmd:: show bgp [afi] [safi] dampening flap-statistics
2364 Display flap statistics of routes of the selected afi and safi selected.
2366 .. _bgp-display-routes-by-community:
2368 Displaying Routes by Community Attribute
2369 ----------------------------------------
2371 The following commands allow displaying routes based on their community
2374 .. index:: show [ip] bgp <ipv4|ipv6> community
2375 .. clicmd:: show [ip] bgp <ipv4|ipv6> community
2377 .. index:: show [ip] bgp <ipv4|ipv6> community COMMUNITY
2378 .. clicmd:: show [ip] bgp <ipv4|ipv6> community COMMUNITY
2380 .. index:: show [ip] bgp <ipv4|ipv6> community COMMUNITY exact-match
2381 .. clicmd:: show [ip] bgp <ipv4|ipv6> community COMMUNITY exact-match
2383 These commands display BGP routes which have the community attribute.
2384 attribute. When ``COMMUNITY`` is specified, BGP routes that match that
2385 community are displayed. When `exact-match` is specified, it display only
2386 routes that have an exact match.
2388 .. index:: show [ip] bgp <ipv4|ipv6> community-list WORD
2389 .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD
2391 .. index:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
2392 .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
2394 These commands display BGP routes for the address family specified that
2395 match the specified community list. When `exact-match` is specified, it
2396 displays only routes that have an exact match.
2398 .. _bgp-display-routes-by-lcommunity:
2400 Displaying Routes by Large Community Attribute
2401 ----------------------------------------------
2403 The following commands allow displaying routes based on their
2404 large community attribute.
2406 .. index:: show [ip] bgp <ipv4|ipv6> large-community
2407 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community
2409 .. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
2410 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
2412 .. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
2413 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
2415 .. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
2416 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
2418 These commands display BGP routes which have the large community attribute.
2419 attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that
2420 large community are displayed. When `exact-match` is specified, it display
2421 only routes that have an exact match. When `json` is specified, it display
2422 routes in json format.
2424 .. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
2425 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
2427 .. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
2428 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
2430 .. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
2431 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
2433 These commands display BGP routes for the address family specified that
2434 match the specified large community list. When `exact-match` is specified,
2435 it displays only routes that have an exact match. When `json` is specified,
2436 it display routes in json format.
2438 .. _bgp-display-routes-by-as-path:
2441 Displaying Routes by AS Path
2442 ----------------------------
2444 .. index:: show bgp ipv4|ipv6 regexp LINE
2445 .. clicmd:: show bgp ipv4|ipv6 regexp LINE
2447 This commands displays BGP routes that matches a regular
2448 expression `line` (:ref:`bgp-regular-expressions`).
2450 .. index:: show [ip] bgp ipv4 vpn
2451 .. clicmd:: show [ip] bgp ipv4 vpn
2453 .. index:: show [ip] bgp ipv6 vpn
2454 .. clicmd:: show [ip] bgp ipv6 vpn
2456 Print active IPV4 or IPV6 routes advertised via the VPN SAFI.
2458 .. index:: show bgp ipv4 vpn summary
2459 .. clicmd:: show bgp ipv4 vpn summary
2461 .. index:: show bgp ipv6 vpn summary
2462 .. clicmd:: show bgp ipv6 vpn summary
2464 Print a summary of neighbor connections for the specified AFI/SAFI combination.
2466 Displaying Update Group Information
2467 -----------------------------------
2469 ..index:: show bgp update-groups SUBGROUP-ID [advertise-queue|advertised-routes|packet-queue]
2470 ..clicmd:: show bgp update-groups [advertise-queue|advertised-routes|packet-queue]
2472 Display Information about each individual update-group being used.
2473 If SUBGROUP-ID is specified only display about that particular group. If
2474 advertise-queue is specified the list of routes that need to be sent
2475 to the peers in the update-group is displayed, advertised-routes means
2476 the list of routes we have sent to the peers in the update-group and
2477 packet-queue specifies the list of packets in the queue to be sent.
2479 ..index:: show bgp update-groups statistics
2480 ..clicmd:: show bgp update-groups statistics
2482 Display Information about update-group events in FRR.
2484 .. _bgp-route-reflector:
2489 BGP routers connected inside the same AS through BGP belong to an internal
2490 BGP session, or IBGP. In order to prevent routing table loops, IBGP does not
2491 advertise IBGP-learned routes to other routers in the same session. As such,
2492 IBGP requires a full mesh of all peers. For large networks, this quickly becomes
2493 unscalable. Introducing route reflectors removes the need for the full-mesh.
2495 When route reflectors are configured, these will reflect the routes announced
2496 by the peers configured as clients. A route reflector client is configured
2499 .. index:: neighbor PEER route-reflector-client
2500 .. clicmd:: neighbor PEER route-reflector-client
2502 .. index:: no neighbor PEER route-reflector-client
2503 .. clicmd:: no neighbor PEER route-reflector-client
2505 To avoid single points of failure, multiple route reflectors can be configured.
2507 A cluster is a collection of route reflectors and their clients, and is used
2508 by route reflectors to avoid looping.
2510 .. index:: bgp cluster-id A.B.C.D
2511 .. clicmd:: bgp cluster-id A.B.C.D
2518 You can set different routing policy for a peer. For example, you can set
2519 different filter for a peer.
2525 neighbor 10.0.0.1 remote-as 2
2526 address-family ipv4 unicast
2527 neighbor 10.0.0.1 distribute-list 1 in
2531 neighbor 10.0.0.1 remote-as 2
2532 address-family ipv4 unicast
2533 neighbor 10.0.0.1 distribute-list 2 in
2536 This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2.
2537 When the update is inserted into view 1, distribute-list 1 is applied. On the
2538 other hand, when the update is inserted into view 2, distribute-list 2 is
2542 .. _bgp-regular-expressions:
2544 BGP Regular Expressions
2545 =======================
2547 BGP regular expressions are based on :t:`POSIX 1003.2` regular expressions. The
2548 following description is just a quick subset of the POSIX regular expressions.
2552 Matches any single character.
2555 Matches 0 or more occurrences of pattern.
2558 Matches 1 or more occurrences of pattern.
2561 Match 0 or 1 occurrences of pattern.
2564 Matches the beginning of the line.
2567 Matches the end of the line.
2570 The ``_`` character has special meanings in BGP regular expressions. It
2571 matches to space and comma , and AS set delimiter ``{`` and ``}`` and AS
2572 confederation delimiter ``(`` and ``)``. And it also matches to the
2573 beginning of the line and the end of the line. So ``_`` can be used for AS
2574 value boundaries match. This character technically evaluates to
2578 .. _bgp-configuration-examples:
2580 Miscellaneous Configuration Examples
2581 ====================================
2583 Example of a session to an upstream, advertising only one prefix to it.
2588 bgp router-id 10.236.87.1
2589 neighbor upstream peer-group
2590 neighbor upstream remote-as 64515
2591 neighbor upstream capability dynamic
2592 neighbor 10.1.1.1 peer-group upstream
2593 neighbor 10.1.1.1 description ACME ISP
2595 address-family ipv4 unicast
2596 network 10.236.87.0/24
2597 neighbor upstream prefix-list pl-allowed-adv out
2600 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
2601 ip prefix-list pl-allowed-adv seq 10 deny any
2603 A more complex example including upstream, peer and customer sessions
2604 advertising global prefixes and NO_EXPORT prefixes and providing actions for
2605 customer routes based on community values. Extensive use is made of route-maps
2606 and the 'call' feature to support selective advertising of prefixes. This
2607 example is intended as guidance only, it has NOT been tested and almost
2608 certainly contains silly mistakes, if not serious flaws.
2613 bgp router-id 10.236.87.1
2614 neighbor upstream capability dynamic
2615 neighbor cust capability dynamic
2616 neighbor peer capability dynamic
2617 neighbor 10.1.1.1 remote-as 64515
2618 neighbor 10.1.1.1 peer-group upstream
2619 neighbor 10.2.1.1 remote-as 64516
2620 neighbor 10.2.1.1 peer-group upstream
2621 neighbor 10.3.1.1 remote-as 64517
2622 neighbor 10.3.1.1 peer-group cust-default
2623 neighbor 10.3.1.1 description customer1
2624 neighbor 10.4.1.1 remote-as 64518
2625 neighbor 10.4.1.1 peer-group cust
2626 neighbor 10.4.1.1 description customer2
2627 neighbor 10.5.1.1 remote-as 64519
2628 neighbor 10.5.1.1 peer-group peer
2629 neighbor 10.5.1.1 description peer AS 1
2630 neighbor 10.6.1.1 remote-as 64520
2631 neighbor 10.6.1.1 peer-group peer
2632 neighbor 10.6.1.1 description peer AS 2
2634 address-family ipv4 unicast
2635 network 10.123.456.0/24
2636 network 10.123.456.128/25 route-map rm-no-export
2637 neighbor upstream route-map rm-upstream-out out
2638 neighbor cust route-map rm-cust-in in
2639 neighbor cust route-map rm-cust-out out
2640 neighbor cust send-community both
2641 neighbor peer route-map rm-peer-in in
2642 neighbor peer route-map rm-peer-out out
2643 neighbor peer send-community both
2644 neighbor 10.3.1.1 prefix-list pl-cust1-network in
2645 neighbor 10.4.1.1 prefix-list pl-cust2-network in
2646 neighbor 10.5.1.1 prefix-list pl-peer1-network in
2647 neighbor 10.6.1.1 prefix-list pl-peer2-network in
2650 ip prefix-list pl-default permit 0.0.0.0/0
2652 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
2653 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
2655 ip prefix-list pl-cust1-network permit 10.3.1.0/24
2656 ip prefix-list pl-cust1-network permit 10.3.2.0/24
2658 ip prefix-list pl-cust2-network permit 10.4.1.0/24
2660 ip prefix-list pl-peer1-network permit 10.5.1.0/24
2661 ip prefix-list pl-peer1-network permit 10.5.2.0/24
2662 ip prefix-list pl-peer1-network permit 192.168.0.0/24
2664 ip prefix-list pl-peer2-network permit 10.6.1.0/24
2665 ip prefix-list pl-peer2-network permit 10.6.2.0/24
2666 ip prefix-list pl-peer2-network permit 192.168.1.0/24
2667 ip prefix-list pl-peer2-network permit 192.168.2.0/24
2668 ip prefix-list pl-peer2-network permit 172.16.1/24
2670 ip as-path access-list asp-own-as permit ^$
2671 ip as-path access-list asp-own-as permit _64512_
2673 ! #################################################################
2674 ! Match communities we provide actions for, on routes receives from
2675 ! customers. Communities values of <our-ASN>:X, with X, have actions:
2677 ! 100 - blackhole the prefix
2678 ! 200 - set no_export
2679 ! 300 - advertise only to other customers
2680 ! 400 - advertise only to upstreams
2681 ! 500 - set no_export when advertising to upstreams
2682 ! 2X00 - set local_preference to X00
2684 ! blackhole the prefix of the route
2685 bgp community-list standard cm-blackhole permit 64512:100
2687 ! set no-export community before advertising
2688 bgp community-list standard cm-set-no-export permit 64512:200
2690 ! advertise only to other customers
2691 bgp community-list standard cm-cust-only permit 64512:300
2693 ! advertise only to upstreams
2694 bgp community-list standard cm-upstream-only permit 64512:400
2696 ! advertise to upstreams with no-export
2697 bgp community-list standard cm-upstream-noexport permit 64512:500
2699 ! set local-pref to least significant 3 digits of the community
2700 bgp community-list standard cm-prefmod-100 permit 64512:2100
2701 bgp community-list standard cm-prefmod-200 permit 64512:2200
2702 bgp community-list standard cm-prefmod-300 permit 64512:2300
2703 bgp community-list standard cm-prefmod-400 permit 64512:2400
2704 bgp community-list expanded cme-prefmod-range permit 64512:2...
2706 ! Informational communities
2708 ! 3000 - learned from upstream
2709 ! 3100 - learned from customer
2710 ! 3200 - learned from peer
2712 bgp community-list standard cm-learnt-upstream permit 64512:3000
2713 bgp community-list standard cm-learnt-cust permit 64512:3100
2714 bgp community-list standard cm-learnt-peer permit 64512:3200
2716 ! ###################################################################
2717 ! Utility route-maps
2719 ! These utility route-maps generally should not used to permit/deny
2720 ! routes, i.e. they do not have meaning as filters, and hence probably
2721 ! should be used with 'on-match next'. These all finish with an empty
2722 ! permit entry so as not interfere with processing in the caller.
2724 route-map rm-no-export permit 10
2725 set community additive no-export
2726 route-map rm-no-export permit 20
2728 route-map rm-blackhole permit 10
2729 description blackhole, up-pref and ensure it cannot escape this AS
2730 set ip next-hop 127.0.0.1
2731 set local-preference 10
2732 set community additive no-export
2733 route-map rm-blackhole permit 20
2735 ! Set local-pref as requested
2736 route-map rm-prefmod permit 10
2737 match community cm-prefmod-100
2738 set local-preference 100
2739 route-map rm-prefmod permit 20
2740 match community cm-prefmod-200
2741 set local-preference 200
2742 route-map rm-prefmod permit 30
2743 match community cm-prefmod-300
2744 set local-preference 300
2745 route-map rm-prefmod permit 40
2746 match community cm-prefmod-400
2747 set local-preference 400
2748 route-map rm-prefmod permit 50
2750 ! Community actions to take on receipt of route.
2751 route-map rm-community-in permit 10
2752 description check for blackholing, no point continuing if it matches.
2753 match community cm-blackhole
2755 route-map rm-community-in permit 20
2756 match community cm-set-no-export
2759 route-map rm-community-in permit 30
2760 match community cme-prefmod-range
2762 route-map rm-community-in permit 40
2764 ! #####################################################################
2765 ! Community actions to take when advertising a route.
2766 ! These are filtering route-maps,
2768 ! Deny customer routes to upstream with cust-only set.
2769 route-map rm-community-filt-to-upstream deny 10
2770 match community cm-learnt-cust
2771 match community cm-cust-only
2772 route-map rm-community-filt-to-upstream permit 20
2774 ! Deny customer routes to other customers with upstream-only set.
2775 route-map rm-community-filt-to-cust deny 10
2776 match community cm-learnt-cust
2777 match community cm-upstream-only
2778 route-map rm-community-filt-to-cust permit 20
2780 ! ###################################################################
2781 ! The top-level route-maps applied to sessions. Further entries could
2782 ! be added obviously..
2785 route-map rm-cust-in permit 10
2786 call rm-community-in
2788 route-map rm-cust-in permit 20
2789 set community additive 64512:3100
2790 route-map rm-cust-in permit 30
2792 route-map rm-cust-out permit 10
2793 call rm-community-filt-to-cust
2795 route-map rm-cust-out permit 20
2797 ! Upstream transit ASes
2798 route-map rm-upstream-out permit 10
2799 description filter customer prefixes which are marked cust-only
2800 call rm-community-filt-to-upstream
2802 route-map rm-upstream-out permit 20
2803 description only customer routes are provided to upstreams/peers
2804 match community cm-learnt-cust
2807 ! outbound policy is same as for upstream
2808 route-map rm-peer-out permit 10
2809 call rm-upstream-out
2811 route-map rm-peer-in permit 10
2812 set community additive 64512:3200
2815 Example of how to set up a 6-Bone connection.
2819 ! bgpd configuration
2820 ! ==================
2822 ! MP-BGP configuration
2825 bgp router-id 10.0.0.1
2826 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number`
2829 network 3ffe:506::/32
2830 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
2831 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
2832 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number`
2833 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
2836 ipv6 access-list all permit any
2838 ! Set output nexthop address.
2840 route-map set-nexthop permit 10
2841 match ipv6 address all
2842 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
2843 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
2849 .. include:: routeserver.rst
2851 .. include:: rpki.rst
2853 .. include:: flowspec.rst
2855 .. [#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)
2856 .. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
2857 .. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
2858 .. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002