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