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