]> git.proxmox.com Git - mirror_frr.git/blob - doc/bgpd.texi
doc: Document 'set as-path prepend' and 'set as-path prepend last-as'
[mirror_frr.git] / doc / bgpd.texi
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
7
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)}.
13
14 Many extensions have been added to @cite{RFC1771}. @cite{RFC2858,
15 Multiprotocol Extensions for BGP-4} provides multiprotocol support to
16 BGP-4.
17
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
36
37 @node Starting BGP
38 @section Starting BGP
39
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}.
44
45 @command{bgpd} specific invocation options are described below. Common
46 options may also be specified (@pxref{Common Invocation Options}).
47
48 @table @samp
49 @item -p @var{PORT}
50 @itemx --bgp_port=@var{PORT}
51 Set the bgp protocol's port number.
52
53 @item -r
54 @itemx --retain
55 When program terminates, retain BGP routes added by zebra.
56 @end table
57
58 @node BGP router
59 @section BGP router
60
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.
65
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
72
73 @deffn Command {no router bgp @var{asn}} {}
74 Destroy a BGP protocol process with the specified @var{asn}.
75 @end deffn
76
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
84
85 @menu
86 * BGP distance::
87 * BGP decision process::
88 * BGP route flap dampening::
89 @end menu
90
91 @node BGP distance
92 @subsection BGP distance
93
94 @deffn {BGP} {distance bgp <1-255> <1-255> <1-255>} {}
95 This command change distance value of BGP. Each argument is distance
96 value for external routes, internal routes and local routes.
97 @end deffn
98
99 @deffn {BGP} {distance <1-255> @var{A.B.C.D/M}} {}
100 @deffnx {BGP} {distance <1-255> @var{A.B.C.D/M} @var{word}} {}
101 This command set distance value to
102 @end deffn
103
104 @node BGP decision process
105 @subsection BGP decision process
106
107 @table @asis
108 @item 1. Weight check
109
110 @item 2. Local preference check.
111
112 @item 3. Local route check.
113
114 @item 4. AS path length check.
115
116 @item 5. Origin check.
117
118 @item 6. MED check.
119 @end table
120
121 @deffn {BGP} {bgp bestpath as-path confed} {}
122 This command specifies that the length of confederation path sets and
123 sequences should should be taken into account during the BGP best path
124 decision process.
125 @end deffn
126
127 @deffn {BGP} {bgp bestpath as-path multipath-relax} {}
128 This command specifies that BGP decision process should consider paths
129 of equal AS_PATH length candidates for multipath computation. Without
130 the knob, the entire AS_PATH must match for multipath computation.
131 @end deffn
132
133 @node BGP route flap dampening
134 @subsection BGP route flap dampening
135
136 @deffn {BGP} {bgp dampening @var{<1-45>} @var{<1-20000>} @var{<1-20000>} @var{<1-255>}} {}
137 This command enables BGP route-flap dampening and specifies dampening parameters.
138
139 @table @asis
140 @item @asis{half-life}
141 Half-life time for the penalty
142 @item @asis{reuse-threshold}
143 Value to start reusing a route
144 @item @asis{suppress-threshold}
145 Value to start suppressing a route
146 @item @asis{max-suppress}
147 Maximum duration to suppress a stable route
148 @end table
149
150 The route-flap damping algorithm is compatible with @cite{RFC2439}. The use of this command
151 is not recommended nowadays, see @uref{http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378}.
152 @end deffn
153
154 @node BGP network
155 @section BGP network
156
157 @menu
158 * BGP route::
159 * Route Aggregation::
160 * Redistribute to BGP::
161 @end menu
162
163 @node BGP route
164 @subsection BGP route
165
166 @deffn {BGP} {network @var{A.B.C.D/M}} {}
167 This command adds the announcement network.
168 @example
169 @group
170 router bgp 1
171 network 10.0.0.0/8
172 @end group
173 @end example
174 This configuration example says that network 10.0.0.0/8 will be
175 announced to all neighbors. Some vendors' routers don't advertise
176 routes if they aren't present in their IGP routing tables; @code{bgpd}
177 doesn't care about IGP routes when announcing its routes.
178 @end deffn
179
180 @deffn {BGP} {no network @var{A.B.C.D/M}} {}
181 @end deffn
182
183 @node Route Aggregation
184 @subsection Route Aggregation
185
186 @deffn {BGP} {aggregate-address @var{A.B.C.D/M}} {}
187 This command specifies an aggregate address.
188 @end deffn
189
190 @deffn {BGP} {aggregate-address @var{A.B.C.D/M} as-set} {}
191 This command specifies an aggregate address. Resulting routes inlucde
192 AS set.
193 @end deffn
194
195 @deffn {BGP} {aggregate-address @var{A.B.C.D/M} summary-only} {}
196 This command specifies an aggregate address. Aggreated routes will
197 not be announce.
198 @end deffn
199
200 @deffn {BGP} {no aggregate-address @var{A.B.C.D/M}} {}
201 @end deffn
202
203 @node Redistribute to BGP
204 @subsection Redistribute to BGP
205
206 @deffn {BGP} {redistribute kernel} {}
207 Redistribute kernel route to BGP process.
208 @end deffn
209
210 @deffn {BGP} {redistribute static} {}
211 Redistribute static route to BGP process.
212 @end deffn
213
214 @deffn {BGP} {redistribute connected} {}
215 Redistribute connected route to BGP process.
216 @end deffn
217
218 @deffn {BGP} {redistribute rip} {}
219 Redistribute RIP route to BGP process.
220 @end deffn
221
222 @deffn {BGP} {redistribute ospf} {}
223 Redistribute OSPF route to BGP process.
224 @end deffn
225
226 @deffn {BGP} {update-delay @var{max-delay}} {}
227 @deffnx {BGP} {update-delay @var{max-delay} @var{establish-wait}} {}
228 This feature is used to enable read-only mode on BGP process restart or when
229 BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
230 would begin as soon as the first peer reaches Established status and a timer
231 for max-delay seconds is started.
232
233 During this mode BGP doesn't run any best-path or generate any updates to its
234 peers. This mode continues until:
235 1. All the configured peers, except the shutdown peers, have sent explicit EOR
236 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
237 Established is considered an implicit-EOR.
238 If the establish-wait optional value is given, then BGP will wait for
239 peers to reach established from the begining of the update-delay till the
240 establish-wait period is over, i.e. the minimum set of established peers for
241 which EOR is expected would be peers established during the establish-wait
242 window, not necessarily all the configured neighbors.
243 2. max-delay period is over.
244 On hitting any of the above two conditions, BGP resumes the decision process
245 and generates updates to its peers.
246
247 Default max-delay is 0, i.e. the feature is off by default.
248 @end deffn
249
250 @deffn {BGP} {table-map @var{route-map-name}} {}
251 This feature is used to apply a route-map on route updates from BGP to Zebra.
252 All the applicable match operations are allowed, such as match on prefix,
253 next-hop, communities, etc. Set operations for this attach-point are limited
254 to metric and next-hop only. Any operation of this feature does not affect
255 BGPs internal RIB.
256
257 Supported for ipv4 and ipv6 address families. It works on multi-paths as well,
258 however, metric setting is based on the best-path only.
259 @end deffn
260
261 @node BGP Peer
262 @section BGP Peer
263
264 @menu
265 * Defining Peer::
266 * BGP Peer commands::
267 * Peer filtering::
268 @end menu
269
270 @node Defining Peer
271 @subsection Defining Peer
272
273 @deffn {BGP} {neighbor @var{peer} remote-as @var{asn}} {}
274 Creates a new neighbor whose remote-as is @var{asn}. @var{peer}
275 can be an IPv4 address or an IPv6 address.
276 @example
277 @group
278 router bgp 1
279 neighbor 10.0.0.1 remote-as 2
280 @end group
281 @end example
282 In this case my router, in AS-1, is trying to peer with AS-2 at
283 10.0.0.1.
284
285 This command must be the first command used when configuring a neighbor.
286 If the remote-as is not specified, @command{bgpd} will complain like this:
287 @example
288 can't find neighbor 10.0.0.1
289 @end example
290 @end deffn
291
292 @node BGP Peer commands
293 @subsection BGP Peer commands
294
295 In a @code{router bgp} clause there are neighbor specific configurations
296 required.
297
298 @deffn {BGP} {neighbor @var{peer} shutdown} {}
299 @deffnx {BGP} {no neighbor @var{peer} shutdown} {}
300 Shutdown the peer. We can delete the neighbor's configuration by
301 @code{no neighbor @var{peer} remote-as @var{as-number}} but all
302 configuration of the neighbor will be deleted. When you want to
303 preserve the configuration, but want to drop the BGP peer, use this
304 syntax.
305 @end deffn
306
307 @deffn {BGP} {neighbor @var{peer} ebgp-multihop} {}
308 @deffnx {BGP} {no neighbor @var{peer} ebgp-multihop} {}
309 @end deffn
310
311 @deffn {BGP} {neighbor @var{peer} description ...} {}
312 @deffnx {BGP} {no neighbor @var{peer} description ...} {}
313 Set description of the peer.
314 @end deffn
315
316 @deffn {BGP} {neighbor @var{peer} version @var{version}} {}
317 Set up the neighbor's BGP version. @var{version} can be @var{4},
318 @var{4+} or @var{4-}. BGP version @var{4} is the default value used for
319 BGP peering. BGP version @var{4+} means that the neighbor supports
320 Multiprotocol Extensions for BGP-4. BGP version @var{4-} is similar but
321 the neighbor speaks the old Internet-Draft revision 00's Multiprotocol
322 Extensions for BGP-4. Some routing software is still using this
323 version.
324 @end deffn
325
326 @deffn {BGP} {neighbor @var{peer} interface @var{ifname}} {}
327 @deffnx {BGP} {no neighbor @var{peer} interface @var{ifname}} {}
328 When you connect to a BGP peer over an IPv6 link-local address, you
329 have to specify the @var{ifname} of the interface used for the
330 connection. To specify IPv4 session addresses, see the
331 @code{neighbor @var{peer} update-source} command below.
332
333 This command is deprecated and may be removed in a future release. Its
334 use should be avoided.
335 @end deffn
336
337 @deffn {BGP} {neighbor @var{peer} next-hop-self [all]} {}
338 @deffnx {BGP} {no neighbor @var{peer} next-hop-self [all]} {}
339 This command specifies an announced route's nexthop as being equivalent
340 to the address of the bgp router if it is learned via eBGP.
341 If the optional keyword @code{all} is specified the modifiation is done
342 also for routes learned via iBGP.
343 @end deffn
344
345 @deffn {BGP} {neighbor @var{peer} update-source @var{<ifname|address>}} {}
346 @deffnx {BGP} {no neighbor @var{peer} update-source} {}
347 Specify the IPv4 source address to use for the @acronym{BGP} session to this
348 neighbour, may be specified as either an IPv4 address directly or
349 as an interface name (in which case the @command{zebra} daemon MUST be running
350 in order for @command{bgpd} to be able to retrieve interface state).
351 @example
352 @group
353 router bgp 64555
354 neighbor foo update-source 192.168.0.1
355 neighbor bar update-source lo0
356 @end group
357 @end example
358 @end deffn
359
360 @deffn {BGP} {neighbor @var{peer} default-originate} {}
361 @deffnx {BGP} {no neighbor @var{peer} default-originate} {}
362 @command{bgpd}'s default is to not announce the default route (0.0.0.0/0) even it
363 is in routing table. When you want to announce default routes to the
364 peer, use this command.
365 @end deffn
366
367 @deffn {BGP} {neighbor @var{peer} port @var{port}} {}
368 @deffnx {BGP} {neighbor @var{peer} port @var{port}} {}
369 @end deffn
370
371 @deffn {BGP} {neighbor @var{peer} send-community} {}
372 @deffnx {BGP} {neighbor @var{peer} send-community} {}
373 @end deffn
374
375 @deffn {BGP} {neighbor @var{peer} weight @var{weight}} {}
376 @deffnx {BGP} {no neighbor @var{peer} weight @var{weight}} {}
377 This command specifies a default @var{weight} value for the neighbor's
378 routes.
379 @end deffn
380
381 @deffn {BGP} {neighbor @var{peer} maximum-prefix @var{number}} {}
382 @deffnx {BGP} {no neighbor @var{peer} maximum-prefix @var{number}} {}
383 @end deffn
384
385 @deffn {BGP} {neighbor @var{peer} local-as @var{as-number}} {}
386 @deffnx {BGP} {neighbor @var{peer} local-as @var{as-number} no-prepend} {}
387 @deffnx {BGP} {neighbor @var{peer} local-as @var{as-number} no-prepend replace-as} {}
388 @deffnx {BGP} {no neighbor @var{peer} local-as} {}
389 Specify an alternate AS for this BGP process when interacting with the
390 specified peer. With no modifiers, the specified local-as is prepended to
391 the received AS_PATH when receiving routing updates from the peer, and
392 prepended to the outgoing AS_PATH (after the process local AS) when
393 transmitting local routes to the peer.
394
395 If the no-prepend attribute is specified, then the supplied local-as is not
396 prepended to the received AS_PATH.
397
398 If the replace-as attribute is specified, then only the supplied local-as is
399 prepended to the AS_PATH when transmitting local-route updates to this peer.
400
401 Note that replace-as can only be specified if no-prepend is.
402
403 This command is only allowed for eBGP peers.
404 @end deffn
405
406 @deffn {BGP} {neighbor @var{peer} ttl-security hops @var{number}} {}
407 @deffnx {BGP} {no neighbor @var{peer} ttl-security hops @var{number}} {}
408 This command enforces Generalized TTL Security Mechanism (GTSM), as
409 specified in RFC 5082. With this command, only neighbors that are the
410 specified number of hops away will be allowed to become neighbors. This
411 command is mututally exclusive with @command{ebgp-multihop}.
412 @end deffn
413
414 @node Peer filtering
415 @subsection Peer filtering
416
417 @deffn {BGP} {neighbor @var{peer} distribute-list @var{name} [in|out]} {}
418 This command specifies a distribute-list for the peer. @var{direct} is
419 @samp{in} or @samp{out}.
420 @end deffn
421
422 @deffn {BGP command} {neighbor @var{peer} prefix-list @var{name} [in|out]} {}
423 @end deffn
424
425 @deffn {BGP command} {neighbor @var{peer} filter-list @var{name} [in|out]} {}
426 @end deffn
427
428 @deffn {BGP} {neighbor @var{peer} route-map @var{name} [in|out]} {}
429 Apply a route-map on the neighbor. @var{direct} must be @code{in} or
430 @code{out}.
431 @end deffn
432
433 @deffn {BGP} {bgp route-reflector allow-outbound-policy} {}
434 By default, attribute modification via route-map policy out is not reflected
435 on reflected routes. This option allows the modifications to be reflected as
436 well. Once enabled, it affects all reflected routes.
437 @end deffn
438
439 @c -----------------------------------------------------------------------
440 @node BGP Peer Group
441 @section BGP Peer Group
442
443 @deffn {BGP} {neighbor @var{word} peer-group} {}
444 This command defines a new peer group.
445 @end deffn
446
447 @deffn {BGP} {neighbor @var{peer} peer-group @var{word}} {}
448 This command bind specific peer to peer group @var{word}.
449 @end deffn
450
451 @node BGP Address Family
452 @section BGP Address Family
453
454 @c -----------------------------------------------------------------------
455 @node Autonomous System
456 @section Autonomous System
457
458 The @acronym{AS,Autonomous System} number is one of the essential
459 element of BGP. BGP is a distance vector routing protocol, and the
460 AS-Path framework provides distance vector metric and loop detection to
461 BGP. @cite{RFC1930, Guidelines for creation, selection, and
462 registration of an Autonomous System (AS)} provides some background on
463 the concepts of an AS.
464
465 The AS number is a two octet value, ranging in value from 1 to 65535.
466 The AS numbers 64512 through 65535 are defined as private AS numbers.
467 Private AS numbers must not to be advertised in the global Internet.
468
469 @menu
470 * AS Path Regular Expression::
471 * Display BGP Routes by AS Path::
472 * AS Path Access List::
473 * Using AS Path in Route Map::
474 * Private AS Numbers::
475 @end menu
476
477 @node AS Path Regular Expression
478 @subsection AS Path Regular Expression
479
480 AS path regular expression can be used for displaying BGP routes and
481 AS path access list. AS path regular expression is based on
482 @code{POSIX 1003.2} regular expressions. Following description is
483 just a subset of @code{POSIX} regular expression. User can use full
484 @code{POSIX} regular expression. Adding to that special character '_'
485 is added for AS path regular expression.
486
487 @table @code
488 @item .
489 Matches any single character.
490 @item *
491 Matches 0 or more occurrences of pattern.
492 @item +
493 Matches 1 or more occurrences of pattern.
494 @item ?
495 Match 0 or 1 occurrences of pattern.
496 @item ^
497 Matches the beginning of the line.
498 @item $
499 Matches the end of the line.
500 @item _
501 Character @code{_} has special meanings in AS path regular expression.
502 It matches to space and comma , and AS set delimiter @{ and @} and AS
503 confederation delimiter @code{(} and @code{)}. And it also matches to
504 the beginning of the line and the end of the line. So @code{_} can be
505 used for AS value boundaries match. @code{show ip bgp regexp _7675_}
506 matches to all of BGP routes which as AS number include @var{7675}.
507 @end table
508
509 @node Display BGP Routes by AS Path
510 @subsection Display BGP Routes by AS Path
511
512 To show BGP routes which has specific AS path information @code{show
513 ip bgp} command can be used.
514
515 @deffn Command {show ip bgp regexp @var{line}} {}
516 This commands display BGP routes that matches AS path regular
517 expression @var{line}.
518 @end deffn
519
520 @node AS Path Access List
521 @subsection AS Path Access List
522
523 AS path access list is user defined AS path.
524
525 @deffn {Command} {ip as-path access-list @var{word} @{permit|deny@} @var{line}} {}
526 This command defines a new AS path access list.
527 @end deffn
528
529 @deffn {Command} {no ip as-path access-list @var{word}} {}
530 @deffnx {Command} {no ip as-path access-list @var{word} @{permit|deny@} @var{line}} {}
531 @end deffn
532
533 @node Using AS Path in Route Map
534 @subsection Using AS Path in Route Map
535
536 @deffn {Route Map} {match as-path @var{word}} {}
537 @end deffn
538
539 @deffn {Route Map} {set as-path prepend @var{as-path}} {}
540 Prepend the given string of AS numbers to the AS_PATH.
541 @end deffn
542
543 @deffn {Route Map} {set as-path prepend last-as @var{num}} {}
544 Prepend the existing last AS number (the leftmost ASN) to the AS_PATH.
545 @end deffn
546
547 @node Private AS Numbers
548 @subsection Private AS Numbers
549
550 @c -----------------------------------------------------------------------
551 @node BGP Communities Attribute
552 @section BGP Communities Attribute
553
554 BGP communities attribute is widely used for implementing policy
555 routing. Network operators can manipulate BGP communities attribute
556 based on their network policy. BGP communities attribute is defined
557 in @cite{RFC1997, BGP Communities Attribute} and
558 @cite{RFC1998, An Application of the BGP Community Attribute
559 in Multi-home Routing}. It is an optional transitive attribute,
560 therefore local policy can travel through different autonomous system.
561
562 Communities attribute is a set of communities values. Each
563 communities value is 4 octet long. The following format is used to
564 define communities value.
565
566 @table @code
567 @item AS:VAL
568 This format represents 4 octet communities value. @code{AS} is high
569 order 2 octet in digit format. @code{VAL} is low order 2 octet in
570 digit format. This format is useful to define AS oriented policy
571 value. For example, @code{7675:80} can be used when AS 7675 wants to
572 pass local policy value 80 to neighboring peer.
573 @item internet
574 @code{internet} represents well-known communities value 0.
575 @item no-export
576 @code{no-export} represents well-known communities value @code{NO_EXPORT}@*
577 @r{(0xFFFFFF01)}. All routes carry this value must not be advertised
578 to outside a BGP confederation boundary. If neighboring BGP peer is
579 part of BGP confederation, the peer is considered as inside a BGP
580 confederation boundary, so the route will be announced to the peer.
581 @item no-advertise
582 @code{no-advertise} represents well-known communities value
583 @code{NO_ADVERTISE}@*@r{(0xFFFFFF02)}. All routes carry this value
584 must not be advertise to other BGP peers.
585 @item local-AS
586 @code{local-AS} represents well-known communities value
587 @code{NO_EXPORT_SUBCONFED} @r{(0xFFFFFF03)}. All routes carry this
588 value must not be advertised to external BGP peers. Even if the
589 neighboring router is part of confederation, it is considered as
590 external BGP peer, so the route will not be announced to the peer.
591 @end table
592
593 When BGP communities attribute is received, duplicated communities
594 value in the communities attribute is ignored and each communities
595 values are sorted in numerical order.
596
597 @menu
598 * BGP Community Lists::
599 * Numbered BGP Community Lists::
600 * BGP Community in Route Map::
601 * Display BGP Routes by Community::
602 * Using BGP Communities Attribute::
603 @end menu
604
605 @node BGP Community Lists
606 @subsection BGP Community Lists
607
608 BGP community list is a user defined BGP communites attribute list.
609 BGP community list can be used for matching or manipulating BGP
610 communities attribute in updates.
611
612 There are two types of community list. One is standard community
613 list and another is expanded community list. Standard community list
614 defines communities attribute. Expanded community list defines
615 communities attribute string with regular expression. Standard
616 community list is compiled into binary format when user define it.
617 Standard community list will be directly compared to BGP communities
618 attribute in BGP updates. Therefore the comparison is faster than
619 expanded community list.
620
621 @deffn Command {ip community-list standard @var{name} @{permit|deny@} @var{community}} {}
622 This command defines a new standard community list. @var{community}
623 is communities value. The @var{community} is compiled into community
624 structure. We can define multiple community list under same name. In
625 that case match will happen user defined order. Once the
626 community list matches to communities attribute in BGP updates it
627 return permit or deny by the community list definition. When there is
628 no matched entry, deny will be returned. When @var{community} is
629 empty it matches to any routes.
630 @end deffn
631
632 @deffn Command {ip community-list expanded @var{name} @{permit|deny@} @var{line}} {}
633 This command defines a new expanded community list. @var{line} is a
634 string expression of communities attribute. @var{line} can include
635 regular expression to match communities attribute in BGP updates.
636 @end deffn
637
638 @deffn Command {no ip community-list @var{name}} {}
639 @deffnx Command {no ip community-list standard @var{name}} {}
640 @deffnx Command {no ip community-list expanded @var{name}} {}
641 These commands delete community lists specified by @var{name}. All of
642 community lists shares a single name space. So community lists can be
643 removed simpley specifying community lists name.
644 @end deffn
645
646 @deffn {Command} {show ip community-list} {}
647 @deffnx {Command} {show ip community-list @var{name}} {}
648 This command display current community list information. When
649 @var{name} is specified the specified community list's information is
650 shown.
651
652 @example
653 # show ip community-list
654 Named Community standard list CLIST
655 permit 7675:80 7675:100 no-export
656 deny internet
657 Named Community expanded list EXPAND
658 permit :
659
660 # show ip community-list CLIST
661 Named Community standard list CLIST
662 permit 7675:80 7675:100 no-export
663 deny internet
664 @end example
665 @end deffn
666
667 @node Numbered BGP Community Lists
668 @subsection Numbered BGP Community Lists
669
670 When number is used for BGP community list name, the number has
671 special meanings. Community list number in the range from 1 and 99 is
672 standard community list. Community list number in the range from 100
673 to 199 is expanded community list. These community lists are called
674 as numbered community lists. On the other hand normal community lists
675 is called as named community lists.
676
677 @deffn Command {ip community-list <1-99> @{permit|deny@} @var{community}} {}
678 This command defines a new community list. <1-99> is standard
679 community list number. Community list name within this range defines
680 standard community list. When @var{community} is empty it matches to
681 any routes.
682 @end deffn
683
684 @deffn Command {ip community-list <100-199> @{permit|deny@} @var{community}} {}
685 This command defines a new community list. <100-199> is expanded
686 community list number. Community list name within this range defines
687 expanded community list.
688 @end deffn
689
690 @deffn Command {ip community-list @var{name} @{permit|deny@} @var{community}} {}
691 When community list type is not specifed, the community list type is
692 automatically detected. If @var{community} can be compiled into
693 communities attribute, the community list is defined as a standard
694 community list. Otherwise it is defined as an expanded community
695 list. This feature is left for backward compability. Use of this
696 feature is not recommended.
697 @end deffn
698
699 @node BGP Community in Route Map
700 @subsection BGP Community in Route Map
701
702 In Route Map (@pxref{Route Map}), we can match or set BGP
703 communities attribute. Using this feature network operator can
704 implement their network policy based on BGP communities attribute.
705
706 Following commands can be used in Route Map.
707
708 @deffn {Route Map} {match community @var{word}} {}
709 @deffnx {Route Map} {match community @var{word} exact-match} {}
710 This command perform match to BGP updates using community list
711 @var{word}. When the one of BGP communities value match to the one of
712 communities value in community list, it is match. When
713 @code{exact-match} keyword is spcified, match happen only when BGP
714 updates have completely same communities value specified in the
715 community list.
716 @end deffn
717
718 @deffn {Route Map} {set community none} {}
719 @deffnx {Route Map} {set community @var{community}} {}
720 @deffnx {Route Map} {set community @var{community} additive} {}
721 This command manipulate communities value in BGP updates. When
722 @code{none} is specified as communities value, it removes entire
723 communities attribute from BGP updates. When @var{community} is not
724 @code{none}, specified communities value is set to BGP updates. If
725 BGP updates already has BGP communities value, the existing BGP
726 communities value is replaced with specified @var{community} value.
727 When @code{additive} keyword is specified, @var{community} is appended
728 to the existing communities value.
729 @end deffn
730
731 @deffn {Route Map} {set comm-list @var{word} delete} {}
732 This command remove communities value from BGP communities attribute.
733 The @var{word} is community list name. When BGP route's communities
734 value matches to the community list @var{word}, the communities value
735 is removed. When all of communities value is removed eventually, the
736 BGP update's communities attribute is completely removed.
737 @end deffn
738
739 @node Display BGP Routes by Community
740 @subsection Display BGP Routes by Community
741
742 To show BGP routes which has specific BGP communities attribute,
743 @code{show ip bgp} command can be used. The @var{community} value and
744 community list can be used for @code{show ip bgp} command.
745
746 @deffn Command {show ip bgp community} {}
747 @deffnx Command {show ip bgp community @var{community}} {}
748 @deffnx Command {show ip bgp community @var{community} exact-match} {}
749 @code{show ip bgp community} displays BGP routes which has communities
750 attribute. When @var{community} is specified, BGP routes that matches
751 @var{community} value is displayed. For this command, @code{internet}
752 keyword can't be used for @var{community} value. When
753 @code{exact-match} is specified, it display only routes that have an
754 exact match.
755 @end deffn
756
757 @deffn Command {show ip bgp community-list @var{word}} {}
758 @deffnx Command {show ip bgp community-list @var{word} exact-match} {}
759 This commands display BGP routes that matches community list
760 @var{word}. When @code{exact-match} is specified, display only routes
761 that have an exact match.
762 @end deffn
763
764 @node Using BGP Communities Attribute
765 @subsection Using BGP Communities Attribute
766
767 Following configuration is the most typical usage of BGP communities
768 attribute. AS 7675 provides upstream Internet connection to AS 100.
769 When following configuration exists in AS 7675, AS 100 networks
770 operator can set local preference in AS 7675 network by setting BGP
771 communities attribute to the updates.
772
773 @example
774 router bgp 7675
775 neighbor 192.168.0.1 remote-as 100
776 neighbor 192.168.0.1 route-map RMAP in
777 !
778 ip community-list 70 permit 7675:70
779 ip community-list 70 deny
780 ip community-list 80 permit 7675:80
781 ip community-list 80 deny
782 ip community-list 90 permit 7675:90
783 ip community-list 90 deny
784 !
785 route-map RMAP permit 10
786 match community 70
787 set local-preference 70
788 !
789 route-map RMAP permit 20
790 match community 80
791 set local-preference 80
792 !
793 route-map RMAP permit 30
794 match community 90
795 set local-preference 90
796 @end example
797
798 Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675.
799 The route has communities value 7675:80 so when above configuration
800 exists in AS 7675, announced route's local preference will be set to
801 value 80.
802
803 @example
804 router bgp 100
805 network 10.0.0.0/8
806 neighbor 192.168.0.2 remote-as 7675
807 neighbor 192.168.0.2 route-map RMAP out
808 !
809 ip prefix-list PLIST permit 10.0.0.0/8
810 !
811 route-map RMAP permit 10
812 match ip address prefix-list PLIST
813 set community 7675:80
814 @end example
815
816 Following configuration is an example of BGP route filtering using
817 communities attribute. This configuration only permit BGP routes
818 which has BGP communities value 0:80 or 0:90. Network operator can
819 put special internal communities value at BGP border router, then
820 limit the BGP routes announcement into the internal network.
821
822 @example
823 router bgp 7675
824 neighbor 192.168.0.1 remote-as 100
825 neighbor 192.168.0.1 route-map RMAP in
826 !
827 ip community-list 1 permit 0:80 0:90
828 !
829 route-map RMAP permit in
830 match community 1
831 @end example
832
833 Following exmaple filter BGP routes which has communities value 1:1.
834 When there is no match community-list returns deny. To avoid
835 filtering all of routes, we need to define permit any at last.
836
837 @example
838 router bgp 7675
839 neighbor 192.168.0.1 remote-as 100
840 neighbor 192.168.0.1 route-map RMAP in
841 !
842 ip community-list standard FILTER deny 1:1
843 ip community-list standard FILTER permit
844 !
845 route-map RMAP permit 10
846 match community FILTER
847 @end example
848
849 Communities value keyword @code{internet} has special meanings in
850 standard community lists. In below example @code{internet} act as
851 match any. It matches all of BGP routes even if the route does not
852 have communities attribute at all. So community list @code{INTERNET}
853 is same as above example's @code{FILTER}.
854
855 @example
856 ip community-list standard INTERNET deny 1:1
857 ip community-list standard INTERNET permit internet
858 @end example
859
860 Following configuration is an example of communities value deletion.
861 With this configuration communities value 100:1 and 100:2 is removed
862 from BGP updates. For communities value deletion, only @code{permit}
863 community-list is used. @code{deny} community-list is ignored.
864
865 @example
866 router bgp 7675
867 neighbor 192.168.0.1 remote-as 100
868 neighbor 192.168.0.1 route-map RMAP in
869 !
870 ip community-list standard DEL permit 100:1 100:2
871 !
872 route-map RMAP permit 10
873 set comm-list DEL delete
874 @end example
875
876 @c -----------------------------------------------------------------------
877 @node BGP Extended Communities Attribute
878 @section BGP Extended Communities Attribute
879
880 BGP extended communities attribute is introduced with MPLS VPN/BGP
881 technology. MPLS VPN/BGP expands capability of network infrastructure
882 to provide VPN functionality. At the same time it requires a new
883 framework for policy routing. With BGP Extended Communities Attribute
884 we can use Route Target or Site of Origin for implementing network
885 policy for MPLS VPN/BGP.
886
887 BGP Extended Communities Attribute is similar to BGP Communities
888 Attribute. It is an optional transitive attribute. BGP Extended
889 Communities Attribute can carry multiple Extended Community value.
890 Each Extended Community value is eight octet length.
891
892 BGP Extended Communities Attribute provides an extended range
893 compared with BGP Communities Attribute. Adding to that there is a
894 type field in each value to provides community space structure.
895
896 There are two format to define Extended Community value. One is AS
897 based format the other is IP address based format.
898
899 @table @code
900 @item AS:VAL
901 This is a format to define AS based Extended Community value.
902 @code{AS} part is 2 octets Global Administrator subfield in Extended
903 Community value. @code{VAL} part is 4 octets Local Administrator
904 subfield. @code{7675:100} represents AS 7675 policy value 100.
905 @item IP-Address:VAL
906 This is a format to define IP address based Extended Community value.
907 @code{IP-Address} part is 4 octets Global Administrator subfield.
908 @code{VAL} part is 2 octets Local Administrator subfield.
909 @code{10.0.0.1:100} represents
910 @end table
911
912 @menu
913 * BGP Extended Community Lists::
914 * BGP Extended Communities in Route Map::
915 @end menu
916
917 @node BGP Extended Community Lists
918 @subsection BGP Extended Community Lists
919
920 Expanded Community Lists is a user defined BGP Expanded Community
921 Lists.
922
923 @deffn Command {ip extcommunity-list standard @var{name} @{permit|deny@} @var{extcommunity}} {}
924 This command defines a new standard extcommunity-list.
925 @var{extcommunity} is extended communities value. The
926 @var{extcommunity} is compiled into extended community structure. We
927 can define multiple extcommunity-list under same name. In that case
928 match will happen user defined order. Once the extcommunity-list
929 matches to extended communities attribute in BGP updates it return
930 permit or deny based upon the extcommunity-list definition. When
931 there is no matched entry, deny will be returned. When
932 @var{extcommunity} is empty it matches to any routes.
933 @end deffn
934
935 @deffn Command {ip extcommunity-list expanded @var{name} @{permit|deny@} @var{line}} {}
936 This command defines a new expanded extcommunity-list. @var{line} is
937 a string expression of extended communities attribute. @var{line} can
938 include regular expression to match extended communities attribute in
939 BGP updates.
940 @end deffn
941
942 @deffn Command {no ip extcommunity-list @var{name}} {}
943 @deffnx Command {no ip extcommunity-list standard @var{name}} {}
944 @deffnx Command {no ip extcommunity-list expanded @var{name}} {}
945 These commands delete extended community lists specified by
946 @var{name}. All of extended community lists shares a single name
947 space. So extended community lists can be removed simpley specifying
948 the name.
949 @end deffn
950
951 @deffn {Command} {show ip extcommunity-list} {}
952 @deffnx {Command} {show ip extcommunity-list @var{name}} {}
953 This command display current extcommunity-list information. When
954 @var{name} is specified the community list's information is shown.
955
956 @example
957 # show ip extcommunity-list
958 @end example
959 @end deffn
960
961 @node BGP Extended Communities in Route Map
962 @subsection BGP Extended Communities in Route Map
963
964 @deffn {Route Map} {match extcommunity @var{word}} {}
965 @end deffn
966
967 @deffn {Route Map} {set extcommunity rt @var{extcommunity}} {}
968 This command set Route Target value.
969 @end deffn
970
971 @deffn {Route Map} {set extcommunity soo @var{extcommunity}} {}
972 This command set Site of Origin value.
973 @end deffn
974
975 @c -----------------------------------------------------------------------
976 @node Displaying BGP routes
977 @section Displaying BGP Routes
978
979 @menu
980 * Show IP BGP::
981 * More Show IP BGP::
982 @end menu
983
984 @node Show IP BGP
985 @subsection Show IP BGP
986
987 @deffn {Command} {show ip bgp} {}
988 @deffnx {Command} {show ip bgp @var{A.B.C.D}} {}
989 @deffnx {Command} {show ip bgp @var{X:X::X:X}} {}
990 This command displays BGP routes. When no route is specified it
991 display all of IPv4 BGP routes.
992 @end deffn
993
994 @example
995 BGP table version is 0, local router ID is 10.1.1.1
996 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
997 Origin codes: i - IGP, e - EGP, ? - incomplete
998
999 Network Next Hop Metric LocPrf Weight Path
1000 *> 1.1.1.1/32 0.0.0.0 0 32768 i
1001
1002 Total number of prefixes 1
1003 @end example
1004
1005 @node More Show IP BGP
1006 @subsection More Show IP BGP
1007
1008 @deffn {Command} {show ip bgp regexp @var{line}} {}
1009 This command display BGP routes using AS path regular expression (@pxref{Display BGP Routes by AS Path}).
1010 @end deffn
1011
1012 @deffn Command {show ip bgp community @var{community}} {}
1013 @deffnx Command {show ip bgp community @var{community} exact-match} {}
1014 This command display BGP routes using @var{community} (@pxref{Display
1015 BGP Routes by Community}).
1016 @end deffn
1017
1018 @deffn Command {show ip bgp community-list @var{word}} {}
1019 @deffnx Command {show ip bgp community-list @var{word} exact-match} {}
1020 This command display BGP routes using community list (@pxref{Display
1021 BGP Routes by Community}).
1022 @end deffn
1023
1024 @deffn {Command} {show ip bgp summary} {}
1025 @end deffn
1026
1027 @deffn {Command} {show ip bgp neighbor [@var{peer}]} {}
1028 @end deffn
1029
1030 @deffn {Command} {clear ip bgp @var{peer}} {}
1031 Clear peers which have addresses of X.X.X.X
1032 @end deffn
1033
1034 @deffn {Command} {clear ip bgp @var{peer} soft in} {}
1035 Clear peer using soft reconfiguration.
1036 @end deffn
1037
1038 @deffn {Command} {show ip bgp dampened-paths} {}
1039 Display paths suppressed due to dampening
1040 @end deffn
1041
1042 @deffn {Command} {show ip bgp flap-statistics} {}
1043 Display flap statistics of routes
1044 @end deffn
1045
1046 @deffn {Command} {show debug} {}
1047 @end deffn
1048
1049 @deffn {Command} {debug event} {}
1050 @end deffn
1051
1052 @deffn {Command} {debug update} {}
1053 @end deffn
1054
1055 @deffn {Command} {debug keepalive} {}
1056 @end deffn
1057
1058 @deffn {Command} {no debug event} {}
1059 @end deffn
1060
1061 @deffn {Command} {no debug update} {}
1062 @end deffn
1063
1064 @deffn {Command} {no debug keepalive} {}
1065 @end deffn
1066
1067 @node Capability Negotiation
1068 @section Capability Negotiation
1069
1070 When adding IPv6 routing information exchange feature to BGP. There
1071 were some proposals. @acronym{IETF,Internet Engineering Task Force}
1072 @acronym{IDR, Inter Domain Routing} @acronym{WG, Working group} adopted
1073 a proposal called Multiprotocol Extension for BGP. The specification
1074 is described in @cite{RFC2283}. The protocol does not define new protocols.
1075 It defines new attributes to existing BGP. When it is used exchanging
1076 IPv6 routing information it is called BGP-4+. When it is used for
1077 exchanging multicast routing information it is called MBGP.
1078
1079 @command{bgpd} supports Multiprotocol Extension for BGP. So if remote
1080 peer supports the protocol, @command{bgpd} can exchange IPv6 and/or
1081 multicast routing information.
1082
1083 Traditional BGP did not have the feature to detect remote peer's
1084 capabilities, e.g. whether it can handle prefix types other than IPv4
1085 unicast routes. This was a big problem using Multiprotocol Extension
1086 for BGP to operational network. @cite{RFC2842, Capabilities
1087 Advertisement with BGP-4} adopted a feature called Capability
1088 Negotiation. @command{bgpd} use this Capability Negotiation to detect
1089 the remote peer's capabilities. If the peer is only configured as IPv4
1090 unicast neighbor, @command{bgpd} does not send these Capability
1091 Negotiation packets (at least not unless other optional BGP features
1092 require capability negotation).
1093
1094 By default, Quagga will bring up peering with minimal common capability
1095 for the both sides. For example, local router has unicast and
1096 multicast capabilitie and remote router has unicast capability. In
1097 this case, the local router will establish the connection with unicast
1098 only capability. When there are no common capabilities, Quagga sends
1099 Unsupported Capability error and then resets the connection.
1100
1101 If you want to completely match capabilities with remote peer. Please
1102 use @command{strict-capability-match} command.
1103
1104 @deffn {BGP} {neighbor @var{peer} strict-capability-match} {}
1105 @deffnx {BGP} {no neighbor @var{peer} strict-capability-match} {}
1106 Strictly compares remote capabilities and local capabilities. If capabilities
1107 are different, send Unsupported Capability error then reset connection.
1108 @end deffn
1109
1110 You may want to disable sending Capability Negotiation OPEN message
1111 optional parameter to the peer when remote peer does not implement
1112 Capability Negotiation. Please use @command{dont-capability-negotiate}
1113 command to disable the feature.
1114
1115 @deffn {BGP} {neighbor @var{peer} dont-capability-negotiate} {}
1116 @deffnx {BGP} {no neighbor @var{peer} dont-capability-negotiate} {}
1117 Suppress sending Capability Negotiation as OPEN message optional
1118 parameter to the peer. This command only affects the peer is configured
1119 other than IPv4 unicast configuration.
1120 @end deffn
1121
1122 When remote peer does not have capability negotiation feature, remote
1123 peer will not send any capabilities at all. In that case, bgp
1124 configures the peer with configured capabilities.
1125
1126 You may prefer locally configured capabilities more than the negotiated
1127 capabilities even though remote peer sends capabilities. If the peer
1128 is configured by @command{override-capability}, @command{bgpd} ignores
1129 received capabilities then override negotiated capabilities with
1130 configured values.
1131
1132 @deffn {BGP} {neighbor @var{peer} override-capability} {}
1133 @deffnx {BGP} {no neighbor @var{peer} override-capability} {}
1134 Override the result of Capability Negotiation with local configuration.
1135 Ignore remote peer's capability value.
1136 @end deffn
1137
1138 @node Route Reflector
1139 @section Route Reflector
1140
1141 @deffn {BGP} {bgp cluster-id @var{a.b.c.d}} {}
1142 @end deffn
1143
1144 @deffn {BGP} {neighbor @var{peer} route-reflector-client} {}
1145 @deffnx {BGP} {no neighbor @var{peer} route-reflector-client} {}
1146 @end deffn
1147
1148 @node Route Server
1149 @section Route Server
1150
1151 At an Internet Exchange point, many ISPs are connected to each other by
1152 external BGP peering. Normally these external BGP connection are done by
1153 @samp{full mesh} method. As with internal BGP full mesh formation,
1154 this method has a scaling problem.
1155
1156 This scaling problem is well known. Route Server is a method to resolve
1157 the problem. Each ISP's BGP router only peers to Route Server. Route
1158 Server serves as BGP information exchange to other BGP routers. By
1159 applying this method, numbers of BGP connections is reduced from
1160 O(n*(n-1)/2) to O(n).
1161
1162 Unlike normal BGP router, Route Server must have several routing tables
1163 for managing different routing policies for each BGP speaker. We call the
1164 routing tables as different @code{view}s. @command{bgpd} can work as
1165 normal BGP router or Route Server or both at the same time.
1166
1167 @menu
1168 * Multiple instance::
1169 * BGP instance and view::
1170 * Routing policy::
1171 * Viewing the view::
1172 @end menu
1173
1174 @node Multiple instance
1175 @subsection Multiple instance
1176
1177 To enable multiple view function of @code{bgpd}, you must turn on
1178 multiple instance feature beforehand.
1179
1180 @deffn {Command} {bgp multiple-instance} {}
1181 Enable BGP multiple instance feature. After this feature is enabled,
1182 you can make multiple BGP instances or multiple BGP views.
1183 @end deffn
1184
1185 @deffn {Command} {no bgp multiple-instance} {}
1186 Disable BGP multiple instance feature. You can not disable this feature
1187 when BGP multiple instances or views exist.
1188 @end deffn
1189
1190 When you want to make configuration more Cisco like one,
1191
1192 @deffn {Command} {bgp config-type cisco} {}
1193 Cisco compatible BGP configuration output.
1194 @end deffn
1195
1196 When bgp config-type cisco is specified,
1197
1198 ``no synchronization'' is displayed.
1199 ``no auto-summary'' is displayed.
1200
1201 ``network'' and ``aggregate-address'' argument is displayed as
1202 ``A.B.C.D M.M.M.M''
1203
1204 Quagga: network 10.0.0.0/8
1205 Cisco: network 10.0.0.0
1206
1207 Quagga: aggregate-address 192.168.0.0/24
1208 Cisco: aggregate-address 192.168.0.0 255.255.255.0
1209
1210 Community attribute handling is also different. If there is no
1211 configuration is specified community attribute and extended community
1212 attribute are sent to neighbor. When user manually disable the
1213 feature community attribute is not sent to the neighbor. In case of
1214 @command{bgp config-type cisco} is specified, community attribute is not
1215 sent to the neighbor by default. To send community attribute user has
1216 to specify @command{neighbor A.B.C.D send-community} command.
1217
1218 @example
1219 !
1220 router bgp 1
1221 neighbor 10.0.0.1 remote-as 1
1222 no neighbor 10.0.0.1 send-community
1223 !
1224 router bgp 1
1225 neighbor 10.0.0.1 remote-as 1
1226 neighbor 10.0.0.1 send-community
1227 !
1228 @end example
1229
1230 @deffn {Command} {bgp config-type zebra} {}
1231 Quagga style BGP configuration. This is default.
1232 @end deffn
1233
1234 @node BGP instance and view
1235 @subsection BGP instance and view
1236
1237 BGP instance is a normal BGP process. The result of route selection
1238 goes to the kernel routing table. You can setup different AS at the
1239 same time when BGP multiple instance feature is enabled.
1240
1241 @deffn {Command} {router bgp @var{as-number}} {}
1242 Make a new BGP instance. You can use arbitrary word for the @var{name}.
1243 @end deffn
1244
1245 @example
1246 @group
1247 bgp multiple-instance
1248 !
1249 router bgp 1
1250 neighbor 10.0.0.1 remote-as 2
1251 neighbor 10.0.0.2 remote-as 3
1252 !
1253 router bgp 2
1254 neighbor 10.0.0.3 remote-as 4
1255 neighbor 10.0.0.4 remote-as 5
1256 @end group
1257 @end example
1258
1259 BGP view is almost same as normal BGP process. The result of
1260 route selection does not go to the kernel routing table. BGP view is
1261 only for exchanging BGP routing information.
1262
1263 @deffn {Command} {router bgp @var{as-number} view @var{name}} {}
1264 Make a new BGP view. You can use arbitrary word for the @var{name}. This
1265 view's route selection result does not go to the kernel routing table.
1266 @end deffn
1267
1268 With this command, you can setup Route Server like below.
1269
1270 @example
1271 @group
1272 bgp multiple-instance
1273 !
1274 router bgp 1 view 1
1275 neighbor 10.0.0.1 remote-as 2
1276 neighbor 10.0.0.2 remote-as 3
1277 !
1278 router bgp 2 view 2
1279 neighbor 10.0.0.3 remote-as 4
1280 neighbor 10.0.0.4 remote-as 5
1281 @end group
1282 @end example
1283
1284 @node Routing policy
1285 @subsection Routing policy
1286
1287 You can set different routing policy for a peer. For example, you can
1288 set different filter for a peer.
1289
1290 @example
1291 @group
1292 bgp multiple-instance
1293 !
1294 router bgp 1 view 1
1295 neighbor 10.0.0.1 remote-as 2
1296 neighbor 10.0.0.1 distribute-list 1 in
1297 !
1298 router bgp 1 view 2
1299 neighbor 10.0.0.1 remote-as 2
1300 neighbor 10.0.0.1 distribute-list 2 in
1301 @end group
1302 @end example
1303
1304 This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view
1305 2. When the update is inserted into view 1, distribute-list 1 is
1306 applied. On the other hand, when the update is inserted into view 2,
1307 distribute-list 2 is applied.
1308
1309 @node Viewing the view
1310 @subsection Viewing the view
1311
1312 To display routing table of BGP view, you must specify view name.
1313
1314 @deffn {Command} {show ip bgp view @var{name}} {}
1315 Display routing table of BGP view @var{name}.
1316 @end deffn
1317
1318 @node How to set up a 6-Bone connection
1319 @section How to set up a 6-Bone connection
1320
1321
1322 @example
1323 @group
1324 zebra configuration
1325 ===================
1326 !
1327 ! Actually there is no need to configure zebra
1328 !
1329
1330 bgpd configuration
1331 ==================
1332 !
1333 ! This means that routes go through zebra and into the kernel.
1334 !
1335 router zebra
1336 !
1337 ! MP-BGP configuration
1338 !
1339 router bgp 7675
1340 bgp router-id 10.0.0.1
1341 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as @var{as-number}
1342 !
1343 address-family ipv6
1344 network 3ffe:506::/32
1345 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
1346 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
1347 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as @var{as-number}
1348 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
1349 exit-address-family
1350 !
1351 ipv6 access-list all permit any
1352 !
1353 ! Set output nexthop address.
1354 !
1355 route-map set-nexthop permit 10
1356 match ipv6 address all
1357 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
1358 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
1359 !
1360 ! logfile FILENAME is obsolete. Please use log file FILENAME
1361
1362 log file bgpd.log
1363 !
1364 @end group
1365 @end example
1366
1367 @node Dump BGP packets and table
1368 @section Dump BGP packets and table
1369
1370 @deffn Command {dump bgp all @var{path} [@var{interval}]} {}
1371 @deffnx Command {dump bgp all-et @var{path} [@var{interval}]} {}
1372 @deffnx Command {no dump bgp all [@var{path}] [@var{interval}]} {}
1373 Dump all BGP packet and events to @var{path} file.
1374 If @var{interval} is set, a new file will be created for echo @var{interval} of seconds.
1375 The path @var{path} can be set with date and time formatting (strftime).
1376 The type ‘all-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}).
1377 (@pxref{Packet Binary Dump Format})
1378 @end deffn
1379
1380 @deffn Command {dump bgp updates @var{path} [@var{interval}]} {}
1381 @deffnx Command {dump bgp updates-et @var{path} [@var{interval}]} {}
1382 @deffnx Command {no dump bgp updates [@var{path}] [@var{interval}]} {}
1383 Dump only BGP updates messages to @var{path} file.
1384 If @var{interval} is set, a new file will be created for echo @var{interval} of seconds.
1385 The path @var{path} can be set with date and time formatting (strftime).
1386 The type ‘updates-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}).
1387 @end deffn
1388
1389 @deffn Command {dump bgp routes-mrt @var{path}} {}
1390 @deffnx Command {dump bgp routes-mrt @var{path} @var{interval}} {}
1391 @deffnx Command {no dump bgp route-mrt [@var{path}] [@var{interval}]} {}
1392 Dump whole BGP routing table to @var{path}. This is heavy process.
1393 The path @var{path} can be set with date and time formatting (strftime).
1394 If @var{interval} is set, a new file will be created for echo @var{interval} of seconds.
1395 @end deffn
1396
1397 Note: the interval variable can also be set using hours and minutes: 04h20m00.
1398
1399
1400 @node BGP Configuration Examples
1401 @section BGP Configuration Examples
1402
1403 Example of a session to an upstream, advertising only one prefix to it.
1404
1405 @example
1406 router bgp 64512
1407 bgp router-id 10.236.87.1
1408 network 10.236.87.0/24
1409 neighbor upstream peer-group
1410 neighbor upstream remote-as 64515
1411 neighbor upstream capability dynamic
1412 neighbor upstream prefix-list pl-allowed-adv out
1413 neighbor 10.1.1.1 peer-group upstream
1414 neighbor 10.1.1.1 description ACME ISP
1415 !
1416 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
1417 ip prefix-list pl-allowed-adv seq 10 deny any
1418
1419 @end example
1420
1421 A more complex example. With upstream, peer and customer sessions.
1422 Advertising global prefixes and NO_EXPORT prefixes and providing
1423 actions for customer routes based on community values. Extensive use of
1424 route-maps and the 'call' feature to support selective advertising of
1425 prefixes. This example is intended as guidance only, it has NOT been
1426 tested and almost certainly containts silly mistakes, if not serious
1427 flaws.
1428
1429 @example
1430 router bgp 64512
1431 bgp router-id 10.236.87.1
1432 network 10.123.456.0/24
1433 network 10.123.456.128/25 route-map rm-no-export
1434 neighbor upstream capability dynamic
1435 neighbor upstream route-map rm-upstream-out out
1436 neighbor cust capability dynamic
1437 neighbor cust route-map rm-cust-in in
1438 neighbor cust route-map rm-cust-out out
1439 neighbor cust send-community both
1440 neighbor peer capability dynamic
1441 neighbor peer route-map rm-peer-in in
1442 neighbor peer route-map rm-peer-out out
1443 neighbor peer send-community both
1444 neighbor 10.1.1.1 remote-as 64515
1445 neighbor 10.1.1.1 peer-group upstream
1446 neighbor 10.2.1.1 remote-as 64516
1447 neighbor 10.2.1.1 peer-group upstream
1448 neighbor 10.3.1.1 remote-as 64517
1449 neighbor 10.3.1.1 peer-group cust-default
1450 neighbor 10.3.1.1 description customer1
1451 neighbor 10.3.1.1 prefix-list pl-cust1-network in
1452 neighbor 10.4.1.1 remote-as 64518
1453 neighbor 10.4.1.1 peer-group cust
1454 neighbor 10.4.1.1 prefix-list pl-cust2-network in
1455 neighbor 10.4.1.1 description customer2
1456 neighbor 10.5.1.1 remote-as 64519
1457 neighbor 10.5.1.1 peer-group peer
1458 neighbor 10.5.1.1 prefix-list pl-peer1-network in
1459 neighbor 10.5.1.1 description peer AS 1
1460 neighbor 10.6.1.1 remote-as 64520
1461 neighbor 10.6.1.1 peer-group peer
1462 neighbor 10.6.1.1 prefix-list pl-peer2-network in
1463 neighbor 10.6.1.1 description peer AS 2
1464 !
1465 ip prefix-list pl-default permit 0.0.0.0/0
1466 !
1467 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
1468 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
1469 !
1470 ip prefix-list pl-cust1-network permit 10.3.1.0/24
1471 ip prefix-list pl-cust1-network permit 10.3.2.0/24
1472 !
1473 ip prefix-list pl-cust2-network permit 10.4.1.0/24
1474 !
1475 ip prefix-list pl-peer1-network permit 10.5.1.0/24
1476 ip prefix-list pl-peer1-network permit 10.5.2.0/24
1477 ip prefix-list pl-peer1-network permit 192.168.0.0/24
1478 !
1479 ip prefix-list pl-peer2-network permit 10.6.1.0/24
1480 ip prefix-list pl-peer2-network permit 10.6.2.0/24
1481 ip prefix-list pl-peer2-network permit 192.168.1.0/24
1482 ip prefix-list pl-peer2-network permit 192.168.2.0/24
1483 ip prefix-list pl-peer2-network permit 172.16.1/24
1484 !
1485 ip as-path access-list asp-own-as permit ^$
1486 ip as-path access-list asp-own-as permit _64512_
1487 !
1488 ! #################################################################
1489 ! Match communities we provide actions for, on routes receives from
1490 ! customers. Communities values of <our-ASN>:X, with X, have actions:
1491 !
1492 ! 100 - blackhole the prefix
1493 ! 200 - set no_export
1494 ! 300 - advertise only to other customers
1495 ! 400 - advertise only to upstreams
1496 ! 500 - set no_export when advertising to upstreams
1497 ! 2X00 - set local_preference to X00
1498 !
1499 ! blackhole the prefix of the route
1500 ip community-list standard cm-blackhole permit 64512:100
1501 !
1502 ! set no-export community before advertising
1503 ip community-list standard cm-set-no-export permit 64512:200
1504 !
1505 ! advertise only to other customers
1506 ip community-list standard cm-cust-only permit 64512:300
1507 !
1508 ! advertise only to upstreams
1509 ip community-list standard cm-upstream-only permit 64512:400
1510 !
1511 ! advertise to upstreams with no-export
1512 ip community-list standard cm-upstream-noexport permit 64512:500
1513 !
1514 ! set local-pref to least significant 3 digits of the community
1515 ip community-list standard cm-prefmod-100 permit 64512:2100
1516 ip community-list standard cm-prefmod-200 permit 64512:2200
1517 ip community-list standard cm-prefmod-300 permit 64512:2300
1518 ip community-list standard cm-prefmod-400 permit 64512:2400
1519 ip community-list expanded cme-prefmod-range permit 64512:2...
1520 !
1521 ! Informational communities
1522 !
1523 ! 3000 - learned from upstream
1524 ! 3100 - learned from customer
1525 ! 3200 - learned from peer
1526 !
1527 ip community-list standard cm-learnt-upstream permit 64512:3000
1528 ip community-list standard cm-learnt-cust permit 64512:3100
1529 ip community-list standard cm-learnt-peer permit 64512:3200
1530 !
1531 ! ###################################################################
1532 ! Utility route-maps
1533 !
1534 ! These utility route-maps generally should not used to permit/deny
1535 ! routes, i.e. they do not have meaning as filters, and hence probably
1536 ! should be used with 'on-match next'. These all finish with an empty
1537 ! permit entry so as not interfere with processing in the caller.
1538 !
1539 route-map rm-no-export permit 10
1540 set community additive no-export
1541 route-map rm-no-export permit 20
1542 !
1543 route-map rm-blackhole permit 10
1544 description blackhole, up-pref and ensure it cant escape this AS
1545 set ip next-hop 127.0.0.1
1546 set local-preference 10
1547 set community additive no-export
1548 route-map rm-blackhole permit 20
1549 !
1550 ! Set local-pref as requested
1551 route-map rm-prefmod permit 10
1552 match community cm-prefmod-100
1553 set local-preference 100
1554 route-map rm-prefmod permit 20
1555 match community cm-prefmod-200
1556 set local-preference 200
1557 route-map rm-prefmod permit 30
1558 match community cm-prefmod-300
1559 set local-preference 300
1560 route-map rm-prefmod permit 40
1561 match community cm-prefmod-400
1562 set local-preference 400
1563 route-map rm-prefmod permit 50
1564 !
1565 ! Community actions to take on receipt of route.
1566 route-map rm-community-in permit 10
1567 description check for blackholing, no point continuing if it matches.
1568 match community cm-blackhole
1569 call rm-blackhole
1570 route-map rm-community-in permit 20
1571 match community cm-set-no-export
1572 call rm-no-export
1573 on-match next
1574 route-map rm-community-in permit 30
1575 match community cme-prefmod-range
1576 call rm-prefmod
1577 route-map rm-community-in permit 40
1578 !
1579 ! #####################################################################
1580 ! Community actions to take when advertising a route.
1581 ! These are filtering route-maps,
1582 !
1583 ! Deny customer routes to upstream with cust-only set.
1584 route-map rm-community-filt-to-upstream deny 10
1585 match community cm-learnt-cust
1586 match community cm-cust-only
1587 route-map rm-community-filt-to-upstream permit 20
1588 !
1589 ! Deny customer routes to other customers with upstream-only set.
1590 route-map rm-community-filt-to-cust deny 10
1591 match community cm-learnt-cust
1592 match community cm-upstream-only
1593 route-map rm-community-filt-to-cust permit 20
1594 !
1595 ! ###################################################################
1596 ! The top-level route-maps applied to sessions. Further entries could
1597 ! be added obviously..
1598 !
1599 ! Customers
1600 route-map rm-cust-in permit 10
1601 call rm-community-in
1602 on-match next
1603 route-map rm-cust-in permit 20
1604 set community additive 64512:3100
1605 route-map rm-cust-in permit 30
1606 !
1607 route-map rm-cust-out permit 10
1608 call rm-community-filt-to-cust
1609 on-match next
1610 route-map rm-cust-out permit 20
1611 !
1612 ! Upstream transit ASes
1613 route-map rm-upstream-out permit 10
1614 description filter customer prefixes which are marked cust-only
1615 call rm-community-filt-to-upstream
1616 on-match next
1617 route-map rm-upstream-out permit 20
1618 description only customer routes are provided to upstreams/peers
1619 match community cm-learnt-cust
1620 !
1621 ! Peer ASes
1622 ! outbound policy is same as for upstream
1623 route-map rm-peer-out permit 10
1624 call rm-upstream-out
1625 !
1626 route-map rm-peer-in permit 10
1627 set community additive 64512:3200
1628 @end example