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