blob: a9c4810f6a56abbb63f6ee6c8da4926c7fdab045 [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}
4@c See file quagga.texi for copying conditions.
paul718e3742002-12-13 20:15:29 +00005@node BGP
paul718e3742002-12-13 20:15:29 +00006@chapter BGP
7
paulaa5943f2005-11-04 21:53:59 +00008@acronym{BGP} stands for a Border Gateway Protocol. The lastest BGP version
paul718e3742002-12-13 20:15:29 +00009is 4. It is referred as BGP-4. BGP-4 is one of the Exterior Gateway
10Protocols and de-fact standard of Inter Domain routing protocol.
paulaa5943f2005-11-04 21:53:59 +000011BGP-4 is described in @cite{RFC1771, A Border Gateway Protocol
paul718e3742002-12-13 20:15:29 +0000124 (BGP-4)}.
13
paulaa5943f2005-11-04 21:53:59 +000014Many extensions have been added to @cite{RFC1771}. @cite{RFC2858,
15Multiprotocol Extensions for BGP-4} provides multiprotocol support to
16BGP-4.
paul718e3742002-12-13 20:15:29 +000017
18@menu
19* Starting BGP::
20* BGP router::
21* BGP network::
22* BGP Peer::
23* BGP Peer Group::
24* BGP Address Family::
25* Autonomous System::
26* BGP Communities Attribute::
27* BGP Extended Communities Attribute::
28* Displaying BGP routes::
29* Capability Negotiation::
30* Route Reflector::
31* Route Server::
32* How to set up a 6-Bone connection::
33* Dump BGP packets and table::
paulaa5943f2005-11-04 21:53:59 +000034* BGP Configuration Examples::
paul718e3742002-12-13 20:15:29 +000035@end menu
36
paul76b89b42004-11-06 17:13:09 +000037@node Starting BGP
paul718e3742002-12-13 20:15:29 +000038@section Starting BGP
39
40Default configuration file of @command{bgpd} is @file{bgpd.conf}.
41@command{bgpd} searches the current directory first then
42@value{INSTALL_PREFIX_ETC}/bgpd.conf. All of bgpd's command must be
43configured in @file{bgpd.conf}.
44
45@command{bgpd} specific invocation options are described below. Common
46options may also be specified (@pxref{Common Invocation Options}).
47
48@table @samp
49@item -p @var{PORT}
50@itemx --bgp_port=@var{PORT}
51Set the bgp protocol's port number.
52
53@item -r
54@itemx --retain
55When program terminates, retain BGP routes added by zebra.
56@end table
57
paul76b89b42004-11-06 17:13:09 +000058@node BGP router
paul718e3742002-12-13 20:15:29 +000059@section BGP router
60
61 First of all you must configure BGP router with @command{router bgp}
62command. To configure BGP router, you need AS number. AS number is an
63identification of autonomous system. BGP protocol uses the AS number
64for detecting whether the BGP connection is internal one or external one.
65
66@deffn Command {router bgp @var{asn}} {}
67Enable a BGP protocol process with the specified @var{asn}. After
68this statement you can input any @code{BGP Commands}. You can not
69create different BGP process under different @var{asn} without
70specifying @code{multiple-instance} (@pxref{Multiple instance}).
71@end deffn
72
73@deffn Command {no router bgp @var{asn}} {}
74Destroy a BGP protocol process with the specified @var{asn}.
75@end deffn
76
77@deffn {BGP} {bgp router-id @var{A.B.C.D}} {}
78This command specifies the router-ID. If @command{bgpd} connects to @command{zebra} it gets
79interface and address information. In that case default router ID value
80is selected as the largest IP Address of the interfaces. When
81@code{router zebra} is not enabled @command{bgpd} can't get interface information
82so @code{router-id} is set to 0.0.0.0. So please set router-id by hand.
83@end deffn
84
85@menu
86* BGP distance::
87* BGP decision process::
88@end menu
89
paul76b89b42004-11-06 17:13:09 +000090@node BGP distance
paul718e3742002-12-13 20:15:29 +000091@subsection BGP distance
92
93@deffn {BGP} {distance bgp <1-255> <1-255> <1-255>} {}
94This command change distance value of BGP. Each argument is distance
95value for external routes, internal routes and local routes.
96@end deffn
97
98@deffn {BGP} {distance <1-255> @var{A.B.C.D/M}} {}
99@deffnx {BGP} {distance <1-255> @var{A.B.C.D/M} @var{word}} {}
100This command set distance value to
101@end deffn
102
paul76b89b42004-11-06 17:13:09 +0000103@node BGP decision process
paul718e3742002-12-13 20:15:29 +0000104@subsection BGP decision process
105
106@table @asis
107@item 1. Weight check
108
109@item 2. Local preference check.
110
111@item 3. Local route check.
112
113@item 4. AS path length check.
114
115@item 5. Origin check.
116
117@item 6. MED check.
118@end table
119
hasso68118452005-04-08 15:40:36 +0000120@deffn {BGP} {bgp bestpath as-path confed} {}
121This command specifies that the length of confederation path sets and
122sequences should should be taken into account during the BGP best path
123decision process.
124@end deffn
125
paul76b89b42004-11-06 17:13:09 +0000126@node BGP network
paul718e3742002-12-13 20:15:29 +0000127@section BGP network
128
129@menu
130* BGP route::
131* Route Aggregation::
132* Redistribute to BGP::
133@end menu
134
paul76b89b42004-11-06 17:13:09 +0000135@node BGP route
paul718e3742002-12-13 20:15:29 +0000136@subsection BGP route
137
138@deffn {BGP} {network @var{A.B.C.D/M}} {}
139This command adds the announcement network.
140@example
141@group
142router bgp 1
143 network 10.0.0.0/8
144@end group
145@end example
146This configuration example says that network 10.0.0.0/8 will be
147announced to all neighbors. Some vendors' routers don't advertise
148routes if they aren't present in their IGP routing tables; @code{bgp}
149doesn't care about IGP routes when announcing its routes.
150@end deffn
151
152@deffn {BGP} {no network @var{A.B.C.D/M}} {}
153@end deffn
154
paul76b89b42004-11-06 17:13:09 +0000155@node Route Aggregation
paul718e3742002-12-13 20:15:29 +0000156@subsection Route Aggregation
157
158@deffn {BGP} {aggregate-address @var{A.B.C.D/M}} {}
159This command specifies an aggregate address.
160@end deffn
161
162@deffn {BGP} {aggregate-address @var{A.B.C.D/M} as-set} {}
163This command specifies an aggregate address. Resulting routes inlucde
164AS set.
165@end deffn
166
167@deffn {BGP} {aggregate-address @var{A.B.C.D/M} summary-only} {}
168This command specifies an aggregate address. Aggreated routes will
169not be announce.
170@end deffn
171
172@deffn {BGP} {no aggregate-address @var{A.B.C.D/M}} {}
173@end deffn
174
paul76b89b42004-11-06 17:13:09 +0000175@node Redistribute to BGP
paul718e3742002-12-13 20:15:29 +0000176@subsection Redistribute to BGP
177
178@deffn {BGP} {redistribute kernel} {}
179Redistribute kernel route to BGP process.
180@end deffn
181
182@deffn {BGP} {redistribute static} {}
183Redistribute static route to BGP process.
184@end deffn
185
186@deffn {BGP} {redistribute connected} {}
187Redistribute connected route to BGP process.
188@end deffn
189
190@deffn {BGP} {redistribute rip} {}
191Redistribute RIP route to BGP process.
192@end deffn
193
194@deffn {BGP} {redistribute ospf} {}
195Redistribute OSPF route to BGP process.
196@end deffn
197
paul76b89b42004-11-06 17:13:09 +0000198@node BGP Peer
paul718e3742002-12-13 20:15:29 +0000199@section BGP Peer
200
201@menu
202* Defining Peer::
203* BGP Peer commands::
204* Peer filtering::
205@end menu
206
paul76b89b42004-11-06 17:13:09 +0000207@node Defining Peer
paul718e3742002-12-13 20:15:29 +0000208@subsection Defining Peer
209
210@deffn {BGP} {neighbor @var{peer} remote-as @var{asn}} {}
211Creates a new neighbor whose remote-as is @var{asn}. @var{peer}
212can be an IPv4 address or an IPv6 address.
213@example
214@group
215router bgp 1
216 neighbor 10.0.0.1 remote-as 2
217@end group
218@end example
219In this case my router, in AS-1, is trying to peer with AS-2 at
22010.0.0.1.
221
222This command must be the first command used when configuring a neighbor.
223If the remote-as is not specified, @command{bgpd} will complain like this:
224@example
225can't find neighbor 10.0.0.1
226@end example
227@end deffn
228
paul76b89b42004-11-06 17:13:09 +0000229@node BGP Peer commands
paul718e3742002-12-13 20:15:29 +0000230@subsection BGP Peer commands
231
232In a @code{router bgp} clause there are neighbor specific configurations
233required.
234
235@deffn {BGP} {neighbor @var{peer} shutdown} {}
236@deffnx {BGP} {no neighbor @var{peer} shutdown} {}
237Shutdown the peer. We can delete the neighbor's configuration by
238@code{no neighbor @var{peer} remote-as @var{as-number}} but all
239configuration of the neighbor will be deleted. When you want to
240preserve the configuration, but want to drop the BGP peer, use this
241syntax.
242@end deffn
243
244@deffn {BGP} {neighbor @var{peer} ebgp-multihop} {}
245@deffnx {BGP} {no neighbor @var{peer} ebgp-multihop} {}
246@end deffn
247
248@deffn {BGP} {neighbor @var{peer} description ...} {}
249@deffnx {BGP} {no neighbor @var{peer} description ...} {}
250Set description of the peer.
251@end deffn
252
253@deffn {BGP} {neighbor @var{peer} version @var{version}} {}
254Set up the neighbor's BGP version. @var{version} can be @var{4},
255@var{4+} or @var{4-}. BGP version @var{4} is the default value used for
256BGP peering. BGP version @var{4+} means that the neighbor supports
257Multiprotocol Extensions for BGP-4. BGP version @var{4-} is similar but
258the neighbor speaks the old Internet-Draft revision 00's Multiprotocol
259Extensions for BGP-4. Some routing software is still using this
260version.
261@end deffn
262
263@deffn {BGP} {neighbor @var{peer} interface @var{ifname}} {}
264@deffnx {BGP} {no neighbor @var{peer} interface @var{ifname}} {}
265When you connect to a BGP peer over an IPv6 link-local address, you have
266to specify the @var{ifname} of the interface used for the connection.
267@end deffn
268
269@deffn {BGP} {neighbor @var{peer} next-hop-self} {}
270@deffnx {BGP} {no neighbor @var{peer} next-hop-self} {}
271This command specifies an announced route's nexthop as being equivalent
272to the address of the bgp router.
273@end deffn
274
275@deffn {BGP} {neighbor @var{peer} update-source} {}
276@deffnx {BGP} {no neighbor @var{peer} update-source} {}
277@end deffn
278
279@deffn {BGP} {neighbor @var{peer} default-originate} {}
280@deffnx {BGP} {no neighbor @var{peer} default-originate} {}
281@command{bgpd}'s default is to not announce the default route (0.0.0.0/0) even it
282is in routing table. When you want to announce default routes to the
283peer, use this command.
284@end deffn
285
286@deffn {BGP} {neighbor @var{peer} port @var{port}} {}
287@deffnx {BGP} {neighbor @var{peer} port @var{port}} {}
288@end deffn
289
290@deffn {BGP} {neighbor @var{peer} send-community} {}
291@deffnx {BGP} {neighbor @var{peer} send-community} {}
292@end deffn
293
294@deffn {BGP} {neighbor @var{peer} weight @var{weight}} {}
295@deffnx {BGP} {no neighbor @var{peer} weight @var{weight}} {}
296This command specifies a default @var{weight} value for the neighbor's
297routes.
298@end deffn
299
300@deffn {BGP} {neighbor @var{peer} maximum-prefix @var{number}} {}
301@deffnx {BGP} {no neighbor @var{peer} maximum-prefix @var{number}} {}
302@end deffn
303
paul76b89b42004-11-06 17:13:09 +0000304@node Peer filtering
paul718e3742002-12-13 20:15:29 +0000305@subsection Peer filtering
306
307@deffn {BGP} {neighbor @var{peer} distribute-list @var{name} [in|out]} {}
308This command specifies a distribute-list for the peer. @var{direct} is
309@samp{in} or @samp{out}.
310@end deffn
311
312@deffn {BGP command} {neighbor @var{peer} prefix-list @var{name} [in|out]} {}
313@end deffn
314
315@deffn {BGP command} {neighbor @var{peer} filter-list @var{name} [in|out]} {}
316@end deffn
317
318@deffn {BGP} {neighbor @var{peer} route-map @var{name} [in|out]} {}
319Apply a route-map on the neighbor. @var{direct} must be @code{in} or
320@code{out}.
321@end deffn
322
323@c -----------------------------------------------------------------------
paul76b89b42004-11-06 17:13:09 +0000324@node BGP Peer Group
paul718e3742002-12-13 20:15:29 +0000325@section BGP Peer Group
326
327@deffn {BGP} {neighbor @var{word} peer-group} {}
328This command defines a new peer group.
329@end deffn
330
331@deffn {BGP} {neighbor @var{peer} peer-group @var{word}} {}
332This command bind specific peer to peer group @var{word}.
333@end deffn
334
paul76b89b42004-11-06 17:13:09 +0000335@node BGP Address Family
paul718e3742002-12-13 20:15:29 +0000336@section BGP Address Family
337
paul718e3742002-12-13 20:15:29 +0000338@c -----------------------------------------------------------------------
paul76b89b42004-11-06 17:13:09 +0000339@node Autonomous System
paul718e3742002-12-13 20:15:29 +0000340@section Autonomous System
341
paulaa5943f2005-11-04 21:53:59 +0000342The @acronym{AS,Autonomous System} number is one of the essential
343element of BGP. BGP is a distance vector routing protocol, and the
344AS-Path framework provides distance vector metric and loop detection to
345BGP. @cite{RFC1930, Guidelines for creation, selection, and
346registration of an Autonomous System (AS)} provides some background on
347the concepts of an AS.
paul718e3742002-12-13 20:15:29 +0000348
paulaa5943f2005-11-04 21:53:59 +0000349The AS number is a two octet value, ranging in value from 1 to 65535.
350The AS numbers 64512 through 65535 are defined as private AS numbers.
351Private AS numbers must not to be advertised in the global Internet.
paul718e3742002-12-13 20:15:29 +0000352
353@menu
354* AS Path Regular Expression::
355* Display BGP Routes by AS Path::
356* AS Path Access List::
357* Using AS Path in Route Map::
358* Private AS Numbers::
359@end menu
360
paul76b89b42004-11-06 17:13:09 +0000361@node AS Path Regular Expression
paul718e3742002-12-13 20:15:29 +0000362@subsection AS Path Regular Expression
363
paulaa5943f2005-11-04 21:53:59 +0000364AS path regular expression can be used for displaying BGP routes and
paul718e3742002-12-13 20:15:29 +0000365AS path access list. AS path regular expression is based on
366@code{POSIX 1003.2} regular expressions. Following description is
367just a subset of @code{POSIX} regular expression. User can use full
368@code{POSIX} regular expression. Adding to that special character '_'
369is added for AS path regular expression.
370
371@table @code
372@item .
373Matches any single character.
374@item *
375Matches 0 or more occurrences of pattern.
376@item +
377Matches 1 or more occurrences of pattern.
378@item ?
379Match 0 or 1 occurrences of pattern.
380@item ^
381Matches the beginning of the line.
382@item $
383Matches the end of the line.
384@item _
385Character @code{_} has special meanings in AS path regular expression.
386It matches to space and comma , and AS set delimiter @{ and @} and AS
387confederation delimiter @code{(} and @code{)}. And it also matches to
388the beginning of the line and the end of the line. So @code{_} can be
389used for AS value boundaries match. @code{show ip bgp regexp _7675_}
390matches to all of BGP routes which as AS number include @var{7675}.
391@end table
392
paul76b89b42004-11-06 17:13:09 +0000393@node Display BGP Routes by AS Path
paul718e3742002-12-13 20:15:29 +0000394@subsection Display BGP Routes by AS Path
395
paulaa5943f2005-11-04 21:53:59 +0000396To show BGP routes which has specific AS path information @code{show
paul718e3742002-12-13 20:15:29 +0000397ip bgp} command can be used.
398
399@deffn Command {show ip bgp regexp @var{line}} {}
400This commands display BGP routes that matches AS path regular
401expression @var{line}.
402@end deffn
403
paul76b89b42004-11-06 17:13:09 +0000404@node AS Path Access List
paul718e3742002-12-13 20:15:29 +0000405@subsection AS Path Access List
406
paulaa5943f2005-11-04 21:53:59 +0000407AS path access list is user defined AS path.
paul718e3742002-12-13 20:15:29 +0000408
409@deffn {Command} {ip as-path access-list @var{word} @{permit|deny@} @var{line}} {}
410This command defines a new AS path access list.
411@end deffn
412
413@deffn {Command} {no ip as-path access-list @var{word}} {}
414@deffnx {Command} {no ip as-path access-list @var{word} @{permit|deny@} @var{line}} {}
415@end deffn
416
paul76b89b42004-11-06 17:13:09 +0000417@node Using AS Path in Route Map
paul718e3742002-12-13 20:15:29 +0000418@subsection Using AS Path in Route Map
419
420@deffn {Route Map} {match as-path @var{word}} {}
421@end deffn
422
423@deffn {Route Map} {set as-path prepend @var{as-path}} {}
424@end deffn
425
paul76b89b42004-11-06 17:13:09 +0000426@node Private AS Numbers
paul718e3742002-12-13 20:15:29 +0000427@subsection Private AS Numbers
428
paul718e3742002-12-13 20:15:29 +0000429@c -----------------------------------------------------------------------
paul76b89b42004-11-06 17:13:09 +0000430@node BGP Communities Attribute
paul718e3742002-12-13 20:15:29 +0000431@section BGP Communities Attribute
432
paulaa5943f2005-11-04 21:53:59 +0000433BGP communities attribute is widely used for implementing policy
paul718e3742002-12-13 20:15:29 +0000434routing. Network operators can manipulate BGP communities attribute
435based on their network policy. BGP communities attribute is defined
paulaa5943f2005-11-04 21:53:59 +0000436in @cite{RFC1997, BGP Communities Attribute} and
437@cite{RFC1998, An Application of the BGP Community Attribute
paul718e3742002-12-13 20:15:29 +0000438in Multi-home Routing}. It is an optional transitive attribute,
439therefore local policy can travel through different autonomous system.
440
paulaa5943f2005-11-04 21:53:59 +0000441Communities attribute is a set of communities values. Each
paul718e3742002-12-13 20:15:29 +0000442communities value is 4 octet long. The following format is used to
443define communities value.
444
445@table @code
446@item AS:VAL
447This format represents 4 octet communities value. @code{AS} is high
448order 2 octet in digit format. @code{VAL} is low order 2 octet in
449digit format. This format is useful to define AS oriented policy
450value. For example, @code{7675:80} can be used when AS 7675 wants to
451pass local policy value 80 to neighboring peer.
452@item internet
453@code{internet} represents well-known communities value 0.
454@item no-export
455@code{no-export} represents well-known communities value @code{NO_EXPORT}@*
456@r{(0xFFFFFF01)}. All routes carry this value must not be advertised
457to outside a BGP confederation boundary. If neighboring BGP peer is
458part of BGP confederation, the peer is considered as inside a BGP
459confederation boundary, so the route will be announced to the peer.
460@item no-advertise
461@code{no-advertise} represents well-known communities value
462@code{NO_ADVERTISE}@*@r{(0xFFFFFF02)}. All routes carry this value
463must not be advertise to other BGP peers.
464@item local-AS
465@code{local-AS} represents well-known communities value
466@code{NO_EXPORT_SUBCONFED} @r{(0xFFFFFF03)}. All routes carry this
467value must not be advertised to external BGP peers. Even if the
468neighboring router is part of confederation, it is considered as
469external BGP peer, so the route will not be announced to the peer.
470@end table
471
472 When BGP communities attribute is received, duplicated communities
473value in the communities attribute is ignored and each communities
474values are sorted in numerical order.
475
476@menu
477* BGP Community Lists::
478* Numbered BGP Community Lists::
479* BGP Community in Route Map::
480* Display BGP Routes by Community::
481* Using BGP Communities Attribute::
482@end menu
483
paul76b89b42004-11-06 17:13:09 +0000484@node BGP Community Lists
paul718e3742002-12-13 20:15:29 +0000485@subsection BGP Community Lists
486
487 BGP community list is a user defined BGP communites attribute list.
488BGP community list can be used for matching or manipulating BGP
489communities attribute in updates.
490
paulaa5943f2005-11-04 21:53:59 +0000491There are two types of community list. One is standard community
paul718e3742002-12-13 20:15:29 +0000492list and another is expanded community list. Standard community list
493defines communities attribute. Expanded community list defines
494communities attribute string with regular expression. Standard
495community list is compiled into binary format when user define it.
496Standard community list will be directly compared to BGP communities
497attribute in BGP updates. Therefore the comparison is faster than
498expanded community list.
499
500@deffn Command {ip community-list standard @var{name} @{permit|deny@} @var{community}} {}
501This command defines a new standard community list. @var{community}
502is communities value. The @var{community} is compiled into community
503structure. We can define multiple community list under same name. In
504that case match will happen user defined order. Once the
505community list matches to communities attribute in BGP updates it
506return permit or deny by the community list definition. When there is
507no matched entry, deny will be returned. When @var{community} is
508empty it matches to any routes.
509@end deffn
510
511@deffn Command {ip community-list expanded @var{name} @{permit|deny@} @var{line}} {}
512This command defines a new expanded community list. @var{line} is a
513string expression of communities attribute. @var{line} can include
514regular expression to match communities attribute in BGP updates.
515@end deffn
516
517@deffn Command {no ip community-list @var{name}} {}
518@deffnx Command {no ip community-list standard @var{name}} {}
519@deffnx Command {no ip community-list expanded @var{name}} {}
520These commands delete community lists specified by @var{name}. All of
521community lists shares a single name space. So community lists can be
522removed simpley specifying community lists name.
523@end deffn
524
525@deffn {Command} {show ip community-list} {}
526@deffnx {Command} {show ip community-list @var{name}} {}
527This command display current community list information. When
528@var{name} is specified the specified community list's information is
529shown.
530
531@example
532# show ip community-list
533Named Community standard list CLIST
534 permit 7675:80 7675:100 no-export
535 deny internet
536Named Community expanded list EXPAND
537 permit :
538
539# show ip community-list CLIST
540Named Community standard list CLIST
541 permit 7675:80 7675:100 no-export
542 deny internet
543@end example
544@end deffn
545
paul76b89b42004-11-06 17:13:09 +0000546@node Numbered BGP Community Lists
paul718e3742002-12-13 20:15:29 +0000547@subsection Numbered BGP Community Lists
548
paulaa5943f2005-11-04 21:53:59 +0000549When number is used for BGP community list name, the number has
paul718e3742002-12-13 20:15:29 +0000550special meanings. Community list number in the range from 1 and 99 is
551standard community list. Community list number in the range from 100
552to 199 is expanded community list. These community lists are called
553as numbered community lists. On the other hand normal community lists
554is called as named community lists.
555
556@deffn Command {ip community-list <1-99> @{permit|deny@} @var{community}} {}
557This command defines a new community list. <1-99> is standard
558community list number. Community list name within this range defines
559standard community list. When @var{community} is empty it matches to
560any routes.
561@end deffn
562
563@deffn Command {ip community-list <100-199> @{permit|deny@} @var{community}} {}
564This command defines a new community list. <100-199> is expanded
565community list number. Community list name within this range defines
566expanded community list.
567@end deffn
568
569@deffn Command {ip community-list @var{name} @{permit|deny@} @var{community}} {}
570When community list type is not specifed, the community list type is
571automatically detected. If @var{community} can be compiled into
572communities attribute, the community list is defined as a standard
573community list. Otherwise it is defined as an expanded community
574list. This feature is left for backward compability. Use of this
575feature is not recommended.
576@end deffn
577
paul76b89b42004-11-06 17:13:09 +0000578@node BGP Community in Route Map
paul718e3742002-12-13 20:15:29 +0000579@subsection BGP Community in Route Map
580
paulaa5943f2005-11-04 21:53:59 +0000581In Route Map (@pxref{Route Map}), we can match or set BGP
paul718e3742002-12-13 20:15:29 +0000582communities attribute. Using this feature network operator can
583implement their network policy based on BGP communities attribute.
584
paulaa5943f2005-11-04 21:53:59 +0000585Following commands can be used in Route Map.
paul718e3742002-12-13 20:15:29 +0000586
587@deffn {Route Map} {match community @var{word}} {}
588@deffnx {Route Map} {match community @var{word} exact-match} {}
589This command perform match to BGP updates using community list
590@var{word}. When the one of BGP communities value match to the one of
591communities value in community list, it is match. When
592@code{exact-match} keyword is spcified, match happen only when BGP
593updates have completely same communities value specified in the
594community list.
595@end deffn
596
597@deffn {Route Map} {set community none} {}
598@deffnx {Route Map} {set community @var{community}} {}
599@deffnx {Route Map} {set community @var{community} additive} {}
600This command manipulate communities value in BGP updates. When
601@code{none} is specified as communities value, it removes entire
602communities attribute from BGP updates. When @var{community} is not
603@code{none}, specified communities value is set to BGP updates. If
604BGP updates already has BGP communities value, the existing BGP
605communities value is replaced with specified @var{community} value.
606When @code{additive} keyword is specified, @var{community} is appended
607to the existing communities value.
608@end deffn
609
610@deffn {Route Map} {set comm-list @var{word} delete} {}
611This command remove communities value from BGP communities attribute.
612The @var{word} is community list name. When BGP route's communities
613value matches to the community list @var{word}, the communities value
614is removed. When all of communities value is removed eventually, the
615BGP update's communities attribute is completely removed.
616@end deffn
617
paul76b89b42004-11-06 17:13:09 +0000618@node Display BGP Routes by Community
paul718e3742002-12-13 20:15:29 +0000619@subsection Display BGP Routes by Community
620
paulaa5943f2005-11-04 21:53:59 +0000621To show BGP routes which has specific BGP communities attribute,
paul718e3742002-12-13 20:15:29 +0000622@code{show ip bgp} command can be used. The @var{community} value and
623community list can be used for @code{show ip bgp} command.
624
625@deffn Command {show ip bgp community} {}
626@deffnx Command {show ip bgp community @var{community}} {}
627@deffnx Command {show ip bgp community @var{community} exact-match} {}
628@code{show ip bgp community} displays BGP routes which has communities
629attribute. When @var{community} is specified, BGP routes that matches
630@var{community} value is displayed. For this command, @code{internet}
631keyword can't be used for @var{community} value. When
632@code{exact-match} is specified, it display only routes that have an
633exact match.
634@end deffn
635
636@deffn Command {show ip bgp community-list @var{word}} {}
637@deffnx Command {show ip bgp community-list @var{word} exact-match} {}
638This commands display BGP routes that matches community list
639@var{word}. When @code{exact-match} is specified, display only routes
640that have an exact match.
641@end deffn
642
paul76b89b42004-11-06 17:13:09 +0000643@node Using BGP Communities Attribute
paul718e3742002-12-13 20:15:29 +0000644@subsection Using BGP Communities Attribute
645
paulaa5943f2005-11-04 21:53:59 +0000646Following configuration is the most typical usage of BGP communities
paul718e3742002-12-13 20:15:29 +0000647attribute. AS 7675 provides upstream Internet connection to AS 100.
648When following configuration exists in AS 7675, AS 100 networks
649operator can set local preference in AS 7675 network by setting BGP
650communities attribute to the updates.
651
652@example
653router bgp 7675
654 neighbor 192.168.0.1 remote-as 100
655 neighbor 192.168.0.1 route-map RMAP in
656!
657ip community-list 70 permit 7675:70
658ip community-list 70 deny
659ip community-list 80 permit 7675:80
660ip community-list 80 deny
661ip community-list 90 permit 7675:90
662ip community-list 90 deny
663!
664route-map RMAP permit 10
665 match community 70
666 set local-preference 70
667!
668route-map RMAP permit 20
669 match community 80
670 set local-preference 80
671!
672route-map RMAP permit 30
673 match community 90
674 set local-preference 90
675@end example
676
paulaa5943f2005-11-04 21:53:59 +0000677Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675.
paul718e3742002-12-13 20:15:29 +0000678The route has communities value 7675:80 so when above configuration
679exists in AS 7675, announced route's local preference will be set to
680value 80.
681
682@example
683router bgp 100
684 network 10.0.0.0/8
685 neighbor 192.168.0.2 remote-as 7675
686 neighbor 192.168.0.2 route-map RMAP out
687!
688ip prefix-list PLIST permit 10.0.0.0/8
689!
690route-map RMAP permit 10
691 match ip address prefix-list PLIST
692 set community 7675:80
693@end example
694
paulaa5943f2005-11-04 21:53:59 +0000695Following configuration is an example of BGP route filtering using
paul718e3742002-12-13 20:15:29 +0000696communities attribute. This configuration only permit BGP routes
697which has BGP communities value 0:80 or 0:90. Network operator can
698put special internal communities value at BGP border router, then
699limit the BGP routes announcement into the internal network.
700
701@example
702router bgp 7675
703 neighbor 192.168.0.1 remote-as 100
704 neighbor 192.168.0.1 route-map RMAP in
705!
706ip community-list 1 permit 0:80 0:90
707!
708route-map RMAP permit in
709 match community 1
710@end example
711
paulaa5943f2005-11-04 21:53:59 +0000712Following exmaple filter BGP routes which has communities value 1:1.
paul718e3742002-12-13 20:15:29 +0000713When there is no match community-list returns deny. To avoid
714filtering all of routes, we need to define permit any at last.
715
716@example
717router bgp 7675
718 neighbor 192.168.0.1 remote-as 100
719 neighbor 192.168.0.1 route-map RMAP in
720!
721ip community-list standard FILTER deny 1:1
722ip community-list standard FILTER permit
723!
724route-map RMAP permit 10
725 match community FILTER
726@end example
727
paulaa5943f2005-11-04 21:53:59 +0000728Communities value keyword @code{internet} has special meanings in
paul718e3742002-12-13 20:15:29 +0000729standard community lists. In below example @code{internet} act as
730match any. It matches all of BGP routes even if the route does not
731have communities attribute at all. So community list @code{INTERNET}
732is same as above example's @code{FILTER}.
733
734@example
735ip community-list standard INTERNET deny 1:1
736ip community-list standard INTERNET permit internet
737@end example
738
paulaa5943f2005-11-04 21:53:59 +0000739Following configuration is an example of communities value deletion.
paul718e3742002-12-13 20:15:29 +0000740With this configuration communities value 100:1 and 100:2 is removed
741from BGP updates. For communities value deletion, only @code{permit}
742community-list is used. @code{deny} community-list is ignored.
743
744@example
745router bgp 7675
746 neighbor 192.168.0.1 remote-as 100
747 neighbor 192.168.0.1 route-map RMAP in
748!
749ip community-list standard DEL permit 100:1 100:2
750!
751route-map RMAP permit 10
752 set comm-list DEL delete
753@end example
754
755@c -----------------------------------------------------------------------
paul76b89b42004-11-06 17:13:09 +0000756@node BGP Extended Communities Attribute
paul718e3742002-12-13 20:15:29 +0000757@section BGP Extended Communities Attribute
758
paulaa5943f2005-11-04 21:53:59 +0000759BGP extended communities attribute is introduced with MPLS VPN/BGP
paul718e3742002-12-13 20:15:29 +0000760technology. MPLS VPN/BGP expands capability of network infrastructure
761to provide VPN functionality. At the same time it requires a new
762framework for policy routing. With BGP Extended Communities Attribute
763we can use Route Target or Site of Origin for implementing network
764policy for MPLS VPN/BGP.
765
paulaa5943f2005-11-04 21:53:59 +0000766BGP Extended Communities Attribute is similar to BGP Communities
paul718e3742002-12-13 20:15:29 +0000767Attribute. It is an optional transitive attribute. BGP Extended
768Communities Attribute can carry multiple Extended Community value.
769Each Extended Community value is eight octet length.
770
paulaa5943f2005-11-04 21:53:59 +0000771BGP Extended Communities Attribute provides an extended range
paul718e3742002-12-13 20:15:29 +0000772compared with BGP Communities Attribute. Adding to that there is a
773type field in each value to provides community space structure.
774
paulaa5943f2005-11-04 21:53:59 +0000775There are two format to define Extended Community value. One is AS
paul718e3742002-12-13 20:15:29 +0000776based format the other is IP address based format.
777
778@table @code
779@item AS:VAL
780This is a format to define AS based Extended Community value.
781@code{AS} part is 2 octets Global Administrator subfield in Extended
782Community value. @code{VAL} part is 4 octets Local Administrator
783subfield. @code{7675:100} represents AS 7675 policy value 100.
784@item IP-Address:VAL
785This is a format to define IP address based Extended Community value.
786@code{IP-Address} part is 4 octets Global Administrator subfield.
787@code{VAL} part is 2 octets Local Administrator subfield.
788@code{10.0.0.1:100} represents
789@end table
790
791@menu
792* BGP Extended Community Lists::
793* BGP Extended Communities in Route Map::
794@end menu
795
paul76b89b42004-11-06 17:13:09 +0000796@node BGP Extended Community Lists
paul718e3742002-12-13 20:15:29 +0000797@subsection BGP Extended Community Lists
798
paulaa5943f2005-11-04 21:53:59 +0000799Expanded Community Lists is a user defined BGP Expanded Community
paul718e3742002-12-13 20:15:29 +0000800Lists.
801
802@deffn Command {ip extcommunity-list standard @var{name} @{permit|deny@} @var{extcommunity}} {}
803This command defines a new standard extcommunity-list.
804@var{extcommunity} is extended communities value. The
805@var{extcommunity} is compiled into extended community structure. We
806can define multiple extcommunity-list under same name. In that case
807match will happen user defined order. Once the extcommunity-list
808matches to extended communities attribute in BGP updates it return
809permit or deny based upon the extcommunity-list definition. When
810there is no matched entry, deny will be returned. When
811@var{extcommunity} is empty it matches to any routes.
812@end deffn
813
814@deffn Command {ip extcommunity-list expanded @var{name} @{permit|deny@} @var{line}} {}
815This command defines a new expanded extcommunity-list. @var{line} is
816a string expression of extended communities attribute. @var{line} can
817include regular expression to match extended communities attribute in
818BGP updates.
819@end deffn
820
821@deffn Command {no ip extcommunity-list @var{name}} {}
822@deffnx Command {no ip extcommunity-list standard @var{name}} {}
823@deffnx Command {no ip extcommunity-list expanded @var{name}} {}
824These commands delete extended community lists specified by
825@var{name}. All of extended community lists shares a single name
826space. So extended community lists can be removed simpley specifying
827the name.
828@end deffn
829
830@deffn {Command} {show ip extcommunity-list} {}
831@deffnx {Command} {show ip extcommunity-list @var{name}} {}
832This command display current extcommunity-list information. When
833@var{name} is specified the community list's information is shown.
834
835@example
836# show ip extcommunity-list
837@end example
838@end deffn
839
paul76b89b42004-11-06 17:13:09 +0000840@node BGP Extended Communities in Route Map
paul718e3742002-12-13 20:15:29 +0000841@subsection BGP Extended Communities in Route Map
842
843@deffn {Route Map} {match extcommunity @var{word}} {}
844@end deffn
845
846@deffn {Route Map} {set extcommunity rt @var{extcommunity}} {}
847This command set Route Target value.
848@end deffn
849
850@deffn {Route Map} {set extcommunity soo @var{extcommunity}} {}
851This command set Site of Origin value.
852@end deffn
853
854@c -----------------------------------------------------------------------
paul76b89b42004-11-06 17:13:09 +0000855@node Displaying BGP routes
paul718e3742002-12-13 20:15:29 +0000856@section Displaying BGP Routes
857
858@menu
859* Show IP BGP::
860* More Show IP BGP::
861@end menu
862
paul76b89b42004-11-06 17:13:09 +0000863@node Show IP BGP
paul718e3742002-12-13 20:15:29 +0000864@subsection Show IP BGP
865
866@deffn {Command} {show ip bgp} {}
867@deffnx {Command} {show ip bgp @var{A.B.C.D}} {}
868@deffnx {Command} {show ip bgp @var{X:X::X:X}} {}
869This command displays BGP routes. When no route is specified it
870display all of IPv4 BGP routes.
871@end deffn
872
873@example
874BGP table version is 0, local router ID is 10.1.1.1
875Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
876Origin codes: i - IGP, e - EGP, ? - incomplete
877
878 Network Next Hop Metric LocPrf Weight Path
879*> 1.1.1.1/32 0.0.0.0 0 32768 i
880
881Total number of prefixes 1
882@end example
883
paul76b89b42004-11-06 17:13:09 +0000884@node More Show IP BGP
paul718e3742002-12-13 20:15:29 +0000885@subsection More Show IP BGP
886
887@deffn {Command} {show ip bgp regexp @var{line}} {}
888This command display BGP routes using AS path regular expression (@pxref{Display BGP Routes by AS Path}).
889@end deffn
890
891@deffn Command {show ip bgp community @var{community}} {}
892@deffnx Command {show ip bgp community @var{community} exact-match} {}
893This command display BGP routes using @var{community} (@pxref{Display
894BGP Routes by Community}).
895@end deffn
896
897@deffn Command {show ip bgp community-list @var{word}} {}
898@deffnx Command {show ip bgp community-list @var{word} exact-match} {}
899This command display BGP routes using community list (@pxref{Display
900BGP Routes by Community}).
901@end deffn
902
903@deffn {Command} {show ip bgp summary} {}
904@end deffn
905
906@deffn {Command} {show ip bgp neighbor [@var{peer}]} {}
907@end deffn
908
909@deffn {Command} {clear ip bgp @var{peer}} {}
910Clear peers which have addresses of X.X.X.X
911@end deffn
912
913@deffn {Command} {clear ip bgp @var{peer} soft in} {}
914Clear peer using soft reconfiguration.
915@end deffn
916
917@deffn {Command} {show debug} {}
918@end deffn
919
920@deffn {Command} {debug event} {}
921@end deffn
922
923@deffn {Command} {debug update} {}
924@end deffn
925
926@deffn {Command} {debug keepalive} {}
927@end deffn
928
929@deffn {Command} {no debug event} {}
930@end deffn
931
932@deffn {Command} {no debug update} {}
933@end deffn
934
935@deffn {Command} {no debug keepalive} {}
936@end deffn
937
paul76b89b42004-11-06 17:13:09 +0000938@node Capability Negotiation
paul718e3742002-12-13 20:15:29 +0000939@section Capability Negotiation
940
paulaa5943f2005-11-04 21:53:59 +0000941When adding IPv6 routing information exchange feature to BGP. There
942were some proposals. @acronym{IETF,Internet Engineering Task Force}
943@acronym{IDR, Inter Domain Routing} @acronym{WG, Working group} adopted
944a proposal called Multiprotocol Extension for BGP. The specification
945is described in @cite{RFC2283}. The protocol does not define new protocols.
946It defines new attributes to existing BGP. When it is used exchanging
947IPv6 routing information it is called BGP-4+. When it is used for
948exchanging multicast routing information it is called MBGP.
paul718e3742002-12-13 20:15:29 +0000949
paulaa5943f2005-11-04 21:53:59 +0000950@command{bgpd} supports Multiprotocol Extension for BGP. So if remote
951peer supports the protocol, @command{bgpd} can exchange IPv6 and/or
952multicast routing information.
paul718e3742002-12-13 20:15:29 +0000953
paulaa5943f2005-11-04 21:53:59 +0000954Traditional BGP did not have the feature to detect remote peer's
955capabilities, e.g. whether it can handle prefix types other than IPv4
956unicast routes. This was a big problem using Multiprotocol Extension
957for BGP to operational network. @cite{RFC2842, Capabilities
958Advertisement with BGP-4} adopted a feature called Capability
959Negotiation. @command{bgpd} use this Capability Negotiation to detect
960the remote peer's capabilities. If the peer is only configured as IPv4
961unicast neighbor, @command{bgpd} does not send these Capability
962Negotiation packets (at least not unless other optional BGP features
963require capability negotation).
paul718e3742002-12-13 20:15:29 +0000964
paulaa5943f2005-11-04 21:53:59 +0000965By default, Quagga will bring up peering with minimal common capability
966for the both sides. For example, local router has unicast and
967multicast capabilitie and remote router has unicast capability. In
968this case, the local router will establish the connection with unicast
969only capability. When there are no common capabilities, Quagga sends
970Unsupported Capability error and then resets the connection.
paul718e3742002-12-13 20:15:29 +0000971
paulaa5943f2005-11-04 21:53:59 +0000972If you want to completely match capabilities with remote peer. Please
paul718e3742002-12-13 20:15:29 +0000973use @command{strict-capability-match} command.
974
975@deffn {BGP} {neighbor @var{peer} strict-capability-match} {}
976@deffnx {BGP} {no neighbor @var{peer} strict-capability-match} {}
977Strictly compares remote capabilities and local capabilities. If capabilities
978are different, send Unsupported Capability error then reset connection.
979@end deffn
980
paulaa5943f2005-11-04 21:53:59 +0000981You may want to disable sending Capability Negotiation OPEN message
paul718e3742002-12-13 20:15:29 +0000982optional parameter to the peer when remote peer does not implement
983Capability Negotiation. Please use @command{dont-capability-negotiate}
984command to disable the feature.
985
986@deffn {BGP} {neighbor @var{peer} dont-capability-negotiate} {}
987@deffnx {BGP} {no neighbor @var{peer} dont-capability-negotiate} {}
988Suppress sending Capability Negotiation as OPEN message optional
989parameter to the peer. This command only affects the peer is configured
990other than IPv4 unicast configuration.
991@end deffn
992
paulaa5943f2005-11-04 21:53:59 +0000993When remote peer does not have capability negotiation feature, remote
994peer will not send any capabilities at all. In that case, bgp
995configures the peer with configured capabilities.
paul718e3742002-12-13 20:15:29 +0000996
paulaa5943f2005-11-04 21:53:59 +0000997You may prefer locally configured capabilities more than the negotiated
998capabilities even though remote peer sends capabilities. If the peer
999is configured by @command{override-capability}, @command{bgpd} ignores
1000received capabilities then override negotiated capabilities with
1001configured values.
paul718e3742002-12-13 20:15:29 +00001002
1003@deffn {BGP} {neighbor @var{peer} override-capability} {}
1004@deffnx {BGP} {no neighbor @var{peer} override-capability} {}
1005Override the result of Capability Negotiation with local configuration.
1006Ignore remote peer's capability value.
1007@end deffn
1008
paul76b89b42004-11-06 17:13:09 +00001009@node Route Reflector
paul718e3742002-12-13 20:15:29 +00001010@section Route Reflector
1011
1012@deffn {BGP} {bgp cluster-id @var{a.b.c.d}} {}
1013@end deffn
1014
1015@deffn {BGP} {neighbor @var{peer} route-reflector-client} {}
1016@deffnx {BGP} {no neighbor @var{peer} route-reflector-client} {}
1017@end deffn
1018
paul76b89b42004-11-06 17:13:09 +00001019@node Route Server
paul718e3742002-12-13 20:15:29 +00001020@section Route Server
1021
1022At an Internet Exchange point, many ISPs are connected to each other by
1023external BGP peering. Normally these external BGP connection are done by
paulaa5943f2005-11-04 21:53:59 +00001024@samp{full mesh} method. As with internal BGP full mesh formation,
paul718e3742002-12-13 20:15:29 +00001025this method has a scaling problem.
1026
1027This scaling problem is well known. Route Server is a method to resolve
1028the problem. Each ISP's BGP router only peers to Route Server. Route
1029Server serves as BGP information exchange to other BGP routers. By
1030applying this method, numbers of BGP connections is reduced from
1031O(n*(n-1)/2) to O(n).
1032
1033Unlike normal BGP router, Route Server must have several routing tables
1034for managing different routing policies for each BGP speaker. We call the
1035routing tables as different @code{view}s. @command{bgpd} can work as
1036normal BGP router or Route Server or both at the same time.
1037
1038@menu
1039* Multiple instance::
1040* BGP instance and view::
1041* Routing policy::
1042* Viewing the view::
1043@end menu
1044
paul76b89b42004-11-06 17:13:09 +00001045@node Multiple instance
paul718e3742002-12-13 20:15:29 +00001046@subsection Multiple instance
1047
1048To enable multiple view function of @code{bgpd}, you must turn on
1049multiple instance feature beforehand.
1050
1051@deffn {Command} {bgp multiple-instance} {}
1052Enable BGP multiple instance feature. After this feature is enabled,
1053you can make multiple BGP instances or multiple BGP views.
1054@end deffn
1055
1056@deffn {Command} {no bgp multiple-instance} {}
1057Disable BGP multiple instance feature. You can not disable this feature
1058when BGP multiple instances or views exist.
1059@end deffn
1060
1061When you want to make configuration more Cisco like one,
1062
1063@deffn {Command} {bgp config-type cisco} {}
1064Cisco compatible BGP configuration output.
1065@end deffn
1066
1067When bgp config-type cisco is specified,
1068
1069``no synchronization'' is displayed.
1070``no auto-summary'' is desplayed.
1071
1072``network'' and ``aggregate-address'' argument is displayed as
1073``A.B.C.D M.M.M.M''
1074
paul7190f4e2003-08-12 12:40:20 +00001075Quagga: network 10.0.0.0/8
paul718e3742002-12-13 20:15:29 +00001076Cisco: network 10.0.0.0
1077
paul7190f4e2003-08-12 12:40:20 +00001078Quagga: aggregate-address 192.168.0.0/24
paul718e3742002-12-13 20:15:29 +00001079Cisco: aggregate-address 192.168.0.0 255.255.255.0
1080
1081Community attribute handling is also different. If there is no
1082configuration is specified community attribute and extended community
1083attribute are sent to neighbor. When user manually disable the
1084feature community attribute is not sent to the neighbor. In case of
paulaa5943f2005-11-04 21:53:59 +00001085@command{bgp config-type cisco} is specified, community attribute is not
paul718e3742002-12-13 20:15:29 +00001086sent to the neighbor by default. To send community attribute user has
paulaa5943f2005-11-04 21:53:59 +00001087to specify @command{neighbor A.B.C.D send-community} command.
paul718e3742002-12-13 20:15:29 +00001088
paulaa5943f2005-11-04 21:53:59 +00001089@example
paul718e3742002-12-13 20:15:29 +00001090!
1091router bgp 1
1092 neighbor 10.0.0.1 remote-as 1
1093 no neighbor 10.0.0.1 send-community
1094!
paul718e3742002-12-13 20:15:29 +00001095router bgp 1
1096 neighbor 10.0.0.1 remote-as 1
1097 neighbor 10.0.0.1 send-community
1098!
paulaa5943f2005-11-04 21:53:59 +00001099@end example
paul718e3742002-12-13 20:15:29 +00001100
1101@deffn {Command} {bgp config-type zebra} {}
paul7190f4e2003-08-12 12:40:20 +00001102Quagga style BGP configuration. This is default.
paul718e3742002-12-13 20:15:29 +00001103@end deffn
1104
paul76b89b42004-11-06 17:13:09 +00001105@node BGP instance and view
paul718e3742002-12-13 20:15:29 +00001106@subsection BGP instance and view
1107
1108BGP instance is a normal BGP process. The result of route selection
1109goes to the kernel routing table. You can setup different AS at the
1110same time when BGP multiple instance feature is enabled.
1111
1112@deffn {Command} {router bgp @var{as-number}} {}
1113Make a new BGP instance. You can use arbitrary word for the @var{name}.
1114@end deffn
1115
1116@example
1117@group
1118bgp multiple-instance
1119!
1120router bgp 1
1121 neighbor 10.0.0.1 remote-as 2
1122 neighbor 10.0.0.2 remote-as 3
1123!
1124router bgp 2
1125 neighbor 10.0.0.3 remote-as 4
1126 neighbor 10.0.0.4 remote-as 5
1127@end group
1128@end example
1129
1130BGP view is almost same as normal BGP process. The result of
1131route selection does not go to the kernel routing table. BGP view is
1132only for exchanging BGP routing information.
1133
1134@deffn {Command} {router bgp @var{as-number} view @var{name}} {}
1135Make a new BGP view. You can use arbitrary word for the @var{name}. This
1136view's route selection result does not go to the kernel routing table.
1137@end deffn
1138
1139With this command, you can setup Route Server like below.
1140
1141@example
1142@group
1143bgp multiple-instance
1144!
1145router bgp 1 view 1
1146 neighbor 10.0.0.1 remote-as 2
1147 neighbor 10.0.0.2 remote-as 3
1148!
1149router bgp 2 view 2
1150 neighbor 10.0.0.3 remote-as 4
1151 neighbor 10.0.0.4 remote-as 5
1152@end group
1153@end example
1154
paul76b89b42004-11-06 17:13:09 +00001155@node Routing policy
paul718e3742002-12-13 20:15:29 +00001156@subsection Routing policy
1157
1158You can set different routing policy for a peer. For example, you can
1159set different filter for a peer.
1160
1161@example
1162@group
1163bgp multiple-instance
1164!
1165router bgp 1 view 1
1166 neighbor 10.0.0.1 remote-as 2
1167 neighbor 10.0.0.1 distribute-list 1 in
1168!
1169router bgp 1 view 2
1170 neighbor 10.0.0.1 remote-as 2
1171 neighbor 10.0.0.1 distribute-list 2 in
1172@end group
1173@end example
1174
1175This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view
11762. When the update is inserted into view 1, distribute-list 1 is
1177applied. On the other hand, when the update is inserted into view 2,
1178distribute-list 2 is applied.
1179
paul76b89b42004-11-06 17:13:09 +00001180@node Viewing the view
paul718e3742002-12-13 20:15:29 +00001181@subsection Viewing the view
1182
1183To display routing table of BGP view, you must specify view name.
1184
1185@deffn {Command} {show ip bgp view @var{name}} {}
1186Display routing table of BGP view @var{name}.
1187@end deffn
1188
paul76b89b42004-11-06 17:13:09 +00001189@node How to set up a 6-Bone connection
paul718e3742002-12-13 20:15:29 +00001190@section How to set up a 6-Bone connection
1191
paul6a22b1f2004-11-07 19:39:13 +00001192
paul718e3742002-12-13 20:15:29 +00001193@example
1194@group
1195zebra configuration
1196===================
1197!
1198! Actually there is no need to configure zebra
1199!
1200
1201bgpd configuration
1202==================
1203!
1204! This means that routes go through zebra and into the kernel.
1205!
1206router zebra
1207!
1208! MP-BGP configuration
1209!
1210router bgp 7675
1211 bgp router-id 10.0.0.1
1212 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as @var{as-number}
1213!
1214 address-family ipv6
1215 network 3ffe:506::/32
1216 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
1217 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
1218 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as @var{as-number}
1219 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
1220 exit-address-family
1221!
1222ipv6 access-list all permit any
1223!
1224! Set output nexthop address.
1225!
1226route-map set-nexthop permit 10
1227 match ipv6 address all
1228 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
1229 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
1230!
1231! logfile FILENAME is obsolete. Please use log file FILENAME
paul7190f4e2003-08-12 12:40:20 +00001232
paul718e3742002-12-13 20:15:29 +00001233log file bgpd.log
1234!
1235@end group
1236@end example
1237
paul76b89b42004-11-06 17:13:09 +00001238@node Dump BGP packets and table
paul718e3742002-12-13 20:15:29 +00001239@section Dump BGP packets and table
1240
1241@deffn Command {dump bgp all @var{path}} {}
1242@deffnx Command {dump bgp all @var{path} @var{interval}} {}
1243Dump all BGP packet and events to @var{path} file.
1244@end deffn
1245
1246@deffn Command {dump bgp updates @var{path}} {}
1247@deffnx Command {dump bgp updates @var{path} @var{interval}} {}
1248Dump BGP updates to @var{path} file.
1249@end deffn
1250
1251@deffn Command {dump bgp routes @var{path}} {}
1252@deffnx Command {dump bgp routes @var{path}} {}
1253Dump whole BGP routing table to @var{path}. This is heavy process.
1254@end deffn
paulaa5943f2005-11-04 21:53:59 +00001255
1256@node BGP Configuration Examples
1257@section BGP Configuration Examples
1258
1259Example of a session to an upstream, advertising only one prefix to it.
1260
1261@example
1262router bgp 64512
1263 bgp router-id 10.236.87.1
1264 network 10.236.87.0/24
1265 neighbor upstream peer-group
1266 neighbor upstream remote-as 64515
1267 neighbor upstream capability dynamic
1268 neighbor upstream prefix-list pl-allowed-adv out
1269 neighbor 10.1.1.1 peer-group upstream
1270 neighbor 10.1.1.1 description ACME ISP
1271!
1272ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
1273ip prefix-list pl-allowed-adv seq 10 deny any
1274
1275@end example
1276
1277A more complex example. With upstream, peer and customer sessions.
1278Advertising global prefixes and NO_EXPORT prefixes and providing
1279actions for customer routes based on community values. Extensive use of
1280route-maps and the 'call' feature to support selective advertising of
1281prefixes. This example is intended as guidance only, it has NOT been
1282tested and almost certainly containts silly mistakes, if not serious
1283flaws.
1284
1285@example
1286router bgp 64512
1287 bgp router-id 10.236.87.1
1288 network 10.123.456.0/24
1289 network 10.123.456.128/25 route-map rm-no-export
1290 neighbor upstream capability dynamic
1291 neighbor upstream route-map rm-upstream-out out
1292 neighbor cust capability dynamic
1293 neighbor cust route-map rm-cust-in in
1294 neighbor cust route-map rm-cust-out out
1295 neighbor cust send-community both
1296 neighbor peer capability dynamic
1297 neighbor peer route-map rm-peer-in in
1298 neighbor peer route-map rm-peer-out out
1299 neighbor peer send-community both
1300 neighbor 10.1.1.1 remote-as 64515
1301 neighbor 10.1.1.1 peer-group upstream
1302 neighbor 10.2.1.1 remote-as 64516
1303 neighbor 10.2.1.1 peer-group upstream
1304 neighbor 10.3.1.1 remote-as 64517
1305 neighbor 10.3.1.1 peer-group cust-default
1306 neighbor 10.3.1.1 description customer1
1307 neighbor 10.3.1.1 prefix-list pl-cust1-network in
1308 neighbor 10.4.1.1 remote-as 64518
1309 neighbor 10.4.1.1 peer-group cust
1310 neighbor 10.4.1.1 prefix-list pl-cust2-network in
1311 neighbor 10.4.1.1 description customer2
1312 neighbor 10.5.1.1 remote-as 64519
1313 neighbor 10.5.1.1 peer-group peer
1314 neighbor 10.5.1.1 prefix-list pl-peer1-network in
1315 neighbor 10.5.1.1 description peer AS 1
1316 neighbor 10.6.1.1 remote-as 64520
1317 neighbor 10.6.1.1 peer-group peer
1318 neighbor 10.6.1.1 prefix-list pl-peer2-network in
1319 neighbor 10.6.1.1 description peer AS 2
1320!
1321ip prefix-list pl-default permit 0.0.0.0/0
1322!
1323ip prefix-list pl-upstream-peers permit 10.1.1.1/32
1324ip prefix-list pl-upstream-peers permit 10.2.1.1/32
1325!
1326ip prefix-list pl-cust1-network permit 10.3.1.0/24
1327ip prefix-list pl-cust1-network permit 10.3.2.0/24
1328!
1329ip prefix-list pl-cust2-network permit 10.4.1.0/24
1330!
1331ip prefix-list pl-peer1-network permit 10.5.1.0/24
1332ip prefix-list pl-peer1-network permit 10.5.2.0/24
1333ip prefix-list pl-peer1-network permit 192.168.0.0/24
1334!
1335ip prefix-list pl-peer2-network permit 10.6.1.0/24
1336ip prefix-list pl-peer2-network permit 10.6.2.0/24
1337ip prefix-list pl-peer2-network permit 192.168.1.0/24
1338ip prefix-list pl-peer2-network permit 192.168.2.0/24
1339ip prefix-list pl-peer2-network permit 172.16.1/24
1340!
1341ip as-path access-list asp-own-as permit ^$
1342ip as-path access-list asp-own-as permit _64512_
1343!
1344! #################################################################
1345! Match communities we provide actions for, on routes receives from
1346! customers. Communities values of <our-ASN>:X, with X, have actions:
1347!
1348! 100 - blackhole the prefix
1349! 200 - set no_export
1350! 300 - advertise only to other customers
1351! 400 - advertise only to upstreams
1352! 500 - set no_export when advertising to upstreams
1353! 2X00 - set local_preference to X00
1354!
1355! blackhole the prefix of the route
1356ip community-list standard cm-blackhole permit 64512:100
1357!
1358! set no-export community before advertising
1359ip community-list standard cm-set-no-export permit 64512:200
1360!
1361! advertise only to other customers
1362ip community-list standard cm-cust-only permit 64512:300
1363!
1364! advertise only to upstreams
1365ip community-list standard cm-upstream-only permit 64512:400
1366!
1367! advertise to upstreams with no-export
1368ip community-list standard cm-upstream-noexport permit 64512:500
1369!
1370! set local-pref to least significant 3 digits of the community
1371ip community-list standard cm-prefmod-100 permit 64512:2100
1372ip community-list standard cm-prefmod-200 permit 64512:2200
1373ip community-list standard cm-prefmod-300 permit 64512:2300
1374ip community-list standard cm-prefmod-400 permit 64512:2400
1375ip community-list expanded cme-prefmod-range permit 64512:2...
1376!
1377! Informational communities
1378!
1379! 3000 - learned from upstream
1380! 3100 - learned from customer
1381! 3200 - learned from peer
1382!
1383ip community-list standard cm-learnt-upstream permit 64512:3000
1384ip community-list standard cm-learnt-cust permit 64512:3100
1385ip community-list standard cm-learnt-peer permit 64512:3200
1386!
1387! ###################################################################
1388! Utility route-maps
1389!
1390! These utility route-maps generally should not used to permit/deny
1391! routes, i.e. they do not have meaning as filters, and hence probably
1392! should be used with 'on-match next'. These all finish with an empty
1393! permit entry so as not interfere with processing in the caller.
1394!
1395route-map rm-no-export permit 10
1396 set community additive no-export
1397route-map rm-no-export permit 20
1398!
1399route-map rm-blackhole permit 10
1400 description blackhole, up-pref and ensure it cant escape this AS
1401 set ip next-hop 127.0.0.1
1402 set local-preference 10
1403 set community additive no-export
1404route-map rm-blackhole permit 20
1405!
1406! Set local-pref as requested
1407route-map rm-prefmod permit 10
1408 match community cm-prefmod-100
1409 set local-preference 100
1410route-map rm-prefmod permit 20
1411 match community cm-prefmod-200
1412 set local-preference 200
1413route-map rm-prefmod permit 30
1414 match community cm-prefmod-300
1415 set local-preference 300
1416route-map rm-prefmod permit 40
1417 match community cm-prefmod-400
1418 set local-preference 400
1419route-map rm-prefmod permit 50
1420!
1421! Community actions to take on receipt of route.
1422route-map rm-community-in permit 10
1423 description check for blackholing, no point continuing if it matches.
1424 match community cm-blackhole
1425 call rm-blackhole
1426route-map rm-community-in permit 20
1427 match community cm-set-no-export
1428 call rm-no-export
1429 on-match next
1430route-map rm-community-in permit 30
1431 match community cme-prefmod-range
1432 call rm-prefmod
1433route-map rm-community-in permit 40
1434!
1435! #####################################################################
1436! Community actions to take when advertising a route.
1437! These are filtering route-maps,
1438!
1439! Deny customer routes to upstream with cust-only set.
1440route-map rm-community-filt-to-upstream deny 10
1441 match community cm-learnt-cust
1442 match community cm-cust-only
1443route-map rm-community-filt-to-upstream permit 20
1444!
1445! Deny customer routes to other customers with upstream-only set.
1446route-map rm-community-filt-to-cust deny 10
1447 match community cm-learnt-cust
1448 match community cm-upstream-only
1449route-map rm-community-filt-to-cust permit 20
1450!
1451! ###################################################################
1452! The top-level route-maps applied to sessions. Further entries could
1453! be added obviously..
1454!
1455! Customers
1456route-map rm-cust-in permit 10
1457 call rm-community-in
1458 on-match next
1459route-map rm-cust-in permit 20
1460 set community additive 64512:3100
1461route-map rm-cust-in permit 30
1462!
1463route-map rm-cust-out permit 10
1464 call rm-community-filt-to-cust
1465 on-match next
1466route-map rm-cust-out permit 20
1467!
1468! Upstream transit ASes
1469route-map rm-upstream-out permit 10
1470 description filter customer prefixes which are marked cust-only
1471 call rm-community-filt-to-upstream
1472 on-match next
1473route-map rm-upstream-out permit 20
1474 description only customer routes are provided to upstreams/peers
1475 match community cm-learnt-cust
1476!
1477! Peer ASes
1478! outbound policy is same as for upstream
1479route-map rm-peer-out permit 10
1480 call rm-upstream-out
1481!
1482route-map rm-peer-in permit 10
1483 set community additive 64512:3200
1484@end example