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