]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/bgp.rst
Merge pull request #7711 from volta-networks/fix_ldpsync_client_close_callback
[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
801.. _bgp-end-of-rib-message:
802
803End-of-RIB (EOR) message
804^^^^^^^^^^^^^^^^^^^^^^^^
805
806An UPDATE message with no reachable Network Layer Reachability Information
807(NLRI) and empty withdrawn NLRI is specified as the End-of-RIB marker that can
808be used by a BGP speaker to indicate to its peer the completion of the initial
809routing update after the session is established.
810
811For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message
812with the minimum length. For any other address family, it is an UPDATE message
813that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for
814that <AFI, SAFI>.
815
816Although the End-of-RIB marker is specified for the purpose of BGP graceful
817restart, it is noted that the generation of such a marker upon completion of
818the initial update would be useful for routing convergence in general, and thus
819the practice is recommended.
820
821.. _bgp-route-selection-deferral-timer:
822
823Route Selection Deferral Timer
824^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
825
826Specifies the time the restarting router defers the route selection process
827after restart.
828
829Restarting Router : The usage of route election deferral timer is specified
830in https://tools.ietf.org/html/rfc4724#section-4.1
831
832Once the session between the Restarting Speaker and the Receiving Speaker is
833re-established, the Restarting Speaker will receive and process BGP messages
834from its peers.
835
836However, it MUST defer route selection for an address family until it either.
837
8381. Receives the End-of-RIB marker from all its peers (excluding the ones with
839 the "Restart State" bit set in the received capability and excluding the ones
840 that do not advertise the graceful restart capability).
8412. The Selection_Deferral_Timer timeout.
842
843.. index:: bgp graceful-restart select-defer-time (0-3600)
844.. clicmd:: bgp graceful-restart select-defer-time (0-3600)
845
846 This is command, will set deferral time to value specified.
847
848
849.. index:: bgp graceful-restart rib-stale-time (1-3600)
850.. clicmd:: bgp graceful-restart rib-stale-time (1-3600)
851
852 This is command, will set the time for which stale routes are kept in RIB.
853
854.. _bgp-per-peer-graceful-restart:
855
856BGP Per Peer Graceful Restart
857^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
858
859Ability to enable and disable graceful restart, helper and no GR at all mode
860functionality at peer level.
861
862So bgp graceful restart can be enabled at modes global BGP level or at per
863peer level. There are two FSM, one for BGP GR global mode and other for peer
864per GR.
865
866Default global mode is helper and default peer per mode is inherit from global.
867If per peer mode is configured, the GR mode of this particular peer will
868override the global mode.
869
2ba1fe69 870.. _bgp-GR-global-mode-cmd:
efcb2ebb 871
872BGP GR Global Mode Commands
873^^^^^^^^^^^^^^^^^^^^^^^^^^^
874
875.. index:: bgp graceful-restart
876.. clicmd:: bgp graceful-restart
877
878 This command will enable BGP graceful restart ifunctionality at the global
879 level.
880
881.. index:: bgp graceful-restart disable
882.. clicmd:: bgp graceful-restart disable
883
884 This command will disable both the functionality graceful restart and helper
885 mode.
886
887
888.. _bgp-GR-peer-mode-cmd:
889
890BGP GR Peer Mode Commands
891^^^^^^^^^^^^^^^^^^^^^^^^^
892
893.. index:: neighbor A.B.C.D graceful-restart
894.. clicmd:: neighbor A.B.C.D graceful-restart
895
896 This command will enable BGP graceful restart ifunctionality at the peer
897 level.
898
899.. index:: neighbor A.B.C.D graceful-restart-helper
900.. clicmd:: neighbor A.B.C.D graceful-restart-helper
901
902 This command will enable BGP graceful restart helper only functionality
903 at the peer level.
904
905.. index:: neighbor A.B.C.D graceful-restart-disable
906.. clicmd:: neighbor A.B.C.D graceful-restart-disable
907
908 This command will disable the entire BGP graceful restart functionality
909 at the peer level.
910
911
df465afe
DS
912.. _bgp-shutdown:
913
914Administrative Shutdown
915-----------------------
916
3d13052d 917.. index:: bgp shutdown [message MSG...]
df465afe
DS
918.. clicmd:: [no] bgp shutdown [message MSG...]
919
920 Administrative shutdown of all peers of a bgp instance. Drop all BGP peers,
921 but preserve their configurations. The peers are notified in accordance with
922 `RFC 8203 <https://tools.ietf.org/html/rfc8203/>`_ by sending a
923 ``NOTIFICATION`` message with error code ``Cease`` and subcode
924 ``Administrative Shutdown`` prior to terminating connections. This global
925 shutdown is independent of the neighbor shutdown, meaning that individually
926 shut down peers will not be affected by lifting it.
927
928 An optional shutdown message `MSG` can be specified.
929
930
0efdf0fe 931.. _bgp-network:
42fc5d26 932
8fcedbd2
QY
933Networks
934--------
42fc5d26 935
c1a54c05
QY
936.. index:: network A.B.C.D/M
937.. clicmd:: network A.B.C.D/M
42fc5d26 938
9eb95b3b 939 This command adds the announcement network.
c3c5a71f 940
9eb95b3b
QY
941 .. code-block:: frr
942
943 router bgp 1
944 address-family ipv4 unicast
945 network 10.0.0.0/8
946 exit-address-family
42fc5d26 947
c1a54c05
QY
948 This configuration example says that network 10.0.0.0/8 will be
949 announced to all neighbors. Some vendors' routers don't advertise
950 routes if they aren't present in their IGP routing tables; `bgpd`
951 doesn't care about IGP routes when announcing its routes.
c3c5a71f 952
3d13052d 953.. index:: network A.B.C.D/M
c1a54c05 954.. clicmd:: no network A.B.C.D/M
42fc5d26 955
3d13052d 956.. index:: bgp network import-check
f990a416
DS
957.. clicmd:: [no] bgp network import-check
958
959 This configuration modifies the behavior of the network statement.
960 If you have this configured the underlying network must exist in
961 the rib. If you have the [no] form configured then BGP will not
962 check for the networks existence in the rib. For versions 7.3 and
963 before frr defaults for datacenter were the network must exist,
964 traditional did not check for existence. For versions 7.4 and beyond
965 both traditional and datacenter the network must exist.
966
ef1b6319 967.. _bgp-ipv6-support:
547ba033
MH
968
969IPv6 Support
970------------
971
3d13052d 972.. index:: neighbor A.B.C.D activate
547ba033
MH
973.. clicmd:: [no] neighbor A.B.C.D activate
974
ef1b6319 975 This configuration modifies whether to enable an address family for a
547ba033
MH
976 specific neighbor. By default only the IPv4 unicast address family is
977 enabled.
978
979 .. code-block:: frr
980
981 router bgp 1
982 address-family ipv6 unicast
983 neighbor 2001:0DB8::1 activate
984 network 2001:0DB8:5009::/64
985 exit-address-family
986
987 This configuration example says that network 2001:0DB8:5009::/64 will be
988 announced and enables the neighbor 2001:0DB8::1 to receive this announcement.
989
547ba033
MH
990 By default, only the IPv4 unicast address family is announced to all
991 neighbors. Using the 'no bgp default ipv4-unicast' configuration overrides
992 this default so that all address families need to be enabled explicitly.
993
994 .. code-block:: frr
995
996 router bgp 1
997 no bgp default ipv4-unicast
998 neighbor 10.10.10.1 remote-as 2
999 neighbor 2001:0DB8::1 remote-as 3
1000 address-family ipv4 unicast
1001 neighbor 10.10.10.1 activate
1002 network 192.168.1.0/24
1003 exit-address-family
1004 address-family ipv6 unicast
1005 neighbor 2001:0DB8::1 activate
1006 network 2001:0DB8:5009::/64
1007 exit-address-family
1008
1009 This configuration demonstrates how the 'no bgp default ipv4-unicast' might
1010 be used in a setup with two upstreams where each of the upstreams should only
1011 receive either IPv4 or IPv6 annocuments.
1012
1013
8fcedbd2 1014.. _bgp-route-aggregation:
42fc5d26
QY
1015
1016Route Aggregation
1017-----------------
1018
5101fece 1019.. _bgp-route-aggregation-ipv4:
1020
1021Route Aggregation-IPv4 Address Family
1022^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1023
c1a54c05
QY
1024.. index:: aggregate-address A.B.C.D/M
1025.. clicmd:: aggregate-address A.B.C.D/M
c3c5a71f 1026
c1a54c05 1027 This command specifies an aggregate address.
42fc5d26 1028
ac2201bb
DA
1029.. index:: aggregate-address A.B.C.D/M route-map NAME
1030.. clicmd:: aggregate-address A.B.C.D/M route-map NAME
1031
1032 Apply a route-map for an aggregated prefix.
1033
a87d2ef7
DA
1034.. index:: aggregate-address A.B.C.D/M origin <egp|igp|incomplete>
1035.. clicmd:: aggregate-address A.B.C.D/M origin <egp|igp|incomplete>
1036
1037 Override ORIGIN for an aggregated prefix.
1038
c1a54c05
QY
1039.. index:: aggregate-address A.B.C.D/M as-set
1040.. clicmd:: aggregate-address A.B.C.D/M as-set
42fc5d26 1041
c1a54c05
QY
1042 This command specifies an aggregate address. Resulting routes include
1043 AS set.
42fc5d26 1044
c1a54c05
QY
1045.. index:: aggregate-address A.B.C.D/M summary-only
1046.. clicmd:: aggregate-address A.B.C.D/M summary-only
c3c5a71f 1047
d1e7591e 1048 This command specifies an aggregate address. Aggregated routes will
b91bf5bd 1049 not be announced.
42fc5d26 1050
01338ba1
RZ
1051.. index:: aggregate-address A.B.C.D/M matching-MED-only
1052.. clicmd:: aggregate-address A.B.C.D/M matching-MED-only
1053
1054 Configure the aggregated address to only be created when the routes MED
1055 match, otherwise no aggregated route will be created.
1056
8fbb9c95
RZ
1057.. index:: aggregate-address A.B.C.D/M suppress-map NAME
1058.. clicmd:: aggregate-address A.B.C.D/M suppress-map NAME
1059
1060 Similar to `summary-only`, but will only suppress more specific routes that
1061 are matched by the selected route-map.
1062
3d13052d 1063.. index:: aggregate-address A.B.C.D/M
c1a54c05 1064.. clicmd:: no aggregate-address A.B.C.D/M
ac2201bb 1065
5101fece 1066 This command removes an aggregate address.
1067
1068
ac2201bb 1069 This configuration example setup the aggregate-address under
5101fece 1070 ipv4 address-family.
1071
1072 .. code-block:: frr
1073
1074 router bgp 1
1075 address-family ipv4 unicast
1076 aggregate-address 10.0.0.0/8
1077 aggregate-address 20.0.0.0/8 as-set
1078 aggregate-address 40.0.0.0/8 summary-only
ac2201bb 1079 aggregate-address 50.0.0.0/8 route-map aggr-rmap
5101fece 1080 exit-address-family
1081
1082
1083.. _bgp-route-aggregation-ipv6:
1084
1085Route Aggregation-IPv6 Address Family
1086^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1087
1088.. index:: aggregate-address X:X::X:X/M
1089.. clicmd:: aggregate-address X:X::X:X/M
1090
1091 This command specifies an aggregate address.
1092
ac2201bb
DA
1093.. index:: aggregate-address X:X::X:X/M route-map NAME
1094.. clicmd:: aggregate-address X:X::X:X/M route-map NAME
1095
1096 Apply a route-map for an aggregated prefix.
1097
a87d2ef7
DA
1098.. index:: aggregate-address X:X::X:X/M origin <egp|igp|incomplete>
1099.. clicmd:: aggregate-address X:X::X:X/M origin <egp|igp|incomplete>
1100
1101 Override ORIGIN for an aggregated prefix.
1102
5101fece 1103.. index:: aggregate-address X:X::X:X/M as-set
1104.. clicmd:: aggregate-address X:X::X:X/M as-set
1105
1106 This command specifies an aggregate address. Resulting routes include
1107 AS set.
1108
1109.. index:: aggregate-address X:X::X:X/M summary-only
1110.. clicmd:: aggregate-address X:X::X:X/M summary-only
1111
1112 This command specifies an aggregate address. Aggregated routes will
b91bf5bd 1113 not be announced.
5101fece 1114
01338ba1
RZ
1115.. index:: aggregate-address X:X::X:X/M matching-MED-only
1116.. clicmd:: aggregate-address X:X::X:X/M matching-MED-only
1117
1118 Configure the aggregated address to only be created when the routes MED
1119 match, otherwise no aggregated route will be created.
1120
8fbb9c95
RZ
1121.. index:: aggregate-address X:X::X:X/M suppress-map NAME
1122.. clicmd:: aggregate-address X:X::X:X/M suppress-map NAME
1123
1124 Similar to `summary-only`, but will only suppress more specific routes that
1125 are matched by the selected route-map.
01338ba1 1126
3d13052d 1127.. index:: aggregate-address X:X::X:X/M
5101fece 1128.. clicmd:: no aggregate-address X:X::X:X/M
1129
1130 This command removes an aggregate address.
1131
1132
ac2201bb
DA
1133 This configuration example setup the aggregate-address under
1134 ipv6 address-family.
5101fece 1135
1136 .. code-block:: frr
1137
1138 router bgp 1
1139 address-family ipv6 unicast
1140 aggregate-address 10::0/64
ac2201bb
DA
1141 aggregate-address 20::0/64 as-set
1142 aggregate-address 40::0/64 summary-only
1143 aggregate-address 50::0/64 route-map aggr-rmap
5101fece 1144 exit-address-family
c3c5a71f 1145
8fcedbd2 1146.. _bgp-redistribute-to-bgp:
42fc5d26 1147
8fcedbd2
QY
1148Redistribution
1149--------------
42fc5d26 1150
c3c5a71f 1151.. index:: redistribute kernel
29adcd50 1152.. clicmd:: redistribute kernel
42fc5d26 1153
c1a54c05 1154 Redistribute kernel route to BGP process.
42fc5d26 1155
c3c5a71f 1156.. index:: redistribute static
29adcd50 1157.. clicmd:: redistribute static
42fc5d26 1158
c1a54c05 1159 Redistribute static route to BGP process.
42fc5d26 1160
c3c5a71f 1161.. index:: redistribute connected
29adcd50 1162.. clicmd:: redistribute connected
42fc5d26 1163
c1a54c05 1164 Redistribute connected route to BGP process.
42fc5d26 1165
c3c5a71f 1166.. index:: redistribute rip
29adcd50 1167.. clicmd:: redistribute rip
42fc5d26 1168
c1a54c05 1169 Redistribute RIP route to BGP process.
42fc5d26 1170
c3c5a71f 1171.. index:: redistribute ospf
29adcd50 1172.. clicmd:: redistribute ospf
42fc5d26 1173
c1a54c05 1174 Redistribute OSPF route to BGP process.
42fc5d26 1175
99ad55e0
DA
1176.. index:: redistribute vnc
1177.. clicmd:: redistribute vnc
42fc5d26 1178
c1a54c05 1179 Redistribute VNC routes to BGP process.
42fc5d26 1180
245d354f
DA
1181.. index:: redistribute vnc-direct
1182.. clicmd:: redistribute vnc-direct
1183
1184 Redistribute VNC direct (not via zebra) routes to BGP process.
1185
d70583f7
D
1186.. index:: bgp update-delay MAX-DELAY
1187.. clicmd:: bgp update-delay MAX-DELAY
1188
1189.. index:: bgp update-delay MAX-DELAY ESTABLISH-WAIT
1190.. clicmd:: bgp update-delay MAX-DELAY ESTABLISH-WAIT
1191
1192 This feature is used to enable read-only mode on BGP process restart or when
1193 a BGP process is cleared using 'clear ip bgp \*'. Note that this command is
1194 configured at the global level and applies to all bgp instances/vrfs. It
1195 cannot be used at the same time as the "update-delay" command described below,
1196 which is entered in each bgp instance/vrf desired to delay update installation
1197 and advertisements. The global and per-vrf approaches to defining update-delay
1198 are mutually exclusive.
1199
1200 When applicable, read-only mode would begin as soon as the first peer reaches
1201 Established status and a timer for max-delay seconds is started. During this
1202 mode BGP doesn't run any best-path or generate any updates to its peers. This
1203 mode continues until:
1204
1205 1. All the configured peers, except the shutdown peers, have sent explicit EOR
1206 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
1207 Established is considered an implicit-EOR.
1208 If the establish-wait optional value is given, then BGP will wait for
1209 peers to reach established from the beginning of the update-delay till the
1210 establish-wait period is over, i.e. the minimum set of established peers for
1211 which EOR is expected would be peers established during the establish-wait
1212 window, not necessarily all the configured neighbors.
1213 2. max-delay period is over.
1214
1215 On hitting any of the above two conditions, BGP resumes the decision process
1216 and generates updates to its peers.
1217
1218 Default max-delay is 0, i.e. the feature is off by default.
1219
1220
c1a54c05
QY
1221.. index:: update-delay MAX-DELAY
1222.. clicmd:: update-delay MAX-DELAY
c3c5a71f 1223
c1a54c05
QY
1224.. index:: update-delay MAX-DELAY ESTABLISH-WAIT
1225.. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT
c3c5a71f 1226
c1a54c05 1227 This feature is used to enable read-only mode on BGP process restart or when
d70583f7
D
1228 a BGP process is cleared using 'clear ip bgp \*'. Note that this command is
1229 configured under the specific bgp instance/vrf that the feaure is enabled for.
1230 It cannot be used at the same time as the global "bgp update-delay" described
1231 above, which is entered at the global level and applies to all bgp instances.
1232 The global and per-vrf approaches to defining update-delay are mutually
1233 exclusive.
1234
1235 When applicable, read-only mode would begin as soon as the first peer reaches
1236 Established status and a timer for max-delay seconds is started. During this
1237 mode BGP doesn't run any best-path or generate any updates to its peers. This
1238 mode continues until:
42fc5d26 1239
c1a54c05
QY
1240 1. All the configured peers, except the shutdown peers, have sent explicit EOR
1241 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
1242 Established is considered an implicit-EOR.
1243 If the establish-wait optional value is given, then BGP will wait for
d1e7591e 1244 peers to reach established from the beginning of the update-delay till the
c1a54c05
QY
1245 establish-wait period is over, i.e. the minimum set of established peers for
1246 which EOR is expected would be peers established during the establish-wait
1247 window, not necessarily all the configured neighbors.
1248 2. max-delay period is over.
42fc5d26 1249
c1a54c05
QY
1250 On hitting any of the above two conditions, BGP resumes the decision process
1251 and generates updates to its peers.
42fc5d26 1252
c1a54c05 1253 Default max-delay is 0, i.e. the feature is off by default.
c3c5a71f 1254
c1a54c05
QY
1255.. index:: table-map ROUTE-MAP-NAME
1256.. clicmd:: table-map ROUTE-MAP-NAME
42fc5d26 1257
c1a54c05
QY
1258 This feature is used to apply a route-map on route updates from BGP to
1259 Zebra. All the applicable match operations are allowed, such as match on
1260 prefix, next-hop, communities, etc. Set operations for this attach-point are
1261 limited to metric and next-hop only. Any operation of this feature does not
1262 affect BGPs internal RIB.
42fc5d26 1263
c1a54c05
QY
1264 Supported for ipv4 and ipv6 address families. It works on multi-paths as
1265 well, however, metric setting is based on the best-path only.
42fc5d26 1266
8fcedbd2 1267.. _bgp-peers:
42fc5d26 1268
8fcedbd2
QY
1269Peers
1270-----
42fc5d26 1271
8fcedbd2 1272.. _bgp-defining-peers:
42fc5d26 1273
8fcedbd2
QY
1274Defining Peers
1275^^^^^^^^^^^^^^
42fc5d26 1276
c1a54c05
QY
1277.. index:: neighbor PEER remote-as ASN
1278.. clicmd:: neighbor PEER remote-as ASN
42fc5d26 1279
c1a54c05 1280 Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address
9eb95b3b 1281 or an IPv6 address or an interface to use for the connection.
76bd1499 1282
9eb95b3b
QY
1283 .. code-block:: frr
1284
1285 router bgp 1
1286 neighbor 10.0.0.1 remote-as 2
76bd1499 1287
c1a54c05 1288 In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1.
76bd1499 1289
c1a54c05 1290 This command must be the first command used when configuring a neighbor. If
9eb95b3b 1291 the remote-as is not specified, *bgpd* will complain like this: ::
76bd1499 1292
c1a54c05 1293 can't find neighbor 10.0.0.1
c3c5a71f 1294
5413757f
DS
1295.. index:: neighbor PEER remote-as internal
1296.. clicmd:: neighbor PEER remote-as internal
1297
1298 Create a peer as you would when you specify an ASN, except that if the
1299 peers ASN is different than mine as specified under the :clicmd:`router bgp ASN`
1300 command the connection will be denied.
1301
1302.. index:: neighbor PEER remote-as external
1303.. clicmd:: neighbor PEER remote-as external
1304
1305 Create a peer as you would when you specify an ASN, except that if the
1306 peers ASN is the same as mine as specified under the :clicmd:`router bgp ASN`
1307 command the connection will be denied.
42fc5d26 1308
3d13052d 1309.. index:: bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME
d7b9898c 1310.. clicmd:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME
d79e0e08
QY
1311
1312 Accept connections from any peers in the specified prefix. Configuration
1313 from the specified peer-group is used to configure these peers.
1314
1315.. note::
1316
1317 When using BGP listen ranges, if the associated peer group has TCP MD5
1318 authentication configured, your kernel must support this on prefixes. On
1319 Linux, this support was added in kernel version 4.14. If your kernel does
1320 not support this feature you will get a warning in the log file, and the
1321 listen range will only accept connections from peers without MD5 configured.
1322
1323 Additionally, we have observed that when using this option at scale (several
1324 hundred peers) the kernel may hit its option memory limit. In this situation
1325 you will see error messages like:
1326
1327 ``bgpd: sockopt_tcp_signature: setsockopt(23): Cannot allocate memory``
1328
1329 In this case you need to increase the value of the sysctl
1330 ``net.core.optmem_max`` to allow the kernel to allocate the necessary option
1331 memory.
1332
3d13052d 1333.. index:: coalesce-time (0-4294967295)
ced26d3d
DS
1334.. clicmd:: [no] coalesce-time (0-4294967295)
1335
1336 The time in milliseconds that BGP will delay before deciding what peers
1337 can be put into an update-group together in order to generate a single
1338 update for them. The default time is 1000.
91052810 1339
8fcedbd2 1340.. _bgp-configuring-peers:
42fc5d26 1341
8fcedbd2
QY
1342Configuring Peers
1343^^^^^^^^^^^^^^^^^
42fc5d26 1344
3d13052d 1345.. index:: neighbor PEER shutdown [message MSG...] [rtt (1-65535) [count (1-255)]]
91052810 1346.. clicmd:: [no] neighbor PEER shutdown [message MSG...] [rtt (1-65535) [count (1-255)]]
c3c5a71f 1347
c1a54c05
QY
1348 Shutdown the peer. We can delete the neighbor's configuration by
1349 ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor
1350 will be deleted. When you want to preserve the configuration, but want to
1351 drop the BGP peer, use this syntax.
c3c5a71f 1352
70335e0a
RZ
1353 Optionally you can specify a shutdown message `MSG`.
1354
56c07345 1355 Also, you can specify optionally ``rtt`` in milliseconds to automatically
91052810
DA
1356 shutdown the peer if round-trip-time becomes higher than defined.
1357
56c07345 1358 Additional ``count`` parameter is the number of keepalive messages to count
91052810
DA
1359 before shutdown the peer if round-trip-time becomes higher than defined.
1360
3d13052d 1361.. index:: neighbor PEER disable-connected-check
c0868e8b 1362.. clicmd:: [no] neighbor PEER disable-connected-check
c3c5a71f 1363
c0868e8b
QY
1364 Allow peerings between directly connected eBGP peers using loopback
1365 addresses.
c3c5a71f 1366
3d13052d 1367.. index:: neighbor PEER ebgp-multihop
c0868e8b 1368.. clicmd:: [no] neighbor PEER ebgp-multihop
42fc5d26 1369
164786a9
QY
1370 Specifying ``ebgp-multihop`` allows sessions with eBGP neighbors to
1371 establish when they are multiple hops away. When the neighbor is not
1372 directly connected and this knob is not enabled, the session will not
1373 establish.
1374
3d13052d 1375.. index:: neighbor PEER description ...
c0868e8b 1376.. clicmd:: [no] neighbor PEER description ...
42fc5d26 1377
c1a54c05 1378 Set description of the peer.
42fc5d26 1379
3d13052d 1380.. index:: neighbor PEER version VERSION
c0868e8b 1381.. clicmd:: [no] neighbor PEER version VERSION
42fc5d26 1382
4da7fda3
QY
1383 Set up the neighbor's BGP version. `version` can be `4`, `4+` or `4-`. BGP
1384 version `4` is the default value used for BGP peering. BGP version `4+`
1385 means that the neighbor supports Multiprotocol Extensions for BGP-4. BGP
1386 version `4-` is similar but the neighbor speaks the old Internet-Draft
1387 revision 00's Multiprotocol Extensions for BGP-4. Some routing software is
1388 still using this version.
42fc5d26 1389
3d13052d 1390.. index:: neighbor PEER interface IFNAME
c0868e8b 1391.. clicmd:: [no] neighbor PEER interface IFNAME
42fc5d26 1392
c1a54c05
QY
1393 When you connect to a BGP peer over an IPv6 link-local address, you have to
1394 specify the IFNAME of the interface used for the connection. To specify
1395 IPv4 session addresses, see the ``neighbor PEER update-source`` command
1396 below.
42fc5d26 1397
c1a54c05
QY
1398 This command is deprecated and may be removed in a future release. Its use
1399 should be avoided.
42fc5d26 1400
3d13052d 1401.. index:: neighbor PEER next-hop-self [all]
c0868e8b 1402.. clicmd:: [no] neighbor PEER next-hop-self [all]
42fc5d26 1403
c1a54c05
QY
1404 This command specifies an announced route's nexthop as being equivalent to
1405 the address of the bgp router if it is learned via eBGP. If the optional
d1e7591e 1406 keyword `all` is specified the modification is done also for routes learned
c1a54c05 1407 via iBGP.
42fc5d26 1408
8b0d734b 1409.. index:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}]
1410.. clicmd:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}]
1411
1412 This command specifies attributes to be left unchanged for advertisements
1413 sent to a peer. Use this to leave the next-hop unchanged in ipv6
1414 configurations, as the route-map directive to leave the next-hop unchanged
1415 is only available for ipv4.
1416
3d13052d 1417.. index:: neighbor PEER update-source <IFNAME|ADDRESS>
c0868e8b 1418.. clicmd:: [no] neighbor PEER update-source <IFNAME|ADDRESS>
42fc5d26 1419
c1a54c05
QY
1420 Specify the IPv4 source address to use for the :abbr:`BGP` session to this
1421 neighbour, may be specified as either an IPv4 address directly or as an
1422 interface name (in which case the *zebra* daemon MUST be running in order
9eb95b3b
QY
1423 for *bgpd* to be able to retrieve interface state).
1424
1425 .. code-block:: frr
42fc5d26 1426
c1a54c05
QY
1427 router bgp 64555
1428 neighbor foo update-source 192.168.0.1
1429 neighbor bar update-source lo0
42fc5d26 1430
42fc5d26 1431
3d13052d 1432.. index:: neighbor PEER default-originate
c0868e8b 1433.. clicmd:: [no] neighbor PEER default-originate
42fc5d26 1434
4da7fda3
QY
1435 *bgpd*'s default is to not announce the default route (0.0.0.0/0) even if it
1436 is in routing table. When you want to announce default routes to the peer,
1437 use this command.
42fc5d26 1438
c1a54c05
QY
1439.. index:: neighbor PEER port PORT
1440.. clicmd:: neighbor PEER port PORT
42fc5d26 1441
3d13052d 1442.. index:: neighbor PEER password PASSWORD
e7c105a7
DS
1443.. clicmd:: [no] neighbor PEER password PASSWORD
1444
1445 Set a MD5 password to be used with the tcp socket that is being used
1446 to connect to the remote peer. Please note if you are using this
1447 command with a large number of peers on linux you should consider
1448 modifying the `net.core.optmem_max` sysctl to a larger value to
1449 avoid out of memory errors from the linux kernel.
1450
c1a54c05
QY
1451.. index:: neighbor PEER send-community
1452.. clicmd:: neighbor PEER send-community
42fc5d26 1453
3d13052d 1454.. index:: neighbor PEER weight WEIGHT
c0868e8b 1455.. clicmd:: [no] neighbor PEER weight WEIGHT
42fc5d26 1456
c1a54c05 1457 This command specifies a default `weight` value for the neighbor's routes.
42fc5d26 1458
3d13052d 1459.. index:: neighbor PEER maximum-prefix NUMBER [force]
c1bcac1d 1460.. clicmd:: [no] neighbor PEER maximum-prefix NUMBER [force]
42fc5d26 1461
886026c8
QY
1462 Sets a maximum number of prefixes we can receive from a given peer. If this
1463 number is exceeded, the BGP session will be destroyed.
1464
1465 In practice, it is generally preferable to use a prefix-list to limit what
1466 prefixes are received from the peer instead of using this knob. Tearing down
1467 the BGP session when a limit is exceeded is far more destructive than merely
1468 rejecting undesired prefixes. The prefix-list method is also much more
1469 granular and offers much smarter matching criterion than number of received
1470 prefixes, making it more suited to implementing policy.
1471
56c07345 1472 If ``force`` is set, then ALL prefixes are counted for maximum instead of
c1bcac1d
DA
1473 accepted only. This is useful for cases where an inbound filter is applied,
1474 but you want maximum-prefix to act on ALL (including filtered) prefixes. This
1475 option requires `soft-reconfiguration inbound` to be enabled for the peer.
1476
3d13052d 1477.. index:: neighbor PEER maximum-prefix-out NUMBER
edf98aa3
DA
1478.. clicmd:: [no] neighbor PEER maximum-prefix-out NUMBER
1479
1480 Sets a maximum number of prefixes we can send to a given peer.
1481
f5399474
DA
1482 Since sent prefix count is managed by update-groups, this option
1483 creates a separate update-group for outgoing updates.
1484
3d13052d 1485.. index:: neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as]
886026c8 1486.. clicmd:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as]
42fc5d26 1487
c1a54c05
QY
1488 Specify an alternate AS for this BGP process when interacting with the
1489 specified peer. With no modifiers, the specified local-as is prepended to
1490 the received AS_PATH when receiving routing updates from the peer, and
1491 prepended to the outgoing AS_PATH (after the process local AS) when
1492 transmitting local routes to the peer.
42fc5d26 1493
c1a54c05
QY
1494 If the no-prepend attribute is specified, then the supplied local-as is not
1495 prepended to the received AS_PATH.
c3c5a71f 1496
c1a54c05
QY
1497 If the replace-as attribute is specified, then only the supplied local-as is
1498 prepended to the AS_PATH when transmitting local-route updates to this peer.
c3c5a71f 1499
c1a54c05 1500 Note that replace-as can only be specified if no-prepend is.
c3c5a71f 1501
c1a54c05 1502 This command is only allowed for eBGP peers.
c3c5a71f 1503
3d13052d 1504.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> as-override
252c5590
RZ
1505.. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> as-override
1506
1507 Override AS number of the originating router with the local AS number.
1508
1509 Usually this configuration is used in PEs (Provider Edge) to replace
1510 the incoming customer AS number so the connected CE (Customer Edge)
1511 can use the same AS number as the other customer sites. This allows
1512 customers of the provider network to use the same AS number across
1513 their sites.
1514
1515 This command is only allowed for eBGP peers.
1516
3d13052d 1517.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]
ae1e0f32
RZ
1518.. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]
1519
1520 Accept incoming routes with AS path containing AS number with the same value
1521 as the current system AS.
1522
1523 This is used when you want to use the same AS number in your sites, but you
1524 can't connect them directly. This is an alternative to
1525 `neighbor WORD as-override`.
1526
1527 The parameter `(1-10)` configures the amount of accepted occurences of the
1528 system AS number in AS path.
1529
1530 The parameter `origin` configures BGP to only accept routes originated with
1531 the same AS number as the system.
1532
1533 This command is only allowed for eBGP peers.
1534
3d13052d 1535.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths
e03bf6fc
RZ
1536.. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths
1537
1538 Configure BGP to send all known paths to neighbor in order to preserve multi
1539 path capabilities inside a network.
1540
3d13052d 1541.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS
e03bf6fc
RZ
1542.. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS
1543
1544 Configure BGP to send best known paths to neighbor in order to preserve multi
1545 path capabilities inside a network.
1546
3d13052d 1547.. index:: neighbor PEER ttl-security hops NUMBER
c0868e8b 1548.. clicmd:: [no] neighbor PEER ttl-security hops NUMBER
c3c5a71f 1549
c1a54c05
QY
1550 This command enforces Generalized TTL Security Mechanism (GTSM), as
1551 specified in RFC 5082. With this command, only neighbors that are the
1552 specified number of hops away will be allowed to become neighbors. This
d1e7591e 1553 command is mutually exclusive with *ebgp-multihop*.
42fc5d26 1554
3d13052d 1555.. index:: neighbor PEER capability extended-nexthop
19f2b5e8
DS
1556.. clicmd:: [no] neighbor PEER capability extended-nexthop
1557
1558 Allow bgp to negotiate the extended-nexthop capability with it's peer.
1559 If you are peering over a v6 LL address then this capability is turned
1560 on automatically. If you are peering over a v6 Global Address then
1561 turning on this command will allow BGP to install v4 routes with
1562 v6 nexthops if you do not have v4 configured on interfaces.
1563
3d13052d 1564.. index:: bgp fast-external-failover
eb938189
DS
1565.. clicmd:: [no] bgp fast-external-failover
1566
1567 This command causes bgp to not take down ebgp peers immediately
1568 when a link flaps. `bgp fast-external-failover` is the default
1569 and will not be displayed as part of a `show run`. The no form
1570 of the command turns off this ability.
1571
3d13052d 1572.. index:: bgp default ipv4-unicast
bc132029
DS
1573.. clicmd:: [no] bgp default ipv4-unicast
1574
1575 This command allows the user to specify that v4 peering is turned
1576 on by default or not. This command defaults to on and is not displayed.
1577 The `no bgp default ipv4-unicast` form of the command is displayed.
1578
3d13052d 1579.. index:: bgp default show-hostname
7d981695
DA
1580.. clicmd:: [no] bgp default show-hostname
1581
1582 This command shows the hostname of the peer in certain BGP commands
1583 outputs. It's easier to troubleshoot if you have a number of BGP peers.
1584
3d13052d 1585.. index:: bgp default show-nexthop-hostname
7d981695
DA
1586.. clicmd:: [no] bgp default show-nexthop-hostname
1587
1588 This command shows the hostname of the next-hop in certain BGP commands
1589 outputs. It's easier to troubleshoot if you have a number of BGP peers
1590 and a number of routes to check.
1591
3d13052d 1592.. index:: neighbor PEER advertisement-interval (0-600)
e10dda57
DS
1593.. clicmd:: [no] neighbor PEER advertisement-interval (0-600)
1594
1595 Setup the minimum route advertisement interval(mrai) for the
1596 peer in question. This number is between 0 and 600 seconds,
1597 with the default advertisement interval being 0.
1598
94abf9b4
DS
1599.. index:: [no] neighbor PEER timers delayopen (1-240)
1600.. clicmd:: [no] neighbor PEER timers delayopen (1-240)
1601
1602 This command allows the user enable the
1603 `RFC 4271 <https://tools.ietf.org/html/rfc4271/>` DelayOpenTimer with the
1604 specified interval or disable it with the negating command for the peer. By
1605 default, the DelayOpenTimer is disabled. The timer interval may be set to a
1606 duration of 1 to 240 seconds.
1607
4e853678
DS
1608Displaying Information about Peers
1609^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1610
1611.. index:: show bgp <afi> <safi> neighbors WORD bestpath-routes [json] [wide]
1612.. clicmd:: show bgp <afi> <safi> neighbors WORD bestpath-routes [json] [wide]
1613
1614 For the given neighbor, WORD, that is specified list the routes selected
1615 by BGP as having the best path.
1616
8fcedbd2 1617.. _bgp-peer-filtering:
42fc5d26 1618
8fcedbd2
QY
1619Peer Filtering
1620^^^^^^^^^^^^^^
42fc5d26 1621
c1a54c05
QY
1622.. index:: neighbor PEER distribute-list NAME [in|out]
1623.. clicmd:: neighbor PEER distribute-list NAME [in|out]
42fc5d26 1624
c1a54c05
QY
1625 This command specifies a distribute-list for the peer. `direct` is
1626 ``in`` or ``out``.
42fc5d26 1627
c3c5a71f 1628.. index:: neighbor PEER prefix-list NAME [in|out]
29adcd50 1629.. clicmd:: neighbor PEER prefix-list NAME [in|out]
42fc5d26 1630
c1a54c05 1631.. index:: neighbor PEER filter-list NAME [in|out]
29adcd50 1632.. clicmd:: neighbor PEER filter-list NAME [in|out]
42fc5d26 1633
c1a54c05
QY
1634.. index:: neighbor PEER route-map NAME [in|out]
1635.. clicmd:: neighbor PEER route-map NAME [in|out]
42fc5d26 1636
c1a54c05 1637 Apply a route-map on the neighbor. `direct` must be `in` or `out`.
42fc5d26 1638
c3c5a71f 1639.. index:: bgp route-reflector allow-outbound-policy
29adcd50 1640.. clicmd:: bgp route-reflector allow-outbound-policy
42fc5d26 1641
c1a54c05
QY
1642 By default, attribute modification via route-map policy out is not reflected
1643 on reflected routes. This option allows the modifications to be reflected as
1644 well. Once enabled, it affects all reflected routes.
42fc5d26 1645
3d13052d 1646.. index:: neighbor PEER sender-as-path-loop-detection
583a9fd4
RZ
1647.. clicmd:: [no] neighbor PEER sender-as-path-loop-detection
1648
1649 Enable the detection of sender side AS path loops and filter the
1650 bad routes before they are sent.
1651
1652 This setting is disabled by default.
1653
0efdf0fe 1654.. _bgp-peer-group:
42fc5d26 1655
8fcedbd2
QY
1656Peer Groups
1657^^^^^^^^^^^
42fc5d26 1658
199ad5c4
LB
1659Peer groups are used to help improve scaling by generating the same
1660update information to all members of a peer group. Note that this means
1661that the routes generated by a member of a peer group will be sent back
1662to that originating peer with the originator identifier attribute set to
1663indicated the originating peer. All peers not associated with a
1664specific peer group are treated as belonging to a default peer group,
1665and will share updates.
1666
c1a54c05
QY
1667.. index:: neighbor WORD peer-group
1668.. clicmd:: neighbor WORD peer-group
42fc5d26 1669
c1a54c05 1670 This command defines a new peer group.
42fc5d26 1671
d7b9898c
DA
1672.. index:: neighbor PEER peer-group PGNAME
1673.. clicmd:: neighbor PEER peer-group PGNAME
c3c5a71f 1674
c1a54c05 1675 This command bind specific peer to peer group WORD.
42fc5d26 1676
199ad5c4
LB
1677.. index:: neighbor PEER solo
1678.. clicmd:: neighbor PEER solo
1679
1680 This command is used to indicate that routes advertised by the peer
1681 should not be reflected back to the peer. This command only is only
1682 meaningful when there is a single peer defined in the peer-group.
1683
8fcedbd2
QY
1684Capability Negotiation
1685^^^^^^^^^^^^^^^^^^^^^^
42fc5d26 1686
8fcedbd2
QY
1687.. index:: neighbor PEER strict-capability-match
1688.. clicmd:: neighbor PEER strict-capability-match
42fc5d26 1689
3d13052d 1690.. index:: neighbor PEER strict-capability-match
8fcedbd2 1691.. clicmd:: no neighbor PEER strict-capability-match
c1a54c05 1692
8fcedbd2
QY
1693 Strictly compares remote capabilities and local capabilities. If
1694 capabilities are different, send Unsupported Capability error then reset
1695 connection.
42fc5d26 1696
8fcedbd2
QY
1697 You may want to disable sending Capability Negotiation OPEN message optional
1698 parameter to the peer when remote peer does not implement Capability
1699 Negotiation. Please use *dont-capability-negotiate* command to disable the
1700 feature.
42fc5d26 1701
3d13052d 1702.. index:: neighbor PEER dont-capability-negotiate
7cdc9530 1703.. clicmd:: [no] neighbor PEER dont-capability-negotiate
42fc5d26 1704
8fcedbd2
QY
1705 Suppress sending Capability Negotiation as OPEN message optional parameter
1706 to the peer. This command only affects the peer is configured other than
1707 IPv4 unicast configuration.
42fc5d26 1708
8fcedbd2
QY
1709 When remote peer does not have capability negotiation feature, remote peer
1710 will not send any capabilities at all. In that case, bgp configures the peer
1711 with configured capabilities.
42fc5d26 1712
8fcedbd2
QY
1713 You may prefer locally configured capabilities more than the negotiated
1714 capabilities even though remote peer sends capabilities. If the peer is
1715 configured by *override-capability*, *bgpd* ignores received capabilities
1716 then override negotiated capabilities with configured values.
42fc5d26 1717
7cdc9530
DS
1718 Additionally the operator should be reminded that this feature fundamentally
1719 disables the ability to use widely deployed BGP features. BGP unnumbered,
1720 hostname support, AS4, Addpath, Route Refresh, ORF, Dynamic Capabilities,
1721 and graceful restart.
1722
8fcedbd2
QY
1723.. index:: neighbor PEER override-capability
1724.. clicmd:: neighbor PEER override-capability
42fc5d26 1725
3d13052d 1726.. index:: neighbor PEER override-capability
8fcedbd2 1727.. clicmd:: no neighbor PEER override-capability
c1a54c05 1728
8fcedbd2
QY
1729 Override the result of Capability Negotiation with local configuration.
1730 Ignore remote peer's capability value.
42fc5d26 1731
8fcedbd2 1732.. _bgp-as-path-access-lists:
42fc5d26 1733
8fcedbd2
QY
1734AS Path Access Lists
1735--------------------
42fc5d26
QY
1736
1737AS path access list is user defined AS path.
1738
a64e0ee5
DA
1739.. index:: bgp as-path access-list WORD permit|deny LINE
1740.. clicmd:: bgp as-path access-list WORD permit|deny LINE
42fc5d26 1741
c1a54c05 1742 This command defines a new AS path access list.
42fc5d26 1743
3d13052d 1744.. index:: bgp as-path access-list WORD
a64e0ee5 1745.. clicmd:: no bgp as-path access-list WORD
42fc5d26 1746
3d13052d 1747.. index:: bgp as-path access-list WORD permit|deny LINE
a64e0ee5 1748.. clicmd:: no bgp as-path access-list WORD permit|deny LINE
42fc5d26 1749
125cec1a
DA
1750.. _bgp-bogon-filter-example:
1751
1752Bogon ASN filter policy configuration example
1753^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1754
1755.. code-block:: frr
1756
1757 bgp as-path access-list 99 permit _0_
1758 bgp as-path access-list 99 permit _23456_
1759 bgp as-path access-list 99 permit _1310[0-6][0-9]_|_13107[0-1]_
1760
8fcedbd2 1761.. _bgp-using-as-path-in-route-map:
42fc5d26
QY
1762
1763Using AS Path in Route Map
1764--------------------------
1765
3d13052d 1766.. index:: match as-path WORD
eb1f303d 1767.. clicmd:: [no] match as-path WORD
42fc5d26 1768
eb1f303d
DS
1769 For a given as-path, WORD, match it on the BGP as-path given for the prefix
1770 and if it matches do normal route-map actions. The no form of the command
1771 removes this match from the route-map.
42fc5d26 1772
3d13052d 1773.. index:: set as-path prepend AS-PATH
eb1f303d 1774.. clicmd:: [no] set as-path prepend AS-PATH
42fc5d26 1775
eb1f303d
DS
1776 Prepend the given string of AS numbers to the AS_PATH of the BGP path's NLRI.
1777 The no form of this command removes this set operation from the route-map.
42fc5d26 1778
3d13052d 1779.. index:: set as-path prepend last-as NUM
eb1f303d 1780.. clicmd:: [no] set as-path prepend last-as NUM
c1a54c05
QY
1781
1782 Prepend the existing last AS number (the leftmost ASN) to the AS_PATH.
eb1f303d 1783 The no form of this command removes this set operation from the route-map.
42fc5d26 1784
0efdf0fe 1785.. _bgp-communities-attribute:
42fc5d26 1786
8fcedbd2
QY
1787Communities Attribute
1788---------------------
42fc5d26 1789
8fcedbd2 1790The BGP communities attribute is widely used for implementing policy routing.
c1a54c05
QY
1791Network operators can manipulate BGP communities attribute based on their
1792network policy. BGP communities attribute is defined in :rfc:`1997` and
1793:rfc:`1998`. It is an optional transitive attribute, therefore local policy can
1794travel through different autonomous system.
1795
8fcedbd2
QY
1796The communities attribute is a set of communities values. Each community value
1797is 4 octet long. The following format is used to define the community value.
c1a54c05 1798
8fcedbd2 1799``AS:VAL``
c1a54c05
QY
1800 This format represents 4 octet communities value. ``AS`` is high order 2
1801 octet in digit format. ``VAL`` is low order 2 octet in digit format. This
1802 format is useful to define AS oriented policy value. For example,
1803 ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
1804 neighboring peer.
1805
8fcedbd2
QY
1806``internet``
1807 ``internet`` represents well-known communities value 0.
c1a54c05 1808
cae770d3
C
1809``graceful-shutdown``
1810 ``graceful-shutdown`` represents well-known communities value
1811 ``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements
1812 the purpose Graceful BGP Session Shutdown to reduce the amount of
56f0bea7 1813 lost traffic when taking BGP sessions down for maintenance. The use
cae770d3
C
1814 of the community needs to be supported from your peers side to
1815 actually have any effect.
1816
1817``accept-own``
1818 ``accept-own`` represents well-known communities value ``ACCEPT_OWN``
1819 ``0xFFFF0001`` ``65535:1``. :rfc:`7611` implements a way to signal
1820 to a router to accept routes with a local nexthop address. This
1821 can be the case when doing policing and having traffic having a
1822 nexthop located in another VRF but still local interface to the
1823 router. It is recommended to read the RFC for full details.
1824
1825``route-filter-translated-v4``
1826 ``route-filter-translated-v4`` represents well-known communities value
1827 ``ROUTE_FILTER_TRANSLATED_v4`` ``0xFFFF0002`` ``65535:2``.
1828
1829``route-filter-v4``
1830 ``route-filter-v4`` represents well-known communities value
1831 ``ROUTE_FILTER_v4`` ``0xFFFF0003`` ``65535:3``.
1832
1833``route-filter-translated-v6``
1834 ``route-filter-translated-v6`` represents well-known communities value
1835 ``ROUTE_FILTER_TRANSLATED_v6`` ``0xFFFF0004`` ``65535:4``.
1836
1837``route-filter-v6``
1838 ``route-filter-v6`` represents well-known communities value
1839 ``ROUTE_FILTER_v6`` ``0xFFFF0005`` ``65535:5``.
1840
1841``llgr-stale``
1842 ``llgr-stale`` represents well-known communities value ``LLGR_STALE``
1843 ``0xFFFF0006`` ``65535:6``.
56f0bea7 1844 Assigned and intended only for use with routers supporting the
cae770d3 1845 Long-lived Graceful Restart Capability as described in
49606d58 1846 [Draft-IETF-uttaro-idr-bgp-persistence]_.
56f0bea7 1847 Routers receiving routes with this community may (depending on
cae770d3
C
1848 implementation) choose allow to reject or modify routes on the
1849 presence or absence of this community.
1850
1851``no-llgr``
1852 ``no-llgr`` represents well-known communities value ``NO_LLGR``
1853 ``0xFFFF0007`` ``65535:7``.
56f0bea7 1854 Assigned and intended only for use with routers supporting the
cae770d3 1855 Long-lived Graceful Restart Capability as described in
49606d58 1856 [Draft-IETF-uttaro-idr-bgp-persistence]_.
56f0bea7 1857 Routers receiving routes with this community may (depending on
cae770d3
C
1858 implementation) choose allow to reject or modify routes on the
1859 presence or absence of this community.
1860
1861``accept-own-nexthop``
1862 ``accept-own-nexthop`` represents well-known communities value
1863 ``accept-own-nexthop`` ``0xFFFF0008`` ``65535:8``.
49606d58 1864 [Draft-IETF-agrewal-idr-accept-own-nexthop]_ describes
cae770d3
C
1865 how to tag and label VPN routes to be able to send traffic between VRFs
1866 via an internal layer 2 domain on the same PE device. Refer to
49606d58 1867 [Draft-IETF-agrewal-idr-accept-own-nexthop]_ for full details.
cae770d3
C
1868
1869``blackhole``
1870 ``blackhole`` represents well-known communities value ``BLACKHOLE``
1871 ``0xFFFF029A`` ``65535:666``. :rfc:`7999` documents sending prefixes to
1872 EBGP peers and upstream for the purpose of blackholing traffic.
1873 Prefixes tagged with the this community should normally not be
1874 re-advertised from neighbors of the originating network. It is
1875 recommended upon receiving prefixes tagged with this community to
1876 add ``NO_EXPORT`` and ``NO_ADVERTISE``.
1877
8fcedbd2 1878``no-export``
c1a54c05
QY
1879 ``no-export`` represents well-known communities value ``NO_EXPORT``
1880 ``0xFFFFFF01``. All routes carry this value must not be advertised to
1881 outside a BGP confederation boundary. If neighboring BGP peer is part of BGP
1882 confederation, the peer is considered as inside a BGP confederation
1883 boundary, so the route will be announced to the peer.
1884
8fcedbd2 1885``no-advertise``
c1a54c05
QY
1886 ``no-advertise`` represents well-known communities value ``NO_ADVERTISE``
1887 ``0xFFFFFF02``. All routes carry this value must not be advertise to other
1888 BGP peers.
1889
8fcedbd2 1890``local-AS``
c1a54c05
QY
1891 ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED``
1892 ``0xFFFFFF03``. All routes carry this value must not be advertised to
1893 external BGP peers. Even if the neighboring router is part of confederation,
1894 it is considered as external BGP peer, so the route will not be announced to
1895 the peer.
1896
cae770d3
C
1897``no-peer``
1898 ``no-peer`` represents well-known communities value ``NOPEER``
1899 ``0xFFFFFF04`` ``65535:65284``. :rfc:`3765` is used to communicate to
1900 another network how the originating network want the prefix propagated.
1901
aa9eafa4
QY
1902When the communities attribute is received duplicate community values in the
1903attribute are ignored and value is sorted in numerical order.
42fc5d26 1904
49606d58
PG
1905.. [Draft-IETF-uttaro-idr-bgp-persistence] <https://tools.ietf.org/id/draft-uttaro-idr-bgp-persistence-04.txt>
1906.. [Draft-IETF-agrewal-idr-accept-own-nexthop] <https://tools.ietf.org/id/draft-agrewal-idr-accept-own-nexthop-00.txt>
1907
0efdf0fe 1908.. _bgp-community-lists:
42fc5d26 1909
8fcedbd2
QY
1910Community Lists
1911^^^^^^^^^^^^^^^
aa9eafa4
QY
1912Community lists are user defined lists of community attribute values. These
1913lists can be used for matching or manipulating the communities attribute in
1914UPDATE messages.
42fc5d26 1915
aa9eafa4 1916There are two types of community list:
c1a54c05 1917
aa9eafa4 1918standard
56f0bea7 1919 This type accepts an explicit value for the attribute.
aa9eafa4
QY
1920
1921expanded
1922 This type accepts a regular expression. Because the regex must be
1923 interpreted on each use expanded community lists are slower than standard
1924 lists.
42fc5d26 1925
a64e0ee5
DA
1926.. index:: bgp community-list standard NAME permit|deny COMMUNITY
1927.. clicmd:: bgp community-list standard NAME permit|deny COMMUNITY
42fc5d26 1928
aa9eafa4
QY
1929 This command defines a new standard community list. ``COMMUNITY`` is
1930 communities value. The ``COMMUNITY`` is compiled into community structure.
1931 We can define multiple community list under same name. In that case match
1932 will happen user defined order. Once the community list matches to
1933 communities attribute in BGP updates it return permit or deny by the
1934 community list definition. When there is no matched entry, deny will be
1935 returned. When ``COMMUNITY`` is empty it matches to any routes.
42fc5d26 1936
a64e0ee5
DA
1937.. index:: bgp community-list expanded NAME permit|deny COMMUNITY
1938.. clicmd:: bgp community-list expanded NAME permit|deny COMMUNITY
42fc5d26 1939
aa9eafa4
QY
1940 This command defines a new expanded community list. ``COMMUNITY`` is a
1941 string expression of communities attribute. ``COMMUNITY`` can be a regular
1942 expression (:ref:`bgp-regular-expressions`) to match the communities
47f47873
PG
1943 attribute in BGP updates. The expanded community is only used to filter,
1944 not `set` actions.
42fc5d26 1945
aa9eafa4
QY
1946.. deprecated:: 5.0
1947 It is recommended to use the more explicit versions of this command.
42fc5d26 1948
a64e0ee5
DA
1949.. index:: bgp community-list NAME permit|deny COMMUNITY
1950.. clicmd:: bgp community-list NAME permit|deny COMMUNITY
aa9eafa4
QY
1951
1952 When the community list type is not specified, the community list type is
1953 automatically detected. If ``COMMUNITY`` can be compiled into communities
1954 attribute, the community list is defined as a standard community list.
1955 Otherwise it is defined as an expanded community list. This feature is left
1956 for backward compatibility. Use of this feature is not recommended.
42fc5d26 1957
42fc5d26 1958
3d13052d 1959.. index:: bgp community-list [standard|expanded] NAME
a64e0ee5 1960.. clicmd:: no bgp community-list [standard|expanded] NAME
42fc5d26 1961
aa9eafa4
QY
1962 Deletes the community list specified by ``NAME``. All community lists share
1963 the same namespace, so it's not necessary to specify ``standard`` or
1964 ``expanded``; these modifiers are purely aesthetic.
42fc5d26 1965
36dc43aa
DA
1966.. index:: show bgp community-list [NAME detail]
1967.. clicmd:: show bgp community-list [NAME detail]
42fc5d26 1968
aa9eafa4
QY
1969 Displays community list information. When ``NAME`` is specified the
1970 specified community list's information is shown.
c3c5a71f 1971
c1a54c05 1972 ::
76bd1499 1973
a64e0ee5 1974 # show bgp community-list
c1a54c05
QY
1975 Named Community standard list CLIST
1976 permit 7675:80 7675:100 no-export
1977 deny internet
1978 Named Community expanded list EXPAND
1979 permit :
76bd1499 1980
36dc43aa 1981 # show bgp community-list CLIST detail
c1a54c05
QY
1982 Named Community standard list CLIST
1983 permit 7675:80 7675:100 no-export
1984 deny internet
42fc5d26 1985
42fc5d26 1986
8fcedbd2 1987.. _bgp-numbered-community-lists:
42fc5d26 1988
8fcedbd2
QY
1989Numbered Community Lists
1990^^^^^^^^^^^^^^^^^^^^^^^^
42fc5d26
QY
1991
1992When number is used for BGP community list name, the number has
c3c5a71f
QY
1993special meanings. Community list number in the range from 1 and 99 is
1994standard community list. Community list number in the range from 100
1995to 199 is expanded community list. These community lists are called
1996as numbered community lists. On the other hand normal community lists
42fc5d26
QY
1997is called as named community lists.
1998
a64e0ee5
DA
1999.. index:: bgp community-list (1-99) permit|deny COMMUNITY
2000.. clicmd:: bgp community-list (1-99) permit|deny COMMUNITY
42fc5d26 2001
aa9eafa4
QY
2002 This command defines a new community list. The argument to (1-99) defines
2003 the list identifier.
42fc5d26 2004
a64e0ee5
DA
2005.. index:: bgp community-list (100-199) permit|deny COMMUNITY
2006.. clicmd:: bgp community-list (100-199) permit|deny COMMUNITY
42fc5d26 2007
aa9eafa4
QY
2008 This command defines a new expanded community list. The argument to
2009 (100-199) defines the list identifier.
42fc5d26 2010
8fcedbd2 2011.. _bgp-using-communities-in-route-map:
42fc5d26 2012
8fcedbd2
QY
2013Using Communities in Route Maps
2014^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42fc5d26 2015
aa9eafa4
QY
2016In :ref:`route-map` we can match on or set the BGP communities attribute. Using
2017this feature network operator can implement their network policy based on BGP
2018communities attribute.
42fc5d26 2019
b91bf5bd 2020The following commands can be used in route maps:
42fc5d26 2021
aa9eafa4
QY
2022.. index:: match community WORD exact-match [exact-match]
2023.. clicmd:: match community WORD exact-match [exact-match]
42fc5d26 2024
c1a54c05
QY
2025 This command perform match to BGP updates using community list WORD. When
2026 the one of BGP communities value match to the one of communities value in
d1e7591e 2027 community list, it is match. When `exact-match` keyword is specified, match
c1a54c05
QY
2028 happen only when BGP updates have completely same communities value
2029 specified in the community list.
42fc5d26 2030
aa9eafa4
QY
2031.. index:: set community <none|COMMUNITY> additive
2032.. clicmd:: set community <none|COMMUNITY> additive
42fc5d26 2033
aa9eafa4
QY
2034 This command sets the community value in BGP updates. If the attribute is
2035 already configured, the newly provided value replaces the old one unless the
2036 ``additive`` keyword is specified, in which case the new value is appended
2037 to the existing value.
42fc5d26 2038
aa9eafa4
QY
2039 If ``none`` is specified as the community value, the communities attribute
2040 is not sent.
42fc5d26 2041
47f47873
PG
2042 It is not possible to set an expanded community list.
2043
c1a54c05 2044.. index:: set comm-list WORD delete
29adcd50 2045.. clicmd:: set comm-list WORD delete
c1a54c05 2046
aa9eafa4
QY
2047 This command remove communities value from BGP communities attribute. The
2048 ``word`` is community list name. When BGP route's communities value matches
2049 to the community list ``word``, the communities value is removed. When all
2050 of communities value is removed eventually, the BGP update's communities
2051 attribute is completely removed.
42fc5d26 2052
8fcedbd2 2053.. _bgp-communities-example:
c1a54c05 2054
8fcedbd2
QY
2055Example Configuration
2056^^^^^^^^^^^^^^^^^^^^^
9eb95b3b 2057
8fcedbd2
QY
2058The following configuration is exemplary of the most typical usage of BGP
2059communities attribute. In the example, AS 7675 provides an upstream Internet
2060connection to AS 100. When the following configuration exists in AS 7675, the
2061network operator of AS 100 can set local preference in AS 7675 network by
2062setting BGP communities attribute to the updates.
9eb95b3b
QY
2063
2064.. code-block:: frr
c1a54c05
QY
2065
2066 router bgp 7675
2067 neighbor 192.168.0.1 remote-as 100
2068 address-family ipv4 unicast
2069 neighbor 192.168.0.1 route-map RMAP in
2070 exit-address-family
2071 !
a64e0ee5
DA
2072 bgp community-list 70 permit 7675:70
2073 bgp community-list 70 deny
2074 bgp community-list 80 permit 7675:80
2075 bgp community-list 80 deny
2076 bgp community-list 90 permit 7675:90
2077 bgp community-list 90 deny
c1a54c05
QY
2078 !
2079 route-map RMAP permit 10
2080 match community 70
2081 set local-preference 70
2082 !
2083 route-map RMAP permit 20
2084 match community 80
2085 set local-preference 80
2086 !
2087 route-map RMAP permit 30
2088 match community 90
2089 set local-preference 90
c3c5a71f 2090
42fc5d26 2091
8fcedbd2
QY
2092The following configuration announces ``10.0.0.0/8`` from AS 100 to AS 7675.
2093The route has communities value ``7675:80`` so when above configuration exists
2094in AS 7675, the announced routes' local preference value will be set to 80.
9eb95b3b
QY
2095
2096.. code-block:: frr
c1a54c05
QY
2097
2098 router bgp 100
2099 network 10.0.0.0/8
2100 neighbor 192.168.0.2 remote-as 7675
2101 address-family ipv4 unicast
2102 neighbor 192.168.0.2 route-map RMAP out
2103 exit-address-family
2104 !
2105 ip prefix-list PLIST permit 10.0.0.0/8
2106 !
2107 route-map RMAP permit 10
2108 match ip address prefix-list PLIST
2109 set community 7675:80
c3c5a71f 2110
42fc5d26 2111
8fcedbd2
QY
2112The following configuration is an example of BGP route filtering using
2113communities attribute. This configuration only permit BGP routes which has BGP
2114communities value ``0:80`` or ``0:90``. The network operator can set special
2115internal communities value at BGP border router, then limit the BGP route
2116announcements into the internal network.
9eb95b3b
QY
2117
2118.. code-block:: frr
42fc5d26 2119
c1a54c05
QY
2120 router bgp 7675
2121 neighbor 192.168.0.1 remote-as 100
2122 address-family ipv4 unicast
2123 neighbor 192.168.0.1 route-map RMAP in
2124 exit-address-family
2125 !
a64e0ee5 2126 bgp community-list 1 permit 0:80 0:90
c1a54c05
QY
2127 !
2128 route-map RMAP permit in
2129 match community 1
c3c5a71f 2130
42fc5d26 2131
8fcedbd2
QY
2132The following example filters BGP routes which have a community value of
2133``1:1``. When there is no match community-list returns ``deny``. To avoid
2134filtering all routes, a ``permit`` line is set at the end of the
2135community-list.
9eb95b3b
QY
2136
2137.. code-block:: frr
42fc5d26 2138
c1a54c05
QY
2139 router bgp 7675
2140 neighbor 192.168.0.1 remote-as 100
2141 address-family ipv4 unicast
2142 neighbor 192.168.0.1 route-map RMAP in
2143 exit-address-family
2144 !
a64e0ee5
DA
2145 bgp community-list standard FILTER deny 1:1
2146 bgp community-list standard FILTER permit
c1a54c05
QY
2147 !
2148 route-map RMAP permit 10
2149 match community FILTER
c3c5a71f 2150
42fc5d26 2151
8fcedbd2
QY
2152The communities value keyword ``internet`` has special meanings in standard
2153community lists. In the below example ``internet`` matches all BGP routes even
2154if the route does not have communities attribute at all. So community list
2155``INTERNET`` is the same as ``FILTER`` in the previous example.
9eb95b3b
QY
2156
2157.. code-block:: frr
42fc5d26 2158
a64e0ee5
DA
2159 bgp community-list standard INTERNET deny 1:1
2160 bgp community-list standard INTERNET permit internet
c3c5a71f 2161
42fc5d26 2162
8fcedbd2
QY
2163The following configuration is an example of communities value deletion. With
2164this configuration the community values ``100:1`` and ``100:2`` are removed
2165from BGP updates. For communities value deletion, only ``permit``
2166community-list is used. ``deny`` community-list is ignored.
9eb95b3b
QY
2167
2168.. code-block:: frr
42fc5d26 2169
c1a54c05
QY
2170 router bgp 7675
2171 neighbor 192.168.0.1 remote-as 100
2172 address-family ipv4 unicast
2173 neighbor 192.168.0.1 route-map RMAP in
2174 exit-address-family
2175 !
a64e0ee5 2176 bgp community-list standard DEL permit 100:1 100:2
c1a54c05
QY
2177 !
2178 route-map RMAP permit 10
2179 set comm-list DEL delete
c3c5a71f 2180
42fc5d26 2181
0efdf0fe 2182.. _bgp-extended-communities-attribute:
42fc5d26 2183
8fcedbd2
QY
2184Extended Communities Attribute
2185^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42fc5d26 2186
c1a54c05
QY
2187BGP extended communities attribute is introduced with MPLS VPN/BGP technology.
2188MPLS VPN/BGP expands capability of network infrastructure to provide VPN
2189functionality. At the same time it requires a new framework for policy routing.
2190With BGP Extended Communities Attribute we can use Route Target or Site of
2191Origin for implementing network policy for MPLS VPN/BGP.
42fc5d26 2192
c1a54c05
QY
2193BGP Extended Communities Attribute is similar to BGP Communities Attribute. It
2194is an optional transitive attribute. BGP Extended Communities Attribute can
2195carry multiple Extended Community value. Each Extended Community value is
2196eight octet length.
42fc5d26 2197
c1a54c05
QY
2198BGP Extended Communities Attribute provides an extended range compared with BGP
2199Communities Attribute. Adding to that there is a type field in each value to
2200provides community space structure.
42fc5d26 2201
c1a54c05
QY
2202There are two format to define Extended Community value. One is AS based format
2203the other is IP address based format.
42fc5d26 2204
8fcedbd2
QY
2205``AS:VAL``
2206 This is a format to define AS based Extended Community value. ``AS`` part
2207 is 2 octets Global Administrator subfield in Extended Community value.
2208 ``VAL`` part is 4 octets Local Administrator subfield. ``7675:100``
2209 represents AS 7675 policy value 100.
42fc5d26 2210
8fcedbd2 2211``IP-Address:VAL``
c1a54c05 2212 This is a format to define IP address based Extended Community value.
8fcedbd2
QY
2213 ``IP-Address`` part is 4 octets Global Administrator subfield. ``VAL`` part
2214 is 2 octets Local Administrator subfield.
42fc5d26 2215
0efdf0fe 2216.. _bgp-extended-community-lists:
42fc5d26 2217
8fcedbd2
QY
2218Extended Community Lists
2219^^^^^^^^^^^^^^^^^^^^^^^^
42fc5d26 2220
a64e0ee5
DA
2221.. index:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY
2222.. clicmd:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY
42fc5d26 2223
4da7fda3
QY
2224 This command defines a new standard extcommunity-list. `extcommunity` is
2225 extended communities value. The `extcommunity` is compiled into extended
2226 community structure. We can define multiple extcommunity-list under same
2227 name. In that case match will happen user defined order. Once the
2228 extcommunity-list matches to extended communities attribute in BGP updates
2229 it return permit or deny based upon the extcommunity-list definition. When
2230 there is no matched entry, deny will be returned. When `extcommunity` is
2231 empty it matches to any routes.
42fc5d26 2232
a64e0ee5
DA
2233.. index:: bgp extcommunity-list expanded NAME permit|deny LINE
2234.. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE
42fc5d26 2235
4da7fda3
QY
2236 This command defines a new expanded extcommunity-list. `line` is a string
2237 expression of extended communities attribute. `line` can be a regular
2238 expression (:ref:`bgp-regular-expressions`) to match an extended communities
2239 attribute in BGP updates.
42fc5d26 2240
3d13052d 2241.. index:: bgp extcommunity-list NAME
a64e0ee5 2242.. clicmd:: no bgp extcommunity-list NAME
42fc5d26 2243
3d13052d 2244.. index:: bgp extcommunity-list standard NAME
a64e0ee5 2245.. clicmd:: no bgp extcommunity-list standard NAME
42fc5d26 2246
3d13052d 2247.. index:: bgp extcommunity-list expanded NAME
a64e0ee5 2248.. clicmd:: no bgp extcommunity-list expanded NAME
42fc5d26 2249
4da7fda3
QY
2250 These commands delete extended community lists specified by `name`. All of
2251 extended community lists shares a single name space. So extended community
d1e7591e 2252 lists can be removed simply specifying the name.
42fc5d26 2253
a64e0ee5
DA
2254.. index:: show bgp extcommunity-list
2255.. clicmd:: show bgp extcommunity-list
42fc5d26 2256
36dc43aa
DA
2257.. index:: show bgp extcommunity-list NAME detail
2258.. clicmd:: show bgp extcommunity-list NAME detail
c1a54c05 2259
4da7fda3 2260 This command displays current extcommunity-list information. When `name` is
9eb95b3b 2261 specified the community list's information is shown.::
42fc5d26 2262
a64e0ee5 2263 # show bgp extcommunity-list
c3c5a71f 2264
42fc5d26 2265
0efdf0fe 2266.. _bgp-extended-communities-in-route-map:
42fc5d26
QY
2267
2268BGP Extended Communities in Route Map
8fcedbd2 2269"""""""""""""""""""""""""""""""""""""
42fc5d26 2270
c3c5a71f 2271.. index:: match extcommunity WORD
29adcd50 2272.. clicmd:: match extcommunity WORD
42fc5d26 2273
c1a54c05 2274.. index:: set extcommunity rt EXTCOMMUNITY
29adcd50 2275.. clicmd:: set extcommunity rt EXTCOMMUNITY
42fc5d26 2276
c1a54c05 2277 This command set Route Target value.
42fc5d26 2278
c1a54c05 2279.. index:: set extcommunity soo EXTCOMMUNITY
29adcd50 2280.. clicmd:: set extcommunity soo EXTCOMMUNITY
c1a54c05
QY
2281
2282 This command set Site of Origin value.
42fc5d26 2283
ed647ed2 2284.. index:: set extcommunity bandwidth <(1-25600) | cumulative | num-multipaths> [non-transitive]
2285.. clicmd:: set extcommunity bandwidth <(1-25600) | cumulative | num-multipaths> [non-transitive]
2286
2287 This command sets the BGP link-bandwidth extended community for the prefix
2288 (best path) for which it is applied. The link-bandwidth can be specified as
2289 an ``explicit value`` (specified in Mbps), or the router can be told to use
2290 the ``cumulative bandwidth`` of all multipaths for the prefix or to compute
2291 it based on the ``number of multipaths``. The link bandwidth extended
2292 community is encoded as ``transitive`` unless the set command explicitly
2293 configures it as ``non-transitive``.
2294
2295.. seealso:: :ref:`wecmp_linkbw`
47f47873
PG
2296
2297Note that the extended expanded community is only used for `match` rule, not for
2298`set` actions.
2299
0efdf0fe 2300.. _bgp-large-communities-attribute:
42fc5d26 2301
8fcedbd2
QY
2302Large Communities Attribute
2303^^^^^^^^^^^^^^^^^^^^^^^^^^^
42fc5d26
QY
2304
2305The BGP Large Communities attribute was introduced in Feb 2017 with
c1a54c05 2306:rfc:`8092`.
42fc5d26 2307
8fcedbd2
QY
2308The BGP Large Communities Attribute is similar to the BGP Communities Attribute
2309except that it has 3 components instead of two and each of which are 4 octets
2310in length. Large Communities bring additional functionality and convenience
2311over traditional communities, specifically the fact that the ``GLOBAL`` part
2312below is now 4 octets wide allowing seamless use in networks using 4-byte ASNs.
2313
2314``GLOBAL:LOCAL1:LOCAL2``
2315 This is the format to define Large Community values. Referencing :rfc:`8195`
2316 the values are commonly referred to as follows:
2317
2318 - The ``GLOBAL`` part is a 4 octet Global Administrator field, commonly used
2319 as the operators AS number.
2320 - The ``LOCAL1`` part is a 4 octet Local Data Part 1 subfield referred to as
2321 a function.
2322 - The ``LOCAL2`` part is a 4 octet Local Data Part 2 field and referred to
2323 as the parameter subfield.
2324
2325 As an example, ``65551:1:10`` represents AS 65551 function 1 and parameter
2326 10. The referenced RFC above gives some guidelines on recommended usage.
42fc5d26 2327
0efdf0fe 2328.. _bgp-large-community-lists:
42fc5d26 2329
8fcedbd2
QY
2330Large Community Lists
2331"""""""""""""""""""""
42fc5d26
QY
2332
2333Two types of large community lists are supported, namely `standard` and
2334`expanded`.
2335
a64e0ee5
DA
2336.. index:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY
2337.. clicmd:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY
42fc5d26 2338
4da7fda3
QY
2339 This command defines a new standard large-community-list. `large-community`
2340 is the Large Community value. We can add multiple large communities under
2341 same name. In that case the match will happen in the user defined order.
2342 Once the large-community-list matches the Large Communities attribute in BGP
2343 updates it will return permit or deny based upon the large-community-list
2344 definition. When there is no matched entry, a deny will be returned. When
2345 `large-community` is empty it matches any routes.
42fc5d26 2346
a64e0ee5
DA
2347.. index:: bgp large-community-list expanded NAME permit|deny LINE
2348.. clicmd:: bgp large-community-list expanded NAME permit|deny LINE
42fc5d26 2349
4da7fda3
QY
2350 This command defines a new expanded large-community-list. Where `line` is a
2351 string matching expression, it will be compared to the entire Large
2352 Communities attribute as a string, with each large-community in order from
2353 lowest to highest. `line` can also be a regular expression which matches
2354 this Large Community attribute.
42fc5d26 2355
3d13052d 2356.. index:: bgp large-community-list NAME
a64e0ee5 2357.. clicmd:: no bgp large-community-list NAME
42fc5d26 2358
3d13052d 2359.. index:: bgp large-community-list standard NAME
a64e0ee5 2360.. clicmd:: no bgp large-community-list standard NAME
42fc5d26 2361
3d13052d 2362.. index:: bgp large-community-list expanded NAME
a64e0ee5 2363.. clicmd:: no bgp large-community-list expanded NAME
42fc5d26 2364
4da7fda3
QY
2365 These commands delete Large Community lists specified by `name`. All Large
2366 Community lists share a single namespace. This means Large Community lists
2367 can be removed by simply specifying the name.
42fc5d26 2368
a64e0ee5
DA
2369.. index:: show bgp large-community-list
2370.. clicmd:: show bgp large-community-list
42fc5d26 2371
36dc43aa
DA
2372.. index:: show bgp large-community-list NAME detail
2373.. clicmd:: show bgp large-community-list NAME detail
42fc5d26 2374
c1a54c05
QY
2375 This command display current large-community-list information. When
2376 `name` is specified the community list information is shown.
42fc5d26 2377
c1a54c05 2378.. index:: show ip bgp large-community-info
29adcd50 2379.. clicmd:: show ip bgp large-community-info
c1a54c05
QY
2380
2381 This command displays the current large communities in use.
42fc5d26 2382
0efdf0fe 2383.. _bgp-large-communities-in-route-map:
42fc5d26 2384
8fcedbd2
QY
2385Large Communities in Route Map
2386""""""""""""""""""""""""""""""
42fc5d26 2387
03ff9a14 2388.. index:: match large-community LINE [exact-match]
2389.. clicmd:: match large-community LINE [exact-match]
42fc5d26 2390
4da7fda3
QY
2391 Where `line` can be a simple string to match, or a regular expression. It
2392 is very important to note that this match occurs on the entire
c1a54c05 2393 large-community string as a whole, where each large-community is ordered
03ff9a14 2394 from lowest to highest. When `exact-match` keyword is specified, match
2395 happen only when BGP updates have completely same large communities value
2396 specified in the large community list.
42fc5d26 2397
c1a54c05 2398.. index:: set large-community LARGE-COMMUNITY
29adcd50 2399.. clicmd:: set large-community LARGE-COMMUNITY
42fc5d26 2400
c1a54c05 2401.. index:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
29adcd50 2402.. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
42fc5d26 2403
c1a54c05 2404.. index:: set large-community LARGE-COMMUNITY additive
29adcd50 2405.. clicmd:: set large-community LARGE-COMMUNITY additive
c1a54c05
QY
2406
2407 These commands are used for setting large-community values. The first
2408 command will overwrite any large-communities currently present.
2409 The second specifies two large-communities, which overwrites the current
2410 large-community list. The third will add a large-community value without
2411 overwriting other values. Multiple large-community values can be specified.
42fc5d26 2412
47f47873
PG
2413Note that the large expanded community is only used for `match` rule, not for
2414`set` actions.
b572f826 2415
c8a5e5e1 2416.. _bgp-l3vpn-vrfs:
b572f826 2417
c8a5e5e1
QY
2418L3VPN VRFs
2419----------
b572f826 2420
c8a5e5e1
QY
2421*bgpd* supports :abbr:`L3VPN (Layer 3 Virtual Private Networks)` :abbr:`VRFs
2422(Virtual Routing and Forwarding)` for IPv4 :rfc:`4364` and IPv6 :rfc:`4659`.
2423L3VPN routes, and their associated VRF MPLS labels, can be distributed to VPN
2424SAFI neighbors in the *default*, i.e., non VRF, BGP instance. VRF MPLS labels
2425are reached using *core* MPLS labels which are distributed using LDP or BGP
2426labeled unicast. *bgpd* also supports inter-VRF route leaking.
b572f826 2427
b572f826 2428
c8a5e5e1 2429.. _bgp-vrf-route-leaking:
8fcedbd2
QY
2430
2431VRF Route Leaking
c8a5e5e1 2432-----------------
8fcedbd2
QY
2433
2434BGP routes may be leaked (i.e. copied) between a unicast VRF RIB and the VPN
f90115c5
LB
2435SAFI RIB of the default VRF for use in MPLS-based L3VPNs. Unicast routes may
2436also be leaked between any VRFs (including the unicast RIB of the default BGP
2437instanced). A shortcut syntax is also available for specifying leaking from one
2438VRF to another VRF using the default instance's VPN RIB as the intemediary. A
2439common application of the VRF-VRF feature is to connect a customer's private
8fcedbd2
QY
2440routing domain to a provider's VPN service. Leaking is configured from the
2441point of view of an individual VRF: ``import`` refers to routes leaked from VPN
2442to a unicast VRF, whereas ``export`` refers to routes leaked from a unicast VRF
2443to VPN.
2444
2445Required parameters
c8a5e5e1 2446^^^^^^^^^^^^^^^^^^^
b572f826 2447
4da7fda3
QY
2448Routes exported from a unicast VRF to the VPN RIB must be augmented by two
2449parameters:
2450
2451- an :abbr:`RD (Route Distinguisher)`
2452- an :abbr:`RTLIST (Route-target List)`
2453
2454Configuration for these exported routes must, at a minimum, specify these two
2455parameters.
2456
2457Routes imported from the VPN RIB to a unicast VRF are selected according to
2458their RTLISTs. Routes whose RTLIST contains at least one route-target in
2459common with the configured import RTLIST are leaked. Configuration for these
2460imported routes must specify an RTLIST to be matched.
2461
2462The RD, which carries no semantic value, is intended to make the route unique
2463in the VPN RIB among all routes of its prefix that originate from all the
2464customers and sites that are attached to the provider's VPN service.
2465Accordingly, each site of each customer is typically assigned an RD that is
2466unique across the entire provider network.
2467
2468The RTLIST is a set of route-target extended community values whose purpose is
2469to specify route-leaking policy. Typically, a customer is assigned a single
2470route-target value for import and export to be used at all customer sites. This
2471configuration specifies a simple topology wherein a customer has a single
2472routing domain which is shared across all its sites. More complex routing
2473topologies are possible through use of additional route-targets to augment the
2474leaking of sets of routes in various ways.
b572f826 2475
e967a1d0
DS
2476When using the shortcut syntax for vrf-to-vrf leaking, the RD and RT are
2477auto-derived.
fb3d9f3e 2478
8fcedbd2 2479General configuration
c8a5e5e1 2480^^^^^^^^^^^^^^^^^^^^^
b572f826 2481
f90115c5 2482Configuration of route leaking between a unicast VRF RIB and the VPN SAFI RIB
4da7fda3
QY
2483of the default VRF is accomplished via commands in the context of a VRF
2484address-family:
b572f826
PZ
2485
2486.. index:: rd vpn export AS:NN|IP:nn
2487.. clicmd:: rd vpn export AS:NN|IP:nn
2488
4da7fda3
QY
2489 Specifies the route distinguisher to be added to a route exported from the
2490 current unicast VRF to VPN.
b572f826 2491
3d13052d 2492.. index:: rd vpn export [AS:NN|IP:nn]
b572f826
PZ
2493.. clicmd:: no rd vpn export [AS:NN|IP:nn]
2494
2495 Deletes any previously-configured export route distinguisher.
2496
2497.. index:: rt vpn import|export|both RTLIST...
2498.. clicmd:: rt vpn import|export|both RTLIST...
2499
4da7fda3
QY
2500 Specifies the route-target list to be attached to a route (export) or the
2501 route-target list to match against (import) when exporting/importing between
2502 the current unicast VRF and VPN.
b572f826 2503
4da7fda3
QY
2504 The RTLIST is a space-separated list of route-targets, which are BGP
2505 extended community values as described in
b572f826
PZ
2506 :ref:`bgp-extended-communities-attribute`.
2507
3d13052d 2508.. index:: rt vpn import|export|both [RTLIST...]
b572f826
PZ
2509.. clicmd:: no rt vpn import|export|both [RTLIST...]
2510
2511 Deletes any previously-configured import or export route-target list.
2512
e70e9f8e
PZ
2513.. index:: label vpn export (0..1048575)|auto
2514.. clicmd:: label vpn export (0..1048575)|auto
b572f826 2515
8a2124f7 2516 Enables an MPLS label to be attached to a route exported from the current
2517 unicast VRF to VPN. If the value specified is ``auto``, the label value is
2518 automatically assigned from a pool maintained by the Zebra daemon. If Zebra
2519 is not running, or if this command is not configured, automatic label
2520 assignment will not complete, which will block corresponding route export.
b572f826 2521
3d13052d 2522.. index:: label vpn export [(0..1048575)|auto]
e70e9f8e 2523.. clicmd:: no label vpn export [(0..1048575)|auto]
b572f826
PZ
2524
2525 Deletes any previously-configured export label.
2526
2527.. index:: nexthop vpn export A.B.C.D|X:X::X:X
2528.. clicmd:: nexthop vpn export A.B.C.D|X:X::X:X
2529
4da7fda3
QY
2530 Specifies an optional nexthop value to be assigned to a route exported from
2531 the current unicast VRF to VPN. If left unspecified, the nexthop will be set
2532 to 0.0.0.0 or 0:0::0:0 (self).
b572f826 2533
3d13052d 2534.. index:: nexthop vpn export [A.B.C.D|X:X::X:X]
b572f826
PZ
2535.. clicmd:: no nexthop vpn export [A.B.C.D|X:X::X:X]
2536
2537 Deletes any previously-configured export nexthop.
2538
2539.. index:: route-map vpn import|export MAP
2540.. clicmd:: route-map vpn import|export MAP
2541
4da7fda3 2542 Specifies an optional route-map to be applied to routes imported or exported
d1e7591e 2543 between the current unicast VRF and VPN.
b572f826 2544
3d13052d 2545.. index:: route-map vpn import|export [MAP]
b572f826
PZ
2546.. clicmd:: no route-map vpn import|export [MAP]
2547
2548 Deletes any previously-configured import or export route-map.
2549
2550.. index:: import|export vpn
2551.. clicmd:: import|export vpn
2552
d1e7591e 2553 Enables import or export of routes between the current unicast VRF and VPN.
b572f826 2554
3d13052d 2555.. index:: import|export vpn
b572f826
PZ
2556.. clicmd:: no import|export vpn
2557
d1e7591e 2558 Disables import or export of routes between the current unicast VRF and VPN.
b572f826 2559
fb3d9f3e
DS
2560.. index:: import vrf VRFNAME
2561.. clicmd:: import vrf VRFNAME
2562
e967a1d0
DS
2563 Shortcut syntax for specifying automatic leaking from vrf VRFNAME to
2564 the current VRF using the VPN RIB as intermediary. The RD and RT
2565 are auto derived and should not be specified explicitly for either the
2566 source or destination VRF's.
2567
2568 This shortcut syntax mode is not compatible with the explicit
2569 `import vpn` and `export vpn` statements for the two VRF's involved.
2570 The CLI will disallow attempts to configure incompatible leaking
2571 modes.
fb3d9f3e 2572
3d13052d 2573.. index:: import vrf VRFNAME
fb3d9f3e
DS
2574.. clicmd:: no import vrf VRFNAME
2575
e967a1d0
DS
2576 Disables automatic leaking from vrf VRFNAME to the current VRF using
2577 the VPN RIB as intermediary.
b572f826 2578
42fc5d26 2579
b6c34e85
CS
2580.. _bgp-evpn:
2581
2582Ethernet Virtual Network - EVPN
2583-------------------------------
2584
2585.. _bgp-evpn-advertise-pip:
2586
2587EVPN advertise-PIP
2588^^^^^^^^^^^^^^^^^^
2589
2590In a EVPN symmetric routing MLAG deployment, all EVPN routes advertised
2591with anycast-IP as next-hop IP and anycast MAC as the Router MAC (RMAC - in
2592BGP EVPN Extended-Community).
2593EVPN picks up the next-hop IP from the VxLAN interface's local tunnel IP and
2594the RMAC is obtained from the MAC of the L3VNI's SVI interface.
2595Note: Next-hop IP is used for EVPN routes whether symmetric routing is
2596deployed or not but the RMAC is only relevant for symmetric routing scenario.
2597
2598Current behavior is not ideal for Prefix (type-5) and self (type-2)
2599routes. This is because the traffic from remote VTEPs routed sub optimally
2600if they land on the system where the route does not belong.
2601
2602The advertise-pip feature advertises Prefix (type-5) and self (type-2)
2603routes with system's individual (primary) IP as the next-hop and individual
2604(system) MAC as Router-MAC (RMAC), while leaving the behavior unchanged for
2605other EVPN routes.
2606
2607To support this feature there needs to have ability to co-exist a
2608(system-MAC, system-IP) pair with a (anycast-MAC, anycast-IP) pair with the
2609ability to terminate VxLAN-encapsulated packets received for either pair on
2610the same L3VNI (i.e associated VLAN). This capability is need per tenant
2611VRF instance.
2612
2613To derive the system-MAC and the anycast MAC, there needs to have a
2614separate/additional MAC-VLAN interface corresponding to L3VNI’s SVI.
2615The SVI interface’s MAC address can be interpreted as system-MAC
2616and MAC-VLAN interface's MAC as anycast MAC.
2617
2618To derive system-IP and anycast-IP, the default BGP instance's router-id is used
2619as system-IP and the VxLAN interface’s local tunnel IP as the anycast-IP.
2620
2621User has an option to configure the system-IP and/or system-MAC value if the
2622auto derived value is not preferred.
2623
2624Note: By default, advertise-pip feature is enabled and user has an option to
2625disable the feature via configuration CLI. Once the feature is disable under
2626bgp vrf instance or MAC-VLAN interface is not configured, all the routes follow
2627the same behavior of using same next-hop and RMAC values.
2628
3d13052d 2629.. index:: advertise-pip [ip <addr> [mac <addr>]]
b6c34e85
CS
2630.. clicmd:: [no] advertise-pip [ip <addr> [mac <addr>]]
2631
2632Enables or disables advertise-pip feature, specifiy system-IP and/or system-MAC
2633parameters.
2634
77457939
AK
2635EVPN Multihoming
2636^^^^^^^^^^^^^^^^
2637
2638All-Active Multihoming is used for redundancy and load sharing. Servers
2639are attached to two or more PEs and the links are bonded (link-aggregation).
2640This group of server links is referred to as an Ethernet Segment.
2641
2642Ethernet Segments
2643"""""""""""""""""
2644An Ethernet Segment can be configured by specifying a system-MAC and a
2645local discriminatior against the bond interface on the PE (via zebra) -
2646
3d13052d 2647.. index:: evpn mh es-id [(1-16777215)$es_lid]
77457939
AK
2648.. clicmd:: [no] evpn mh es-id [(1-16777215)$es_lid]
2649
3d13052d 2650.. index:: evpn mh es-sys-mac [X:X:X:X:X:X$mac]
77457939
AK
2651.. clicmd:: [no$no] evpn mh es-sys-mac [X:X:X:X:X:X$mac]
2652
2653The sys-mac and local discriminator are used for generating a 10-byte,
2654Type-3 Ethernet Segment ID.
2655
2656Type-1 (EAS-per-ES and EAD-per-EVI) routes are used to advertise the locally
2657attached ESs and to learn off remote ESs in the network. Local Type-2/MAC-IP
2658routes are also advertised with a destination ESI allowing for MAC-IP syncing
2659between Ethernet Segment peers.
2660Reference: RFC 7432, RFC 8365
2661
2662EVPN-MH is intended as a replacement for MLAG or Anycast VTEPs. In
2663multihoming each PE has an unique VTEP address which requires the introduction
2664of a new dataplane construct, MAC-ECMP. Here a MAC/FDB entry can point to a
2665list of remote PEs/VTEPs.
2666
2667BUM handling
2668""""""""""""
2669Type-4 (ESR) routes are used for Designated Forwarder (DF) election. DFs
2670forward BUM traffic received via the overlay network. This implementation
2671uses a preference based DF election specified by draft-ietf-bess-evpn-pref-df.
2672The DF preference is configurable per-ES (via zebra) -
2673
3d13052d 2674.. index:: evpn mh es-df-pref [(1-16777215)$df_pref]
77457939
AK
2675.. clicmd:: [no] evpn mh es-df-pref [(1-16777215)$df_pref]
2676
2677BUM traffic is rxed via the overlay by all PEs attached to a server but
2678only the DF can forward the de-capsulated traffic to the access port. To
2679accomodate that non-DF filters are installed in the dataplane to drop
2680the traffic.
2681
2682Similarly traffic received from ES peers via the overlay cannot be forwarded
2683to the server. This is split-horizon-filtering with local bias.
2684
2685Fast failover
2686"""""""""""""
2687As the primary purpose of EVPN-MH is redundancy keeping the failover efficient
2688is a recurring theme in the implementation. Following sub-features have
2689been introduced for the express purpose of efficient ES failovers.
2690
2691- Layer-2 Nexthop Groups and MAC-ECMP via L2NHG.
2692
2693- Host routes (for symmetric IRB) via L3NHG.
2694 On dataplanes that support layer3 nexthop groups the feature can be turned
2695 on via the following BGP config -
2696
3d13052d 2697.. index:: use-es-l3nhg
77457939
AK
2698.. clicmd:: [no$no] use-es-l3nhg
2699
2700- Local ES (MAC/Neigh) failover via ES-redirect.
2701 On dataplanes that do not have support for ES-redirect the feature can be
2702 turned off via the following zebra config -
2703
3d13052d 2704.. index:: evpn mh redirect-off
77457939
AK
2705.. clicmd:: [no$no] evpn mh redirect-off
2706
2707Uplink/Core tracking
2708""""""""""""""""""""
2709When all the underlay links go down the PE no longer has access to the VxLAN
2710+overlay. To prevent blackholing of traffic the server/ES links are
2711protodowned on the PE. A link can be setup for uplink tracking via the
2712following zebra configuration -
2713
3d13052d 2714.. index:: evpn mh uplink
77457939
AK
2715.. clicmd:: [no] evpn mh uplink
2716
2717Proxy advertisements
2718""""""""""""""""""""
2719To handle hitless upgrades support for proxy advertisement has been added
2720as specified by draft-rbickhart-evpn-ip-mac-proxy-adv. This allows a PE
2721(say PE1) to proxy advertise a MAC-IP rxed from an ES peer (say PE2). When
2722the ES peer (PE2) goes down PE1 continues to advertise hosts learnt from PE2
2723for a holdtime during which it attempts to establish local reachability of
2724the host. This holdtime is configurable via the following zebra commands -
2725
3d13052d 2726.. index:: evpn mh neigh-holdtime (0-86400)$duration
77457939
AK
2727.. clicmd:: [no$no] evpn mh neigh-holdtime (0-86400)$duration
2728
3d13052d 2729.. index:: evpn mh mac-holdtime (0-86400)$duration
77457939
AK
2730.. clicmd:: [no$no] evpn mh mac-holdtime (0-86400)$duration
2731
2732Startup delay
2733"""""""""""""
2734When a switch is rebooted we wait for a brief period to allow the underlay
2735and EVPN network to converge before enabling the ESs. For this duration the
2736ES bonds are held protodown. The startup delay is configurable via the
2737following zebra command -
2738
3d13052d 2739.. index:: evpn mh startup-delay(0-3600)$duration
77457939
AK
2740.. clicmd:: [no] evpn mh startup-delay(0-3600)$duration
2741
ee9d0f09
PG
2742+Support with VRF network namespace backend
2743+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2744It is possible to separate overlay networks contained in VXLAN interfaces from
2745underlay networks by using VRFs. VRF-lite and VRF-netns backends can be used for
2746that. In the latter case, it is necessary to set both bridge and vxlan interface
2747in the same network namespace, as below example illustrates:
2748
2749.. code-block:: shell
2750
2751 # linux shell
2752 ip netns add vrf1
2753 ip link add name vxlan101 type vxlan id 101 dstport 4789 dev eth0 local 10.1.1.1
2754 ip link set dev vxlan101 netns vrf1
2755 ip netns exec vrf1 ip link set dev lo up
2756 ip netns exec vrf1 brctl addbr bridge101
2757 ip netns exec vrf1 brctl addif bridge101 vxlan101
2758
2759This makes it possible to separate not only layer 3 networks like VRF-lite networks.
2760Also, VRF netns based make possible to separate layer 2 networks on separate VRF
2761instances.
89b97c33 2762
7f7940e6
MK
2763.. _bgp-conditional-advertisement:
2764
2765BGP Conditional Advertisement
2766-----------------------------
2767The BGP conditional advertisement feature uses the ``non-exist-map`` or the
2768``exist-map`` and the ``advertise-map`` keywords of the neighbor advertise-map
2769command in order to track routes by the route prefix.
2770
2771``non-exist-map``
2772 1. If a route prefix is not present in the output of non-exist-map command,
2773 then advertise the route specified by the advertise-map command.
2774
2775 2. If a route prefix is present in the output of non-exist-map command,
2776 then do not advertise the route specified by the addvertise-map command.
2777
2778``exist-map``
2779 1. If a route prefix is present in the output of exist-map command,
2780 then advertise the route specified by the advertise-map command.
2781
2782 2. If a route prefix is not present in the output of exist-map command,
2783 then do not advertise the route specified by the advertise-map command.
2784
2785This feature is useful when some prefixes are advertised to one of its peers
2786only if the information from the other peer is not present (due to failure in
2787peering session or partial reachability etc).
2788
2789The conditional BGP announcements are sent in addition to the normal
2790announcements that a BGP router sends to its peer.
2791
2792The conditional advertisement process is triggered by the BGP scanner process,
2793which runs every 60 seconds. This means that the maximum time for the conditional
2794advertisement to take effect is 60 seconds. The conditional advertisement can take
2795effect depending on when the tracked route is removed from the BGP table and
2796when the next instance of the BGP scanner occurs.
2797
3d13052d 2798.. index:: neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME
7f7940e6
MK
2799.. clicmd:: [no] neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME
2800
fa36596c 2801 This command enables BGP scanner process to monitor routes specified by
7f7940e6 2802 exist-map or non-exist-map command in BGP table and conditionally advertises
fa36596c 2803 the routes specified by advertise-map command.
7f7940e6
MK
2804
2805Sample Configuration
2806^^^^^^^^^^^^^^^^^^^^^
2807.. code-block:: frr
2808
fa36596c
MK
2809 interface enp0s9
2810 ip address 10.10.10.2/24
2811 !
2812 interface enp0s10
2813 ip address 10.10.20.2/24
2814 !
7f7940e6 2815 interface lo
fa36596c 2816 ip address 203.0.113.1/32
7f7940e6
MK
2817 !
2818 router bgp 2
2819 bgp log-neighbor-changes
2820 no bgp ebgp-requires-policy
2821 neighbor 10.10.10.1 remote-as 1
2822 neighbor 10.10.20.3 remote-as 3
2823 !
2824 address-family ipv4 unicast
7f7940e6 2825 neighbor 10.10.10.1 soft-reconfiguration inbound
7f7940e6 2826 neighbor 10.10.20.3 soft-reconfiguration inbound
fa36596c 2827 neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP
7f7940e6
MK
2828 exit-address-family
2829 !
fa36596c
MK
2830 ip prefix-list DEFAULT seq 5 permit 192.0.2.5/32
2831 ip prefix-list DEFAULT seq 10 permit 192.0.2.1/32
2832 ip prefix-list EXIST seq 5 permit 10.10.10.10/32
2833 ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0
2834 ip prefix-list IP1 seq 5 permit 10.139.224.0/20
2835 !
2836 bgp community-list standard DC-ROUTES seq 5 permit 64952:3008
2837 bgp community-list standard DC-ROUTES seq 10 permit 64671:501
2838 bgp community-list standard DC-ROUTES seq 15 permit 64950:3009
2839 bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200
7f7940e6 2840 !
fa36596c
MK
2841 route-map ADV-MAP permit 10
2842 match ip address prefix-list IP1
7f7940e6 2843 !
fa36596c
MK
2844 route-map ADV-MAP permit 20
2845 match community DC-ROUTES
2846 !
2847 route-map EXIST-MAP permit 10
2848 match community DEFAULT-ROUTE
2849 match ip address prefix-list DEFAULT-ROUTE
7f7940e6
MK
2850 !
2851
2852Sample Output
2853^^^^^^^^^^^^^
2854
fa36596c 2855When 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
2856
2857.. code-block:: frr
2858
2859 Router2# show ip bgp
fa36596c 2860 BGP table version is 20, local router ID is 203.0.113.1, vrf id 0
7f7940e6
MK
2861 Default local pref 100, local AS 2
2862 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
2863 i internal, r RIB-failure, S Stale, R Removed
2864 Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
2865 Origin codes: i - IGP, e - EGP, ? - incomplete
2866
fa36596c
MK
2867 Network Next Hop Metric LocPrf Weight Path
2868 *> 0.0.0.0/0 10.10.10.1 0 0 1 i
2869 *> 10.139.224.0/20 10.10.10.1 0 0 1 ?
2870 *> 192.0.2.1/32 10.10.10.1 0 0 1 i
2871 *> 192.0.2.5/32 10.10.10.1 0 0 1 i
7f7940e6
MK
2872
2873 Displayed 4 routes and 4 total paths
fa36596c 2874 Router2# show ip bgp neighbors 10.10.20.3
7f7940e6
MK
2875
2876 !--- Output suppressed.
2877
2878 For address family: IPv4 Unicast
fa36596c 2879 Update group 7, subgroup 7
7f7940e6
MK
2880 Packet Queue length 0
2881 Inbound soft reconfiguration allowed
2882 Community attribute sent to this neighbor(all)
fa36596c
MK
2883 Condition NON_EXIST, Condition-map *EXIST-MAP, Advertise-map *ADV-MAP, status: Withdraw
2884 0 accepted prefixes
7f7940e6
MK
2885
2886 !--- Output suppressed.
2887
fa36596c
MK
2888 Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
2889 BGP table version is 20, local router ID is 203.0.113.1, vrf id 0
7f7940e6
MK
2890 Default local pref 100, local AS 2
2891 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
fa36596c 2892 i internal, r RIB-failure, S Stale, R Removed
7f7940e6
MK
2893 Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
2894 Origin codes: i - IGP, e - EGP, ? - incomplete
2895
fa36596c
MK
2896 Network Next Hop Metric LocPrf Weight Path
2897 *> 0.0.0.0/0 0.0.0.0 0 1 i
2898 *> 192.0.2.5/32 0.0.0.0 0 1 i
7f7940e6 2899
fa36596c 2900 Total number of prefixes 2
7f7940e6 2901
fa36596c 2902When 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
2903
2904.. code-block:: frr
2905
2906 Router2# show ip bgp
fa36596c 2907 BGP table version is 21, local router ID is 203.0.113.1, vrf id 0
7f7940e6
MK
2908 Default local pref 100, local AS 2
2909 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
2910 i internal, r RIB-failure, S Stale, R Removed
2911 Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
2912 Origin codes: i - IGP, e - EGP, ? - incomplete
2913
fa36596c
MK
2914 Network Next Hop Metric LocPrf Weight Path
2915 *> 10.139.224.0/20 10.10.10.1 0 0 1 ?
2916 *> 192.0.2.1/32 10.10.10.1 0 0 1 i
2917 *> 192.0.2.5/32 10.10.10.1 0 0 1 i
7f7940e6
MK
2918
2919 Displayed 3 routes and 3 total paths
7f7940e6 2920
fa36596c 2921 Router2# show ip bgp neighbors 10.10.20.3
7f7940e6
MK
2922
2923 !--- Output suppressed.
2924
2925 For address family: IPv4 Unicast
fa36596c 2926 Update group 7, subgroup 7
7f7940e6
MK
2927 Packet Queue length 0
2928 Inbound soft reconfiguration allowed
2929 Community attribute sent to this neighbor(all)
fa36596c
MK
2930 Condition NON_EXIST, Condition-map *EXIST-MAP, Advertise-map *ADV-MAP, status: Advertise
2931 0 accepted prefixes
7f7940e6
MK
2932
2933 !--- Output suppressed.
2934
fa36596c
MK
2935 Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
2936 BGP table version is 21, local router ID is 203.0.113.1, vrf id 0
7f7940e6
MK
2937 Default local pref 100, local AS 2
2938 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
2939 i internal, r RIB-failure, S Stale, R Removed
2940 Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
2941 Origin codes: i - IGP, e - EGP, ? - incomplete
2942
fa36596c
MK
2943 Network Next Hop Metric LocPrf Weight Path
2944 *> 10.139.224.0/20 0.0.0.0 0 1 ?
2945 *> 192.0.2.1/32 0.0.0.0 0 1 i
2946 *> 192.0.2.5/32 0.0.0.0 0 1 i
7f7940e6
MK
2947
2948 Total number of prefixes 3
fa36596c 2949 Router2#
7f7940e6 2950
8fcedbd2
QY
2951.. _bgp-debugging:
2952
2953Debugging
2954---------
42fc5d26 2955
c1a54c05 2956.. index:: show debug
29adcd50 2957.. clicmd:: show debug
42fc5d26 2958
8fcedbd2 2959 Show all enabled debugs.
42fc5d26 2960
54422b46
DS
2961.. index:: show bgp listeners
2962.. clicmd:: show bgp listeners
2963
2964 Display Listen sockets and the vrf that created them. Useful for debugging of when
2965 listen is not working and this is considered a developer debug statement.
2966
3d13052d 2967.. index:: debug bgp neighbor-events
53b758f3 2968.. clicmd:: [no] debug bgp neighbor-events
42fc5d26 2969
8fcedbd2
QY
2970 Enable or disable debugging for neighbor events. This provides general
2971 information on BGP events such as peer connection / disconnection, session
2972 establishment / teardown, and capability negotiation.
42fc5d26 2973
3d13052d 2974.. index:: debug bgp updates
53b758f3 2975.. clicmd:: [no] debug bgp updates
42fc5d26 2976
8fcedbd2
QY
2977 Enable or disable debugging for BGP updates. This provides information on
2978 BGP UPDATE messages transmitted and received between local and remote
2979 instances.
42fc5d26 2980
3d13052d 2981.. index:: debug bgp keepalives
53b758f3 2982.. clicmd:: [no] debug bgp keepalives
42fc5d26 2983
8fcedbd2
QY
2984 Enable or disable debugging for BGP keepalives. This provides information on
2985 BGP KEEPALIVE messages transmitted and received between local and remote
2986 instances.
c1a54c05 2987
3d13052d 2988.. index:: debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
8fcedbd2 2989.. clicmd:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
42fc5d26 2990
8fcedbd2 2991 Enable or disable debugging for bestpath selection on the specified prefix.
42fc5d26 2992
3d13052d 2993.. index:: debug bgp nht
8fcedbd2 2994.. clicmd:: [no] debug bgp nht
4da7fda3 2995
8fcedbd2 2996 Enable or disable debugging of BGP nexthop tracking.
4da7fda3 2997
3d13052d 2998.. index:: debug bgp update-groups
8fcedbd2 2999.. clicmd:: [no] debug bgp update-groups
4b44467c 3000
8fcedbd2
QY
3001 Enable or disable debugging of dynamic update groups. This provides general
3002 information on group creation, deletion, join and prune events.
4b44467c 3003
3d13052d 3004.. index:: debug bgp zebra
8fcedbd2 3005.. clicmd:: [no] debug bgp zebra
42fc5d26 3006
8fcedbd2 3007 Enable or disable debugging of communications between *bgpd* and *zebra*.
c3c5a71f 3008
8fcedbd2
QY
3009Dumping Messages and Routing Tables
3010^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42fc5d26 3011
8fcedbd2
QY
3012.. index:: dump bgp all PATH [INTERVAL]
3013.. clicmd:: dump bgp all PATH [INTERVAL]
42fc5d26 3014
8fcedbd2
QY
3015.. index:: dump bgp all-et PATH [INTERVAL]
3016.. clicmd:: dump bgp all-et PATH [INTERVAL]
c3c5a71f 3017
3d13052d 3018.. index:: dump bgp all [PATH] [INTERVAL]
8fcedbd2 3019.. clicmd:: no dump bgp all [PATH] [INTERVAL]
42fc5d26 3020
8fcedbd2
QY
3021 Dump all BGP packet and events to `path` file.
3022 If `interval` is set, a new file will be created for echo `interval` of
3023 seconds. The path `path` can be set with date and time formatting
3024 (strftime). The type ‘all-et’ enables support for Extended Timestamp Header
3025 (:ref:`packet-binary-dump-format`).
c3c5a71f 3026
8fcedbd2
QY
3027.. index:: dump bgp updates PATH [INTERVAL]
3028.. clicmd:: dump bgp updates PATH [INTERVAL]
42fc5d26 3029
8fcedbd2
QY
3030.. index:: dump bgp updates-et PATH [INTERVAL]
3031.. clicmd:: dump bgp updates-et PATH [INTERVAL]
42fc5d26 3032
3d13052d 3033.. index:: dump bgp updates [PATH] [INTERVAL]
8fcedbd2 3034.. clicmd:: no dump bgp updates [PATH] [INTERVAL]
42fc5d26 3035
8fcedbd2
QY
3036 Dump only BGP updates messages to `path` file.
3037 If `interval` is set, a new file will be created for echo `interval` of
3038 seconds. The path `path` can be set with date and time formatting
3039 (strftime). The type ‘updates-et’ enables support for Extended Timestamp
3040 Header (:ref:`packet-binary-dump-format`).
42fc5d26 3041
8fcedbd2
QY
3042.. index:: dump bgp routes-mrt PATH
3043.. clicmd:: dump bgp routes-mrt PATH
c3c5a71f 3044
8fcedbd2
QY
3045.. index:: dump bgp routes-mrt PATH INTERVAL
3046.. clicmd:: dump bgp routes-mrt PATH INTERVAL
42fc5d26 3047
3d13052d 3048.. index:: dump bgp route-mrt [PATH] [INTERVAL]
8fcedbd2 3049.. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL]
42fc5d26 3050
8fcedbd2
QY
3051 Dump whole BGP routing table to `path`. This is heavy process. The path
3052 `path` can be set with date and time formatting (strftime). If `interval` is
3053 set, a new file will be created for echo `interval` of seconds.
42fc5d26 3054
8fcedbd2 3055 Note: the interval variable can also be set using hours and minutes: 04h20m00.
42fc5d26 3056
c3c5a71f 3057
8fcedbd2 3058.. _bgp-other-commands:
42fc5d26 3059
8fcedbd2
QY
3060Other BGP Commands
3061------------------
42fc5d26 3062
e312b6c6
QY
3063The following are available in the top level *enable* mode:
3064
dc912615
DS
3065.. index:: clear bgp \*
3066.. clicmd:: clear bgp \*
3067
3068 Clear all peers.
3069
8fcedbd2
QY
3070.. index:: clear bgp ipv4|ipv6 \*
3071.. clicmd:: clear bgp ipv4|ipv6 \*
42fc5d26 3072
dc912615
DS
3073 Clear all peers with this address-family activated.
3074
3075.. index:: clear bgp ipv4|ipv6 unicast \*
3076.. clicmd:: clear bgp ipv4|ipv6 unicast \*
3077
3078 Clear all peers with this address-family and sub-address-family activated.
42fc5d26 3079
8fcedbd2
QY
3080.. index:: clear bgp ipv4|ipv6 PEER
3081.. clicmd:: clear bgp ipv4|ipv6 PEER
42fc5d26 3082
dc912615
DS
3083 Clear peers with address of X.X.X.X and this address-family activated.
3084
3085.. index:: clear bgp ipv4|ipv6 unicast PEER
3086.. clicmd:: clear bgp ipv4|ipv6 unicast PEER
3087
3088 Clear peer with address of X.X.X.X and this address-family and sub-address-family activated.
3089
3090.. index:: clear bgp ipv4|ipv6 PEER soft|in|out
3091.. clicmd:: clear bgp ipv4|ipv6 PEER soft|in|out
3092
3093 Clear peer using soft reconfiguration in this address-family.
42fc5d26 3094
dc912615
DS
3095.. index:: clear bgp ipv4|ipv6 unicast PEER soft|in|out
3096.. clicmd:: clear bgp ipv4|ipv6 unicast PEER soft|in|out
42fc5d26 3097
dc912615 3098 Clear peer using soft reconfiguration in this address-family and sub-address-family.
42fc5d26 3099
e312b6c6
QY
3100The following are available in the ``router bgp`` mode:
3101
3102.. index:: write-quanta (1-64)
3103.. clicmd:: write-quanta (1-64)
3104
3105 BGP message Tx I/O is vectored. This means that multiple packets are written
3106 to the peer socket at the same time each I/O cycle, in order to minimize
3107 system call overhead. This value controls how many are written at a time.
3108 Under certain load conditions, reducing this value could make peer traffic
3109 less 'bursty'. In practice, leave this settings on the default (64) unless
3110 you truly know what you are doing.
3111
3112.. index:: read-quanta (1-10)
dad83b67 3113.. clicmd:: read-quanta (1-10)
e312b6c6
QY
3114
3115 Unlike Tx, BGP Rx traffic is not vectored. Packets are read off the wire one
3116 at a time in a loop. This setting controls how many iterations the loop runs
3117 for. As with write-quanta, it is best to leave this setting on the default.
42fc5d26 3118
05bd726c 3119The following command is available in ``config`` mode as well as in the
3120``router bgp`` mode:
3121
3122.. index:: bgp graceful-shutdown
3123.. clicmd:: bgp graceful-shutdown
3124
3125 The purpose of this command is to initiate BGP Graceful Shutdown which
3126 is described in :rfc:`8326`. The use case for this is to minimize or
3127 eliminate the amount of traffic loss in a network when a planned
3128 maintenance activity such as software upgrade or hardware replacement
3129 is to be performed on a router. The feature works by re-announcing
3130 routes to eBGP peers with the GRACEFUL_SHUTDOWN community included.
3131 Peers are then expected to treat such paths with the lowest preference.
3132 This happens automatically on a receiver running FRR; with other
3133 routing protocol stacks, an inbound policy may have to be configured.
3134 In FRR, triggering graceful shutdown also results in announcing a
3135 LOCAL_PREF of 0 to iBGP peers.
3136
3137 Graceful shutdown can be configured per BGP instance or globally for
3138 all of BGP. These two options are mutually exclusive. The no form of
3139 the command causes graceful shutdown to be stopped, and routes will
3140 be re-announced without the GRACEFUL_SHUTDOWN community and/or with
3141 the usual LOCAL_PREF value. Note that if this option is saved to
3142 the startup configuration, graceful shutdown will remain in effect
3143 across restarts of *bgpd* and will need to be explicitly disabled.
3144
8fcedbd2 3145.. _bgp-displaying-bgp-information:
42fc5d26 3146
8fcedbd2
QY
3147Displaying BGP Information
3148==========================
42fc5d26 3149
e6f59415
PG
3150The following four commands display the IPv6 and IPv4 routing tables, depending
3151on whether or not the ``ip`` keyword is used.
3152Actually, :clicmd:`show ip bgp` command was used on older `Quagga` routing
3153daemon project, while :clicmd:`show bgp` command is the new format. The choice
3154has been done to keep old format with IPv4 routing table, while new format
3155displays IPv6 routing table.
3156
96f3485c
MK
3157.. index:: show ip bgp [all] [wide|json]
3158.. clicmd:: show ip bgp [all] [wide|json]
42fc5d26 3159
96f3485c
MK
3160.. index:: show ip bgp A.B.C.D [json]
3161.. clicmd:: show ip bgp A.B.C.D [json]
c1a54c05 3162
96f3485c
MK
3163.. index:: show bgp [all] [wide|json]
3164.. clicmd:: show bgp [all] [wide|json]
e6f59415 3165
96f3485c
MK
3166.. index:: show bgp X:X::X:X [json]
3167.. clicmd:: show bgp X:X::X:X [json]
42fc5d26 3168
8fcedbd2 3169 These commands display BGP routes. When no route is specified, the default
e6f59415 3170 is to display all BGP routes.
42fc5d26 3171
8fcedbd2 3172 ::
c1a54c05 3173
8fcedbd2
QY
3174 BGP table version is 0, local router ID is 10.1.1.1
3175 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
3176 Origin codes: i - IGP, e - EGP, ? - incomplete
42fc5d26 3177
8fcedbd2
QY
3178 Network Next Hop Metric LocPrf Weight Path
3179 \*> 1.1.1.1/32 0.0.0.0 0 32768 i
42fc5d26 3180
8fcedbd2 3181 Total number of prefixes 1
4da7fda3 3182
56c07345 3183 If ``wide`` option is specified, then the prefix table's width is increased
986b0fc3
DA
3184 to fully display the prefix and the nexthop.
3185
3186 This is especially handy dealing with IPv6 prefixes and
3187 if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled.
3188
56c07345 3189 If ``all`` option is specified, ``ip`` keyword is ignored, show bgp all and
96f3485c
MK
3190 show ip bgp all commands display routes for all AFIs and SAFIs.
3191
56c07345 3192 If ``json`` option is specified, output is displayed in JSON format.
96f3485c 3193
e6f59415
PG
3194Some other commands provide additional options for filtering the output.
3195
3196.. index:: show [ip] bgp regexp LINE
3197.. clicmd:: show [ip] bgp regexp LINE
42fc5d26 3198
8fcedbd2
QY
3199 This command displays BGP routes using AS path regular expression
3200 (:ref:`bgp-regular-expressions`).
42fc5d26 3201
96f3485c
MK
3202.. index:: show [ip] bgp [all] summary [json]
3203.. clicmd:: show [ip] bgp [all] summary [json]
42fc5d26 3204
8fcedbd2 3205 Show a bgp peer summary for the specified address family.
42fc5d26 3206
e6f59415
PG
3207The old command structure :clicmd:`show ip bgp` may be removed in the future
3208and should no longer be used. In order to reach the other BGP routing tables
3209other than the IPv6 routing table given by :clicmd:`show bgp`, the new command
3210structure is extended with :clicmd:`show bgp [afi] [safi]`.
3211
96f3485c
MK
3212.. index:: show bgp [afi] [safi] [all] [wide|json]
3213.. clicmd:: show bgp [afi] [safi] [all] [wide|json]
e6f59415
PG
3214
3215.. index:: show bgp <ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast>
3216.. clicmd:: show bgp <ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast>
3217
3218 These commands display BGP routes for the specific routing table indicated by
3219 the selected afi and the selected safi. If no afi and no safi value is given,
6cfd16ad
TA
3220 the command falls back to the default IPv6 routing table.
3221 For EVPN prefixes, you can display the full BGP table for this AFI/SAFI
3222 using the standard `show bgp [afi] [safi]` syntax.
3223
3224.. index:: show bgp l2vpn evpn route [type <macip|2|multicast|3|es|4|prefix|5>]
3225.. clicmd:: show bgp l2vpn evpn route [type <macip|2|multicast|3|es|4|prefix|5>]
3226
3227 Additionally, you can also filter this output by route type.
e6f59415 3228
96f3485c
MK
3229.. index:: show bgp [afi] [safi] [all] summary [json]
3230.. clicmd:: show bgp [afi] [safi] [all] summary [json]
e6f59415
PG
3231
3232 Show a bgp peer summary for the specified address family, and subsequent
3233 address-family.
3234
96f3485c
MK
3235.. index:: show bgp [afi] [safi] [all] summary failed [json]
3236.. clicmd:: show bgp [afi] [safi] [all] summary failed [json]
3577f1c5
DD
3237
3238 Show a bgp peer summary for peers that are not succesfully exchanging routes
3239 for the specified address family, and subsequent address-family.
3240
96f3485c
MK
3241.. index:: show bgp [afi] [safi] [all] summary established [json]
3242.. clicmd:: show bgp [afi] [safi] [all] summary established [json]
1c027267
DA
3243
3244 Show a bgp peer summary for peers that are succesfully exchanging routes
3245 for the specified address family, and subsequent address-family.
3246
e6f59415
PG
3247.. index:: show bgp [afi] [safi] neighbor [PEER]
3248.. clicmd:: show bgp [afi] [safi] neighbor [PEER]
9eb95b3b 3249
e6f59415
PG
3250 This command shows information on a specific BGP peer of the relevant
3251 afi and safi selected.
c1a54c05 3252
96f3485c
MK
3253.. index:: show bgp [afi] [safi] [all] dampening dampened-paths [wide|json]
3254.. clicmd:: show bgp [afi] [safi] [all] dampening dampened-paths [wide|json]
42fc5d26 3255
e6f59415
PG
3256 Display paths suppressed due to dampening of the selected afi and safi
3257 selected.
42fc5d26 3258
96f3485c
MK
3259.. index:: show bgp [afi] [safi] [all] dampening flap-statistics [wide|json]
3260.. clicmd:: show bgp [afi] [safi] [all] dampening flap-statistics [wide|json]
c1a54c05 3261
e6f59415 3262 Display flap statistics of routes of the selected afi and safi selected.
42fc5d26 3263
620e23e8
PG
3264.. index:: show bgp [afi] [safi] statistics
3265.. clicmd:: show bgp [afi] [safi] statistics
3266
3267 Display statistics of routes of the selected afi and safi.
3268
3269.. index:: show bgp statistics-all
3270.. clicmd:: show bgp statistics-all
3271
3272 Display statistics of routes of all the afi and safi.
3273
96f3485c
MK
3274.. index:: show [ip] bgp [afi] [safi] [all] cidr-only [wide|json]
3275.. clicmd:: show [ip] bgp [afi] [safi] [all] cidr-only [wide|json]
3276
3277 Display routes with non-natural netmasks.
3278
3279.. index:: show [ip] bgp [afi] [safi] [all] neighbors A.B.C.D [advertised-routes|received-routes|filtered-routes] [json|wide]
3280.. clicmd:: show [ip] bgp [afi] [safi] [all] neighbors A.B.C.D [advertised-routes|received-routes|filtered-routes] [json|wide]
3281
3282 Display the routes advertised to a BGP neighbor or received routes
3283 from neighbor or filtered routes received from neighbor based on the
3284 option specified.
3285
56c07345 3286 If ``wide`` option is specified, then the prefix table's width is increased
96f3485c
MK
3287 to fully display the prefix and the nexthop.
3288
3289 This is especially handy dealing with IPv6 prefixes and
3290 if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled.
3291
56c07345 3292 If ``all`` option is specified, ``ip`` keyword is ignored and,
96f3485c 3293 routes displayed for all AFIs and SAFIs.
56c07345 3294 if afi is specified, with ``all`` option, routes will be displayed for
96f3485c
MK
3295 each SAFI in the selcted AFI
3296
56c07345 3297 If ``json`` option is specified, output is displayed in JSON format.
96f3485c 3298
8fcedbd2 3299.. _bgp-display-routes-by-community:
42fc5d26 3300
8fcedbd2
QY
3301Displaying Routes by Community Attribute
3302----------------------------------------
42fc5d26 3303
8fcedbd2
QY
3304The following commands allow displaying routes based on their community
3305attribute.
42fc5d26 3306
96f3485c
MK
3307.. index:: show [ip] bgp <ipv4|ipv6> [all] community [wide|json]
3308.. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community [wide|json]
42fc5d26 3309
96f3485c
MK
3310.. index:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY [wide|json]
3311.. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY [wide|json]
42fc5d26 3312
96f3485c
MK
3313.. index:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY exact-match [wide|json]
3314.. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY exact-match [wide|json]
76bd1499 3315
8fcedbd2
QY
3316 These commands display BGP routes which have the community attribute.
3317 attribute. When ``COMMUNITY`` is specified, BGP routes that match that
3318 community are displayed. When `exact-match` is specified, it display only
3319 routes that have an exact match.
c3c5a71f 3320
8fcedbd2
QY
3321.. index:: show [ip] bgp <ipv4|ipv6> community-list WORD
3322.. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD
42fc5d26 3323
8fcedbd2
QY
3324.. index:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
3325.. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
42fc5d26 3326
8fcedbd2
QY
3327 These commands display BGP routes for the address family specified that
3328 match the specified community list. When `exact-match` is specified, it
3329 displays only routes that have an exact match.
42fc5d26 3330
56c07345 3331 If ``wide`` option is specified, then the prefix table's width is increased
96f3485c
MK
3332 to fully display the prefix and the nexthop.
3333
3334 This is especially handy dealing with IPv6 prefixes and
3335 if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled.
3336
56c07345 3337 If ``all`` option is specified, ``ip`` keyword is ignored and,
96f3485c 3338 routes displayed for all AFIs and SAFIs.
56c07345 3339 if afi is specified, with ``all`` option, routes will be displayed for
96f3485c
MK
3340 each SAFI in the selcted AFI
3341
56c07345 3342 If ``json`` option is specified, output is displayed in JSON format.
96f3485c 3343
36a206db 3344.. _bgp-display-routes-by-lcommunity:
3345
3346Displaying Routes by Large Community Attribute
3347----------------------------------------------
3348
ac2201bb 3349The following commands allow displaying routes based on their
36a206db 3350large community attribute.
3351
3352.. index:: show [ip] bgp <ipv4|ipv6> large-community
3353.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community
3354
3355.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
3356.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
3357
3358.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
3359.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
3360
3361.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
3362.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
3363
3364 These commands display BGP routes which have the large community attribute.
3365 attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that
ac2201bb
DA
3366 large community are displayed. When `exact-match` is specified, it display
3367 only routes that have an exact match. When `json` is specified, it display
36a206db 3368 routes in json format.
3369
3370.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
3371.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
3372
3373.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
3374.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
3375
3376.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
3377.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
3378
3379 These commands display BGP routes for the address family specified that
ac2201bb
DA
3380 match the specified large community list. When `exact-match` is specified,
3381 it displays only routes that have an exact match. When `json` is specified,
36a206db 3382 it display routes in json format.
3383
8fcedbd2 3384.. _bgp-display-routes-by-as-path:
42fc5d26 3385
36a206db 3386
8fcedbd2
QY
3387Displaying Routes by AS Path
3388----------------------------
42fc5d26 3389
8fcedbd2
QY
3390.. index:: show bgp ipv4|ipv6 regexp LINE
3391.. clicmd:: show bgp ipv4|ipv6 regexp LINE
76bd1499 3392
8fcedbd2
QY
3393 This commands displays BGP routes that matches a regular
3394 expression `line` (:ref:`bgp-regular-expressions`).
3395
e6f59415
PG
3396.. index:: show [ip] bgp ipv4 vpn
3397.. clicmd:: show [ip] bgp ipv4 vpn
8fcedbd2 3398
e6f59415
PG
3399.. index:: show [ip] bgp ipv6 vpn
3400.. clicmd:: show [ip] bgp ipv6 vpn
8fcedbd2
QY
3401
3402 Print active IPV4 or IPV6 routes advertised via the VPN SAFI.
3403
3404.. index:: show bgp ipv4 vpn summary
3405.. clicmd:: show bgp ipv4 vpn summary
3406
3407.. index:: show bgp ipv6 vpn summary
3408.. clicmd:: show bgp ipv6 vpn summary
3409
3410 Print a summary of neighbor connections for the specified AFI/SAFI combination.
3411
09d78f10
DS
3412Displaying Update Group Information
3413-----------------------------------
3414
6c5be52a
SR
3415.. index:: show bgp update-groups SUBGROUP-ID [advertise-queue|advertised-routes|packet-queue]
3416.. clicmd:: show bgp update-groups [advertise-queue|advertised-routes|packet-queue]
09d78f10
DS
3417
3418 Display Information about each individual update-group being used.
3419 If SUBGROUP-ID is specified only display about that particular group. If
3420 advertise-queue is specified the list of routes that need to be sent
3421 to the peers in the update-group is displayed, advertised-routes means
a64e0ee5 3422 the list of routes we have sent to the peers in the update-group and
09d78f10
DS
3423 packet-queue specifies the list of packets in the queue to be sent.
3424
6c5be52a
SR
3425.. index:: show bgp update-groups statistics
3426.. clicmd:: show bgp update-groups statistics
09d78f10
DS
3427
3428 Display Information about update-group events in FRR.
8fcedbd2
QY
3429
3430.. _bgp-route-reflector:
3431
3432Route Reflector
3433===============
3434
749afd7d
RF
3435BGP routers connected inside the same AS through BGP belong to an internal
3436BGP session, or IBGP. In order to prevent routing table loops, IBGP does not
3437advertise IBGP-learned routes to other routers in the same session. As such,
3438IBGP requires a full mesh of all peers. For large networks, this quickly becomes
3439unscalable. Introducing route reflectors removes the need for the full-mesh.
8fcedbd2 3440
749afd7d
RF
3441When route reflectors are configured, these will reflect the routes announced
3442by the peers configured as clients. A route reflector client is configured
3443with:
8fcedbd2
QY
3444
3445.. index:: neighbor PEER route-reflector-client
3446.. clicmd:: neighbor PEER route-reflector-client
3447
3d13052d 3448.. index:: neighbor PEER route-reflector-client
8fcedbd2 3449.. clicmd:: no neighbor PEER route-reflector-client
c3c5a71f 3450
749afd7d
RF
3451To avoid single points of failure, multiple route reflectors can be configured.
3452
3453A cluster is a collection of route reflectors and their clients, and is used
3454by route reflectors to avoid looping.
3455
3456.. index:: bgp cluster-id A.B.C.D
3457.. clicmd:: bgp cluster-id A.B.C.D
42fc5d26 3458
3d13052d 3459.. index:: bgp no-rib
8dad2243
DS
3460.. clicmd:: [no] bgp no-rib
3461
3462To set and unset the BGP daemon ``-n`` / ``--no_kernel`` options during runtime
3463to disable BGP route installation to the RIB (Zebra), the ``[no] bgp no-rib``
3464commands can be used;
3465
3466Please note that setting the option during runtime will withdraw all routes in
3467the daemons RIB from Zebra and unsetting it will announce all routes in the
3468daemons RIB to Zebra. If the option is passed as a command line argument when
3469starting the daemon and the configuration gets saved, the option will persist
3470unless removed from the configuration with the negating command prior to the
3471configuration write operation.
3472
9a06c157
DS
3473.. index:: [no] bgp send-extra-data zebra
3474.. clicmd:: [no] bgp send-extra-data zebra
3475
3476 This Command turns off the ability of BGP to send extra data to zebra.
3477In this case it's the AS-Path being used for the path. The default behavior
3478in BGP is to send this data and to turn it off enter the no form of the command.
3479If extra data was sent to zebra, and this command is turned on there is no
3480effort to clean up this data in the rib.
3481
1cc55938
S
3482.. _bgp-suppress-fib:
3483
3484Suppressing routes not installed in FIB
3485=======================================
3486
3487The FRR implementation of BGP advertises prefixes learnt from a peer to other
3488peers even if the routes do not get installed in the FIB. There can be
3489scenarios where the hardware tables in some of the routers (along the path from
3490the source to destination) is full which will result in all routes not getting
3491installed in the FIB. If these routes are advertised to the downstream routers
3492then traffic will start flowing and will be dropped at the intermediate router.
3493
3494The solution is to provide a configurable option to check for the FIB install
3495status of the prefixes and advertise to peers if the prefixes are successfully
3496installed in the FIB. The advertisement of the prefixes are suppressed if it is
3497not installed in FIB.
3498
3499The following conditions apply will apply when checking for route installation
3500status in FIB:
0ea5223c 3501
1cc55938
S
35021. The advertisement or suppression of routes based on FIB install status
3503 applies only for newly learnt routes from peer (routes which are not in
3504 BGP local RIB).
35052. If the route received from peer already exists in BGP local RIB and route
3506 attributes have changed (best path changed), the old path is deleted and
3507 new path is installed in FIB. The FIB install status will not have any
3508 effect. Therefore only when the route is received first time the checks
3509 apply.
35103. The feature will not apply for routes learnt through other means like
3511 redistribution to bgp from other protocols. This is applicable only to
3512 peer learnt routes.
35134. If a route is installed in FIB and then gets deleted from the dataplane,
3514 then routes will not be withdrawn from peers. This will be considered as
3515 dataplane issue.
35165. The feature will slightly increase the time required to advertise the routes
3517 to peers since the route install status needs to be received from the FIB
35186. If routes are received by the peer before the configuration is applied, then
3519 the bgp sessions need to be reset for the configuration to take effect.
35207. If the route which is already installed in dataplane is removed for some
3521 reason, sending withdraw message to peers is not currently supported.
3522
3d13052d 3523.. index:: bgp suppress-fib-pending
1cc55938 3524.. clicmd:: [no] bgp suppress-fib-pending
8dad2243 3525
0efdf0fe 3526.. _routing-policy:
42fc5d26 3527
8fcedbd2
QY
3528Routing Policy
3529==============
42fc5d26 3530
4da7fda3 3531You can set different routing policy for a peer. For example, you can set
9eb95b3b
QY
3532different filter for a peer.
3533
3534.. code-block:: frr
c1a54c05 3535
c1a54c05
QY
3536 !
3537 router bgp 1 view 1
3538 neighbor 10.0.0.1 remote-as 2
3539 address-family ipv4 unicast
3540 neighbor 10.0.0.1 distribute-list 1 in
3541 exit-address-family
3542 !
3543 router bgp 1 view 2
3544 neighbor 10.0.0.1 remote-as 2
3545 address-family ipv4 unicast
3546 neighbor 10.0.0.1 distribute-list 2 in
3547 exit-address-family
c3c5a71f 3548
4da7fda3
QY
3549This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2.
3550When the update is inserted into view 1, distribute-list 1 is applied. On the
3551other hand, when the update is inserted into view 2, distribute-list 2 is
3552applied.
42fc5d26 3553
42fc5d26 3554
0efdf0fe 3555.. _bgp-regular-expressions:
42fc5d26
QY
3556
3557BGP Regular Expressions
3558=======================
3559
8fcedbd2
QY
3560BGP regular expressions are based on :t:`POSIX 1003.2` regular expressions. The
3561following description is just a quick subset of the POSIX regular expressions.
42fc5d26
QY
3562
3563
8fcedbd2 3564.\*
c1a54c05 3565 Matches any single character.
42fc5d26 3566
8fcedbd2 3567\*
c1a54c05 3568 Matches 0 or more occurrences of pattern.
42fc5d26 3569
8fcedbd2 3570\+
c1a54c05 3571 Matches 1 or more occurrences of pattern.
42fc5d26
QY
3572
3573?
c1a54c05 3574 Match 0 or 1 occurrences of pattern.
42fc5d26
QY
3575
3576^
c1a54c05 3577 Matches the beginning of the line.
42fc5d26
QY
3578
3579$
c1a54c05 3580 Matches the end of the line.
42fc5d26
QY
3581
3582_
8fcedbd2
QY
3583 The ``_`` character has special meanings in BGP regular expressions. It
3584 matches to space and comma , and AS set delimiter ``{`` and ``}`` and AS
3585 confederation delimiter ``(`` and ``)``. And it also matches to the
3586 beginning of the line and the end of the line. So ``_`` can be used for AS
3587 value boundaries match. This character technically evaluates to
3588 ``(^|[,{}()]|$)``.
42fc5d26 3589
42fc5d26 3590
c1a54c05 3591.. _bgp-configuration-examples:
42fc5d26 3592
8fcedbd2
QY
3593Miscellaneous Configuration Examples
3594====================================
42fc5d26 3595
9eb95b3b
QY
3596Example of a session to an upstream, advertising only one prefix to it.
3597
3598.. code-block:: frr
42fc5d26 3599
c1a54c05
QY
3600 router bgp 64512
3601 bgp router-id 10.236.87.1
3602 neighbor upstream peer-group
3603 neighbor upstream remote-as 64515
3604 neighbor upstream capability dynamic
3605 neighbor 10.1.1.1 peer-group upstream
3606 neighbor 10.1.1.1 description ACME ISP
c3c5a71f 3607
c1a54c05
QY
3608 address-family ipv4 unicast
3609 network 10.236.87.0/24
3610 neighbor upstream prefix-list pl-allowed-adv out
3611 exit-address-family
3612 !
3613 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
3614 ip prefix-list pl-allowed-adv seq 10 deny any
42fc5d26 3615
aa9eafa4
QY
3616A more complex example including upstream, peer and customer sessions
3617advertising global prefixes and NO_EXPORT prefixes and providing actions for
3618customer routes based on community values. Extensive use is made of route-maps
3619and the 'call' feature to support selective advertising of prefixes. This
3620example is intended as guidance only, it has NOT been tested and almost
3621certainly contains silly mistakes, if not serious flaws.
42fc5d26 3622
9eb95b3b 3623.. code-block:: frr
42fc5d26 3624
c1a54c05
QY
3625 router bgp 64512
3626 bgp router-id 10.236.87.1
3627 neighbor upstream capability dynamic
3628 neighbor cust capability dynamic
3629 neighbor peer capability dynamic
3630 neighbor 10.1.1.1 remote-as 64515
3631 neighbor 10.1.1.1 peer-group upstream
3632 neighbor 10.2.1.1 remote-as 64516
3633 neighbor 10.2.1.1 peer-group upstream
3634 neighbor 10.3.1.1 remote-as 64517
3635 neighbor 10.3.1.1 peer-group cust-default
3636 neighbor 10.3.1.1 description customer1
3637 neighbor 10.4.1.1 remote-as 64518
3638 neighbor 10.4.1.1 peer-group cust
3639 neighbor 10.4.1.1 description customer2
3640 neighbor 10.5.1.1 remote-as 64519
3641 neighbor 10.5.1.1 peer-group peer
3642 neighbor 10.5.1.1 description peer AS 1
3643 neighbor 10.6.1.1 remote-as 64520
3644 neighbor 10.6.1.1 peer-group peer
3645 neighbor 10.6.1.1 description peer AS 2
3646
3647 address-family ipv4 unicast
3648 network 10.123.456.0/24
3649 network 10.123.456.128/25 route-map rm-no-export
3650 neighbor upstream route-map rm-upstream-out out
3651 neighbor cust route-map rm-cust-in in
3652 neighbor cust route-map rm-cust-out out
3653 neighbor cust send-community both
3654 neighbor peer route-map rm-peer-in in
3655 neighbor peer route-map rm-peer-out out
3656 neighbor peer send-community both
3657 neighbor 10.3.1.1 prefix-list pl-cust1-network in
3658 neighbor 10.4.1.1 prefix-list pl-cust2-network in
3659 neighbor 10.5.1.1 prefix-list pl-peer1-network in
3660 neighbor 10.6.1.1 prefix-list pl-peer2-network in
3661 exit-address-family
3662 !
3663 ip prefix-list pl-default permit 0.0.0.0/0
3664 !
3665 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
3666 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
3667 !
3668 ip prefix-list pl-cust1-network permit 10.3.1.0/24
3669 ip prefix-list pl-cust1-network permit 10.3.2.0/24
3670 !
3671 ip prefix-list pl-cust2-network permit 10.4.1.0/24
3672 !
3673 ip prefix-list pl-peer1-network permit 10.5.1.0/24
3674 ip prefix-list pl-peer1-network permit 10.5.2.0/24
3675 ip prefix-list pl-peer1-network permit 192.168.0.0/24
3676 !
3677 ip prefix-list pl-peer2-network permit 10.6.1.0/24
3678 ip prefix-list pl-peer2-network permit 10.6.2.0/24
3679 ip prefix-list pl-peer2-network permit 192.168.1.0/24
3680 ip prefix-list pl-peer2-network permit 192.168.2.0/24
3681 ip prefix-list pl-peer2-network permit 172.16.1/24
3682 !
9b6fddd4
DS
3683 bgp as-path access-list asp-own-as permit ^$
3684 bgp as-path access-list asp-own-as permit _64512_
c1a54c05
QY
3685 !
3686 ! #################################################################
3687 ! Match communities we provide actions for, on routes receives from
3688 ! customers. Communities values of <our-ASN>:X, with X, have actions:
3689 !
3690 ! 100 - blackhole the prefix
3691 ! 200 - set no_export
3692 ! 300 - advertise only to other customers
3693 ! 400 - advertise only to upstreams
3694 ! 500 - set no_export when advertising to upstreams
3695 ! 2X00 - set local_preference to X00
3696 !
3697 ! blackhole the prefix of the route
a64e0ee5 3698 bgp community-list standard cm-blackhole permit 64512:100
c1a54c05
QY
3699 !
3700 ! set no-export community before advertising
a64e0ee5 3701 bgp community-list standard cm-set-no-export permit 64512:200
c1a54c05
QY
3702 !
3703 ! advertise only to other customers
a64e0ee5 3704 bgp community-list standard cm-cust-only permit 64512:300
c1a54c05
QY
3705 !
3706 ! advertise only to upstreams
a64e0ee5 3707 bgp community-list standard cm-upstream-only permit 64512:400
c1a54c05
QY
3708 !
3709 ! advertise to upstreams with no-export
a64e0ee5 3710 bgp community-list standard cm-upstream-noexport permit 64512:500
c1a54c05
QY
3711 !
3712 ! set local-pref to least significant 3 digits of the community
a64e0ee5
DA
3713 bgp community-list standard cm-prefmod-100 permit 64512:2100
3714 bgp community-list standard cm-prefmod-200 permit 64512:2200
3715 bgp community-list standard cm-prefmod-300 permit 64512:2300
3716 bgp community-list standard cm-prefmod-400 permit 64512:2400
3717 bgp community-list expanded cme-prefmod-range permit 64512:2...
c1a54c05
QY
3718 !
3719 ! Informational communities
3720 !
3721 ! 3000 - learned from upstream
3722 ! 3100 - learned from customer
3723 ! 3200 - learned from peer
3724 !
a64e0ee5
DA
3725 bgp community-list standard cm-learnt-upstream permit 64512:3000
3726 bgp community-list standard cm-learnt-cust permit 64512:3100
3727 bgp community-list standard cm-learnt-peer permit 64512:3200
c1a54c05
QY
3728 !
3729 ! ###################################################################
3730 ! Utility route-maps
3731 !
3732 ! These utility route-maps generally should not used to permit/deny
3733 ! routes, i.e. they do not have meaning as filters, and hence probably
3734 ! should be used with 'on-match next'. These all finish with an empty
3735 ! permit entry so as not interfere with processing in the caller.
3736 !
3737 route-map rm-no-export permit 10
3738 set community additive no-export
3739 route-map rm-no-export permit 20
3740 !
3741 route-map rm-blackhole permit 10
f6aa36f5 3742 description blackhole, up-pref and ensure it cannot escape this AS
c1a54c05
QY
3743 set ip next-hop 127.0.0.1
3744 set local-preference 10
3745 set community additive no-export
3746 route-map rm-blackhole permit 20
3747 !
3748 ! Set local-pref as requested
3749 route-map rm-prefmod permit 10
3750 match community cm-prefmod-100
3751 set local-preference 100
3752 route-map rm-prefmod permit 20
3753 match community cm-prefmod-200
3754 set local-preference 200
3755 route-map rm-prefmod permit 30
3756 match community cm-prefmod-300
3757 set local-preference 300
3758 route-map rm-prefmod permit 40
3759 match community cm-prefmod-400
3760 set local-preference 400
3761 route-map rm-prefmod permit 50
3762 !
3763 ! Community actions to take on receipt of route.
3764 route-map rm-community-in permit 10
3765 description check for blackholing, no point continuing if it matches.
3766 match community cm-blackhole
3767 call rm-blackhole
3768 route-map rm-community-in permit 20
3769 match community cm-set-no-export
3770 call rm-no-export
3771 on-match next
3772 route-map rm-community-in permit 30
3773 match community cme-prefmod-range
3774 call rm-prefmod
3775 route-map rm-community-in permit 40
3776 !
3777 ! #####################################################################
3778 ! Community actions to take when advertising a route.
3779 ! These are filtering route-maps,
3780 !
3781 ! Deny customer routes to upstream with cust-only set.
3782 route-map rm-community-filt-to-upstream deny 10
3783 match community cm-learnt-cust
3784 match community cm-cust-only
3785 route-map rm-community-filt-to-upstream permit 20
3786 !
3787 ! Deny customer routes to other customers with upstream-only set.
3788 route-map rm-community-filt-to-cust deny 10
3789 match community cm-learnt-cust
3790 match community cm-upstream-only
3791 route-map rm-community-filt-to-cust permit 20
3792 !
3793 ! ###################################################################
3794 ! The top-level route-maps applied to sessions. Further entries could
3795 ! be added obviously..
3796 !
3797 ! Customers
3798 route-map rm-cust-in permit 10
3799 call rm-community-in
3800 on-match next
3801 route-map rm-cust-in permit 20
3802 set community additive 64512:3100
3803 route-map rm-cust-in permit 30
3804 !
3805 route-map rm-cust-out permit 10
3806 call rm-community-filt-to-cust
3807 on-match next
3808 route-map rm-cust-out permit 20
3809 !
3810 ! Upstream transit ASes
3811 route-map rm-upstream-out permit 10
3812 description filter customer prefixes which are marked cust-only
3813 call rm-community-filt-to-upstream
3814 on-match next
3815 route-map rm-upstream-out permit 20
3816 description only customer routes are provided to upstreams/peers
3817 match community cm-learnt-cust
3818 !
3819 ! Peer ASes
3820 ! outbound policy is same as for upstream
3821 route-map rm-peer-out permit 10
3822 call rm-upstream-out
3823 !
3824 route-map rm-peer-in permit 10
3825 set community additive 64512:3200
c3c5a71f 3826
8fcedbd2
QY
3827
3828Example of how to set up a 6-Bone connection.
3829
3830.. code-block:: frr
3831
3832 ! bgpd configuration
3833 ! ==================
3834 !
3835 ! MP-BGP configuration
3836 !
3837 router bgp 7675
3838 bgp router-id 10.0.0.1
3839 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number`
3840 !
3841 address-family ipv6
3842 network 3ffe:506::/32
3843 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
3844 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
3845 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number`
3846 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
3847 exit-address-family
3848 !
3849 ipv6 access-list all permit any
3850 !
3851 ! Set output nexthop address.
3852 !
3853 route-map set-nexthop permit 10
3854 match ipv6 address all
3855 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
3856 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
3857 !
3858 log file bgpd.log
3859 !
3860
3861
9e146a81 3862.. include:: routeserver.rst
f3817860
QY
3863
3864.. include:: rpki.rst
c1a54c05 3865
ed647ed2 3866.. include:: wecmp_linkbw.rst
3867
00458d01
PG
3868.. include:: flowspec.rst
3869
d1e7591e 3870.. [#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
3871.. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
3872.. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
3873.. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002