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