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