+ fixed bug #418 (changing address on an existing interface doesn't cause existing...
[jleu-quagga.git] / doc / bgpd.texi
blobbdfd6e4ccb4383b4a3e7df7f70684d9658099d58
1 @c -*-texinfo-*-
2 @c This is part of the Quagga Manual.
3 @c @value{COPYRIGHT_STR}
4 @c See file quagga.texi for copying conditions.
5 @node BGP
6 @chapter BGP
8 @acronym{BGP} stands for a Border Gateway Protocol.  The lastest BGP version
9 is 4.  It is referred as BGP-4.  BGP-4 is one of the Exterior Gateway
10 Protocols and de-fact standard of Inter Domain routing protocol.
11 BGP-4 is described in @cite{RFC1771, A Border Gateway Protocol
12 4 (BGP-4)}.
14 Many extensions have been added to @cite{RFC1771}.  @cite{RFC2858,
15 Multiprotocol Extensions for BGP-4} provides multiprotocol support to
16 BGP-4.
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::  
34 * BGP Configuration Examples::
35 @end menu
37 @node Starting BGP
38 @section Starting BGP
40 Default 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
43 configured in @file{bgpd.conf}.
45 @command{bgpd} specific invocation options are described below.  Common
46 options may also be specified (@pxref{Common Invocation Options}).
48 @table @samp
49 @item -p @var{PORT}
50 @itemx --bgp_port=@var{PORT}
51 Set the bgp protocol's port number.
53 @item -r
54 @itemx --retain
55 When program terminates, retain BGP routes added by zebra.
56 @end table
58 @node BGP router
59 @section BGP router
61   First of all you must configure BGP router with @command{router bgp}
62 command.  To configure BGP router, you need AS number.  AS number is an
63 identification of autonomous system.  BGP protocol uses the AS number
64 for detecting whether the BGP connection is internal one or external one.
66 @deffn Command {router bgp @var{asn}} {}
67 Enable a BGP protocol process with the specified @var{asn}.  After
68 this statement you can input any @code{BGP Commands}.  You can not
69 create different BGP process under different @var{asn} without
70 specifying @code{multiple-instance} (@pxref{Multiple instance}).
71 @end deffn
73 @deffn Command {no router bgp @var{asn}} {}
74 Destroy a BGP protocol process with the specified @var{asn}.
75 @end deffn
77 @deffn {BGP} {bgp router-id @var{A.B.C.D}} {}
78 This command specifies the router-ID.  If @command{bgpd} connects to @command{zebra} it gets
79 interface and address information.  In that case default router ID value
80 is selected as the largest IP Address of the interfaces.  When
81 @code{router zebra} is not enabled @command{bgpd} can't get interface information
82 so @code{router-id} is set to 0.0.0.0.  So please set router-id by hand.
83 @end deffn
85 @menu
86 * BGP distance::                
87 * BGP decision process::        
88 @end menu
90 @node BGP distance
91 @subsection BGP distance
93 @deffn {BGP} {distance bgp <1-255> <1-255> <1-255>} {}
94 This command change distance value of BGP.  Each argument is distance
95 value for external routes, internal routes and local routes.
96 @end deffn
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}} {}
100 This command set distance value to 
101 @end deffn
103 @node BGP decision process
104 @subsection BGP decision process
106 @table @asis
107 @item 1. Weight check
108   
109 @item 2. Local preference check.
111 @item 3. Local route check.
113 @item 4. AS path length check.
115 @item 5. Origin check.
117 @item 6. MED check.
118 @end table
120 @deffn {BGP} {bgp bestpath as-path confed} {}
121 This command specifies that the length of confederation path sets and
122 sequences should should be taken into account during the BGP best path
123 decision process.
124 @end deffn
126 @node BGP network
127 @section BGP network
129 @menu
130 * BGP route::                   
131 * Route Aggregation::           
132 * Redistribute to BGP::         
133 @end menu
135 @node BGP route
136 @subsection BGP route
138 @deffn {BGP} {network @var{A.B.C.D/M}} {}
139 This command adds the announcement network.
140 @example
141 @group
142 router bgp 1
143  network 10.0.0.0/8
144 @end group
145 @end example
146 This configuration example says that network 10.0.0.0/8 will be
147 announced to all neighbors.  Some vendors' routers don't advertise
148 routes if they aren't present in their IGP routing tables; @code{bgpd}
149 doesn't care about IGP routes when announcing its routes.
150 @end deffn
152 @deffn {BGP} {network @var{A.B.C.D/M} pathlimit <0-255>} {}
153 This command configures a route to be originated into BGP, just as with the
154 previous command, but additionally sets an AS-Pathlimit TTL to be advertised
155 on the route. See draft-ietf-idr-as-pathlimit.
157 Specifying a TTL of 0 can be used to remove pathlimit from a previously
158 configured network statement.
160 Note that when advertising prefixes with AS-Pathlimit set, all less-specific
161 prefixes advertised SHOULD also have the Atomic-Aggregate attribute set.
162 Failure to do so increases the risks of accidental routing loops occuring.
164 This implementation will try to automatically set Atomic-Aggregate as
165 appropriate on any less-specific prefixes originated by the same speaker,
166 however it will not (and often can not) do so where @b{other} speakers in
167 the AS are originating more specifics.
169 Hence the system administrator must take care to ensure that all
170 less-specific prefixes originated carry atomic-aggregate as appropriate, by
171 manually configuring speakers originating less-specifics to set
172 Atomic-Aggregate on those advertisements!
173 @end deffn
175 @deffn {BGP} {no network @var{A.B.C.D/M}} {}
176 @end deffn
178 @node Route Aggregation
179 @subsection Route Aggregation
181 @deffn {BGP} {aggregate-address @var{A.B.C.D/M}} {}
182 This command specifies an aggregate address.
183 @end deffn
185 @deffn {BGP} {aggregate-address @var{A.B.C.D/M} as-set} {}
186 This command specifies an aggregate address.  Resulting routes inlucde
187 AS set.
188 @end deffn
190 @deffn {BGP} {aggregate-address @var{A.B.C.D/M} summary-only} {}
191 This command specifies an aggregate address.  Aggreated routes will
192 not be announce.
193 @end deffn
195 @deffn {BGP} {no aggregate-address @var{A.B.C.D/M}} {}
196 @end deffn
198 @node Redistribute to BGP
199 @subsection Redistribute to BGP
201 @deffn {BGP} {redistribute kernel} {}
202 Redistribute kernel route to BGP process.
203 @end deffn
205 @deffn {BGP} {redistribute static} {}
206 Redistribute static route to BGP process.
207 @end deffn
209 @deffn {BGP} {redistribute connected} {}
210 Redistribute connected route to BGP process.
211 @end deffn
213 @deffn {BGP} {redistribute rip} {}
214 Redistribute RIP route to BGP process.
215 @end deffn
217 @deffn {BGP} {redistribute ospf} {}
218 Redistribute OSPF route to BGP process.
219 @end deffn
221 @node BGP Peer
222 @section BGP Peer
224 @menu
225 * Defining Peer::               
226 * BGP Peer commands::           
227 * Peer filtering::              
228 @end menu
230 @node Defining Peer
231 @subsection Defining Peer
233 @deffn {BGP} {neighbor @var{peer} remote-as @var{asn}} {}
234 Creates a new neighbor whose remote-as is @var{asn}.  @var{peer}
235 can be an IPv4 address or an IPv6 address.
236 @example
237 @group
238 router bgp 1
239  neighbor 10.0.0.1 remote-as 2
240 @end group
241 @end example
242 In this case my router, in AS-1, is trying to peer with AS-2 at
243 10.0.0.1.
245 This command must be the first command used when configuring a neighbor.
246 If the remote-as is not specified, @command{bgpd} will complain like this:
247 @example
248 can't find neighbor 10.0.0.1
249 @end example
250 @end deffn
252 @node BGP Peer commands
253 @subsection BGP Peer commands
255 In a @code{router bgp} clause there are neighbor specific configurations
256 required.
258 @deffn {BGP} {neighbor @var{peer} shutdown} {}
259 @deffnx {BGP} {no neighbor @var{peer} shutdown} {}
260 Shutdown the peer.  We can delete the neighbor's configuration by
261 @code{no neighbor @var{peer} remote-as @var{as-number}} but all
262 configuration of the neighbor will be deleted.  When you want to
263 preserve the configuration, but want to drop the BGP peer, use this
264 syntax.
265 @end deffn
267 @deffn {BGP} {neighbor @var{peer} ebgp-multihop} {}
268 @deffnx {BGP} {no neighbor @var{peer} ebgp-multihop} {}
269 @end deffn
271 @deffn {BGP} {neighbor @var{peer} description ...} {}
272 @deffnx {BGP} {no neighbor @var{peer} description ...} {}
273 Set description of the peer.
274 @end deffn
276 @deffn {BGP} {neighbor @var{peer} version @var{version}} {}
277 Set up the neighbor's BGP version.  @var{version} can be @var{4},
278 @var{4+} or @var{4-}.  BGP version @var{4} is the default value used for
279 BGP peering.  BGP version @var{4+} means that the neighbor supports
280 Multiprotocol Extensions for BGP-4.  BGP version @var{4-} is similar but
281 the neighbor speaks the old Internet-Draft revision 00's Multiprotocol
282 Extensions for BGP-4.  Some routing software is still using this
283 version.
284 @end deffn
286 @deffn {BGP} {neighbor @var{peer} interface @var{ifname}} {}
287 @deffnx {BGP} {no neighbor @var{peer} interface @var{ifname}} {}
288 When you connect to a BGP peer over an IPv6 link-local address, you 
289 have to specify the @var{ifname} of the interface used for the 
290 connection. To specify IPv4 session addresses, see the 
291 @code{neighbor @var{peer} update-source} command below.
293 This command is deprecated and may be removed in a future release. Its
294 use should be avoided.
295 @end deffn
297 @deffn {BGP} {neighbor @var{peer} next-hop-self} {}
298 @deffnx {BGP} {no neighbor @var{peer} next-hop-self} {}
299 This command specifies an announced route's nexthop as being equivalent
300 to the address of the bgp router.
301 @end deffn
303 @deffn {BGP} {neighbor @var{peer} update-source @var{<ifname|address>}} {}
304 @deffnx {BGP} {no neighbor @var{peer} update-source} {}
305 Specify the IPv4 source address to use for the @acronym{BGP} session to this
306 neighbour, may be specified as either an IPv4 address directly or
307 as an interface name (in which case the @command{zebra} daemon MUST be running
308 in order for @command{bgpd} to be able to retrieve interface state).
309 @example
310 @group
311 router bgp 64555
312  neighbor foo update-source 192.168.0.1
313  neighbor bar update-source lo0
314 @end group
315 @end example
316 @end deffn
318 @deffn {BGP} {neighbor @var{peer} default-originate} {}
319 @deffnx {BGP} {no neighbor @var{peer} default-originate} {}
320 @command{bgpd}'s default is to not announce the default route (0.0.0.0/0) even it
321 is in routing table.  When you want to announce default routes to the
322 peer, use this command.
323 @end deffn
325 @deffn {BGP} {neighbor @var{peer} port @var{port}} {}
326 @deffnx {BGP} {neighbor @var{peer} port @var{port}} {}
327 @end deffn
329 @deffn {BGP} {neighbor @var{peer} send-community} {}
330 @deffnx {BGP} {neighbor @var{peer} send-community} {}
331 @end deffn
333 @deffn {BGP} {neighbor @var{peer} weight @var{weight}} {}
334 @deffnx {BGP} {no neighbor @var{peer} weight @var{weight}} {}
335 This command specifies a default @var{weight} value for the neighbor's
336 routes.
337 @end deffn
339 @deffn {BGP} {neighbor @var{peer} maximum-prefix @var{number}} {}
340 @deffnx {BGP} {no neighbor @var{peer} maximum-prefix @var{number}} {}
341 @end deffn
343 @node Peer filtering
344 @subsection Peer filtering
346 @deffn {BGP} {neighbor @var{peer} distribute-list @var{name} [in|out]} {}
347 This command specifies a distribute-list for the peer.  @var{direct} is
348 @samp{in} or @samp{out}.
349 @end deffn
351 @deffn {BGP command} {neighbor @var{peer} prefix-list @var{name} [in|out]} {}
352 @end deffn
354 @deffn {BGP command} {neighbor @var{peer} filter-list @var{name} [in|out]} {}
355 @end deffn
357 @deffn {BGP} {neighbor @var{peer} route-map @var{name} [in|out]} {}
358 Apply a route-map on the neighbor.  @var{direct} must be @code{in} or
359 @code{out}.
360 @end deffn
362 @c -----------------------------------------------------------------------
363 @node BGP Peer Group
364 @section BGP Peer Group
366 @deffn {BGP} {neighbor @var{word} peer-group} {}
367 This command defines a new peer group.
368 @end deffn
370 @deffn {BGP} {neighbor @var{peer} peer-group @var{word}} {}
371 This command bind specific peer to peer group @var{word}.
372 @end deffn
374 @node BGP Address Family
375 @section BGP Address Family
377 @c -----------------------------------------------------------------------
378 @node Autonomous System
379 @section Autonomous System
381 The @acronym{AS,Autonomous System} number is one of the essential
382 element of BGP.  BGP is a distance vector routing protocol, and the
383 AS-Path framework provides distance vector metric and loop detection to
384 BGP. @cite{RFC1930, Guidelines for creation, selection, and
385 registration of an Autonomous System (AS)} provides some background on
386 the concepts of an AS.
388 The AS number is a two octet value, ranging in value from 1 to 65535.
389 The AS numbers 64512 through 65535 are defined as private AS numbers. 
390 Private AS numbers must not to be advertised in the global Internet.
392 @menu
393 * AS Path Regular Expression::  
394 * Display BGP Routes by AS Path::  
395 * AS Path Access List::         
396 * Using AS Path in Route Map::  
397 * Private AS Numbers::          
398 @end menu
400 @node AS Path Regular Expression
401 @subsection AS Path Regular Expression
403 AS path regular expression can be used for displaying BGP routes and
404 AS path access list.  AS path regular expression is based on
405 @code{POSIX 1003.2} regular expressions.  Following description is
406 just a subset of @code{POSIX} regular expression.  User can use full
407 @code{POSIX} regular expression.  Adding to that special character '_'
408 is added for AS path regular expression.
410 @table @code
411 @item .
412 Matches any single character.
413 @item *
414 Matches 0 or more occurrences of pattern.
415 @item +
416 Matches 1 or more occurrences of pattern.
417 @item ?
418 Match 0 or 1 occurrences of pattern.
419 @item ^
420 Matches the beginning of the line.
421 @item $
422 Matches the end of the line.
423 @item _
424 Character @code{_} has special meanings in AS path regular expression.
425 It matches to space and comma , and AS set delimiter @{ and @} and AS
426 confederation delimiter @code{(} and @code{)}.  And it also matches to
427 the beginning of the line and the end of the line.  So @code{_} can be
428 used for AS value boundaries match.  @code{show ip bgp regexp _7675_}
429 matches to all of BGP routes which as AS number include @var{7675}.
430 @end table
432 @node Display BGP Routes by AS Path
433 @subsection Display BGP Routes by AS Path
435 To show BGP routes which has specific AS path information @code{show
436 ip bgp} command can be used.  
438 @deffn Command {show ip bgp regexp @var{line}} {}
439 This commands display BGP routes that matches AS path regular
440 expression @var{line}.
441 @end deffn
443 @node AS Path Access List
444 @subsection AS Path Access List
446 AS path access list is user defined AS path.
448 @deffn {Command} {ip as-path access-list @var{word} @{permit|deny@} @var{line}} {}
449 This command defines a new AS path access list.
450 @end deffn
452 @deffn {Command} {no ip as-path access-list @var{word}} {}
453 @deffnx {Command} {no ip as-path access-list @var{word} @{permit|deny@} @var{line}} {}
454 @end deffn
456 @node Using AS Path in Route Map
457 @subsection Using AS Path in Route Map
459 @deffn {Route Map} {match as-path @var{word}} {}
460 @end deffn
462 @deffn {Route Map} {set as-path prepend @var{as-path}} {}
463 @end deffn
465 @node Private AS Numbers
466 @subsection Private AS Numbers
468 @c -----------------------------------------------------------------------
469 @node BGP Communities Attribute
470 @section BGP Communities Attribute
472 BGP communities attribute is widely used for implementing policy
473 routing.  Network operators can manipulate BGP communities attribute
474 based on their network policy.  BGP communities attribute is defined
475 in @cite{RFC1997, BGP Communities Attribute} and
476 @cite{RFC1998, An Application of the BGP Community Attribute
477 in Multi-home Routing}.  It is an optional transitive attribute,
478 therefore local policy can travel through different autonomous system.
480 Communities attribute is a set of communities values.  Each
481 communities value is 4 octet long.  The following format is used to
482 define communities value.
484 @table @code
485 @item AS:VAL
486 This format represents 4 octet communities value.  @code{AS} is high
487 order 2 octet in digit format.  @code{VAL} is low order 2 octet in
488 digit format.  This format is useful to define AS oriented policy
489 value.  For example, @code{7675:80} can be used when AS 7675 wants to
490 pass local policy value 80 to neighboring peer.
491 @item internet
492 @code{internet} represents well-known communities value 0.
493 @item no-export
494 @code{no-export} represents well-known communities value @code{NO_EXPORT}@*
495 @r{(0xFFFFFF01)}.  All routes carry this value must not be advertised
496 to outside a BGP confederation boundary.  If neighboring BGP peer is
497 part of BGP confederation, the peer is considered as inside a BGP
498 confederation boundary, so the route will be announced to the peer.
499 @item no-advertise
500 @code{no-advertise} represents well-known communities value
501 @code{NO_ADVERTISE}@*@r{(0xFFFFFF02)}.  All routes carry this value
502 must not be advertise to other BGP peers.
503 @item local-AS
504 @code{local-AS} represents well-known communities value
505 @code{NO_EXPORT_SUBCONFED} @r{(0xFFFFFF03)}.  All routes carry this
506 value must not be advertised to external BGP peers.  Even if the
507 neighboring router is part of confederation, it is considered as
508 external BGP peer, so the route will not be announced to the peer.
509 @end table
511   When BGP communities attribute is received, duplicated communities
512 value in the communities attribute is ignored and each communities
513 values are sorted in numerical order.
514   
515 @menu
516 * BGP Community Lists::         
517 * Numbered BGP Community Lists::  
518 * BGP Community in Route Map::  
519 * Display BGP Routes by Community::  
520 * Using BGP Communities Attribute::  
521 @end menu
523 @node BGP Community Lists
524 @subsection BGP Community Lists
526   BGP community list is a user defined BGP communites attribute list.
527 BGP community list can be used for matching or manipulating BGP
528 communities attribute in updates.
530 There are two types of community list.  One is standard community
531 list and another is expanded community list.  Standard community list
532 defines communities attribute.  Expanded community list defines
533 communities attribute string with regular expression.  Standard
534 community list is compiled into binary format when user define it.
535 Standard community list will be directly compared to BGP communities
536 attribute in BGP updates.  Therefore the comparison is faster than
537 expanded community list.
539 @deffn Command {ip community-list standard @var{name} @{permit|deny@} @var{community}} {}
540 This command defines a new standard community list.  @var{community}
541 is communities value.  The @var{community} is compiled into community
542 structure.  We can define multiple community list under same name.  In
543 that case match will happen user defined order.  Once the
544 community list matches to communities attribute in BGP updates it
545 return permit or deny by the community list definition.  When there is
546 no matched entry, deny will be returned.  When @var{community} is
547 empty it matches to any routes.
548 @end deffn
550 @deffn Command {ip community-list expanded @var{name} @{permit|deny@} @var{line}} {}
551 This command defines a new expanded community list.  @var{line} is a
552 string expression of communities attribute.  @var{line} can include
553 regular expression to match communities attribute in BGP updates.
554 @end deffn
556 @deffn Command {no ip community-list @var{name}} {}
557 @deffnx Command {no ip community-list standard @var{name}} {}
558 @deffnx Command {no ip community-list expanded @var{name}} {}
559 These commands delete community lists specified by @var{name}.  All of
560 community lists shares a single name space.  So community lists can be
561 removed simpley specifying community lists name.
562 @end deffn
564 @deffn {Command} {show ip community-list} {}
565 @deffnx {Command} {show ip community-list @var{name}} {}
566 This command display current community list information.  When
567 @var{name} is specified the specified community list's information is
568 shown.
570 @example
571 # show ip community-list 
572 Named Community standard list CLIST
573     permit 7675:80 7675:100 no-export
574     deny internet
575 Named Community expanded list EXPAND
576     permit :
578 # show ip community-list CLIST
579 Named Community standard list CLIST
580     permit 7675:80 7675:100 no-export
581     deny internet
582 @end example
583 @end deffn
585 @node Numbered BGP Community Lists
586 @subsection Numbered BGP Community Lists
588 When number is used for BGP community list name, the number has
589 special meanings.  Community list number in the range from 1 and 99 is
590 standard community list.  Community list number in the range from 100
591 to 199 is expanded community list.  These community lists are called
592 as numbered community lists.  On the other hand normal community lists
593 is called as named community lists.
595 @deffn Command {ip community-list <1-99> @{permit|deny@} @var{community}} {}
596 This command defines a new community list.  <1-99> is standard
597 community list number.  Community list name within this range defines
598 standard community list.  When @var{community} is empty it matches to
599 any routes.
600 @end deffn
602 @deffn Command {ip community-list <100-199> @{permit|deny@} @var{community}} {}
603 This command defines a new community list.  <100-199> is expanded
604 community list number.  Community list name within this range defines
605 expanded community list.
606 @end deffn
608 @deffn Command {ip community-list @var{name} @{permit|deny@} @var{community}} {}
609 When community list type is not specifed, the community list type is
610 automatically detected.  If @var{community} can be compiled into
611 communities attribute, the community list is defined as a standard
612 community list.  Otherwise it is defined as an expanded community
613 list.  This feature is left for backward compability.  Use of this
614 feature is not recommended.
615 @end deffn
617 @node BGP Community in Route Map
618 @subsection BGP Community in Route Map
620 In Route Map (@pxref{Route Map}), we can match or set BGP
621 communities attribute.  Using this feature network operator can
622 implement their network policy based on BGP communities attribute.
624 Following commands can be used in Route Map.
626 @deffn {Route Map} {match community @var{word}} {}
627 @deffnx {Route Map} {match community @var{word} exact-match} {}
628 This command perform match to BGP updates using community list
629 @var{word}.  When the one of BGP communities value match to the one of
630 communities value in community list, it is match.  When
631 @code{exact-match} keyword is spcified, match happen only when BGP
632 updates have completely same communities value specified in the
633 community list.
634 @end deffn
636 @deffn {Route Map} {set community none} {}
637 @deffnx {Route Map} {set community @var{community}} {}
638 @deffnx {Route Map} {set community @var{community} additive} {}
639 This command manipulate communities value in BGP updates.  When
640 @code{none} is specified as communities value, it removes entire
641 communities attribute from BGP updates.  When @var{community} is not
642 @code{none}, specified communities value is set to BGP updates.  If
643 BGP updates already has BGP communities value, the existing BGP
644 communities value is replaced with specified @var{community} value.
645 When @code{additive} keyword is specified, @var{community} is appended
646 to the existing communities value.
647 @end deffn
649 @deffn {Route Map} {set comm-list @var{word} delete} {}
650 This command remove communities value from BGP communities attribute.
651 The @var{word} is community list name.  When BGP route's communities
652 value matches to the community list @var{word}, the communities value
653 is removed.  When all of communities value is removed eventually, the
654 BGP update's communities attribute is completely removed.
655 @end deffn
657 @node Display BGP Routes by Community
658 @subsection Display BGP Routes by Community
660 To show BGP routes which has specific BGP communities attribute,
661 @code{show ip bgp} command can be used.  The @var{community} value and
662 community list can be used for @code{show ip bgp} command.
664 @deffn Command {show ip bgp community} {}
665 @deffnx Command {show ip bgp community @var{community}} {}
666 @deffnx Command {show ip bgp community @var{community} exact-match} {}
667 @code{show ip bgp community} displays BGP routes which has communities
668 attribute.  When @var{community} is specified, BGP routes that matches
669 @var{community} value is displayed.  For this command, @code{internet}
670 keyword can't be used for @var{community} value.  When
671 @code{exact-match} is specified, it display only routes that have an
672 exact match.
673 @end deffn
675 @deffn Command {show ip bgp community-list @var{word}} {}
676 @deffnx Command {show ip bgp community-list @var{word} exact-match} {}
677 This commands display BGP routes that matches community list
678 @var{word}.  When @code{exact-match} is specified, display only routes
679 that have an exact match.
680 @end deffn
682 @node Using BGP Communities Attribute
683 @subsection Using BGP Communities Attribute
685 Following configuration is the most typical usage of BGP communities
686 attribute.  AS 7675 provides upstream Internet connection to AS 100.
687 When following configuration exists in AS 7675, AS 100 networks
688 operator can set local preference in AS 7675 network by setting BGP
689 communities attribute to the updates.
691 @example
692 router bgp 7675
693  neighbor 192.168.0.1 remote-as 100
694  neighbor 192.168.0.1 route-map RMAP in
696 ip community-list 70 permit 7675:70
697 ip community-list 70 deny
698 ip community-list 80 permit 7675:80
699 ip community-list 80 deny
700 ip community-list 90 permit 7675:90
701 ip community-list 90 deny
703 route-map RMAP permit 10
704  match community 70
705  set local-preference 70
707 route-map RMAP permit 20
708  match community 80
709  set local-preference 80
711 route-map RMAP permit 30
712  match community 90
713  set local-preference 90
714 @end example
716 Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675.
717 The route has communities value 7675:80 so when above configuration
718 exists in AS 7675, announced route's local preference will be set to
719 value 80.
721 @example
722 router bgp 100
723  network 10.0.0.0/8
724  neighbor 192.168.0.2 remote-as 7675
725  neighbor 192.168.0.2 route-map RMAP out
727 ip prefix-list PLIST permit 10.0.0.0/8
729 route-map RMAP permit 10
730  match ip address prefix-list PLIST
731  set community 7675:80
732 @end example
734 Following configuration is an example of BGP route filtering using
735 communities attribute.  This configuration only permit BGP routes
736 which has BGP communities value 0:80 or 0:90.  Network operator can
737 put special internal communities value at BGP border router, then
738 limit the BGP routes announcement into the internal network.
740 @example
741 router bgp 7675
742  neighbor 192.168.0.1 remote-as 100
743  neighbor 192.168.0.1 route-map RMAP in
745 ip community-list 1 permit 0:80 0:90
747 route-map RMAP permit in
748  match community 1
749 @end example
751 Following exmaple filter BGP routes which has communities value 1:1.
752 When there is no match community-list returns deny.  To avoid
753 filtering all of routes, we need to define permit any at last.
755 @example
756 router bgp 7675
757  neighbor 192.168.0.1 remote-as 100
758  neighbor 192.168.0.1 route-map RMAP in
760 ip community-list standard FILTER deny 1:1
761 ip community-list standard FILTER permit
763 route-map RMAP permit 10
764  match community FILTER
765 @end example
767 Communities value keyword @code{internet} has special meanings in
768 standard community lists.  In below example @code{internet} act as
769 match any.  It matches all of BGP routes even if the route does not
770 have communities attribute at all.  So community list @code{INTERNET}
771 is same as above example's @code{FILTER}.
773 @example
774 ip community-list standard INTERNET deny 1:1
775 ip community-list standard INTERNET permit internet
776 @end example
778 Following configuration is an example of communities value deletion.
779 With this configuration communities value 100:1 and 100:2 is removed
780 from BGP updates.  For communities value deletion, only @code{permit}
781 community-list is used.  @code{deny} community-list is ignored.
783 @example
784 router bgp 7675
785  neighbor 192.168.0.1 remote-as 100
786  neighbor 192.168.0.1 route-map RMAP in
788 ip community-list standard DEL permit 100:1 100:2
790 route-map RMAP permit 10
791  set comm-list DEL delete
792 @end example
794 @c -----------------------------------------------------------------------
795 @node BGP Extended Communities Attribute
796 @section BGP Extended Communities Attribute
798 BGP extended communities attribute is introduced with MPLS VPN/BGP
799 technology.  MPLS VPN/BGP expands capability of network infrastructure
800 to provide VPN functionality.  At the same time it requires a new
801 framework for policy routing.  With BGP Extended Communities Attribute
802 we can use Route Target or Site of Origin for implementing network
803 policy for MPLS VPN/BGP.
805 BGP Extended Communities Attribute is similar to BGP Communities
806 Attribute.  It is an optional transitive attribute.  BGP Extended
807 Communities Attribute can carry multiple Extended Community value.
808 Each Extended Community value is eight octet length.
810 BGP Extended Communities Attribute provides an extended range
811 compared with BGP Communities Attribute.  Adding to that there is a
812 type field in each value to provides community space structure.
814 There are two format to define Extended Community value.  One is AS
815 based format the other is IP address based format.
817 @table @code
818 @item AS:VAL
819 This is a format to define AS based Extended Community value.
820 @code{AS} part is 2 octets Global Administrator subfield in Extended
821 Community value.  @code{VAL} part is 4 octets Local Administrator
822 subfield.  @code{7675:100} represents AS 7675 policy value 100.
823 @item IP-Address:VAL
824 This is a format to define IP address based Extended Community value.
825 @code{IP-Address} part is 4 octets Global Administrator subfield.
826 @code{VAL} part is 2 octets Local Administrator subfield.
827 @code{10.0.0.1:100} represents 
828 @end table
830 @menu
831 * BGP Extended Community Lists::  
832 * BGP Extended Communities in Route Map::  
833 @end menu
835 @node BGP Extended Community Lists
836 @subsection BGP Extended Community Lists
838 Expanded Community Lists is a user defined BGP Expanded Community
839 Lists.
841 @deffn Command {ip extcommunity-list standard @var{name} @{permit|deny@} @var{extcommunity}} {}
842 This command defines a new standard extcommunity-list.
843 @var{extcommunity} is extended communities value.  The
844 @var{extcommunity} is compiled into extended community structure.  We
845 can define multiple extcommunity-list under same name.  In that case
846 match will happen user defined order.  Once the extcommunity-list
847 matches to extended communities attribute in BGP updates it return
848 permit or deny based upon the extcommunity-list definition.  When
849 there is no matched entry, deny will be returned.  When
850 @var{extcommunity} is empty it matches to any routes.
851 @end deffn
853 @deffn Command {ip extcommunity-list expanded @var{name} @{permit|deny@} @var{line}} {}
854 This command defines a new expanded extcommunity-list.  @var{line} is
855 a string expression of extended communities attribute.  @var{line} can
856 include regular expression to match extended communities attribute in
857 BGP updates.
858 @end deffn
860 @deffn Command {no ip extcommunity-list @var{name}} {}
861 @deffnx Command {no ip extcommunity-list standard @var{name}} {}
862 @deffnx Command {no ip extcommunity-list expanded @var{name}} {}
863 These commands delete extended community lists specified by
864 @var{name}.  All of extended community lists shares a single name
865 space.  So extended community lists can be removed simpley specifying
866 the name.
867 @end deffn
869 @deffn {Command} {show ip extcommunity-list} {}
870 @deffnx {Command} {show ip extcommunity-list @var{name}} {}
871 This command display current extcommunity-list information.  When
872 @var{name} is specified the community list's information is shown.
874 @example
875 # show ip extcommunity-list 
876 @end example
877 @end deffn
879 @node BGP Extended Communities in Route Map
880 @subsection BGP Extended Communities in Route Map
882 @deffn {Route Map} {match extcommunity @var{word}} {}
883 @end deffn
885 @deffn {Route Map} {set extcommunity rt @var{extcommunity}} {}
886 This command set Route Target value.
887 @end deffn
889 @deffn {Route Map} {set extcommunity soo @var{extcommunity}} {}
890 This command set Site of Origin value.
891 @end deffn
893 @c -----------------------------------------------------------------------
894 @node Displaying BGP routes
895 @section Displaying BGP Routes
897 @menu
898 * Show IP BGP::                 
899 * More Show IP BGP::            
900 @end menu
902 @node Show IP BGP
903 @subsection Show IP BGP
905 @deffn {Command} {show ip bgp} {}
906 @deffnx {Command} {show ip bgp @var{A.B.C.D}} {}
907 @deffnx {Command} {show ip bgp @var{X:X::X:X}} {}
908 This command displays BGP routes.  When no route is specified it
909 display all of IPv4 BGP routes.
910 @end deffn
912 @example
913 BGP table version is 0, local router ID is 10.1.1.1
914 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
915 Origin codes: i - IGP, e - EGP, ? - incomplete
917    Network          Next Hop            Metric LocPrf Weight Path
918 *> 1.1.1.1/32       0.0.0.0                  0         32768 i
920 Total number of prefixes 1
921 @end example
923 @node More Show IP BGP
924 @subsection More Show IP BGP
926 @deffn {Command} {show ip bgp regexp @var{line}} {}
927 This command display BGP routes using AS path regular expression (@pxref{Display BGP Routes by AS Path}).
928 @end deffn
930 @deffn Command {show ip bgp community @var{community}} {}
931 @deffnx Command {show ip bgp community @var{community} exact-match} {}
932 This command display BGP routes using @var{community} (@pxref{Display
933 BGP Routes by Community}).
934 @end deffn
936 @deffn Command {show ip bgp community-list @var{word}} {}
937 @deffnx Command {show ip bgp community-list @var{word} exact-match} {}
938 This command display BGP routes using community list (@pxref{Display
939 BGP Routes by Community}).
940 @end deffn
942 @deffn {Command} {show ip bgp summary} {}
943 @end deffn
945 @deffn {Command} {show ip bgp neighbor [@var{peer}]} {}
946 @end deffn
948 @deffn {Command} {clear ip bgp @var{peer}} {}
949 Clear peers which have addresses of X.X.X.X
950 @end deffn
952 @deffn {Command} {clear ip bgp @var{peer} soft in} {}
953 Clear peer using soft reconfiguration.
954 @end deffn
956 @deffn {Command} {show debug} {}
957 @end deffn
959 @deffn {Command} {debug event} {}
960 @end deffn
962 @deffn {Command} {debug update} {}
963 @end deffn
965 @deffn {Command} {debug keepalive} {}
966 @end deffn
968 @deffn {Command} {no debug event} {}
969 @end deffn
971 @deffn {Command} {no debug update} {}
972 @end deffn
974 @deffn {Command} {no debug keepalive} {}
975 @end deffn
977 @node Capability Negotiation
978 @section Capability Negotiation
980 When adding IPv6 routing information exchange feature to BGP.  There
981 were some proposals.  @acronym{IETF,Internet Engineering Task Force}
982 @acronym{IDR, Inter Domain Routing} @acronym{WG, Working group} adopted
983 a proposal called Multiprotocol Extension for BGP.  The specification
984 is described in @cite{RFC2283}.  The protocol does not define new protocols. 
985 It defines new attributes to existing BGP.  When it is used exchanging
986 IPv6 routing information it is called BGP-4+.  When it is used for
987 exchanging multicast routing information it is called MBGP.
989 @command{bgpd} supports Multiprotocol Extension for BGP.  So if remote
990 peer supports the protocol, @command{bgpd} can exchange IPv6 and/or
991 multicast routing information.
993 Traditional BGP did not have the feature to detect remote peer's
994 capabilities, e.g. whether it can handle prefix types other than IPv4
995 unicast routes.  This was a big problem using Multiprotocol Extension
996 for BGP to operational network.  @cite{RFC2842, Capabilities
997 Advertisement with BGP-4} adopted a feature called Capability
998 Negotiation. @command{bgpd} use this Capability Negotiation to detect
999 the remote peer's capabilities.  If the peer is only configured as IPv4
1000 unicast neighbor, @command{bgpd} does not send these Capability
1001 Negotiation packets (at least not unless other optional BGP features
1002 require capability negotation).
1004 By default, Quagga will bring up peering with minimal common capability
1005 for the both sides.  For example, local router has unicast and
1006 multicast capabilitie and remote router has unicast capability.  In
1007 this case, the local router will establish the connection with unicast
1008 only capability. When there are no common capabilities, Quagga sends
1009 Unsupported Capability error and then resets the connection.
1011 If you want to completely match capabilities with remote peer.  Please
1012 use @command{strict-capability-match} command.
1013   
1014 @deffn {BGP} {neighbor @var{peer} strict-capability-match} {}
1015 @deffnx {BGP} {no neighbor @var{peer} strict-capability-match} {}
1016 Strictly compares remote capabilities and local capabilities.  If capabilities
1017 are different, send Unsupported Capability error then reset connection.
1018 @end deffn
1020 You may want to disable sending Capability Negotiation OPEN message
1021 optional parameter to the peer when remote peer does not implement
1022 Capability Negotiation.  Please use @command{dont-capability-negotiate}
1023 command to disable the feature.
1025 @deffn {BGP} {neighbor @var{peer} dont-capability-negotiate} {}
1026 @deffnx {BGP} {no neighbor @var{peer} dont-capability-negotiate} {}
1027 Suppress sending Capability Negotiation as OPEN message optional
1028 parameter to the peer.  This command only affects the peer is configured
1029 other than IPv4 unicast configuration.
1030 @end deffn
1032 When remote peer does not have capability negotiation feature, remote
1033 peer will not send any capabilities at all.  In that case, bgp
1034 configures the peer with configured capabilities.
1036 You may prefer locally configured capabilities more than the negotiated
1037 capabilities even though remote peer sends capabilities.  If the peer
1038 is configured by @command{override-capability}, @command{bgpd} ignores
1039 received capabilities then override negotiated capabilities with
1040 configured values.
1042 @deffn {BGP} {neighbor @var{peer} override-capability} {}
1043 @deffnx {BGP} {no neighbor @var{peer} override-capability} {}
1044 Override the result of Capability Negotiation with local configuration.
1045 Ignore remote peer's capability value.
1046 @end deffn
1048 @node Route Reflector
1049 @section Route Reflector
1051 @deffn {BGP} {bgp cluster-id @var{a.b.c.d}} {}
1052 @end deffn
1054 @deffn {BGP} {neighbor @var{peer} route-reflector-client} {}
1055 @deffnx {BGP} {no neighbor @var{peer} route-reflector-client} {}
1056 @end deffn
1058 @node Route Server
1059 @section Route Server
1061 At an Internet Exchange point, many ISPs are connected to each other by
1062 external BGP peering.  Normally these external BGP connection are done by
1063 @samp{full mesh} method.  As with internal BGP full mesh formation,
1064 this method has a scaling problem.
1066 This scaling problem is well known.  Route Server is a method to resolve
1067 the problem.  Each ISP's BGP router only peers to Route Server.  Route
1068 Server serves as BGP information exchange to other BGP routers.  By
1069 applying this method, numbers of BGP connections is reduced from
1070 O(n*(n-1)/2) to O(n).
1072 Unlike normal BGP router, Route Server must have several routing tables
1073 for managing different routing policies for each BGP speaker.  We call the
1074 routing tables as different @code{view}s.  @command{bgpd} can work as
1075 normal BGP router or Route Server or both at the same time.
1077 @menu
1078 * Multiple instance::           
1079 * BGP instance and view::       
1080 * Routing policy::              
1081 * Viewing the view::            
1082 @end menu
1084 @node Multiple instance
1085 @subsection Multiple instance
1087 To enable multiple view function of @code{bgpd}, you must turn on
1088 multiple instance feature beforehand.
1090 @deffn {Command} {bgp multiple-instance} {}
1091 Enable BGP multiple instance feature.  After this feature is enabled,
1092 you can make multiple BGP instances or multiple BGP views.
1093 @end deffn
1095 @deffn {Command} {no bgp multiple-instance} {}
1096 Disable BGP multiple instance feature.  You can not disable this feature
1097 when BGP multiple instances or views exist.
1098 @end deffn
1100 When you want to make configuration more Cisco like one, 
1102 @deffn {Command} {bgp config-type cisco} {}
1103 Cisco compatible BGP configuration output.
1104 @end deffn
1106 When bgp config-type cisco is specified, 
1108 ``no synchronization'' is displayed.
1109 ``no auto-summary'' is desplayed.
1111 ``network'' and ``aggregate-address'' argument is displayed as
1112 ``A.B.C.D M.M.M.M''
1114 Quagga: network 10.0.0.0/8
1115 Cisco: network 10.0.0.0
1117 Quagga: aggregate-address 192.168.0.0/24
1118 Cisco: aggregate-address 192.168.0.0 255.255.255.0
1120 Community attribute handling is also different.  If there is no
1121 configuration is specified community attribute and extended community
1122 attribute are sent to neighbor.  When user manually disable the
1123 feature community attribute is not sent to the neighbor.  In case of
1124 @command{bgp config-type cisco} is specified, community attribute is not
1125 sent to the neighbor by default.  To send community attribute user has
1126 to specify @command{neighbor A.B.C.D send-community} command.
1128 @example
1130 router bgp 1
1131  neighbor 10.0.0.1 remote-as 1
1132  no neighbor 10.0.0.1 send-community
1134 router bgp 1
1135  neighbor 10.0.0.1 remote-as 1
1136  neighbor 10.0.0.1 send-community
1138 @end example
1140 @deffn {Command} {bgp config-type zebra} {}
1141 Quagga style BGP configuration.  This is default.
1142 @end deffn
1144 @node BGP instance and view
1145 @subsection BGP instance and view
1147 BGP instance is a normal BGP process.  The result of route selection
1148 goes to the kernel routing table.  You can setup different AS at the
1149 same time when BGP multiple instance feature is enabled.
1151 @deffn {Command} {router bgp @var{as-number}} {}
1152 Make a new BGP instance.  You can use arbitrary word for the @var{name}.
1153 @end deffn
1155 @example
1156 @group
1157 bgp multiple-instance
1159 router bgp 1
1160  neighbor 10.0.0.1 remote-as 2
1161  neighbor 10.0.0.2 remote-as 3
1163 router bgp 2
1164  neighbor 10.0.0.3 remote-as 4
1165  neighbor 10.0.0.4 remote-as 5
1166 @end group
1167 @end example
1169 BGP view is almost same as normal BGP process. The result of
1170 route selection does not go to the kernel routing table.  BGP view is
1171 only for exchanging BGP routing information.
1173 @deffn {Command} {router bgp @var{as-number} view @var{name}} {}
1174 Make a new BGP view.  You can use arbitrary word for the @var{name}.  This
1175 view's route selection result does not go to the kernel routing table.
1176 @end deffn
1178 With this command, you can setup Route Server like below.
1180 @example
1181 @group
1182 bgp multiple-instance
1184 router bgp 1 view 1
1185  neighbor 10.0.0.1 remote-as 2
1186  neighbor 10.0.0.2 remote-as 3
1188 router bgp 2 view 2
1189  neighbor 10.0.0.3 remote-as 4
1190  neighbor 10.0.0.4 remote-as 5
1191 @end group
1192 @end example
1194 @node Routing policy
1195 @subsection Routing policy
1197 You can set different routing policy for a peer.  For example, you can
1198 set different filter for a peer.
1200 @example
1201 @group
1202 bgp multiple-instance
1204 router bgp 1 view 1
1205  neighbor 10.0.0.1 remote-as 2
1206  neighbor 10.0.0.1 distribute-list 1 in
1208 router bgp 1 view 2
1209  neighbor 10.0.0.1 remote-as 2
1210  neighbor 10.0.0.1 distribute-list 2 in
1211 @end group
1212 @end example
1214 This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view
1215 2.  When the update is inserted into view 1, distribute-list 1 is
1216 applied.  On the other hand, when the update is inserted into view 2,
1217 distribute-list 2 is applied.
1219 @node Viewing the view
1220 @subsection Viewing the view
1222 To display routing table of BGP view, you must specify view name.
1224 @deffn {Command} {show ip bgp view @var{name}} {}
1225 Display routing table of BGP view @var{name}.
1226 @end deffn
1228 @node How to set up a 6-Bone connection
1229 @section How to set up a 6-Bone connection
1232 @example
1233 @group
1234 zebra configuration 
1235 =================== 
1236 !  
1237 ! Actually there is no need to configure zebra 
1240 bgpd configuration
1241 ==================
1243 ! This means that routes go through zebra and into the kernel.
1245 router zebra
1247 ! MP-BGP configuration
1249 router bgp 7675
1250  bgp router-id 10.0.0.1
1251  neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as @var{as-number}
1253  address-family ipv6
1254  network 3ffe:506::/32
1255  neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
1256  neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
1257  neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as @var{as-number}
1258  neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
1259  exit-address-family
1261 ipv6 access-list all permit any
1263 ! Set output nexthop address.
1265 route-map set-nexthop permit 10
1266  match ipv6 address all
1267  set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
1268  set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
1270 ! logfile FILENAME is obsolete.  Please use log file FILENAME
1272 log file bgpd.log
1274 @end group
1275 @end example
1277 @node Dump BGP packets and table
1278 @section Dump BGP packets and table
1280 @deffn Command {dump bgp all @var{path}} {}
1281 @deffnx Command {dump bgp all @var{path} @var{interval}} {}
1282 Dump all BGP packet and events to @var{path} file.
1283 @end deffn 
1285 @deffn Command {dump bgp updates @var{path}} {}
1286 @deffnx Command {dump bgp updates @var{path} @var{interval}} {}
1287 Dump BGP updates to @var{path} file.
1288 @end deffn
1290 @deffn Command {dump bgp routes @var{path}} {}
1291 @deffnx Command {dump bgp routes @var{path}} {}
1292 Dump whole BGP routing table to @var{path}.  This is heavy process.
1293 @end deffn
1295 @node BGP Configuration Examples
1296 @section BGP Configuration Examples
1298 Example of a session to an upstream, advertising only one prefix to it.
1300 @example
1301 router bgp 64512
1302  bgp router-id 10.236.87.1
1303  network 10.236.87.0/24
1304  neighbor upstream peer-group
1305  neighbor upstream remote-as 64515
1306  neighbor upstream capability dynamic
1307  neighbor upstream prefix-list pl-allowed-adv out
1308  neighbor 10.1.1.1 peer-group upstream
1309  neighbor 10.1.1.1 description ACME ISP
1311 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
1312 ip prefix-list pl-allowed-adv seq 10 deny any
1314 @end example
1316 A more complex example. With upstream, peer and customer sessions.
1317 Advertising global prefixes and NO_EXPORT prefixes and providing
1318 actions for customer routes based on community values. Extensive use of
1319 route-maps and the 'call' feature to support selective advertising of
1320 prefixes. This example is intended as guidance only, it has NOT been
1321 tested and almost certainly containts silly mistakes, if not serious
1322 flaws.
1324 @example
1325 router bgp 64512
1326  bgp router-id 10.236.87.1
1327  network 10.123.456.0/24
1328  network 10.123.456.128/25 route-map rm-no-export
1329  neighbor upstream capability dynamic
1330  neighbor upstream route-map rm-upstream-out out
1331  neighbor cust capability dynamic
1332  neighbor cust route-map rm-cust-in in
1333  neighbor cust route-map rm-cust-out out
1334  neighbor cust send-community both
1335  neighbor peer capability dynamic
1336  neighbor peer route-map rm-peer-in in
1337  neighbor peer route-map rm-peer-out out
1338  neighbor peer send-community both
1339  neighbor 10.1.1.1 remote-as 64515
1340  neighbor 10.1.1.1 peer-group upstream
1341  neighbor 10.2.1.1 remote-as 64516
1342  neighbor 10.2.1.1 peer-group upstream
1343  neighbor 10.3.1.1 remote-as 64517
1344  neighbor 10.3.1.1 peer-group cust-default
1345  neighbor 10.3.1.1 description customer1
1346  neighbor 10.3.1.1 prefix-list pl-cust1-network in
1347  neighbor 10.4.1.1 remote-as 64518
1348  neighbor 10.4.1.1 peer-group cust
1349  neighbor 10.4.1.1 prefix-list pl-cust2-network in
1350  neighbor 10.4.1.1 description customer2
1351  neighbor 10.5.1.1 remote-as 64519
1352  neighbor 10.5.1.1 peer-group peer
1353  neighbor 10.5.1.1 prefix-list pl-peer1-network in
1354  neighbor 10.5.1.1 description peer AS 1
1355  neighbor 10.6.1.1 remote-as 64520
1356  neighbor 10.6.1.1 peer-group peer
1357  neighbor 10.6.1.1 prefix-list pl-peer2-network in
1358  neighbor 10.6.1.1 description peer AS 2
1360 ip prefix-list pl-default permit 0.0.0.0/0
1362 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
1363 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
1365 ip prefix-list pl-cust1-network permit 10.3.1.0/24
1366 ip prefix-list pl-cust1-network permit 10.3.2.0/24
1368 ip prefix-list pl-cust2-network permit 10.4.1.0/24
1370 ip prefix-list pl-peer1-network permit 10.5.1.0/24
1371 ip prefix-list pl-peer1-network permit 10.5.2.0/24
1372 ip prefix-list pl-peer1-network permit 192.168.0.0/24
1374 ip prefix-list pl-peer2-network permit 10.6.1.0/24
1375 ip prefix-list pl-peer2-network permit 10.6.2.0/24
1376 ip prefix-list pl-peer2-network permit 192.168.1.0/24
1377 ip prefix-list pl-peer2-network permit 192.168.2.0/24
1378 ip prefix-list pl-peer2-network permit 172.16.1/24
1380 ip as-path access-list asp-own-as permit ^$
1381 ip as-path access-list asp-own-as permit _64512_
1383 ! #################################################################
1384 ! Match communities we provide actions for, on routes receives from
1385 ! customers. Communities values of <our-ASN>:X, with X, have actions:
1387 ! 100 - blackhole the prefix
1388 ! 200 - set no_export
1389 ! 300 - advertise only to other customers
1390 ! 400 - advertise only to upstreams
1391 ! 500 - set no_export when advertising to upstreams
1392 ! 2X00 - set local_preference to X00
1394 ! blackhole the prefix of the route
1395 ip community-list standard cm-blackhole permit 64512:100
1397 ! set no-export community before advertising
1398 ip community-list standard cm-set-no-export permit 64512:200
1400 ! advertise only to other customers
1401 ip community-list standard cm-cust-only permit 64512:300
1403 ! advertise only to upstreams
1404 ip community-list standard cm-upstream-only permit 64512:400
1406 ! advertise to upstreams with no-export
1407 ip community-list standard cm-upstream-noexport permit 64512:500
1409 ! set local-pref to least significant 3 digits of the community
1410 ip community-list standard cm-prefmod-100 permit 64512:2100
1411 ip community-list standard cm-prefmod-200 permit 64512:2200
1412 ip community-list standard cm-prefmod-300 permit 64512:2300
1413 ip community-list standard cm-prefmod-400 permit 64512:2400
1414 ip community-list expanded cme-prefmod-range permit 64512:2...
1416 ! Informational communities
1418 ! 3000 - learned from upstream
1419 ! 3100 - learned from customer
1420 ! 3200 - learned from peer
1422 ip community-list standard cm-learnt-upstream permit 64512:3000
1423 ip community-list standard cm-learnt-cust permit 64512:3100
1424 ip community-list standard cm-learnt-peer permit 64512:3200
1426 ! ###################################################################
1427 ! Utility route-maps
1429 ! These utility route-maps generally should not used to permit/deny
1430 ! routes, i.e. they do not have meaning as filters, and hence probably
1431 ! should be used with 'on-match next'. These all finish with an empty
1432 ! permit entry so as not interfere with processing in the caller.
1434 route-map rm-no-export permit 10
1435  set community additive no-export
1436 route-map rm-no-export permit 20
1438 route-map rm-blackhole permit 10
1439  description blackhole, up-pref and ensure it cant escape this AS
1440  set ip next-hop 127.0.0.1
1441  set local-preference 10
1442  set community additive no-export
1443 route-map rm-blackhole permit 20
1445 ! Set local-pref as requested
1446 route-map rm-prefmod permit 10
1447  match community cm-prefmod-100
1448  set local-preference 100
1449 route-map rm-prefmod permit 20
1450  match community cm-prefmod-200
1451  set local-preference 200
1452 route-map rm-prefmod permit 30
1453  match community cm-prefmod-300
1454  set local-preference 300
1455 route-map rm-prefmod permit 40
1456  match community cm-prefmod-400
1457  set local-preference 400
1458 route-map rm-prefmod permit 50
1460 ! Community actions to take on receipt of route.
1461 route-map rm-community-in permit 10
1462  description check for blackholing, no point continuing if it matches.
1463  match community cm-blackhole
1464  call rm-blackhole
1465 route-map rm-community-in permit 20
1466  match community cm-set-no-export
1467  call rm-no-export
1468  on-match next
1469 route-map rm-community-in permit 30
1470  match community cme-prefmod-range
1471  call rm-prefmod
1472 route-map rm-community-in permit 40
1474 ! #####################################################################
1475 ! Community actions to take when advertising a route.
1476 ! These are filtering route-maps, 
1478 ! Deny customer routes to upstream with cust-only set.
1479 route-map rm-community-filt-to-upstream deny 10
1480  match community cm-learnt-cust
1481  match community cm-cust-only
1482 route-map rm-community-filt-to-upstream permit 20
1484 ! Deny customer routes to other customers with upstream-only set.
1485 route-map rm-community-filt-to-cust deny 10
1486  match community cm-learnt-cust
1487  match community cm-upstream-only
1488 route-map rm-community-filt-to-cust permit 20
1490 ! ###################################################################
1491 ! The top-level route-maps applied to sessions. Further entries could
1492 ! be added obviously..
1494 ! Customers
1495 route-map rm-cust-in permit 10
1496  call rm-community-in
1497  on-match next
1498 route-map rm-cust-in permit 20
1499  set community additive 64512:3100
1500 route-map rm-cust-in permit 30
1502 route-map rm-cust-out permit 10
1503  call rm-community-filt-to-cust
1504  on-match next
1505 route-map rm-cust-out permit 20
1507 ! Upstream transit ASes
1508 route-map rm-upstream-out permit 10
1509  description filter customer prefixes which are marked cust-only
1510  call rm-community-filt-to-upstream
1511  on-match next
1512 route-map rm-upstream-out permit 20
1513  description only customer routes are provided to upstreams/peers
1514  match community cm-learnt-cust
1516 ! Peer ASes
1517 ! outbound policy is same as for upstream
1518 route-map rm-peer-out permit 10
1519  call rm-upstream-out
1521 route-map rm-peer-in permit 10
1522  set community additive 64512:3200
1523 @end example