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