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