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