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