]> git.proxmox.com Git - mirror_frr.git/blob - doc/user/bgp.rst
4a5bdc2428af17efc49c79319298161529ceb975
[mirror_frr.git] / doc / user / bgp.rst
1 .. _bgp:
2
3 ***
4 BGP
5 ***
6
7 :abbr:`BGP` stands for Border Gateway Protocol. The latest BGP version is 4.
8 BGP-4 is one of the Exterior Gateway Protocols and the de facto standard
9 interdomain routing protocol. BGP-4 is described in :rfc:`1771` and updated by
10 :rfc:`4271`. :rfc:`2858` adds multiprotocol support to BGP-4.
11
12 .. _starting-bgp:
13
14 Starting BGP
15 ============
16
17 The default configuration file of *bgpd* is :file:`bgpd.conf`. *bgpd* searches
18 the current directory first, followed by |INSTALL_PREFIX_ETC|/bgpd.conf. All of
19 *bgpd*'s commands must be configured in :file:`bgpd.conf` when the integrated
20 config is not being used.
21
22 *bgpd* specific invocation options are described below. Common options may also
23 be specified (:ref:`common-invocation-options`).
24
25 .. program:: bgpd
26
27 .. option:: -p, --bgp_port <port>
28
29 Set the bgp protocol's port number. When port number is 0, that means do not
30 listen bgp port.
31
32 .. option:: -l, --listenon
33
34 Specify a specific IP address for bgpd to listen on, rather than its default
35 of ``0.0.0.0`` / ``::``. This can be useful to constrain bgpd to an internal
36 address, or to run multiple bgpd processes on one host.
37
38 .. option:: -n, --no_kernel
39
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.
44
45 .. option:: -S, --skip_runas
46
47 Skip the normal process of checking capabilities and changing user and group
48 information.
49
50 .. option:: -e, --ecmp
51
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.
55
56 .. option:: -Z, --no_zebra
57
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.
60
61 .. option:: -s, --socket_size
62
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
67 at.
68
69 LABEL MANAGER
70 -------------
71
72 .. option:: -I, --int_num
73
74 Set zclient id. This is required when using Zebra label manager in proxy mode.
75
76 .. _bgp-basic-concepts:
77
78 Basic Concepts
79 ==============
80
81 .. _bgp-autonomous-systems:
82
83 Autonomous Systems
84 ------------------
85
86 From :rfc:`1930`:
87
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.
90
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.
95
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.
99
100 .. seealso:: :rfc:`1930`
101
102 .. _bgp-address-families:
103
104 Address Families
105 ----------------
106
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`).
113
114 .. _bgp-route-selection:
115
116 Route Selection
117 ---------------
118
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.
122
123 1. **Weight check**
124
125 Prefer higher local weight routes to lower routes.
126
127 2. **Local preference check**
128
129 Prefer higher local preference routes to lower.
130
131 3. **Local route check**
132
133 Prefer local routes (statics, aggregates, redistributed) to received routes.
134
135 4. **AS path length check**
136
137 Prefer shortest hop-count AS_PATHs.
138
139 5. **Origin check**
140
141 Prefer the lowest origin type route. That is, prefer IGP origin routes to
142 EGP, to Incomplete routes.
143
144 6. **MED check**
145
146 Where routes with a MED were received from the same AS, prefer the route
147 with the lowest MED. :ref:`bgp-med`.
148
149 7. **External check**
150
151 Prefer the route received from an external, eBGP peer over routes received
152 from other types of peers.
153
154 8. **IGP cost check**
155
156 Prefer the route with the lower IGP cost.
157
158 9. **Multi-path check**
159
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.
165
166 10. **Already-selected external check**
167
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.
172
173 11. **Router-ID check**
174
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
178 used.
179
180 12. **Cluster-List length check**
181
182 The route with the shortest cluster-list length is used. The cluster-list
183 reflects the iBGP reflection path the route has taken.
184
185 13. **Peer address**
186
187 Prefer the route received from the peer with the higher transport layer
188 address, as a last-resort tie-breaker.
189
190 .. _bgp-capability-negotiation:
191
192 Capability Negotiation
193 ----------------------
194
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.
202
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.
205
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).
214
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
220 connection.
221
222 .. _bgp-router-configuration:
223
224 BGP Router Configuration
225 ========================
226
227 ASN and Router ID
228 -----------------
229
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.
234
235 .. index:: router bgp ASN
236 .. clicmd:: router bgp ASN
237
238 Enable a BGP protocol process with the specified ASN. After
239 this statement you can input any `BGP Commands`.
240
241 .. index:: no router bgp ASN
242 .. clicmd:: no router bgp ASN
243
244 Destroy a BGP protocol process with the specified ASN.
245
246 .. index:: bgp router-id A.B.C.D
247 .. clicmd:: bgp router-id A.B.C.D
248
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.
254
255
256 .. _bgp-multiple-autonomous-systems:
257
258 Multiple Autonomous Systems
259 ---------------------------
260
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
265 single process.
266
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.
272
273 .. note::
274
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>`
279 and route servers.
280
281 Configuration of additional autonomous systems, or of a router that targets a
282 specific VRF, is accomplished with the following command:
283
284 .. index:: router bgp ASN vrf VRFNAME
285 .. clicmd:: router bgp ASN vrf VRFNAME
286
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
289 VRF.
290
291 An example configuration with multiple autonomous systems might look like this:
292
293 .. code-block:: frr
294
295 router bgp 1
296 neighbor 10.0.0.1 remote-as 20
297 neighbor 10.0.0.2 remote-as 30
298 !
299 router bgp 2 vrf blue
300 neighbor 10.0.0.3 remote-as 40
301 neighbor 10.0.0.4 remote-as 50
302 !
303 router bgp 3 vrf red
304 neighbor 10.0.0.5 remote-as 60
305 neighbor 10.0.0.6 remote-as 70
306 ...
307
308 .. seealso:: :ref:`bgp-vrf-route-leaking`
309 .. seealso:: :ref:`zebra-vrf`
310
311
312 .. _bgp-views:
313
314 Views
315 -----
316
317 In addition to supporting multiple autonomous systems, FRR's BGP implementation
318 also supports *views*.
319
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.
326
327 .. index:: router bgp AS-NUMBER view NAME
328 .. clicmd:: router bgp AS-NUMBER view NAME
329
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.
332
333 With this command, you can setup Route Server like below.
334
335 .. code-block:: frr
336
337 !
338 router bgp 1 view 1
339 neighbor 10.0.0.1 remote-as 2
340 neighbor 10.0.0.2 remote-as 3
341 !
342 router bgp 2 view 2
343 neighbor 10.0.0.3 remote-as 4
344 neighbor 10.0.0.4 remote-as 5
345
346 .. index:: show [ip] bgp view NAME
347 .. clicmd:: show [ip] bgp view NAME
348
349 Display the routing table of BGP view ``NAME``.
350
351
352 Route Selection
353 ---------------
354
355 .. index:: bgp bestpath as-path confed
356 .. clicmd:: bgp bestpath as-path confed
357
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
360 decision process.
361
362 .. index:: bgp bestpath as-path multipath-relax
363 .. clicmd:: bgp bestpath as-path multipath-relax
364
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.
368
369 .. clicmd:: bgp bestpath compare-routerid
370
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
373 based on router-ID.
374
375 If this option is enabled, then the already-selected check, where
376 already selected eBGP routes are preferred, is skipped.
377
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.
381
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.
388
389 .. _bgp-distance:
390
391 Administrative Distance Metrics
392 -------------------------------
393
394 .. index:: distance bgp (1-255) (1-255) (1-255)
395 .. clicmd:: distance bgp (1-255) (1-255) (1-255)
396
397 This command change distance value of BGP. The arguments are the distance
398 values for for external routes, internal routes and local routes
399 respectively.
400
401 .. index:: distance (1-255) A.B.C.D/M
402 .. clicmd:: distance (1-255) A.B.C.D/M
403
404 .. index:: distance (1-255) A.B.C.D/M WORD
405 .. clicmd:: distance (1-255) A.B.C.D/M WORD
406
407 Sets the administrative distance for a particular route.
408
409 .. _bgp-requires-policy:
410
411 Require policy on EBGP
412 -------------------------------
413
414 .. index:: [no] bgp ebgp-requires-policy
415 .. clicmd:: [no] bgp ebgp-requires-policy
416
417 This command requires incoming and outgoing filters to be applied
418 for eBGP sessions. Without the incoming filter, no routes will be
419 accepted. Without the outgoing filter, no routes will be announced.
420
421 This is enabled by default.
422
423 When the incoming or outgoing filter is missing you will see
424 "(Policy)" sign under ``show bgp summary``:
425
426 .. code-block:: frr
427
428 exit1# show bgp summary
429
430 IPv4 Unicast Summary:
431 BGP router identifier 10.10.10.1, local AS number 65001 vrf-id 0
432 BGP table version 4
433 RIB entries 7, using 1344 bytes of memory
434 Peers 2, using 43 KiB of memory
435
436 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt
437 192.168.0.2 4 65002 8 10 0 0 0 00:03:09 5 (Policy)
438 fe80:1::2222 4 65002 9 11 0 0 0 00:03:09 (Policy) (Policy)
439
440 Reject routes with AS_SET or AS_CONFED_SET types
441 ------------------------------------------------
442
443 .. index:: [no] bgp reject-as-sets
444 .. clicmd:: [no] bgp reject-as-sets
445
446 This command enables rejection of incoming and outgoing routes having AS_SET or AS_CONFED_SET type.
447
448 Disable checking if nexthop is connected on EBGP sessions
449 ---------------------------------------------------------
450
451 .. index:: [no] bgp disable-ebgp-connected-route-check
452 .. clicmd:: [no] bgp disable-ebgp-connected-route-check
453
454 This command is used to disable the connection verification process for EBGP peering sessions
455 that are reachable by a single hop but are configured on a loopback interface or otherwise
456 configured with a non-directly connected IP address.
457
458 .. _bgp-route-flap-dampening:
459
460 Route Flap Dampening
461 --------------------
462
463 .. clicmd:: bgp dampening (1-45) (1-20000) (1-20000) (1-255)
464
465 This command enables BGP route-flap dampening and specifies dampening parameters.
466
467 half-life
468 Half-life time for the penalty
469
470 reuse-threshold
471 Value to start reusing a route
472
473 suppress-threshold
474 Value to start suppressing a route
475
476 max-suppress
477 Maximum duration to suppress a stable route
478
479 The route-flap damping algorithm is compatible with :rfc:`2439`. The use of
480 this command is not recommended nowadays.
481
482 At the moment, route-flap dampening is not working per VRF and is working only
483 for IPv4 unicast and multicast.
484
485 .. seealso::
486 https://www.ripe.net/publications/docs/ripe-378
487
488 .. _bgp-med:
489
490 Multi-Exit Discriminator
491 ------------------------
492
493 The BGP :abbr:`MED (Multi-Exit Discriminator)` attribute has properties which
494 can cause subtle convergence problems in BGP. These properties and problems
495 have proven to be hard to understand, at least historically, and may still not
496 be widely understood. The following attempts to collect together and present
497 what is known about MED, to help operators and FRR users in designing and
498 configuring their networks.
499
500 The BGP :abbr:`MED` attribute is intended to allow one AS to indicate its
501 preferences for its ingress points to another AS. The MED attribute will not be
502 propagated on to another AS by the receiving AS - it is 'non-transitive' in the
503 BGP sense.
504
505 E.g., if AS X and AS Y have 2 different BGP peering points, then AS X might set
506 a MED of 100 on routes advertised at one and a MED of 200 at the other. When AS
507 Y selects between otherwise equal routes to or via AS X, AS Y should prefer to
508 take the path via the lower MED peering of 100 with AS X. Setting the MED
509 allows an AS to influence the routing taken to it within another, neighbouring
510 AS.
511
512 In this use of MED it is not really meaningful to compare the MED value on
513 routes where the next AS on the paths differs. E.g., if AS Y also had a route
514 for some destination via AS Z in addition to the routes from AS X, and AS Z had
515 also set a MED, it wouldn't make sense for AS Y to compare AS Z's MED values to
516 those of AS X. The MED values have been set by different administrators, with
517 different frames of reference.
518
519 The default behaviour of BGP therefore is to not compare MED values across
520 routes received from different neighbouring ASes. In FRR this is done by
521 comparing the neighbouring, left-most AS in the received AS_PATHs of the routes
522 and only comparing MED if those are the same.
523
524 Unfortunately, this behaviour of MED, of sometimes being compared across routes
525 and sometimes not, depending on the properties of those other routes, means MED
526 can cause the order of preference over all the routes to be undefined. That is,
527 given routes A, B, and C, if A is preferred to B, and B is preferred to C, then
528 a well-defined order should mean the preference is transitive (in the sense of
529 orders [#med-transitivity-rant]_) and that A would be preferred to C.
530
531 However, when MED is involved this need not be the case. With MED it is
532 possible that C is actually preferred over A. So A is preferred to B, B is
533 preferred to C, but C is preferred to A. This can be true even where BGP
534 defines a deterministic 'most preferred' route out of the full set of A,B,C.
535 With MED, for any given set of routes there may be a deterministically
536 preferred route, but there need not be any way to arrange them into any order
537 of preference. With unmodified MED, the order of preference of routes literally
538 becomes undefined.
539
540 That MED can induce non-transitive preferences over routes can cause issues.
541 Firstly, it may be perceived to cause routing table churn locally at speakers;
542 secondly, and more seriously, it may cause routing instability in iBGP
543 topologies, where sets of speakers continually oscillate between different
544 paths.
545
546 The first issue arises from how speakers often implement routing decisions.
547 Though BGP defines a selection process that will deterministically select the
548 same route as best at any given speaker, even with MED, that process requires
549 evaluating all routes together. For performance and ease of implementation
550 reasons, many implementations evaluate route preferences in a pair-wise fashion
551 instead. Given there is no well-defined order when MED is involved, the best
552 route that will be chosen becomes subject to implementation details, such as
553 the order the routes are stored in. That may be (locally) non-deterministic,
554 e.g.: it may be the order the routes were received in.
555
556 This indeterminism may be considered undesirable, though it need not cause
557 problems. It may mean additional routing churn is perceived, as sometimes more
558 updates may be produced than at other times in reaction to some event .
559
560 This first issue can be fixed with a more deterministic route selection that
561 ensures routes are ordered by the neighbouring AS during selection.
562 :clicmd:`bgp deterministic-med`. This may reduce the number of updates as routes
563 are received, and may in some cases reduce routing churn. Though, it could
564 equally deterministically produce the largest possible set of updates in
565 response to the most common sequence of received updates.
566
567 A deterministic order of evaluation tends to imply an additional overhead of
568 sorting over any set of n routes to a destination. The implementation of
569 deterministic MED in FRR scales significantly worse than most sorting
570 algorithms at present, with the number of paths to a given destination. That
571 number is often low enough to not cause any issues, but where there are many
572 paths, the deterministic comparison may quickly become increasingly expensive
573 in terms of CPU.
574
575 Deterministic local evaluation can *not* fix the second, more major, issue of
576 MED however. Which is that the non-transitive preference of routes MED can
577 cause may lead to routing instability or oscillation across multiple speakers
578 in iBGP topologies. This can occur with full-mesh iBGP, but is particularly
579 problematic in non-full-mesh iBGP topologies that further reduce the routing
580 information known to each speaker. This has primarily been documented with iBGP
581 :ref:`route-reflection <bgp-route-reflector>` topologies. However, any
582 route-hiding technologies potentially could also exacerbate oscillation with MED.
583
584 This second issue occurs where speakers each have only a subset of routes, and
585 there are cycles in the preferences between different combinations of routes -
586 as the undefined order of preference of MED allows - and the routes are
587 distributed in a way that causes the BGP speakers to 'chase' those cycles. This
588 can occur even if all speakers use a deterministic order of evaluation in route
589 selection.
590
591 E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and from
592 speaker 3 in AS Y; while speaker 5 in AS A might receive that route from
593 speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 at speaker
594 3. I.e, using ASN:ID:MED to label the speakers:
595
596 ::
597
598 .
599 /---------------\\
600 X:2------|--A:4-------A:5--|-Y:1:200
601 Y:3:100--|-/ |
602 \\---------------/
603
604
605
606 Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then based
607 on the RFC4271 decision process speaker 4 will choose X:2 over Y:3:100, based
608 on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. Speaker 5 will
609 continue to prefer Y:1:200 based on the ID, and advertise this to speaker 4.
610 Speaker 4 will now have the full set of routes, and the Y:1:200 it receives
611 from 5 will beat X:2, but when speaker 4 compares Y:1:200 to Y:3:100 the MED
612 check now becomes active as the ASes match, and now Y:3:100 is preferred.
613 Speaker 4 therefore now advertises Y:3:100 to 5, which will also agrees that
614 Y:3:100 is preferred to Y:1:200, and so withdraws the latter route from 4.
615 Speaker 4 now has only X:2 and Y:3:100, and X:2 beats Y:3:100, and so speaker 4
616 implicitly updates its route to speaker 5 to X:2. Speaker 5 sees that Y:1:200
617 beats X:2 based on the ID, and advertises Y:1:200 to speaker 4, and the cycle
618 continues.
619
620 The root cause is the lack of a clear order of preference caused by how MED
621 sometimes is and sometimes is not compared, leading to this cycle in the
622 preferences between the routes:
623
624 ::
625
626 .
627 /---> X:2 ---beats---> Y:3:100 --\\
628 | |
629 | |
630 \\---beats--- Y:1:200 <---beats---/
631
632
633
634 This particular type of oscillation in full-mesh iBGP topologies can be
635 avoided by speakers preferring already selected, external routes rather than
636 choosing to update to new a route based on a post-MED metric (e.g. router-ID),
637 at the cost of a non-deterministic selection process. FRR implements this, as
638 do many other implementations, so long as it is not overridden by setting
639 :clicmd:`bgp bestpath compare-routerid`, and see also
640 :ref:`bgp-route-selection`.
641
642 However, more complex and insidious cycles of oscillation are possible with
643 iBGP route-reflection, which are not so easily avoided. These have been
644 documented in various places. See, e.g.:
645
646 - [bgp-route-osci-cond]_
647 - [stable-flexible-ibgp]_
648 - [ibgp-correctness]_
649
650 for concrete examples and further references.
651
652 There is as of this writing *no* known way to use MED for its original purpose;
653 *and* reduce routing information in iBGP topologies; *and* be sure to avoid the
654 instability problems of MED due the non-transitive routing preferences it can
655 induce; in general on arbitrary networks.
656
657 There may be iBGP topology specific ways to reduce the instability risks, even
658 while using MED, e.g.: by constraining the reflection topology and by tuning
659 IGP costs between route-reflector clusters, see :rfc:`3345` for details. In the
660 near future, the Add-Path extension to BGP may also solve MED oscillation while
661 still allowing MED to be used as intended, by distributing "best-paths per
662 neighbour AS". This would be at the cost of distributing at least as many
663 routes to all speakers as a full-mesh iBGP would, if not more, while also
664 imposing similar CPU overheads as the "Deterministic MED" feature at each
665 Add-Path reflector.
666
667 More generally, the instability problems that MED can introduce on more
668 complex, non-full-mesh, iBGP topologies may be avoided either by:
669
670 - Setting :clicmd:`bgp always-compare-med`, however this allows MED to be compared
671 across values set by different neighbour ASes, which may not produce
672 coherent desirable results, of itself.
673 - Effectively ignoring MED by setting MED to the same value (e.g.: 0) using
674 :clicmd:`set metric METRIC` on all received routes, in combination with
675 setting :clicmd:`bgp always-compare-med` on all speakers. This is the simplest
676 and most performant way to avoid MED oscillation issues, where an AS is happy
677 not to allow neighbours to inject this problematic metric.
678
679 As MED is evaluated after the AS_PATH length check, another possible use for
680 MED is for intra-AS steering of routes with equal AS_PATH length, as an
681 extension of the last case above. As MED is evaluated before IGP metric, this
682 can allow cold-potato routing to be implemented to send traffic to preferred
683 hand-offs with neighbours, rather than the closest hand-off according to the
684 IGP metric.
685
686 Note that even if action is taken to address the MED non-transitivity issues,
687 other oscillations may still be possible. E.g., on IGP cost if iBGP and IGP
688 topologies are at cross-purposes with each other - see the Flavel and Roughan
689 paper above for an example. Hence the guideline that the iBGP topology should
690 follow the IGP topology.
691
692 .. index:: bgp deterministic-med
693 .. clicmd:: bgp deterministic-med
694
695 Carry out route-selection in way that produces deterministic answers
696 locally, even in the face of MED and the lack of a well-defined order of
697 preference it can induce on routes. Without this option the preferred route
698 with MED may be determined largely by the order that routes were received
699 in.
700
701 Setting this option will have a performance cost that may be noticeable when
702 there are many routes for each destination. Currently in FRR it is
703 implemented in a way that scales poorly as the number of routes per
704 destination increases.
705
706 The default is that this option is not set.
707
708 Note that there are other sources of indeterminism in the route selection
709 process, specifically, the preference for older and already selected routes
710 from eBGP peers, :ref:`bgp-route-selection`.
711
712 .. index:: bgp always-compare-med
713 .. clicmd:: bgp always-compare-med
714
715 Always compare the MED on routes, even when they were received from
716 different neighbouring ASes. Setting this option makes the order of
717 preference of routes more defined, and should eliminate MED induced
718 oscillations.
719
720 If using this option, it may also be desirable to use
721 :clicmd:`set metric METRIC` to set MED to 0 on routes received from external
722 neighbours.
723
724 This option can be used, together with :clicmd:`set metric METRIC` to use
725 MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g.,
726 desired exit points.
727
728
729 .. _bgp-graceful-restart:
730
731 Graceful Restart
732 ----------------
733
734 BGP graceful restart functionality as defined in
735 `RFC-4724 <https://tools.ietf.org/html/rfc4724/>`_ defines the mechanisms that
736 allows BGP speaker to continue to forward data packets along known routes
737 while the routing protocol information is being restored.
738
739
740 Usually, when BGP on a router restarts, all the BGP peers detect that the
741 session went down and then came up. This "down/up" transition results in a
742 "routing flap" and causes BGP route re-computation, generation of BGP routing
743 updates, and unnecessary churn to the forwarding tables.
744
745 The following functionality is provided by graceful restart:
746
747 1. The feature allows the restarting router to indicate to the helping peer the
748 routes it can preserve in its forwarding plane during control plane restart
749 by sending graceful restart capability in the OPEN message sent during
750 session establishment.
751 2. The feature allows helping router to advertise to all other peers the routes
752 received from the restarting router which are preserved in the forwarding
753 plane of the restarting router during control plane restart.
754
755
756 ::
757
758
759
760 (R1)-----------------------------------------------------------------(R2)
761
762 1. BGP Graceful Restart Capability exchanged between R1 & R2.
763
764 <--------------------------------------------------------------------->
765
766 2. Kill BGP Process at R1.
767
768 ---------------------------------------------------------------------->
769
770 3. R2 Detects the above BGP Restart & verifies BGP Restarting
771 Capability of R1.
772
773 4. Start BGP Process at R1.
774
775 5. Re-establish the BGP session between R1 & R2.
776
777 <--------------------------------------------------------------------->
778
779 6. R2 Send initial route updates, followed by End-Of-Rib.
780
781 <----------------------------------------------------------------------
782
783 7. R1 was waiting for End-Of-Rib from R2 & which has been received
784 now.
785
786 8. R1 now runs BGP Best-Path algorithm. Send Initial BGP Update,
787 followed by End-Of Rib
788
789 <--------------------------------------------------------------------->
790
791
792 .. _bgp-end-of-rib-message:
793
794 End-of-RIB (EOR) message
795 ^^^^^^^^^^^^^^^^^^^^^^^^
796
797 An UPDATE message with no reachable Network Layer Reachability Information
798 (NLRI) and empty withdrawn NLRI is specified as the End-of-RIB marker that can
799 be used by a BGP speaker to indicate to its peer the completion of the initial
800 routing update after the session is established.
801
802 For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message
803 with the minimum length. For any other address family, it is an UPDATE message
804 that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for
805 that <AFI, SAFI>.
806
807 Although the End-of-RIB marker is specified for the purpose of BGP graceful
808 restart, it is noted that the generation of such a marker upon completion of
809 the initial update would be useful for routing convergence in general, and thus
810 the practice is recommended.
811
812 .. _bgp-route-selection-deferral-timer:
813
814 Route Selection Deferral Timer
815 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
816
817 Specifies the time the restarting router defers the route selection process
818 after restart.
819
820 Restarting Router : The usage of route election deferral timer is specified
821 in https://tools.ietf.org/html/rfc4724#section-4.1
822
823 Once the session between the Restarting Speaker and the Receiving Speaker is
824 re-established, the Restarting Speaker will receive and process BGP messages
825 from its peers.
826
827 However, it MUST defer route selection for an address family until it either.
828
829 1. Receives the End-of-RIB marker from all its peers (excluding the ones with
830 the "Restart State" bit set in the received capability and excluding the ones
831 that do not advertise the graceful restart capability).
832 2. The Selection_Deferral_Timer timeout.
833
834 .. index:: bgp graceful-restart select-defer-time (0-3600)
835 .. clicmd:: bgp graceful-restart select-defer-time (0-3600)
836
837 This is command, will set deferral time to value specified.
838
839
840 .. index:: bgp graceful-restart rib-stale-time (1-3600)
841 .. clicmd:: bgp graceful-restart rib-stale-time (1-3600)
842
843 This is command, will set the time for which stale routes are kept in RIB.
844
845 .. _bgp-per-peer-graceful-restart:
846
847 BGP Per Peer Graceful Restart
848 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
849
850 Ability to enable and disable graceful restart, helper and no GR at all mode
851 functionality at peer level.
852
853 So bgp graceful restart can be enabled at modes global BGP level or at per
854 peer level. There are two FSM, one for BGP GR global mode and other for peer
855 per GR.
856
857 Default global mode is helper and default peer per mode is inherit from global.
858 If per peer mode is configured, the GR mode of this particular peer will
859 override the global mode.
860
861 .. _bgp-GR-global-mode-cmd:
862
863 BGP GR Global Mode Commands
864 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
865
866 .. index:: bgp graceful-restart
867 .. clicmd:: bgp graceful-restart
868
869 This command will enable BGP graceful restart ifunctionality at the global
870 level.
871
872 .. index:: bgp graceful-restart disable
873 .. clicmd:: bgp graceful-restart disable
874
875 This command will disable both the functionality graceful restart and helper
876 mode.
877
878
879 .. _bgp-GR-peer-mode-cmd:
880
881 BGP GR Peer Mode Commands
882 ^^^^^^^^^^^^^^^^^^^^^^^^^
883
884 .. index:: neighbor A.B.C.D graceful-restart
885 .. clicmd:: neighbor A.B.C.D graceful-restart
886
887 This command will enable BGP graceful restart ifunctionality at the peer
888 level.
889
890 .. index:: neighbor A.B.C.D graceful-restart-helper
891 .. clicmd:: neighbor A.B.C.D graceful-restart-helper
892
893 This command will enable BGP graceful restart helper only functionality
894 at the peer level.
895
896 .. index:: neighbor A.B.C.D graceful-restart-disable
897 .. clicmd:: neighbor A.B.C.D graceful-restart-disable
898
899 This command will disable the entire BGP graceful restart functionality
900 at the peer level.
901
902
903 .. _bgp-shutdown:
904
905 Administrative Shutdown
906 -----------------------
907
908 .. index:: [no] bgp shutdown [message MSG...]
909 .. clicmd:: [no] bgp shutdown [message MSG...]
910
911 Administrative shutdown of all peers of a bgp instance. Drop all BGP peers,
912 but preserve their configurations. The peers are notified in accordance with
913 `RFC 8203 <https://tools.ietf.org/html/rfc8203/>`_ by sending a
914 ``NOTIFICATION`` message with error code ``Cease`` and subcode
915 ``Administrative Shutdown`` prior to terminating connections. This global
916 shutdown is independent of the neighbor shutdown, meaning that individually
917 shut down peers will not be affected by lifting it.
918
919 An optional shutdown message `MSG` can be specified.
920
921
922 .. _bgp-network:
923
924 Networks
925 --------
926
927 .. index:: network A.B.C.D/M
928 .. clicmd:: network A.B.C.D/M
929
930 This command adds the announcement network.
931
932 .. code-block:: frr
933
934 router bgp 1
935 address-family ipv4 unicast
936 network 10.0.0.0/8
937 exit-address-family
938
939 This configuration example says that network 10.0.0.0/8 will be
940 announced to all neighbors. Some vendors' routers don't advertise
941 routes if they aren't present in their IGP routing tables; `bgpd`
942 doesn't care about IGP routes when announcing its routes.
943
944 .. index:: no network A.B.C.D/M
945 .. clicmd:: no network A.B.C.D/M
946
947 .. index:: [no] bgp network import-check
948 .. clicmd:: [no] bgp network import-check
949
950 This configuration modifies the behavior of the network statement.
951 If you have this configured the underlying network must exist in
952 the rib. If you have the [no] form configured then BGP will not
953 check for the networks existence in the rib. For versions 7.3 and
954 before frr defaults for datacenter were the network must exist,
955 traditional did not check for existence. For versions 7.4 and beyond
956 both traditional and datacenter the network must exist.
957
958 .. _bgp-route-aggregation:
959
960 Route Aggregation
961 -----------------
962
963 .. _bgp-route-aggregation-ipv4:
964
965 Route Aggregation-IPv4 Address Family
966 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
967
968 .. index:: aggregate-address A.B.C.D/M
969 .. clicmd:: aggregate-address A.B.C.D/M
970
971 This command specifies an aggregate address.
972
973 .. index:: aggregate-address A.B.C.D/M route-map NAME
974 .. clicmd:: aggregate-address A.B.C.D/M route-map NAME
975
976 Apply a route-map for an aggregated prefix.
977
978 .. index:: aggregate-address A.B.C.D/M origin <egp|igp|incomplete>
979 .. clicmd:: aggregate-address A.B.C.D/M origin <egp|igp|incomplete>
980
981 Override ORIGIN for an aggregated prefix.
982
983 .. index:: aggregate-address A.B.C.D/M as-set
984 .. clicmd:: aggregate-address A.B.C.D/M as-set
985
986 This command specifies an aggregate address. Resulting routes include
987 AS set.
988
989 .. index:: aggregate-address A.B.C.D/M summary-only
990 .. clicmd:: aggregate-address A.B.C.D/M summary-only
991
992 This command specifies an aggregate address. Aggregated routes will
993 not be announced.
994
995 .. index:: no aggregate-address A.B.C.D/M
996 .. clicmd:: no aggregate-address A.B.C.D/M
997
998 This command removes an aggregate address.
999
1000
1001 This configuration example setup the aggregate-address under
1002 ipv4 address-family.
1003
1004 .. code-block:: frr
1005
1006 router bgp 1
1007 address-family ipv4 unicast
1008 aggregate-address 10.0.0.0/8
1009 aggregate-address 20.0.0.0/8 as-set
1010 aggregate-address 40.0.0.0/8 summary-only
1011 aggregate-address 50.0.0.0/8 route-map aggr-rmap
1012 exit-address-family
1013
1014
1015 .. _bgp-route-aggregation-ipv6:
1016
1017 Route Aggregation-IPv6 Address Family
1018 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1019
1020 .. index:: aggregate-address X:X::X:X/M
1021 .. clicmd:: aggregate-address X:X::X:X/M
1022
1023 This command specifies an aggregate address.
1024
1025 .. index:: aggregate-address X:X::X:X/M route-map NAME
1026 .. clicmd:: aggregate-address X:X::X:X/M route-map NAME
1027
1028 Apply a route-map for an aggregated prefix.
1029
1030 .. index:: aggregate-address X:X::X:X/M origin <egp|igp|incomplete>
1031 .. clicmd:: aggregate-address X:X::X:X/M origin <egp|igp|incomplete>
1032
1033 Override ORIGIN for an aggregated prefix.
1034
1035 .. index:: aggregate-address X:X::X:X/M as-set
1036 .. clicmd:: aggregate-address X:X::X:X/M as-set
1037
1038 This command specifies an aggregate address. Resulting routes include
1039 AS set.
1040
1041 .. index:: aggregate-address X:X::X:X/M summary-only
1042 .. clicmd:: aggregate-address X:X::X:X/M summary-only
1043
1044 This command specifies an aggregate address. Aggregated routes will
1045 not be announced.
1046
1047 .. index:: no aggregate-address X:X::X:X/M
1048 .. clicmd:: no aggregate-address X:X::X:X/M
1049
1050 This command removes an aggregate address.
1051
1052
1053 This configuration example setup the aggregate-address under
1054 ipv6 address-family.
1055
1056 .. code-block:: frr
1057
1058 router bgp 1
1059 address-family ipv6 unicast
1060 aggregate-address 10::0/64
1061 aggregate-address 20::0/64 as-set
1062 aggregate-address 40::0/64 summary-only
1063 aggregate-address 50::0/64 route-map aggr-rmap
1064 exit-address-family
1065
1066 .. _bgp-redistribute-to-bgp:
1067
1068 Redistribution
1069 --------------
1070
1071 .. index:: redistribute kernel
1072 .. clicmd:: redistribute kernel
1073
1074 Redistribute kernel route to BGP process.
1075
1076 .. index:: redistribute static
1077 .. clicmd:: redistribute static
1078
1079 Redistribute static route to BGP process.
1080
1081 .. index:: redistribute connected
1082 .. clicmd:: redistribute connected
1083
1084 Redistribute connected route to BGP process.
1085
1086 .. index:: redistribute rip
1087 .. clicmd:: redistribute rip
1088
1089 Redistribute RIP route to BGP process.
1090
1091 .. index:: redistribute ospf
1092 .. clicmd:: redistribute ospf
1093
1094 Redistribute OSPF route to BGP process.
1095
1096 .. index:: redistribute vnc
1097 .. clicmd:: redistribute vnc
1098
1099 Redistribute VNC routes to BGP process.
1100
1101 .. index:: redistribute vnc-direct
1102 .. clicmd:: redistribute vnc-direct
1103
1104 Redistribute VNC direct (not via zebra) routes to BGP process.
1105
1106 .. index:: update-delay MAX-DELAY
1107 .. clicmd:: update-delay MAX-DELAY
1108
1109 .. index:: update-delay MAX-DELAY ESTABLISH-WAIT
1110 .. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT
1111
1112 This feature is used to enable read-only mode on BGP process restart or when
1113 BGP process is cleared using 'clear ip bgp \*'. When applicable, read-only
1114 mode would begin as soon as the first peer reaches Established status and a
1115 timer for max-delay seconds is started.
1116
1117 During this mode BGP doesn't run any best-path or generate any updates to its
1118 peers. This mode continues until:
1119
1120 1. All the configured peers, except the shutdown peers, have sent explicit EOR
1121 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
1122 Established is considered an implicit-EOR.
1123 If the establish-wait optional value is given, then BGP will wait for
1124 peers to reach established from the beginning of the update-delay till the
1125 establish-wait period is over, i.e. the minimum set of established peers for
1126 which EOR is expected would be peers established during the establish-wait
1127 window, not necessarily all the configured neighbors.
1128 2. max-delay period is over.
1129
1130 On hitting any of the above two conditions, BGP resumes the decision process
1131 and generates updates to its peers.
1132
1133 Default max-delay is 0, i.e. the feature is off by default.
1134
1135 .. index:: table-map ROUTE-MAP-NAME
1136 .. clicmd:: table-map ROUTE-MAP-NAME
1137
1138 This feature is used to apply a route-map on route updates from BGP to
1139 Zebra. All the applicable match operations are allowed, such as match on
1140 prefix, next-hop, communities, etc. Set operations for this attach-point are
1141 limited to metric and next-hop only. Any operation of this feature does not
1142 affect BGPs internal RIB.
1143
1144 Supported for ipv4 and ipv6 address families. It works on multi-paths as
1145 well, however, metric setting is based on the best-path only.
1146
1147 .. _bgp-peers:
1148
1149 Peers
1150 -----
1151
1152 .. _bgp-defining-peers:
1153
1154 Defining Peers
1155 ^^^^^^^^^^^^^^
1156
1157 .. index:: neighbor PEER remote-as ASN
1158 .. clicmd:: neighbor PEER remote-as ASN
1159
1160 Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address
1161 or an IPv6 address or an interface to use for the connection.
1162
1163 .. code-block:: frr
1164
1165 router bgp 1
1166 neighbor 10.0.0.1 remote-as 2
1167
1168 In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1.
1169
1170 This command must be the first command used when configuring a neighbor. If
1171 the remote-as is not specified, *bgpd* will complain like this: ::
1172
1173 can't find neighbor 10.0.0.1
1174
1175 .. index:: neighbor PEER remote-as internal
1176 .. clicmd:: neighbor PEER remote-as internal
1177
1178 Create a peer as you would when you specify an ASN, except that if the
1179 peers ASN is different than mine as specified under the :clicmd:`router bgp ASN`
1180 command the connection will be denied.
1181
1182 .. index:: neighbor PEER remote-as external
1183 .. clicmd:: neighbor PEER remote-as external
1184
1185 Create a peer as you would when you specify an ASN, except that if the
1186 peers ASN is the same as mine as specified under the :clicmd:`router bgp ASN`
1187 command the connection will be denied.
1188
1189 .. index:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME
1190 .. clicmd:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME
1191
1192 Accept connections from any peers in the specified prefix. Configuration
1193 from the specified peer-group is used to configure these peers.
1194
1195 .. note::
1196
1197 When using BGP listen ranges, if the associated peer group has TCP MD5
1198 authentication configured, your kernel must support this on prefixes. On
1199 Linux, this support was added in kernel version 4.14. If your kernel does
1200 not support this feature you will get a warning in the log file, and the
1201 listen range will only accept connections from peers without MD5 configured.
1202
1203 Additionally, we have observed that when using this option at scale (several
1204 hundred peers) the kernel may hit its option memory limit. In this situation
1205 you will see error messages like:
1206
1207 ``bgpd: sockopt_tcp_signature: setsockopt(23): Cannot allocate memory``
1208
1209 In this case you need to increase the value of the sysctl
1210 ``net.core.optmem_max`` to allow the kernel to allocate the necessary option
1211 memory.
1212
1213 .. index:: [no] coalesce-time (0-4294967295)
1214 .. clicmd:: [no] coalesce-time (0-4294967295)
1215
1216 The time in milliseconds that BGP will delay before deciding what peers
1217 can be put into an update-group together in order to generate a single
1218 update for them. The default time is 1000.
1219
1220 .. _bgp-configuring-peers:
1221
1222 Configuring Peers
1223 ^^^^^^^^^^^^^^^^^
1224
1225 .. index:: [no] neighbor PEER shutdown [message MSG...]
1226 .. clicmd:: [no] neighbor PEER shutdown [message MSG...]
1227
1228 Shutdown the peer. We can delete the neighbor's configuration by
1229 ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor
1230 will be deleted. When you want to preserve the configuration, but want to
1231 drop the BGP peer, use this syntax.
1232
1233 Optionally you can specify a shutdown message `MSG`.
1234
1235 .. index:: [no] neighbor PEER disable-connected-check
1236 .. clicmd:: [no] neighbor PEER disable-connected-check
1237
1238 Allow peerings between directly connected eBGP peers using loopback
1239 addresses.
1240
1241 .. index:: [no] neighbor PEER ebgp-multihop
1242 .. clicmd:: [no] neighbor PEER ebgp-multihop
1243
1244 Specifying ``ebgp-multihop`` allows sessions with eBGP neighbors to
1245 establish when they are multiple hops away. When the neighbor is not
1246 directly connected and this knob is not enabled, the session will not
1247 establish.
1248
1249 .. index:: [no] neighbor PEER description ...
1250 .. clicmd:: [no] neighbor PEER description ...
1251
1252 Set description of the peer.
1253
1254 .. index:: [no] neighbor PEER version VERSION
1255 .. clicmd:: [no] neighbor PEER version VERSION
1256
1257 Set up the neighbor's BGP version. `version` can be `4`, `4+` or `4-`. BGP
1258 version `4` is the default value used for BGP peering. BGP version `4+`
1259 means that the neighbor supports Multiprotocol Extensions for BGP-4. BGP
1260 version `4-` is similar but the neighbor speaks the old Internet-Draft
1261 revision 00's Multiprotocol Extensions for BGP-4. Some routing software is
1262 still using this version.
1263
1264 .. index:: [no] neighbor PEER interface IFNAME
1265 .. clicmd:: [no] neighbor PEER interface IFNAME
1266
1267 When you connect to a BGP peer over an IPv6 link-local address, you have to
1268 specify the IFNAME of the interface used for the connection. To specify
1269 IPv4 session addresses, see the ``neighbor PEER update-source`` command
1270 below.
1271
1272 This command is deprecated and may be removed in a future release. Its use
1273 should be avoided.
1274
1275 .. index:: [no] neighbor PEER next-hop-self [all]
1276 .. clicmd:: [no] neighbor PEER next-hop-self [all]
1277
1278 This command specifies an announced route's nexthop as being equivalent to
1279 the address of the bgp router if it is learned via eBGP. If the optional
1280 keyword `all` is specified the modification is done also for routes learned
1281 via iBGP.
1282
1283 .. index:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}]
1284 .. clicmd:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}]
1285
1286 This command specifies attributes to be left unchanged for advertisements
1287 sent to a peer. Use this to leave the next-hop unchanged in ipv6
1288 configurations, as the route-map directive to leave the next-hop unchanged
1289 is only available for ipv4.
1290
1291 .. index:: [no] neighbor PEER update-source <IFNAME|ADDRESS>
1292 .. clicmd:: [no] neighbor PEER update-source <IFNAME|ADDRESS>
1293
1294 Specify the IPv4 source address to use for the :abbr:`BGP` session to this
1295 neighbour, may be specified as either an IPv4 address directly or as an
1296 interface name (in which case the *zebra* daemon MUST be running in order
1297 for *bgpd* to be able to retrieve interface state).
1298
1299 .. code-block:: frr
1300
1301 router bgp 64555
1302 neighbor foo update-source 192.168.0.1
1303 neighbor bar update-source lo0
1304
1305
1306 .. index:: [no] neighbor PEER default-originate
1307 .. clicmd:: [no] neighbor PEER default-originate
1308
1309 *bgpd*'s default is to not announce the default route (0.0.0.0/0) even if it
1310 is in routing table. When you want to announce default routes to the peer,
1311 use this command.
1312
1313 .. index:: neighbor PEER port PORT
1314 .. clicmd:: neighbor PEER port PORT
1315
1316 .. index:: [no] neighbor PEER password PASSWORD
1317 .. clicmd:: [no] neighbor PEER password PASSWORD
1318
1319 Set a MD5 password to be used with the tcp socket that is being used
1320 to connect to the remote peer. Please note if you are using this
1321 command with a large number of peers on linux you should consider
1322 modifying the `net.core.optmem_max` sysctl to a larger value to
1323 avoid out of memory errors from the linux kernel.
1324
1325 .. index:: neighbor PEER send-community
1326 .. clicmd:: neighbor PEER send-community
1327
1328 .. index:: [no] neighbor PEER weight WEIGHT
1329 .. clicmd:: [no] neighbor PEER weight WEIGHT
1330
1331 This command specifies a default `weight` value for the neighbor's routes.
1332
1333 .. index:: [no] neighbor PEER maximum-prefix NUMBER [force]
1334 .. clicmd:: [no] neighbor PEER maximum-prefix NUMBER [force]
1335
1336 Sets a maximum number of prefixes we can receive from a given peer. If this
1337 number is exceeded, the BGP session will be destroyed.
1338
1339 In practice, it is generally preferable to use a prefix-list to limit what
1340 prefixes are received from the peer instead of using this knob. Tearing down
1341 the BGP session when a limit is exceeded is far more destructive than merely
1342 rejecting undesired prefixes. The prefix-list method is also much more
1343 granular and offers much smarter matching criterion than number of received
1344 prefixes, making it more suited to implementing policy.
1345
1346 If _force_ is set, then ALL prefixes are counted for maximum instead of
1347 accepted only. This is useful for cases where an inbound filter is applied,
1348 but you want maximum-prefix to act on ALL (including filtered) prefixes. This
1349 option requires `soft-reconfiguration inbound` to be enabled for the peer.
1350
1351 .. index:: [no] neighbor PEER maximum-prefix-out NUMBER
1352 .. clicmd:: [no] neighbor PEER maximum-prefix-out NUMBER
1353
1354 Sets a maximum number of prefixes we can send to a given peer.
1355
1356 .. index:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as]
1357 .. clicmd:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as]
1358
1359 Specify an alternate AS for this BGP process when interacting with the
1360 specified peer. With no modifiers, the specified local-as is prepended to
1361 the received AS_PATH when receiving routing updates from the peer, and
1362 prepended to the outgoing AS_PATH (after the process local AS) when
1363 transmitting local routes to the peer.
1364
1365 If the no-prepend attribute is specified, then the supplied local-as is not
1366 prepended to the received AS_PATH.
1367
1368 If the replace-as attribute is specified, then only the supplied local-as is
1369 prepended to the AS_PATH when transmitting local-route updates to this peer.
1370
1371 Note that replace-as can only be specified if no-prepend is.
1372
1373 This command is only allowed for eBGP peers.
1374
1375 .. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> as-override
1376 .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> as-override
1377
1378 Override AS number of the originating router with the local AS number.
1379
1380 Usually this configuration is used in PEs (Provider Edge) to replace
1381 the incoming customer AS number so the connected CE (Customer Edge)
1382 can use the same AS number as the other customer sites. This allows
1383 customers of the provider network to use the same AS number across
1384 their sites.
1385
1386 This command is only allowed for eBGP peers.
1387
1388 .. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]
1389 .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]
1390
1391 Accept incoming routes with AS path containing AS number with the same value
1392 as the current system AS.
1393
1394 This is used when you want to use the same AS number in your sites, but you
1395 can't connect them directly. This is an alternative to
1396 `neighbor WORD as-override`.
1397
1398 The parameter `(1-10)` configures the amount of accepted occurences of the
1399 system AS number in AS path.
1400
1401 The parameter `origin` configures BGP to only accept routes originated with
1402 the same AS number as the system.
1403
1404 This command is only allowed for eBGP peers.
1405
1406 .. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths
1407 .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths
1408
1409 Configure BGP to send all known paths to neighbor in order to preserve multi
1410 path capabilities inside a network.
1411
1412 .. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS
1413 .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS
1414
1415 Configure BGP to send best known paths to neighbor in order to preserve multi
1416 path capabilities inside a network.
1417
1418 .. index:: [no] neighbor PEER ttl-security hops NUMBER
1419 .. clicmd:: [no] neighbor PEER ttl-security hops NUMBER
1420
1421 This command enforces Generalized TTL Security Mechanism (GTSM), as
1422 specified in RFC 5082. With this command, only neighbors that are the
1423 specified number of hops away will be allowed to become neighbors. This
1424 command is mutually exclusive with *ebgp-multihop*.
1425
1426 .. index:: [no] neighbor PEER capability extended-nexthop
1427 .. clicmd:: [no] neighbor PEER capability extended-nexthop
1428
1429 Allow bgp to negotiate the extended-nexthop capability with it's peer.
1430 If you are peering over a v6 LL address then this capability is turned
1431 on automatically. If you are peering over a v6 Global Address then
1432 turning on this command will allow BGP to install v4 routes with
1433 v6 nexthops if you do not have v4 configured on interfaces.
1434
1435 .. index:: [no] bgp fast-external-failover
1436 .. clicmd:: [no] bgp fast-external-failover
1437
1438 This command causes bgp to not take down ebgp peers immediately
1439 when a link flaps. `bgp fast-external-failover` is the default
1440 and will not be displayed as part of a `show run`. The no form
1441 of the command turns off this ability.
1442
1443 .. index:: [no] bgp default ipv4-unicast
1444 .. clicmd:: [no] bgp default ipv4-unicast
1445
1446 This command allows the user to specify that v4 peering is turned
1447 on by default or not. This command defaults to on and is not displayed.
1448 The `no bgp default ipv4-unicast` form of the command is displayed.
1449
1450 .. index:: [no] bgp default show-hostname
1451 .. clicmd:: [no] bgp default show-hostname
1452
1453 This command shows the hostname of the peer in certain BGP commands
1454 outputs. It's easier to troubleshoot if you have a number of BGP peers.
1455
1456 .. index:: [no] bgp default show-nexthop-hostname
1457 .. clicmd:: [no] bgp default show-nexthop-hostname
1458
1459 This command shows the hostname of the next-hop in certain BGP commands
1460 outputs. It's easier to troubleshoot if you have a number of BGP peers
1461 and a number of routes to check.
1462
1463 .. index:: [no] neighbor PEER advertisement-interval (0-600)
1464 .. clicmd:: [no] neighbor PEER advertisement-interval (0-600)
1465
1466 Setup the minimum route advertisement interval(mrai) for the
1467 peer in question. This number is between 0 and 600 seconds,
1468 with the default advertisement interval being 0.
1469
1470 Displaying Information about Peers
1471 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1472
1473 .. index:: show bgp <afi> <safi> neighbors WORD bestpath-routes [json] [wide]
1474 .. clicmd:: show bgp <afi> <safi> neighbors WORD bestpath-routes [json] [wide]
1475
1476 For the given neighbor, WORD, that is specified list the routes selected
1477 by BGP as having the best path.
1478
1479 .. _bgp-peer-filtering:
1480
1481 Peer Filtering
1482 ^^^^^^^^^^^^^^
1483
1484 .. index:: neighbor PEER distribute-list NAME [in|out]
1485 .. clicmd:: neighbor PEER distribute-list NAME [in|out]
1486
1487 This command specifies a distribute-list for the peer. `direct` is
1488 ``in`` or ``out``.
1489
1490 .. index:: neighbor PEER prefix-list NAME [in|out]
1491 .. clicmd:: neighbor PEER prefix-list NAME [in|out]
1492
1493 .. index:: neighbor PEER filter-list NAME [in|out]
1494 .. clicmd:: neighbor PEER filter-list NAME [in|out]
1495
1496 .. index:: neighbor PEER route-map NAME [in|out]
1497 .. clicmd:: neighbor PEER route-map NAME [in|out]
1498
1499 Apply a route-map on the neighbor. `direct` must be `in` or `out`.
1500
1501 .. index:: bgp route-reflector allow-outbound-policy
1502 .. clicmd:: bgp route-reflector allow-outbound-policy
1503
1504 By default, attribute modification via route-map policy out is not reflected
1505 on reflected routes. This option allows the modifications to be reflected as
1506 well. Once enabled, it affects all reflected routes.
1507
1508 .. index:: [no] neighbor PEER sender-as-path-loop-detection
1509 .. clicmd:: [no] neighbor PEER sender-as-path-loop-detection
1510
1511 Enable the detection of sender side AS path loops and filter the
1512 bad routes before they are sent.
1513
1514 This setting is disabled by default.
1515
1516 .. _bgp-peer-group:
1517
1518 Peer Groups
1519 ^^^^^^^^^^^
1520
1521 Peer groups are used to help improve scaling by generating the same
1522 update information to all members of a peer group. Note that this means
1523 that the routes generated by a member of a peer group will be sent back
1524 to that originating peer with the originator identifier attribute set to
1525 indicated the originating peer. All peers not associated with a
1526 specific peer group are treated as belonging to a default peer group,
1527 and will share updates.
1528
1529 .. index:: neighbor WORD peer-group
1530 .. clicmd:: neighbor WORD peer-group
1531
1532 This command defines a new peer group.
1533
1534 .. index:: neighbor PEER peer-group PGNAME
1535 .. clicmd:: neighbor PEER peer-group PGNAME
1536
1537 This command bind specific peer to peer group WORD.
1538
1539 .. index:: neighbor PEER solo
1540 .. clicmd:: neighbor PEER solo
1541
1542 This command is used to indicate that routes advertised by the peer
1543 should not be reflected back to the peer. This command only is only
1544 meaningful when there is a single peer defined in the peer-group.
1545
1546 Capability Negotiation
1547 ^^^^^^^^^^^^^^^^^^^^^^
1548
1549 .. index:: neighbor PEER strict-capability-match
1550 .. clicmd:: neighbor PEER strict-capability-match
1551
1552 .. index:: no neighbor PEER strict-capability-match
1553 .. clicmd:: no neighbor PEER strict-capability-match
1554
1555 Strictly compares remote capabilities and local capabilities. If
1556 capabilities are different, send Unsupported Capability error then reset
1557 connection.
1558
1559 You may want to disable sending Capability Negotiation OPEN message optional
1560 parameter to the peer when remote peer does not implement Capability
1561 Negotiation. Please use *dont-capability-negotiate* command to disable the
1562 feature.
1563
1564 .. index:: [no] neighbor PEER dont-capability-negotiate
1565 .. clicmd:: [no] neighbor PEER dont-capability-negotiate
1566
1567 Suppress sending Capability Negotiation as OPEN message optional parameter
1568 to the peer. This command only affects the peer is configured other than
1569 IPv4 unicast configuration.
1570
1571 When remote peer does not have capability negotiation feature, remote peer
1572 will not send any capabilities at all. In that case, bgp configures the peer
1573 with configured capabilities.
1574
1575 You may prefer locally configured capabilities more than the negotiated
1576 capabilities even though remote peer sends capabilities. If the peer is
1577 configured by *override-capability*, *bgpd* ignores received capabilities
1578 then override negotiated capabilities with configured values.
1579
1580 Additionally the operator should be reminded that this feature fundamentally
1581 disables the ability to use widely deployed BGP features. BGP unnumbered,
1582 hostname support, AS4, Addpath, Route Refresh, ORF, Dynamic Capabilities,
1583 and graceful restart.
1584
1585 .. index:: neighbor PEER override-capability
1586 .. clicmd:: neighbor PEER override-capability
1587
1588 .. index:: no neighbor PEER override-capability
1589 .. clicmd:: no neighbor PEER override-capability
1590
1591 Override the result of Capability Negotiation with local configuration.
1592 Ignore remote peer's capability value.
1593
1594 .. _bgp-as-path-access-lists:
1595
1596 AS Path Access Lists
1597 --------------------
1598
1599 AS path access list is user defined AS path.
1600
1601 .. index:: bgp as-path access-list WORD permit|deny LINE
1602 .. clicmd:: bgp as-path access-list WORD permit|deny LINE
1603
1604 This command defines a new AS path access list.
1605
1606 .. index:: no bgp as-path access-list WORD
1607 .. clicmd:: no bgp as-path access-list WORD
1608
1609 .. index:: no bgp as-path access-list WORD permit|deny LINE
1610 .. clicmd:: no bgp as-path access-list WORD permit|deny LINE
1611
1612 .. _bgp-bogon-filter-example:
1613
1614 Bogon ASN filter policy configuration example
1615 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616
1617 .. code-block:: frr
1618
1619 bgp as-path access-list 99 permit _0_
1620 bgp as-path access-list 99 permit _23456_
1621 bgp as-path access-list 99 permit _1310[0-6][0-9]_|_13107[0-1]_
1622
1623 .. _bgp-using-as-path-in-route-map:
1624
1625 Using AS Path in Route Map
1626 --------------------------
1627
1628 .. index:: [no] match as-path WORD
1629 .. clicmd:: [no] match as-path WORD
1630
1631 For a given as-path, WORD, match it on the BGP as-path given for the prefix
1632 and if it matches do normal route-map actions. The no form of the command
1633 removes this match from the route-map.
1634
1635 .. index:: [no] set as-path prepend AS-PATH
1636 .. clicmd:: [no] set as-path prepend AS-PATH
1637
1638 Prepend the given string of AS numbers to the AS_PATH of the BGP path's NLRI.
1639 The no form of this command removes this set operation from the route-map.
1640
1641 .. index:: [no] set as-path prepend last-as NUM
1642 .. clicmd:: [no] set as-path prepend last-as NUM
1643
1644 Prepend the existing last AS number (the leftmost ASN) to the AS_PATH.
1645 The no form of this command removes this set operation from the route-map.
1646
1647 .. _bgp-communities-attribute:
1648
1649 Communities Attribute
1650 ---------------------
1651
1652 The BGP communities attribute is widely used for implementing policy routing.
1653 Network operators can manipulate BGP communities attribute based on their
1654 network policy. BGP communities attribute is defined in :rfc:`1997` and
1655 :rfc:`1998`. It is an optional transitive attribute, therefore local policy can
1656 travel through different autonomous system.
1657
1658 The communities attribute is a set of communities values. Each community value
1659 is 4 octet long. The following format is used to define the community value.
1660
1661 ``AS:VAL``
1662 This format represents 4 octet communities value. ``AS`` is high order 2
1663 octet in digit format. ``VAL`` is low order 2 octet in digit format. This
1664 format is useful to define AS oriented policy value. For example,
1665 ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
1666 neighboring peer.
1667
1668 ``internet``
1669 ``internet`` represents well-known communities value 0.
1670
1671 ``graceful-shutdown``
1672 ``graceful-shutdown`` represents well-known communities value
1673 ``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements
1674 the purpose Graceful BGP Session Shutdown to reduce the amount of
1675 lost traffic when taking BGP sessions down for maintenance. The use
1676 of the community needs to be supported from your peers side to
1677 actually have any effect.
1678
1679 ``accept-own``
1680 ``accept-own`` represents well-known communities value ``ACCEPT_OWN``
1681 ``0xFFFF0001`` ``65535:1``. :rfc:`7611` implements a way to signal
1682 to a router to accept routes with a local nexthop address. This
1683 can be the case when doing policing and having traffic having a
1684 nexthop located in another VRF but still local interface to the
1685 router. It is recommended to read the RFC for full details.
1686
1687 ``route-filter-translated-v4``
1688 ``route-filter-translated-v4`` represents well-known communities value
1689 ``ROUTE_FILTER_TRANSLATED_v4`` ``0xFFFF0002`` ``65535:2``.
1690
1691 ``route-filter-v4``
1692 ``route-filter-v4`` represents well-known communities value
1693 ``ROUTE_FILTER_v4`` ``0xFFFF0003`` ``65535:3``.
1694
1695 ``route-filter-translated-v6``
1696 ``route-filter-translated-v6`` represents well-known communities value
1697 ``ROUTE_FILTER_TRANSLATED_v6`` ``0xFFFF0004`` ``65535:4``.
1698
1699 ``route-filter-v6``
1700 ``route-filter-v6`` represents well-known communities value
1701 ``ROUTE_FILTER_v6`` ``0xFFFF0005`` ``65535:5``.
1702
1703 ``llgr-stale``
1704 ``llgr-stale`` represents well-known communities value ``LLGR_STALE``
1705 ``0xFFFF0006`` ``65535:6``.
1706 Assigned and intended only for use with routers supporting the
1707 Long-lived Graceful Restart Capability as described in
1708 [Draft-IETF-uttaro-idr-bgp-persistence]_.
1709 Routers receiving routes with this community may (depending on
1710 implementation) choose allow to reject or modify routes on the
1711 presence or absence of this community.
1712
1713 ``no-llgr``
1714 ``no-llgr`` represents well-known communities value ``NO_LLGR``
1715 ``0xFFFF0007`` ``65535:7``.
1716 Assigned and intended only for use with routers supporting the
1717 Long-lived Graceful Restart Capability as described in
1718 [Draft-IETF-uttaro-idr-bgp-persistence]_.
1719 Routers receiving routes with this community may (depending on
1720 implementation) choose allow to reject or modify routes on the
1721 presence or absence of this community.
1722
1723 ``accept-own-nexthop``
1724 ``accept-own-nexthop`` represents well-known communities value
1725 ``accept-own-nexthop`` ``0xFFFF0008`` ``65535:8``.
1726 [Draft-IETF-agrewal-idr-accept-own-nexthop]_ describes
1727 how to tag and label VPN routes to be able to send traffic between VRFs
1728 via an internal layer 2 domain on the same PE device. Refer to
1729 [Draft-IETF-agrewal-idr-accept-own-nexthop]_ for full details.
1730
1731 ``blackhole``
1732 ``blackhole`` represents well-known communities value ``BLACKHOLE``
1733 ``0xFFFF029A`` ``65535:666``. :rfc:`7999` documents sending prefixes to
1734 EBGP peers and upstream for the purpose of blackholing traffic.
1735 Prefixes tagged with the this community should normally not be
1736 re-advertised from neighbors of the originating network. It is
1737 recommended upon receiving prefixes tagged with this community to
1738 add ``NO_EXPORT`` and ``NO_ADVERTISE``.
1739
1740 ``no-export``
1741 ``no-export`` represents well-known communities value ``NO_EXPORT``
1742 ``0xFFFFFF01``. All routes carry this value must not be advertised to
1743 outside a BGP confederation boundary. If neighboring BGP peer is part of BGP
1744 confederation, the peer is considered as inside a BGP confederation
1745 boundary, so the route will be announced to the peer.
1746
1747 ``no-advertise``
1748 ``no-advertise`` represents well-known communities value ``NO_ADVERTISE``
1749 ``0xFFFFFF02``. All routes carry this value must not be advertise to other
1750 BGP peers.
1751
1752 ``local-AS``
1753 ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED``
1754 ``0xFFFFFF03``. All routes carry this value must not be advertised to
1755 external BGP peers. Even if the neighboring router is part of confederation,
1756 it is considered as external BGP peer, so the route will not be announced to
1757 the peer.
1758
1759 ``no-peer``
1760 ``no-peer`` represents well-known communities value ``NOPEER``
1761 ``0xFFFFFF04`` ``65535:65284``. :rfc:`3765` is used to communicate to
1762 another network how the originating network want the prefix propagated.
1763
1764 When the communities attribute is received duplicate community values in the
1765 attribute are ignored and value is sorted in numerical order.
1766
1767 .. [Draft-IETF-uttaro-idr-bgp-persistence] <https://tools.ietf.org/id/draft-uttaro-idr-bgp-persistence-04.txt>
1768 .. [Draft-IETF-agrewal-idr-accept-own-nexthop] <https://tools.ietf.org/id/draft-agrewal-idr-accept-own-nexthop-00.txt>
1769
1770 .. _bgp-community-lists:
1771
1772 Community Lists
1773 ^^^^^^^^^^^^^^^
1774 Community lists are user defined lists of community attribute values. These
1775 lists can be used for matching or manipulating the communities attribute in
1776 UPDATE messages.
1777
1778 There are two types of community list:
1779
1780 standard
1781 This type accepts an explicit value for the attribute.
1782
1783 expanded
1784 This type accepts a regular expression. Because the regex must be
1785 interpreted on each use expanded community lists are slower than standard
1786 lists.
1787
1788 .. index:: bgp community-list standard NAME permit|deny COMMUNITY
1789 .. clicmd:: bgp community-list standard NAME permit|deny COMMUNITY
1790
1791 This command defines a new standard community list. ``COMMUNITY`` is
1792 communities value. The ``COMMUNITY`` is compiled into community structure.
1793 We can define multiple community list under same name. In that case match
1794 will happen user defined order. Once the community list matches to
1795 communities attribute in BGP updates it return permit or deny by the
1796 community list definition. When there is no matched entry, deny will be
1797 returned. When ``COMMUNITY`` is empty it matches to any routes.
1798
1799 .. index:: bgp community-list expanded NAME permit|deny COMMUNITY
1800 .. clicmd:: bgp community-list expanded NAME permit|deny COMMUNITY
1801
1802 This command defines a new expanded community list. ``COMMUNITY`` is a
1803 string expression of communities attribute. ``COMMUNITY`` can be a regular
1804 expression (:ref:`bgp-regular-expressions`) to match the communities
1805 attribute in BGP updates. The expanded community is only used to filter,
1806 not `set` actions.
1807
1808 .. deprecated:: 5.0
1809 It is recommended to use the more explicit versions of this command.
1810
1811 .. index:: bgp community-list NAME permit|deny COMMUNITY
1812 .. clicmd:: bgp community-list NAME permit|deny COMMUNITY
1813
1814 When the community list type is not specified, the community list type is
1815 automatically detected. If ``COMMUNITY`` can be compiled into communities
1816 attribute, the community list is defined as a standard community list.
1817 Otherwise it is defined as an expanded community list. This feature is left
1818 for backward compatibility. Use of this feature is not recommended.
1819
1820
1821 .. index:: no bgp community-list [standard|expanded] NAME
1822 .. clicmd:: no bgp community-list [standard|expanded] NAME
1823
1824 Deletes the community list specified by ``NAME``. All community lists share
1825 the same namespace, so it's not necessary to specify ``standard`` or
1826 ``expanded``; these modifiers are purely aesthetic.
1827
1828 .. index:: show bgp community-list [NAME detail]
1829 .. clicmd:: show bgp community-list [NAME detail]
1830
1831 Displays community list information. When ``NAME`` is specified the
1832 specified community list's information is shown.
1833
1834 ::
1835
1836 # show bgp community-list
1837 Named Community standard list CLIST
1838 permit 7675:80 7675:100 no-export
1839 deny internet
1840 Named Community expanded list EXPAND
1841 permit :
1842
1843 # show bgp community-list CLIST detail
1844 Named Community standard list CLIST
1845 permit 7675:80 7675:100 no-export
1846 deny internet
1847
1848
1849 .. _bgp-numbered-community-lists:
1850
1851 Numbered Community Lists
1852 ^^^^^^^^^^^^^^^^^^^^^^^^
1853
1854 When number is used for BGP community list name, the number has
1855 special meanings. Community list number in the range from 1 and 99 is
1856 standard community list. Community list number in the range from 100
1857 to 199 is expanded community list. These community lists are called
1858 as numbered community lists. On the other hand normal community lists
1859 is called as named community lists.
1860
1861 .. index:: bgp community-list (1-99) permit|deny COMMUNITY
1862 .. clicmd:: bgp community-list (1-99) permit|deny COMMUNITY
1863
1864 This command defines a new community list. The argument to (1-99) defines
1865 the list identifier.
1866
1867 .. index:: bgp community-list (100-199) permit|deny COMMUNITY
1868 .. clicmd:: bgp community-list (100-199) permit|deny COMMUNITY
1869
1870 This command defines a new expanded community list. The argument to
1871 (100-199) defines the list identifier.
1872
1873 .. _bgp-using-communities-in-route-map:
1874
1875 Using Communities in Route Maps
1876 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1877
1878 In :ref:`route-map` we can match on or set the BGP communities attribute. Using
1879 this feature network operator can implement their network policy based on BGP
1880 communities attribute.
1881
1882 The following commands can be used in route maps:
1883
1884 .. index:: match community WORD exact-match [exact-match]
1885 .. clicmd:: match community WORD exact-match [exact-match]
1886
1887 This command perform match to BGP updates using community list WORD. When
1888 the one of BGP communities value match to the one of communities value in
1889 community list, it is match. When `exact-match` keyword is specified, match
1890 happen only when BGP updates have completely same communities value
1891 specified in the community list.
1892
1893 .. index:: set community <none|COMMUNITY> additive
1894 .. clicmd:: set community <none|COMMUNITY> additive
1895
1896 This command sets the community value in BGP updates. If the attribute is
1897 already configured, the newly provided value replaces the old one unless the
1898 ``additive`` keyword is specified, in which case the new value is appended
1899 to the existing value.
1900
1901 If ``none`` is specified as the community value, the communities attribute
1902 is not sent.
1903
1904 It is not possible to set an expanded community list.
1905
1906 .. index:: set comm-list WORD delete
1907 .. clicmd:: set comm-list WORD delete
1908
1909 This command remove communities value from BGP communities attribute. The
1910 ``word`` is community list name. When BGP route's communities value matches
1911 to the community list ``word``, the communities value is removed. When all
1912 of communities value is removed eventually, the BGP update's communities
1913 attribute is completely removed.
1914
1915 .. _bgp-communities-example:
1916
1917 Example Configuration
1918 ^^^^^^^^^^^^^^^^^^^^^
1919
1920 The following configuration is exemplary of the most typical usage of BGP
1921 communities attribute. In the example, AS 7675 provides an upstream Internet
1922 connection to AS 100. When the following configuration exists in AS 7675, the
1923 network operator of AS 100 can set local preference in AS 7675 network by
1924 setting BGP communities attribute to the updates.
1925
1926 .. code-block:: frr
1927
1928 router bgp 7675
1929 neighbor 192.168.0.1 remote-as 100
1930 address-family ipv4 unicast
1931 neighbor 192.168.0.1 route-map RMAP in
1932 exit-address-family
1933 !
1934 bgp community-list 70 permit 7675:70
1935 bgp community-list 70 deny
1936 bgp community-list 80 permit 7675:80
1937 bgp community-list 80 deny
1938 bgp community-list 90 permit 7675:90
1939 bgp community-list 90 deny
1940 !
1941 route-map RMAP permit 10
1942 match community 70
1943 set local-preference 70
1944 !
1945 route-map RMAP permit 20
1946 match community 80
1947 set local-preference 80
1948 !
1949 route-map RMAP permit 30
1950 match community 90
1951 set local-preference 90
1952
1953
1954 The following configuration announces ``10.0.0.0/8`` from AS 100 to AS 7675.
1955 The route has communities value ``7675:80`` so when above configuration exists
1956 in AS 7675, the announced routes' local preference value will be set to 80.
1957
1958 .. code-block:: frr
1959
1960 router bgp 100
1961 network 10.0.0.0/8
1962 neighbor 192.168.0.2 remote-as 7675
1963 address-family ipv4 unicast
1964 neighbor 192.168.0.2 route-map RMAP out
1965 exit-address-family
1966 !
1967 ip prefix-list PLIST permit 10.0.0.0/8
1968 !
1969 route-map RMAP permit 10
1970 match ip address prefix-list PLIST
1971 set community 7675:80
1972
1973
1974 The following configuration is an example of BGP route filtering using
1975 communities attribute. This configuration only permit BGP routes which has BGP
1976 communities value ``0:80`` or ``0:90``. The network operator can set special
1977 internal communities value at BGP border router, then limit the BGP route
1978 announcements into the internal network.
1979
1980 .. code-block:: frr
1981
1982 router bgp 7675
1983 neighbor 192.168.0.1 remote-as 100
1984 address-family ipv4 unicast
1985 neighbor 192.168.0.1 route-map RMAP in
1986 exit-address-family
1987 !
1988 bgp community-list 1 permit 0:80 0:90
1989 !
1990 route-map RMAP permit in
1991 match community 1
1992
1993
1994 The following example filters BGP routes which have a community value of
1995 ``1:1``. When there is no match community-list returns ``deny``. To avoid
1996 filtering all routes, a ``permit`` line is set at the end of the
1997 community-list.
1998
1999 .. code-block:: frr
2000
2001 router bgp 7675
2002 neighbor 192.168.0.1 remote-as 100
2003 address-family ipv4 unicast
2004 neighbor 192.168.0.1 route-map RMAP in
2005 exit-address-family
2006 !
2007 bgp community-list standard FILTER deny 1:1
2008 bgp community-list standard FILTER permit
2009 !
2010 route-map RMAP permit 10
2011 match community FILTER
2012
2013
2014 The communities value keyword ``internet`` has special meanings in standard
2015 community lists. In the below example ``internet`` matches all BGP routes even
2016 if the route does not have communities attribute at all. So community list
2017 ``INTERNET`` is the same as ``FILTER`` in the previous example.
2018
2019 .. code-block:: frr
2020
2021 bgp community-list standard INTERNET deny 1:1
2022 bgp community-list standard INTERNET permit internet
2023
2024
2025 The following configuration is an example of communities value deletion. With
2026 this configuration the community values ``100:1`` and ``100:2`` are removed
2027 from BGP updates. For communities value deletion, only ``permit``
2028 community-list is used. ``deny`` community-list is ignored.
2029
2030 .. code-block:: frr
2031
2032 router bgp 7675
2033 neighbor 192.168.0.1 remote-as 100
2034 address-family ipv4 unicast
2035 neighbor 192.168.0.1 route-map RMAP in
2036 exit-address-family
2037 !
2038 bgp community-list standard DEL permit 100:1 100:2
2039 !
2040 route-map RMAP permit 10
2041 set comm-list DEL delete
2042
2043
2044 .. _bgp-extended-communities-attribute:
2045
2046 Extended Communities Attribute
2047 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2048
2049 BGP extended communities attribute is introduced with MPLS VPN/BGP technology.
2050 MPLS VPN/BGP expands capability of network infrastructure to provide VPN
2051 functionality. At the same time it requires a new framework for policy routing.
2052 With BGP Extended Communities Attribute we can use Route Target or Site of
2053 Origin for implementing network policy for MPLS VPN/BGP.
2054
2055 BGP Extended Communities Attribute is similar to BGP Communities Attribute. It
2056 is an optional transitive attribute. BGP Extended Communities Attribute can
2057 carry multiple Extended Community value. Each Extended Community value is
2058 eight octet length.
2059
2060 BGP Extended Communities Attribute provides an extended range compared with BGP
2061 Communities Attribute. Adding to that there is a type field in each value to
2062 provides community space structure.
2063
2064 There are two format to define Extended Community value. One is AS based format
2065 the other is IP address based format.
2066
2067 ``AS:VAL``
2068 This is a format to define AS based Extended Community value. ``AS`` part
2069 is 2 octets Global Administrator subfield in Extended Community value.
2070 ``VAL`` part is 4 octets Local Administrator subfield. ``7675:100``
2071 represents AS 7675 policy value 100.
2072
2073 ``IP-Address:VAL``
2074 This is a format to define IP address based Extended Community value.
2075 ``IP-Address`` part is 4 octets Global Administrator subfield. ``VAL`` part
2076 is 2 octets Local Administrator subfield.
2077
2078 .. _bgp-extended-community-lists:
2079
2080 Extended Community Lists
2081 ^^^^^^^^^^^^^^^^^^^^^^^^
2082
2083 .. index:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY
2084 .. clicmd:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY
2085
2086 This command defines a new standard extcommunity-list. `extcommunity` is
2087 extended communities value. The `extcommunity` is compiled into extended
2088 community structure. We can define multiple extcommunity-list under same
2089 name. In that case match will happen user defined order. Once the
2090 extcommunity-list matches to extended communities attribute in BGP updates
2091 it return permit or deny based upon the extcommunity-list definition. When
2092 there is no matched entry, deny will be returned. When `extcommunity` is
2093 empty it matches to any routes.
2094
2095 .. index:: bgp extcommunity-list expanded NAME permit|deny LINE
2096 .. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE
2097
2098 This command defines a new expanded extcommunity-list. `line` is a string
2099 expression of extended communities attribute. `line` can be a regular
2100 expression (:ref:`bgp-regular-expressions`) to match an extended communities
2101 attribute in BGP updates.
2102
2103 .. index:: no bgp extcommunity-list NAME
2104 .. clicmd:: no bgp extcommunity-list NAME
2105
2106 .. index:: no bgp extcommunity-list standard NAME
2107 .. clicmd:: no bgp extcommunity-list standard NAME
2108
2109 .. index:: no bgp extcommunity-list expanded NAME
2110 .. clicmd:: no bgp extcommunity-list expanded NAME
2111
2112 These commands delete extended community lists specified by `name`. All of
2113 extended community lists shares a single name space. So extended community
2114 lists can be removed simply specifying the name.
2115
2116 .. index:: show bgp extcommunity-list
2117 .. clicmd:: show bgp extcommunity-list
2118
2119 .. index:: show bgp extcommunity-list NAME detail
2120 .. clicmd:: show bgp extcommunity-list NAME detail
2121
2122 This command displays current extcommunity-list information. When `name` is
2123 specified the community list's information is shown.::
2124
2125 # show bgp extcommunity-list
2126
2127
2128 .. _bgp-extended-communities-in-route-map:
2129
2130 BGP Extended Communities in Route Map
2131 """""""""""""""""""""""""""""""""""""
2132
2133 .. index:: match extcommunity WORD
2134 .. clicmd:: match extcommunity WORD
2135
2136 .. index:: set extcommunity rt EXTCOMMUNITY
2137 .. clicmd:: set extcommunity rt EXTCOMMUNITY
2138
2139 This command set Route Target value.
2140
2141 .. index:: set extcommunity soo EXTCOMMUNITY
2142 .. clicmd:: set extcommunity soo EXTCOMMUNITY
2143
2144 This command set Site of Origin value.
2145
2146 .. index:: set extcommunity bandwidth <(1-25600) | cumulative | num-multipaths> [non-transitive]
2147 .. clicmd:: set extcommunity bandwidth <(1-25600) | cumulative | num-multipaths> [non-transitive]
2148
2149 This command sets the BGP link-bandwidth extended community for the prefix
2150 (best path) for which it is applied. The link-bandwidth can be specified as
2151 an ``explicit value`` (specified in Mbps), or the router can be told to use
2152 the ``cumulative bandwidth`` of all multipaths for the prefix or to compute
2153 it based on the ``number of multipaths``. The link bandwidth extended
2154 community is encoded as ``transitive`` unless the set command explicitly
2155 configures it as ``non-transitive``.
2156
2157 .. seealso:: :ref:`wecmp_linkbw`
2158
2159 Note that the extended expanded community is only used for `match` rule, not for
2160 `set` actions.
2161
2162 .. _bgp-large-communities-attribute:
2163
2164 Large Communities Attribute
2165 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2166
2167 The BGP Large Communities attribute was introduced in Feb 2017 with
2168 :rfc:`8092`.
2169
2170 The BGP Large Communities Attribute is similar to the BGP Communities Attribute
2171 except that it has 3 components instead of two and each of which are 4 octets
2172 in length. Large Communities bring additional functionality and convenience
2173 over traditional communities, specifically the fact that the ``GLOBAL`` part
2174 below is now 4 octets wide allowing seamless use in networks using 4-byte ASNs.
2175
2176 ``GLOBAL:LOCAL1:LOCAL2``
2177 This is the format to define Large Community values. Referencing :rfc:`8195`
2178 the values are commonly referred to as follows:
2179
2180 - The ``GLOBAL`` part is a 4 octet Global Administrator field, commonly used
2181 as the operators AS number.
2182 - The ``LOCAL1`` part is a 4 octet Local Data Part 1 subfield referred to as
2183 a function.
2184 - The ``LOCAL2`` part is a 4 octet Local Data Part 2 field and referred to
2185 as the parameter subfield.
2186
2187 As an example, ``65551:1:10`` represents AS 65551 function 1 and parameter
2188 10. The referenced RFC above gives some guidelines on recommended usage.
2189
2190 .. _bgp-large-community-lists:
2191
2192 Large Community Lists
2193 """""""""""""""""""""
2194
2195 Two types of large community lists are supported, namely `standard` and
2196 `expanded`.
2197
2198 .. index:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY
2199 .. clicmd:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY
2200
2201 This command defines a new standard large-community-list. `large-community`
2202 is the Large Community value. We can add multiple large communities under
2203 same name. In that case the match will happen in the user defined order.
2204 Once the large-community-list matches the Large Communities attribute in BGP
2205 updates it will return permit or deny based upon the large-community-list
2206 definition. When there is no matched entry, a deny will be returned. When
2207 `large-community` is empty it matches any routes.
2208
2209 .. index:: bgp large-community-list expanded NAME permit|deny LINE
2210 .. clicmd:: bgp large-community-list expanded NAME permit|deny LINE
2211
2212 This command defines a new expanded large-community-list. Where `line` is a
2213 string matching expression, it will be compared to the entire Large
2214 Communities attribute as a string, with each large-community in order from
2215 lowest to highest. `line` can also be a regular expression which matches
2216 this Large Community attribute.
2217
2218 .. index:: no bgp large-community-list NAME
2219 .. clicmd:: no bgp large-community-list NAME
2220
2221 .. index:: no bgp large-community-list standard NAME
2222 .. clicmd:: no bgp large-community-list standard NAME
2223
2224 .. index:: no bgp large-community-list expanded NAME
2225 .. clicmd:: no bgp large-community-list expanded NAME
2226
2227 These commands delete Large Community lists specified by `name`. All Large
2228 Community lists share a single namespace. This means Large Community lists
2229 can be removed by simply specifying the name.
2230
2231 .. index:: show bgp large-community-list
2232 .. clicmd:: show bgp large-community-list
2233
2234 .. index:: show bgp large-community-list NAME detail
2235 .. clicmd:: show bgp large-community-list NAME detail
2236
2237 This command display current large-community-list information. When
2238 `name` is specified the community list information is shown.
2239
2240 .. index:: show ip bgp large-community-info
2241 .. clicmd:: show ip bgp large-community-info
2242
2243 This command displays the current large communities in use.
2244
2245 .. _bgp-large-communities-in-route-map:
2246
2247 Large Communities in Route Map
2248 """"""""""""""""""""""""""""""
2249
2250 .. index:: match large-community LINE [exact-match]
2251 .. clicmd:: match large-community LINE [exact-match]
2252
2253 Where `line` can be a simple string to match, or a regular expression. It
2254 is very important to note that this match occurs on the entire
2255 large-community string as a whole, where each large-community is ordered
2256 from lowest to highest. When `exact-match` keyword is specified, match
2257 happen only when BGP updates have completely same large communities value
2258 specified in the large community list.
2259
2260 .. index:: set large-community LARGE-COMMUNITY
2261 .. clicmd:: set large-community LARGE-COMMUNITY
2262
2263 .. index:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
2264 .. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
2265
2266 .. index:: set large-community LARGE-COMMUNITY additive
2267 .. clicmd:: set large-community LARGE-COMMUNITY additive
2268
2269 These commands are used for setting large-community values. The first
2270 command will overwrite any large-communities currently present.
2271 The second specifies two large-communities, which overwrites the current
2272 large-community list. The third will add a large-community value without
2273 overwriting other values. Multiple large-community values can be specified.
2274
2275 Note that the large expanded community is only used for `match` rule, not for
2276 `set` actions.
2277
2278 .. _bgp-l3vpn-vrfs:
2279
2280 L3VPN VRFs
2281 ----------
2282
2283 *bgpd* supports :abbr:`L3VPN (Layer 3 Virtual Private Networks)` :abbr:`VRFs
2284 (Virtual Routing and Forwarding)` for IPv4 :rfc:`4364` and IPv6 :rfc:`4659`.
2285 L3VPN routes, and their associated VRF MPLS labels, can be distributed to VPN
2286 SAFI neighbors in the *default*, i.e., non VRF, BGP instance. VRF MPLS labels
2287 are reached using *core* MPLS labels which are distributed using LDP or BGP
2288 labeled unicast. *bgpd* also supports inter-VRF route leaking.
2289
2290
2291 .. _bgp-vrf-route-leaking:
2292
2293 VRF Route Leaking
2294 -----------------
2295
2296 BGP routes may be leaked (i.e. copied) between a unicast VRF RIB and the VPN
2297 SAFI RIB of the default VRF for use in MPLS-based L3VPNs. Unicast routes may
2298 also be leaked between any VRFs (including the unicast RIB of the default BGP
2299 instanced). A shortcut syntax is also available for specifying leaking from one
2300 VRF to another VRF using the default instance's VPN RIB as the intemediary. A
2301 common application of the VRF-VRF feature is to connect a customer's private
2302 routing domain to a provider's VPN service. Leaking is configured from the
2303 point of view of an individual VRF: ``import`` refers to routes leaked from VPN
2304 to a unicast VRF, whereas ``export`` refers to routes leaked from a unicast VRF
2305 to VPN.
2306
2307 Required parameters
2308 ^^^^^^^^^^^^^^^^^^^
2309
2310 Routes exported from a unicast VRF to the VPN RIB must be augmented by two
2311 parameters:
2312
2313 - an :abbr:`RD (Route Distinguisher)`
2314 - an :abbr:`RTLIST (Route-target List)`
2315
2316 Configuration for these exported routes must, at a minimum, specify these two
2317 parameters.
2318
2319 Routes imported from the VPN RIB to a unicast VRF are selected according to
2320 their RTLISTs. Routes whose RTLIST contains at least one route-target in
2321 common with the configured import RTLIST are leaked. Configuration for these
2322 imported routes must specify an RTLIST to be matched.
2323
2324 The RD, which carries no semantic value, is intended to make the route unique
2325 in the VPN RIB among all routes of its prefix that originate from all the
2326 customers and sites that are attached to the provider's VPN service.
2327 Accordingly, each site of each customer is typically assigned an RD that is
2328 unique across the entire provider network.
2329
2330 The RTLIST is a set of route-target extended community values whose purpose is
2331 to specify route-leaking policy. Typically, a customer is assigned a single
2332 route-target value for import and export to be used at all customer sites. This
2333 configuration specifies a simple topology wherein a customer has a single
2334 routing domain which is shared across all its sites. More complex routing
2335 topologies are possible through use of additional route-targets to augment the
2336 leaking of sets of routes in various ways.
2337
2338 When using the shortcut syntax for vrf-to-vrf leaking, the RD and RT are
2339 auto-derived.
2340
2341 General configuration
2342 ^^^^^^^^^^^^^^^^^^^^^
2343
2344 Configuration of route leaking between a unicast VRF RIB and the VPN SAFI RIB
2345 of the default VRF is accomplished via commands in the context of a VRF
2346 address-family:
2347
2348 .. index:: rd vpn export AS:NN|IP:nn
2349 .. clicmd:: rd vpn export AS:NN|IP:nn
2350
2351 Specifies the route distinguisher to be added to a route exported from the
2352 current unicast VRF to VPN.
2353
2354 .. index:: no rd vpn export [AS:NN|IP:nn]
2355 .. clicmd:: no rd vpn export [AS:NN|IP:nn]
2356
2357 Deletes any previously-configured export route distinguisher.
2358
2359 .. index:: rt vpn import|export|both RTLIST...
2360 .. clicmd:: rt vpn import|export|both RTLIST...
2361
2362 Specifies the route-target list to be attached to a route (export) or the
2363 route-target list to match against (import) when exporting/importing between
2364 the current unicast VRF and VPN.
2365
2366 The RTLIST is a space-separated list of route-targets, which are BGP
2367 extended community values as described in
2368 :ref:`bgp-extended-communities-attribute`.
2369
2370 .. index:: no rt vpn import|export|both [RTLIST...]
2371 .. clicmd:: no rt vpn import|export|both [RTLIST...]
2372
2373 Deletes any previously-configured import or export route-target list.
2374
2375 .. index:: label vpn export (0..1048575)|auto
2376 .. clicmd:: label vpn export (0..1048575)|auto
2377
2378 Enables an MPLS label to be attached to a route exported from the current
2379 unicast VRF to VPN. If the value specified is ``auto``, the label value is
2380 automatically assigned from a pool maintained by the Zebra daemon. If Zebra
2381 is not running, or if this command is not configured, automatic label
2382 assignment will not complete, which will block corresponding route export.
2383
2384 .. index:: no label vpn export [(0..1048575)|auto]
2385 .. clicmd:: no label vpn export [(0..1048575)|auto]
2386
2387 Deletes any previously-configured export label.
2388
2389 .. index:: nexthop vpn export A.B.C.D|X:X::X:X
2390 .. clicmd:: nexthop vpn export A.B.C.D|X:X::X:X
2391
2392 Specifies an optional nexthop value to be assigned to a route exported from
2393 the current unicast VRF to VPN. If left unspecified, the nexthop will be set
2394 to 0.0.0.0 or 0:0::0:0 (self).
2395
2396 .. index:: no nexthop vpn export [A.B.C.D|X:X::X:X]
2397 .. clicmd:: no nexthop vpn export [A.B.C.D|X:X::X:X]
2398
2399 Deletes any previously-configured export nexthop.
2400
2401 .. index:: route-map vpn import|export MAP
2402 .. clicmd:: route-map vpn import|export MAP
2403
2404 Specifies an optional route-map to be applied to routes imported or exported
2405 between the current unicast VRF and VPN.
2406
2407 .. index:: no route-map vpn import|export [MAP]
2408 .. clicmd:: no route-map vpn import|export [MAP]
2409
2410 Deletes any previously-configured import or export route-map.
2411
2412 .. index:: import|export vpn
2413 .. clicmd:: import|export vpn
2414
2415 Enables import or export of routes between the current unicast VRF and VPN.
2416
2417 .. index:: no import|export vpn
2418 .. clicmd:: no import|export vpn
2419
2420 Disables import or export of routes between the current unicast VRF and VPN.
2421
2422 .. index:: import vrf VRFNAME
2423 .. clicmd:: import vrf VRFNAME
2424
2425 Shortcut syntax for specifying automatic leaking from vrf VRFNAME to
2426 the current VRF using the VPN RIB as intermediary. The RD and RT
2427 are auto derived and should not be specified explicitly for either the
2428 source or destination VRF's.
2429
2430 This shortcut syntax mode is not compatible with the explicit
2431 `import vpn` and `export vpn` statements for the two VRF's involved.
2432 The CLI will disallow attempts to configure incompatible leaking
2433 modes.
2434
2435 .. index:: no import vrf VRFNAME
2436 .. clicmd:: no import vrf VRFNAME
2437
2438 Disables automatic leaking from vrf VRFNAME to the current VRF using
2439 the VPN RIB as intermediary.
2440
2441
2442 .. _bgp-evpn:
2443
2444 Ethernet Virtual Network - EVPN
2445 -------------------------------
2446
2447 .. _bgp-evpn-advertise-pip:
2448
2449 EVPN advertise-PIP
2450 ^^^^^^^^^^^^^^^^^^
2451
2452 In a EVPN symmetric routing MLAG deployment, all EVPN routes advertised
2453 with anycast-IP as next-hop IP and anycast MAC as the Router MAC (RMAC - in
2454 BGP EVPN Extended-Community).
2455 EVPN picks up the next-hop IP from the VxLAN interface's local tunnel IP and
2456 the RMAC is obtained from the MAC of the L3VNI's SVI interface.
2457 Note: Next-hop IP is used for EVPN routes whether symmetric routing is
2458 deployed or not but the RMAC is only relevant for symmetric routing scenario.
2459
2460 Current behavior is not ideal for Prefix (type-5) and self (type-2)
2461 routes. This is because the traffic from remote VTEPs routed sub optimally
2462 if they land on the system where the route does not belong.
2463
2464 The advertise-pip feature advertises Prefix (type-5) and self (type-2)
2465 routes with system's individual (primary) IP as the next-hop and individual
2466 (system) MAC as Router-MAC (RMAC), while leaving the behavior unchanged for
2467 other EVPN routes.
2468
2469 To support this feature there needs to have ability to co-exist a
2470 (system-MAC, system-IP) pair with a (anycast-MAC, anycast-IP) pair with the
2471 ability to terminate VxLAN-encapsulated packets received for either pair on
2472 the same L3VNI (i.e associated VLAN). This capability is need per tenant
2473 VRF instance.
2474
2475 To derive the system-MAC and the anycast MAC, there needs to have a
2476 separate/additional MAC-VLAN interface corresponding to L3VNI’s SVI.
2477 The SVI interface’s MAC address can be interpreted as system-MAC
2478 and MAC-VLAN interface's MAC as anycast MAC.
2479
2480 To derive system-IP and anycast-IP, the default BGP instance's router-id is used
2481 as system-IP and the VxLAN interface’s local tunnel IP as the anycast-IP.
2482
2483 User has an option to configure the system-IP and/or system-MAC value if the
2484 auto derived value is not preferred.
2485
2486 Note: By default, advertise-pip feature is enabled and user has an option to
2487 disable the feature via configuration CLI. Once the feature is disable under
2488 bgp vrf instance or MAC-VLAN interface is not configured, all the routes follow
2489 the same behavior of using same next-hop and RMAC values.
2490
2491 .. index:: [no] advertise-pip [ip <addr> [mac <addr>]]
2492 .. clicmd:: [no] advertise-pip [ip <addr> [mac <addr>]]
2493
2494 Enables or disables advertise-pip feature, specifiy system-IP and/or system-MAC
2495 parameters.
2496
2497
2498 .. _bgp-debugging:
2499
2500 Debugging
2501 ---------
2502
2503 .. index:: show debug
2504 .. clicmd:: show debug
2505
2506 Show all enabled debugs.
2507
2508 .. index:: show bgp listeners
2509 .. clicmd:: show bgp listeners
2510
2511 Display Listen sockets and the vrf that created them. Useful for debugging of when
2512 listen is not working and this is considered a developer debug statement.
2513
2514 .. index:: [no] debug bgp neighbor-events
2515 .. clicmd:: [no] debug bgp neighbor-events
2516
2517 Enable or disable debugging for neighbor events. This provides general
2518 information on BGP events such as peer connection / disconnection, session
2519 establishment / teardown, and capability negotiation.
2520
2521 .. index:: [no] debug bgp updates
2522 .. clicmd:: [no] debug bgp updates
2523
2524 Enable or disable debugging for BGP updates. This provides information on
2525 BGP UPDATE messages transmitted and received between local and remote
2526 instances.
2527
2528 .. index:: [no] debug bgp keepalives
2529 .. clicmd:: [no] debug bgp keepalives
2530
2531 Enable or disable debugging for BGP keepalives. This provides information on
2532 BGP KEEPALIVE messages transmitted and received between local and remote
2533 instances.
2534
2535 .. index:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
2536 .. clicmd:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
2537
2538 Enable or disable debugging for bestpath selection on the specified prefix.
2539
2540 .. index:: [no] debug bgp nht
2541 .. clicmd:: [no] debug bgp nht
2542
2543 Enable or disable debugging of BGP nexthop tracking.
2544
2545 .. index:: [no] debug bgp update-groups
2546 .. clicmd:: [no] debug bgp update-groups
2547
2548 Enable or disable debugging of dynamic update groups. This provides general
2549 information on group creation, deletion, join and prune events.
2550
2551 .. index:: [no] debug bgp zebra
2552 .. clicmd:: [no] debug bgp zebra
2553
2554 Enable or disable debugging of communications between *bgpd* and *zebra*.
2555
2556 Dumping Messages and Routing Tables
2557 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2558
2559 .. index:: dump bgp all PATH [INTERVAL]
2560 .. clicmd:: dump bgp all PATH [INTERVAL]
2561
2562 .. index:: dump bgp all-et PATH [INTERVAL]
2563 .. clicmd:: dump bgp all-et PATH [INTERVAL]
2564
2565 .. index:: no dump bgp all [PATH] [INTERVAL]
2566 .. clicmd:: no dump bgp all [PATH] [INTERVAL]
2567
2568 Dump all BGP packet and events to `path` file.
2569 If `interval` is set, a new file will be created for echo `interval` of
2570 seconds. The path `path` can be set with date and time formatting
2571 (strftime). The type ‘all-et’ enables support for Extended Timestamp Header
2572 (:ref:`packet-binary-dump-format`).
2573
2574 .. index:: dump bgp updates PATH [INTERVAL]
2575 .. clicmd:: dump bgp updates PATH [INTERVAL]
2576
2577 .. index:: dump bgp updates-et PATH [INTERVAL]
2578 .. clicmd:: dump bgp updates-et PATH [INTERVAL]
2579
2580 .. index:: no dump bgp updates [PATH] [INTERVAL]
2581 .. clicmd:: no dump bgp updates [PATH] [INTERVAL]
2582
2583 Dump only BGP updates messages to `path` file.
2584 If `interval` is set, a new file will be created for echo `interval` of
2585 seconds. The path `path` can be set with date and time formatting
2586 (strftime). The type ‘updates-et’ enables support for Extended Timestamp
2587 Header (:ref:`packet-binary-dump-format`).
2588
2589 .. index:: dump bgp routes-mrt PATH
2590 .. clicmd:: dump bgp routes-mrt PATH
2591
2592 .. index:: dump bgp routes-mrt PATH INTERVAL
2593 .. clicmd:: dump bgp routes-mrt PATH INTERVAL
2594
2595 .. index:: no dump bgp route-mrt [PATH] [INTERVAL]
2596 .. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL]
2597
2598 Dump whole BGP routing table to `path`. This is heavy process. The path
2599 `path` can be set with date and time formatting (strftime). If `interval` is
2600 set, a new file will be created for echo `interval` of seconds.
2601
2602 Note: the interval variable can also be set using hours and minutes: 04h20m00.
2603
2604
2605 .. _bgp-other-commands:
2606
2607 Other BGP Commands
2608 ------------------
2609
2610 The following are available in the top level *enable* mode:
2611
2612 .. index:: clear bgp \*
2613 .. clicmd:: clear bgp \*
2614
2615 Clear all peers.
2616
2617 .. index:: clear bgp ipv4|ipv6 \*
2618 .. clicmd:: clear bgp ipv4|ipv6 \*
2619
2620 Clear all peers with this address-family activated.
2621
2622 .. index:: clear bgp ipv4|ipv6 unicast \*
2623 .. clicmd:: clear bgp ipv4|ipv6 unicast \*
2624
2625 Clear all peers with this address-family and sub-address-family activated.
2626
2627 .. index:: clear bgp ipv4|ipv6 PEER
2628 .. clicmd:: clear bgp ipv4|ipv6 PEER
2629
2630 Clear peers with address of X.X.X.X and this address-family activated.
2631
2632 .. index:: clear bgp ipv4|ipv6 unicast PEER
2633 .. clicmd:: clear bgp ipv4|ipv6 unicast PEER
2634
2635 Clear peer with address of X.X.X.X and this address-family and sub-address-family activated.
2636
2637 .. index:: clear bgp ipv4|ipv6 PEER soft|in|out
2638 .. clicmd:: clear bgp ipv4|ipv6 PEER soft|in|out
2639
2640 Clear peer using soft reconfiguration in this address-family.
2641
2642 .. index:: clear bgp ipv4|ipv6 unicast PEER soft|in|out
2643 .. clicmd:: clear bgp ipv4|ipv6 unicast PEER soft|in|out
2644
2645 Clear peer using soft reconfiguration in this address-family and sub-address-family.
2646
2647 The following are available in the ``router bgp`` mode:
2648
2649 .. index:: write-quanta (1-64)
2650 .. clicmd:: write-quanta (1-64)
2651
2652 BGP message Tx I/O is vectored. This means that multiple packets are written
2653 to the peer socket at the same time each I/O cycle, in order to minimize
2654 system call overhead. This value controls how many are written at a time.
2655 Under certain load conditions, reducing this value could make peer traffic
2656 less 'bursty'. In practice, leave this settings on the default (64) unless
2657 you truly know what you are doing.
2658
2659 .. index:: read-quanta (1-10)
2660 .. clicmd:: read-quanta (1-10)
2661
2662 Unlike Tx, BGP Rx traffic is not vectored. Packets are read off the wire one
2663 at a time in a loop. This setting controls how many iterations the loop runs
2664 for. As with write-quanta, it is best to leave this setting on the default.
2665
2666 .. _bgp-displaying-bgp-information:
2667
2668 Displaying BGP Information
2669 ==========================
2670
2671 The following four commands display the IPv6 and IPv4 routing tables, depending
2672 on whether or not the ``ip`` keyword is used.
2673 Actually, :clicmd:`show ip bgp` command was used on older `Quagga` routing
2674 daemon project, while :clicmd:`show bgp` command is the new format. The choice
2675 has been done to keep old format with IPv4 routing table, while new format
2676 displays IPv6 routing table.
2677
2678 .. index:: show ip bgp [wide]
2679 .. clicmd:: show ip bgp [wide]
2680
2681 .. index:: show ip bgp A.B.C.D [wide]
2682 .. clicmd:: show ip bgp A.B.C.D [wide]
2683
2684 .. index:: show bgp [wide]
2685 .. clicmd:: show bgp [wide]
2686
2687 .. index:: show bgp X:X::X:X [wide]
2688 .. clicmd:: show bgp X:X::X:X [wide]
2689
2690 These commands display BGP routes. When no route is specified, the default
2691 is to display all BGP routes.
2692
2693 ::
2694
2695 BGP table version is 0, local router ID is 10.1.1.1
2696 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
2697 Origin codes: i - IGP, e - EGP, ? - incomplete
2698
2699 Network Next Hop Metric LocPrf Weight Path
2700 \*> 1.1.1.1/32 0.0.0.0 0 32768 i
2701
2702 Total number of prefixes 1
2703
2704 If _wide_ option is specified, then the prefix table's width is increased
2705 to fully display the prefix and the nexthop.
2706
2707 This is especially handy dealing with IPv6 prefixes and
2708 if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled.
2709
2710 Some other commands provide additional options for filtering the output.
2711
2712 .. index:: show [ip] bgp regexp LINE
2713 .. clicmd:: show [ip] bgp regexp LINE
2714
2715 This command displays BGP routes using AS path regular expression
2716 (:ref:`bgp-regular-expressions`).
2717
2718 .. index:: show [ip] bgp summary
2719 .. clicmd:: show [ip] bgp summary
2720
2721 Show a bgp peer summary for the specified address family.
2722
2723 The old command structure :clicmd:`show ip bgp` may be removed in the future
2724 and should no longer be used. In order to reach the other BGP routing tables
2725 other than the IPv6 routing table given by :clicmd:`show bgp`, the new command
2726 structure is extended with :clicmd:`show bgp [afi] [safi]`.
2727
2728 .. index:: show bgp [afi] [safi]
2729 .. clicmd:: show bgp [afi] [safi]
2730
2731 .. index:: show bgp <ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast>
2732 .. clicmd:: show bgp <ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast>
2733
2734 These commands display BGP routes for the specific routing table indicated by
2735 the selected afi and the selected safi. If no afi and no safi value is given,
2736 the command falls back to the default IPv6 routing table.
2737 For EVPN prefixes, you can display the full BGP table for this AFI/SAFI
2738 using the standard `show bgp [afi] [safi]` syntax.
2739
2740 .. index:: show bgp l2vpn evpn route [type <macip|2|multicast|3|es|4|prefix|5>]
2741 .. clicmd:: show bgp l2vpn evpn route [type <macip|2|multicast|3|es|4|prefix|5>]
2742
2743 Additionally, you can also filter this output by route type.
2744
2745 .. index:: show bgp [afi] [safi] summary
2746 .. clicmd:: show bgp [afi] [safi] summary
2747
2748 Show a bgp peer summary for the specified address family, and subsequent
2749 address-family.
2750
2751 .. index:: show bgp [afi] [safi] summary failed [json]
2752 .. clicmd:: show bgp [afi] [safi] summary failed [json]
2753
2754 Show a bgp peer summary for peers that are not succesfully exchanging routes
2755 for the specified address family, and subsequent address-family.
2756
2757 .. index:: show bgp [afi] [safi] summary established [json]
2758 .. clicmd:: show bgp [afi] [safi] summary established [json]
2759
2760 Show a bgp peer summary for peers that are succesfully exchanging routes
2761 for the specified address family, and subsequent address-family.
2762
2763 .. index:: show bgp [afi] [safi] neighbor [PEER]
2764 .. clicmd:: show bgp [afi] [safi] neighbor [PEER]
2765
2766 This command shows information on a specific BGP peer of the relevant
2767 afi and safi selected.
2768
2769 .. index:: show bgp [afi] [safi] dampening dampened-paths
2770 .. clicmd:: show bgp [afi] [safi] dampening dampened-paths
2771
2772 Display paths suppressed due to dampening of the selected afi and safi
2773 selected.
2774
2775 .. index:: show bgp [afi] [safi] dampening flap-statistics
2776 .. clicmd:: show bgp [afi] [safi] dampening flap-statistics
2777
2778 Display flap statistics of routes of the selected afi and safi selected.
2779
2780 .. index:: show bgp [afi] [safi] statistics
2781 .. clicmd:: show bgp [afi] [safi] statistics
2782
2783 Display statistics of routes of the selected afi and safi.
2784
2785 .. index:: show bgp statistics-all
2786 .. clicmd:: show bgp statistics-all
2787
2788 Display statistics of routes of all the afi and safi.
2789
2790 .. _bgp-display-routes-by-community:
2791
2792 Displaying Routes by Community Attribute
2793 ----------------------------------------
2794
2795 The following commands allow displaying routes based on their community
2796 attribute.
2797
2798 .. index:: show [ip] bgp <ipv4|ipv6> community
2799 .. clicmd:: show [ip] bgp <ipv4|ipv6> community
2800
2801 .. index:: show [ip] bgp <ipv4|ipv6> community COMMUNITY
2802 .. clicmd:: show [ip] bgp <ipv4|ipv6> community COMMUNITY
2803
2804 .. index:: show [ip] bgp <ipv4|ipv6> community COMMUNITY exact-match
2805 .. clicmd:: show [ip] bgp <ipv4|ipv6> community COMMUNITY exact-match
2806
2807 These commands display BGP routes which have the community attribute.
2808 attribute. When ``COMMUNITY`` is specified, BGP routes that match that
2809 community are displayed. When `exact-match` is specified, it display only
2810 routes that have an exact match.
2811
2812 .. index:: show [ip] bgp <ipv4|ipv6> community-list WORD
2813 .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD
2814
2815 .. index:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
2816 .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
2817
2818 These commands display BGP routes for the address family specified that
2819 match the specified community list. When `exact-match` is specified, it
2820 displays only routes that have an exact match.
2821
2822 .. _bgp-display-routes-by-lcommunity:
2823
2824 Displaying Routes by Large Community Attribute
2825 ----------------------------------------------
2826
2827 The following commands allow displaying routes based on their
2828 large community attribute.
2829
2830 .. index:: show [ip] bgp <ipv4|ipv6> large-community
2831 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community
2832
2833 .. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
2834 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
2835
2836 .. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
2837 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
2838
2839 .. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
2840 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
2841
2842 These commands display BGP routes which have the large community attribute.
2843 attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that
2844 large community are displayed. When `exact-match` is specified, it display
2845 only routes that have an exact match. When `json` is specified, it display
2846 routes in json format.
2847
2848 .. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
2849 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
2850
2851 .. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
2852 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
2853
2854 .. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
2855 .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
2856
2857 These commands display BGP routes for the address family specified that
2858 match the specified large community list. When `exact-match` is specified,
2859 it displays only routes that have an exact match. When `json` is specified,
2860 it display routes in json format.
2861
2862 .. _bgp-display-routes-by-as-path:
2863
2864
2865 Displaying Routes by AS Path
2866 ----------------------------
2867
2868 .. index:: show bgp ipv4|ipv6 regexp LINE
2869 .. clicmd:: show bgp ipv4|ipv6 regexp LINE
2870
2871 This commands displays BGP routes that matches a regular
2872 expression `line` (:ref:`bgp-regular-expressions`).
2873
2874 .. index:: show [ip] bgp ipv4 vpn
2875 .. clicmd:: show [ip] bgp ipv4 vpn
2876
2877 .. index:: show [ip] bgp ipv6 vpn
2878 .. clicmd:: show [ip] bgp ipv6 vpn
2879
2880 Print active IPV4 or IPV6 routes advertised via the VPN SAFI.
2881
2882 .. index:: show bgp ipv4 vpn summary
2883 .. clicmd:: show bgp ipv4 vpn summary
2884
2885 .. index:: show bgp ipv6 vpn summary
2886 .. clicmd:: show bgp ipv6 vpn summary
2887
2888 Print a summary of neighbor connections for the specified AFI/SAFI combination.
2889
2890 Displaying Update Group Information
2891 -----------------------------------
2892
2893 .. index:: show bgp update-groups SUBGROUP-ID [advertise-queue|advertised-routes|packet-queue]
2894 .. clicmd:: show bgp update-groups [advertise-queue|advertised-routes|packet-queue]
2895
2896 Display Information about each individual update-group being used.
2897 If SUBGROUP-ID is specified only display about that particular group. If
2898 advertise-queue is specified the list of routes that need to be sent
2899 to the peers in the update-group is displayed, advertised-routes means
2900 the list of routes we have sent to the peers in the update-group and
2901 packet-queue specifies the list of packets in the queue to be sent.
2902
2903 .. index:: show bgp update-groups statistics
2904 .. clicmd:: show bgp update-groups statistics
2905
2906 Display Information about update-group events in FRR.
2907
2908 .. _bgp-route-reflector:
2909
2910 Route Reflector
2911 ===============
2912
2913 BGP routers connected inside the same AS through BGP belong to an internal
2914 BGP session, or IBGP. In order to prevent routing table loops, IBGP does not
2915 advertise IBGP-learned routes to other routers in the same session. As such,
2916 IBGP requires a full mesh of all peers. For large networks, this quickly becomes
2917 unscalable. Introducing route reflectors removes the need for the full-mesh.
2918
2919 When route reflectors are configured, these will reflect the routes announced
2920 by the peers configured as clients. A route reflector client is configured
2921 with:
2922
2923 .. index:: neighbor PEER route-reflector-client
2924 .. clicmd:: neighbor PEER route-reflector-client
2925
2926 .. index:: no neighbor PEER route-reflector-client
2927 .. clicmd:: no neighbor PEER route-reflector-client
2928
2929 To avoid single points of failure, multiple route reflectors can be configured.
2930
2931 A cluster is a collection of route reflectors and their clients, and is used
2932 by route reflectors to avoid looping.
2933
2934 .. index:: bgp cluster-id A.B.C.D
2935 .. clicmd:: bgp cluster-id A.B.C.D
2936
2937 .. _routing-policy:
2938
2939 Routing Policy
2940 ==============
2941
2942 You can set different routing policy for a peer. For example, you can set
2943 different filter for a peer.
2944
2945 .. code-block:: frr
2946
2947 !
2948 router bgp 1 view 1
2949 neighbor 10.0.0.1 remote-as 2
2950 address-family ipv4 unicast
2951 neighbor 10.0.0.1 distribute-list 1 in
2952 exit-address-family
2953 !
2954 router bgp 1 view 2
2955 neighbor 10.0.0.1 remote-as 2
2956 address-family ipv4 unicast
2957 neighbor 10.0.0.1 distribute-list 2 in
2958 exit-address-family
2959
2960 This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2.
2961 When the update is inserted into view 1, distribute-list 1 is applied. On the
2962 other hand, when the update is inserted into view 2, distribute-list 2 is
2963 applied.
2964
2965
2966 .. _bgp-regular-expressions:
2967
2968 BGP Regular Expressions
2969 =======================
2970
2971 BGP regular expressions are based on :t:`POSIX 1003.2` regular expressions. The
2972 following description is just a quick subset of the POSIX regular expressions.
2973
2974
2975 .\*
2976 Matches any single character.
2977
2978 \*
2979 Matches 0 or more occurrences of pattern.
2980
2981 \+
2982 Matches 1 or more occurrences of pattern.
2983
2984 ?
2985 Match 0 or 1 occurrences of pattern.
2986
2987 ^
2988 Matches the beginning of the line.
2989
2990 $
2991 Matches the end of the line.
2992
2993 _
2994 The ``_`` character has special meanings in BGP regular expressions. It
2995 matches to space and comma , and AS set delimiter ``{`` and ``}`` and AS
2996 confederation delimiter ``(`` and ``)``. And it also matches to the
2997 beginning of the line and the end of the line. So ``_`` can be used for AS
2998 value boundaries match. This character technically evaluates to
2999 ``(^|[,{}()]|$)``.
3000
3001
3002 .. _bgp-configuration-examples:
3003
3004 Miscellaneous Configuration Examples
3005 ====================================
3006
3007 Example of a session to an upstream, advertising only one prefix to it.
3008
3009 .. code-block:: frr
3010
3011 router bgp 64512
3012 bgp router-id 10.236.87.1
3013 neighbor upstream peer-group
3014 neighbor upstream remote-as 64515
3015 neighbor upstream capability dynamic
3016 neighbor 10.1.1.1 peer-group upstream
3017 neighbor 10.1.1.1 description ACME ISP
3018
3019 address-family ipv4 unicast
3020 network 10.236.87.0/24
3021 neighbor upstream prefix-list pl-allowed-adv out
3022 exit-address-family
3023 !
3024 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
3025 ip prefix-list pl-allowed-adv seq 10 deny any
3026
3027 A more complex example including upstream, peer and customer sessions
3028 advertising global prefixes and NO_EXPORT prefixes and providing actions for
3029 customer routes based on community values. Extensive use is made of route-maps
3030 and the 'call' feature to support selective advertising of prefixes. This
3031 example is intended as guidance only, it has NOT been tested and almost
3032 certainly contains silly mistakes, if not serious flaws.
3033
3034 .. code-block:: frr
3035
3036 router bgp 64512
3037 bgp router-id 10.236.87.1
3038 neighbor upstream capability dynamic
3039 neighbor cust capability dynamic
3040 neighbor peer capability dynamic
3041 neighbor 10.1.1.1 remote-as 64515
3042 neighbor 10.1.1.1 peer-group upstream
3043 neighbor 10.2.1.1 remote-as 64516
3044 neighbor 10.2.1.1 peer-group upstream
3045 neighbor 10.3.1.1 remote-as 64517
3046 neighbor 10.3.1.1 peer-group cust-default
3047 neighbor 10.3.1.1 description customer1
3048 neighbor 10.4.1.1 remote-as 64518
3049 neighbor 10.4.1.1 peer-group cust
3050 neighbor 10.4.1.1 description customer2
3051 neighbor 10.5.1.1 remote-as 64519
3052 neighbor 10.5.1.1 peer-group peer
3053 neighbor 10.5.1.1 description peer AS 1
3054 neighbor 10.6.1.1 remote-as 64520
3055 neighbor 10.6.1.1 peer-group peer
3056 neighbor 10.6.1.1 description peer AS 2
3057
3058 address-family ipv4 unicast
3059 network 10.123.456.0/24
3060 network 10.123.456.128/25 route-map rm-no-export
3061 neighbor upstream route-map rm-upstream-out out
3062 neighbor cust route-map rm-cust-in in
3063 neighbor cust route-map rm-cust-out out
3064 neighbor cust send-community both
3065 neighbor peer route-map rm-peer-in in
3066 neighbor peer route-map rm-peer-out out
3067 neighbor peer send-community both
3068 neighbor 10.3.1.1 prefix-list pl-cust1-network in
3069 neighbor 10.4.1.1 prefix-list pl-cust2-network in
3070 neighbor 10.5.1.1 prefix-list pl-peer1-network in
3071 neighbor 10.6.1.1 prefix-list pl-peer2-network in
3072 exit-address-family
3073 !
3074 ip prefix-list pl-default permit 0.0.0.0/0
3075 !
3076 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
3077 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
3078 !
3079 ip prefix-list pl-cust1-network permit 10.3.1.0/24
3080 ip prefix-list pl-cust1-network permit 10.3.2.0/24
3081 !
3082 ip prefix-list pl-cust2-network permit 10.4.1.0/24
3083 !
3084 ip prefix-list pl-peer1-network permit 10.5.1.0/24
3085 ip prefix-list pl-peer1-network permit 10.5.2.0/24
3086 ip prefix-list pl-peer1-network permit 192.168.0.0/24
3087 !
3088 ip prefix-list pl-peer2-network permit 10.6.1.0/24
3089 ip prefix-list pl-peer2-network permit 10.6.2.0/24
3090 ip prefix-list pl-peer2-network permit 192.168.1.0/24
3091 ip prefix-list pl-peer2-network permit 192.168.2.0/24
3092 ip prefix-list pl-peer2-network permit 172.16.1/24
3093 !
3094 bgp as-path access-list asp-own-as permit ^$
3095 bgp as-path access-list asp-own-as permit _64512_
3096 !
3097 ! #################################################################
3098 ! Match communities we provide actions for, on routes receives from
3099 ! customers. Communities values of <our-ASN>:X, with X, have actions:
3100 !
3101 ! 100 - blackhole the prefix
3102 ! 200 - set no_export
3103 ! 300 - advertise only to other customers
3104 ! 400 - advertise only to upstreams
3105 ! 500 - set no_export when advertising to upstreams
3106 ! 2X00 - set local_preference to X00
3107 !
3108 ! blackhole the prefix of the route
3109 bgp community-list standard cm-blackhole permit 64512:100
3110 !
3111 ! set no-export community before advertising
3112 bgp community-list standard cm-set-no-export permit 64512:200
3113 !
3114 ! advertise only to other customers
3115 bgp community-list standard cm-cust-only permit 64512:300
3116 !
3117 ! advertise only to upstreams
3118 bgp community-list standard cm-upstream-only permit 64512:400
3119 !
3120 ! advertise to upstreams with no-export
3121 bgp community-list standard cm-upstream-noexport permit 64512:500
3122 !
3123 ! set local-pref to least significant 3 digits of the community
3124 bgp community-list standard cm-prefmod-100 permit 64512:2100
3125 bgp community-list standard cm-prefmod-200 permit 64512:2200
3126 bgp community-list standard cm-prefmod-300 permit 64512:2300
3127 bgp community-list standard cm-prefmod-400 permit 64512:2400
3128 bgp community-list expanded cme-prefmod-range permit 64512:2...
3129 !
3130 ! Informational communities
3131 !
3132 ! 3000 - learned from upstream
3133 ! 3100 - learned from customer
3134 ! 3200 - learned from peer
3135 !
3136 bgp community-list standard cm-learnt-upstream permit 64512:3000
3137 bgp community-list standard cm-learnt-cust permit 64512:3100
3138 bgp community-list standard cm-learnt-peer permit 64512:3200
3139 !
3140 ! ###################################################################
3141 ! Utility route-maps
3142 !
3143 ! These utility route-maps generally should not used to permit/deny
3144 ! routes, i.e. they do not have meaning as filters, and hence probably
3145 ! should be used with 'on-match next'. These all finish with an empty
3146 ! permit entry so as not interfere with processing in the caller.
3147 !
3148 route-map rm-no-export permit 10
3149 set community additive no-export
3150 route-map rm-no-export permit 20
3151 !
3152 route-map rm-blackhole permit 10
3153 description blackhole, up-pref and ensure it cannot escape this AS
3154 set ip next-hop 127.0.0.1
3155 set local-preference 10
3156 set community additive no-export
3157 route-map rm-blackhole permit 20
3158 !
3159 ! Set local-pref as requested
3160 route-map rm-prefmod permit 10
3161 match community cm-prefmod-100
3162 set local-preference 100
3163 route-map rm-prefmod permit 20
3164 match community cm-prefmod-200
3165 set local-preference 200
3166 route-map rm-prefmod permit 30
3167 match community cm-prefmod-300
3168 set local-preference 300
3169 route-map rm-prefmod permit 40
3170 match community cm-prefmod-400
3171 set local-preference 400
3172 route-map rm-prefmod permit 50
3173 !
3174 ! Community actions to take on receipt of route.
3175 route-map rm-community-in permit 10
3176 description check for blackholing, no point continuing if it matches.
3177 match community cm-blackhole
3178 call rm-blackhole
3179 route-map rm-community-in permit 20
3180 match community cm-set-no-export
3181 call rm-no-export
3182 on-match next
3183 route-map rm-community-in permit 30
3184 match community cme-prefmod-range
3185 call rm-prefmod
3186 route-map rm-community-in permit 40
3187 !
3188 ! #####################################################################
3189 ! Community actions to take when advertising a route.
3190 ! These are filtering route-maps,
3191 !
3192 ! Deny customer routes to upstream with cust-only set.
3193 route-map rm-community-filt-to-upstream deny 10
3194 match community cm-learnt-cust
3195 match community cm-cust-only
3196 route-map rm-community-filt-to-upstream permit 20
3197 !
3198 ! Deny customer routes to other customers with upstream-only set.
3199 route-map rm-community-filt-to-cust deny 10
3200 match community cm-learnt-cust
3201 match community cm-upstream-only
3202 route-map rm-community-filt-to-cust permit 20
3203 !
3204 ! ###################################################################
3205 ! The top-level route-maps applied to sessions. Further entries could
3206 ! be added obviously..
3207 !
3208 ! Customers
3209 route-map rm-cust-in permit 10
3210 call rm-community-in
3211 on-match next
3212 route-map rm-cust-in permit 20
3213 set community additive 64512:3100
3214 route-map rm-cust-in permit 30
3215 !
3216 route-map rm-cust-out permit 10
3217 call rm-community-filt-to-cust
3218 on-match next
3219 route-map rm-cust-out permit 20
3220 !
3221 ! Upstream transit ASes
3222 route-map rm-upstream-out permit 10
3223 description filter customer prefixes which are marked cust-only
3224 call rm-community-filt-to-upstream
3225 on-match next
3226 route-map rm-upstream-out permit 20
3227 description only customer routes are provided to upstreams/peers
3228 match community cm-learnt-cust
3229 !
3230 ! Peer ASes
3231 ! outbound policy is same as for upstream
3232 route-map rm-peer-out permit 10
3233 call rm-upstream-out
3234 !
3235 route-map rm-peer-in permit 10
3236 set community additive 64512:3200
3237
3238
3239 Example of how to set up a 6-Bone connection.
3240
3241 .. code-block:: frr
3242
3243 ! bgpd configuration
3244 ! ==================
3245 !
3246 ! MP-BGP configuration
3247 !
3248 router bgp 7675
3249 bgp router-id 10.0.0.1
3250 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number`
3251 !
3252 address-family ipv6
3253 network 3ffe:506::/32
3254 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
3255 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
3256 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number`
3257 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
3258 exit-address-family
3259 !
3260 ipv6 access-list all permit any
3261 !
3262 ! Set output nexthop address.
3263 !
3264 route-map set-nexthop permit 10
3265 match ipv6 address all
3266 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
3267 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
3268 !
3269 log file bgpd.log
3270 !
3271
3272
3273 .. include:: routeserver.rst
3274
3275 .. include:: rpki.rst
3276
3277 .. include:: wecmp_linkbw.rst
3278
3279 .. include:: flowspec.rst
3280
3281 .. [#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)
3282 .. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
3283 .. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
3284 .. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002