]> git.proxmox.com Git - mirror_frr.git/blob - doc/user/bgp.rst
pimd: Do not create upstream state when not DR for igmp request
[mirror_frr.git] / doc / user / bgp.rst
1 .. _bgp:
2
3 ***
4 BGP
5 ***
6
7 :abbr:`BGP` stands for Border Gateway Protocol. The latest BGP version is 4.
8 BGP-4 is one of the Exterior Gateway Protocols and the de facto standard
9 interdomain routing protocol. BGP-4 is described in :rfc:`1771` and updated by
10 :rfc:`4271`. :rfc:`2858` adds multiprotocol support to BGP-4.
11
12 .. _starting-bgp:
13
14 Starting BGP
15 ============
16
17 The default configuration file of *bgpd* is :file:`bgpd.conf`. *bgpd* searches
18 the current directory first, followed by |INSTALL_PREFIX_ETC|/bgpd.conf. All of
19 *bgpd*'s commands must be configured in :file:`bgpd.conf` when the integrated
20 config is not being used.
21
22 *bgpd* specific invocation options are described below. Common options may also
23 be specified (:ref:`common-invocation-options`).
24
25 .. program:: bgpd
26
27 .. option:: -p, --bgp_port <port>
28
29 Set the bgp protocol's port number. When port number is 0, that means do not
30 listen bgp port.
31
32 .. option:: -l, --listenon
33
34 Specify a specific IP address for bgpd to listen on, rather than its
35 default of INADDR_ANY / IN6ADDR_ANY. This can be useful to constrain bgpd
36 to an internal address, or to run multiple bgpd processes on one host.
37
38 .. _bgp-basic-concepts:
39
40 Basic Concepts
41 ==============
42
43 .. _bgp-autonomous-systems:
44
45 Autonomous Systems
46 ------------------
47
48 The :abbr:`AS (Autonomous System)` number is one of the essential element of
49 BGP. BGP is a distance vector routing protocol, and the AS-Path framework
50 provides distance vector metric and loop detection to BGP. :rfc:`1930` provides
51 some background on the concepts of an AS.
52
53 The AS number is a two octet value, ranging in value from 1 to 65535. The AS
54 numbers 64512 through 65535 are defined as private AS numbers. Private AS
55 numbers must not to be advertised in the global Internet.
56
57 .. _bgp-address-families:
58
59 Address Families
60 ----------------
61
62 Multiprotocol BGP enables BGP to carry routing information for multiple Network
63 Layer protocols. BGP supports an Address Family Identifier (AFI) for IPv4 and
64 IPv6. Support is also provided for multiple sets of per-AFI information via the
65 BGP Subsequent Address Family Identifier (SAFI). FRR supports SAFIs for unicast
66 information, labeled information :rfc:`3107` and :rfc:`8277`, and Layer 3 VPN
67 information :rfc:`4364` and :rfc:`4659`.
68
69 .. _bgp-route-selection:
70
71 Route Selection
72 ---------------
73
74 The route selection process used by FRR's BGP implementation uses the following
75 decision criterion, starting at the top of the list and going towards the
76 bottom until one of the factors can be used.
77
78 1. **Weight check**
79
80 Prefer higher local weight routes to lower routes.
81
82 2. **Local preference check**
83
84 Prefer higher local preference routes to lower.
85
86 3. **Local route check**
87
88 Prefer local routes (statics, aggregates, redistributed) to received routes.
89
90 4. **AS path length check**
91
92 Prefer shortest hop-count AS_PATHs.
93
94 5. **Origin check**
95
96 Prefer the lowest origin type route. That is, prefer IGP origin routes to
97 EGP, to Incomplete routes.
98
99 6. **MED check**
100
101 Where routes with a MED were received from the same AS, prefer the route
102 with the lowest MED. :ref:`bgp-med`.
103
104 7. **External check**
105
106 Prefer the route received from an external, eBGP peer over routes received
107 from other types of peers.
108
109 8. **IGP cost check**
110
111 Prefer the route with the lower IGP cost.
112
113 9. **Multi-path check**
114
115 If multi-pathing is enabled, then check whether the routes not yet
116 distinguished in preference may be considered equal. If
117 :clicmd:`bgp bestpath as-path multipath-relax` is set, all such routes are
118 considered equal, otherwise routes received via iBGP with identical AS_PATHs
119 or routes received from eBGP neighbours in the same AS are considered equal.
120
121 10. **Already-selected external check**
122
123 Where both routes were received from eBGP peers, then prefer the route
124 which is already selected. Note that this check is not applied if
125 :clicmd:`bgp bestpath compare-routerid` is configured. This check can
126 prevent some cases of oscillation.
127
128 11. **Router-ID check**
129
130 Prefer the route with the lowest `router-ID`. If the route has an
131 `ORIGINATOR_ID` attribute, through iBGP reflection, then that router ID is
132 used, otherwise the `router-ID` of the peer the route was received from is
133 used.
134
135 12. **Cluster-List length check**
136
137 The route with the shortest cluster-list length is used. The cluster-list
138 reflects the iBGP reflection path the route has taken.
139
140 13. **Peer address**
141
142 Prefer the route received from the peer with the higher transport layer
143 address, as a last-resort tie-breaker.
144
145 .. _bgp-capability-negotiation:
146
147 Capability Negotiation
148 ----------------------
149
150 When adding IPv6 routing information exchange feature to BGP. There were some
151 proposals. :abbr:`IETF (Internet Engineering Task Force)`
152 :abbr:`IDR (Inter Domain Routing)` adopted a proposal called Multiprotocol
153 Extension for BGP. The specification is described in :rfc:`2283`. The protocol
154 does not define new protocols. It defines new attributes to existing BGP. When
155 it is used exchanging IPv6 routing information it is called BGP-4+. When it is
156 used for exchanging multicast routing information it is called MBGP.
157
158 *bgpd* supports Multiprotocol Extension for BGP. So if a remote peer supports
159 the protocol, *bgpd* can exchange IPv6 and/or multicast routing information.
160
161 Traditional BGP did not have the feature to detect a remote peer's
162 capabilities, e.g. whether it can handle prefix types other than IPv4 unicast
163 routes. This was a big problem using Multiprotocol Extension for BGP in an
164 operational network. :rfc:`2842` adopted a feature called Capability
165 Negotiation. *bgpd* use this Capability Negotiation to detect the remote peer's
166 capabilities. If a peer is only configured as an IPv4 unicast neighbor, *bgpd*
167 does not send these Capability Negotiation packets (at least not unless other
168 optional BGP features require capability negotiation).
169
170 By default, FRR will bring up peering with minimal common capability for the
171 both sides. For example, if the local router has unicast and multicast
172 capabilities and the remote router only has unicast capability the local router
173 will establish the connection with unicast only capability. When there are no
174 common capabilities, FRR sends Unsupported Capability error and then resets the
175 connection.
176
177 .. _bgp-concepts-vrfs:
178
179 VRFs: Virtual Routing and Forwarding
180 ------------------------------------
181
182 *bgpd* supports :abbr:`L3VPN (Layer 3 Virtual Private Networks)` :abbr:`VRFs
183 (Virtual Routing and Forwarding tables)` for IPv4 :rfc:`4364` and IPv6
184 :rfc:`4659`. L3VPN routes, and their associated VRF MPLS labels, can be
185 distributed to VPN SAFI neighbors in the *default*, i.e., non VRF, BGP
186 instance. VRF MPLS labels are reached using *core* MPLS labels which are
187 distributed using LDP or BGP labeled unicast. *bgpd* also supports inter-VRF
188 route leaking. General information on FRR's VRF support can be found in
189 :ref:`zebra-vrf`.
190
191 .. _bgp-router-configuration:
192
193 BGP Router Configuration
194 ========================
195
196 ASN and Router ID
197 -----------------
198
199 First of all you must configure BGP router with the :clicmd:`router bgp ASN`
200 command. The AS number is an identifier for the autonomous system. The BGP
201 protocol uses the AS number for detecting whether the BGP connection is
202 internal or external.
203
204 .. index:: router bgp ASN
205 .. clicmd:: router bgp ASN
206
207 Enable a BGP protocol process with the specified ASN. After
208 this statement you can input any `BGP Commands`.
209
210 .. index:: no router bgp ASN
211 .. clicmd:: no router bgp ASN
212
213 Destroy a BGP protocol process with the specified ASN.
214
215 .. index:: bgp router-id A.B.C.D
216 .. clicmd:: bgp router-id A.B.C.D
217
218 This command specifies the router-ID. If *bgpd* connects to *zebra* it gets
219 interface and address information. In that case default router ID value is
220 selected as the largest IP Address of the interfaces. When `router zebra` is
221 not enabled *bgpd* can't get interface information so `router-id` is set to
222 0.0.0.0. So please set router-id by hand.
223
224 Route Selection
225 ---------------
226
227 .. index:: bgp bestpath as-path confed
228 .. clicmd:: bgp bestpath as-path confed
229
230 This command specifies that the length of confederation path sets and
231 sequences should should be taken into account during the BGP best path
232 decision process.
233
234 .. index:: bgp bestpath as-path multipath-relax
235 .. clicmd:: bgp bestpath as-path multipath-relax
236
237 This command specifies that BGP decision process should consider paths
238 of equal AS_PATH length candidates for multipath computation. Without
239 the knob, the entire AS_PATH must match for multipath computation.
240
241 .. clicmd:: bgp bestpath compare-routerid
242
243 Ensure that when comparing routes where both are equal on most metrics,
244 including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken
245 based on router-ID.
246
247 If this option is enabled, then the already-selected check, where
248 already selected eBGP routes are preferred, is skipped.
249
250 If a route has an `ORIGINATOR_ID` attribute because it has been reflected,
251 that `ORIGINATOR_ID` will be used. Otherwise, the router-ID of the peer the
252 route was received from will be used.
253
254 The advantage of this is that the route-selection (at this point) will be
255 more deterministic. The disadvantage is that a few or even one lowest-ID
256 router may attract all traffic to otherwise-equal paths because of this
257 check. It may increase the possibility of MED or IGP oscillation, unless
258 other measures were taken to avoid these. The exact behaviour will be
259 sensitive to the iBGP and reflection topology.
260
261 .. _bgp-distance:
262
263 Administrative Distance Metrics
264 -------------------------------
265
266 .. index:: distance bgp (1-255) (1-255) (1-255)
267 .. clicmd:: distance bgp (1-255) (1-255) (1-255)
268
269 This command change distance value of BGP. The arguments are the distance
270 values for for external routes, internal routes and local routes
271 respectively.
272
273 .. index:: distance (1-255) A.B.C.D/M
274 .. clicmd:: distance (1-255) A.B.C.D/M
275
276 .. index:: distance (1-255) A.B.C.D/M WORD
277 .. clicmd:: distance (1-255) A.B.C.D/M WORD
278
279 Sets the administrative distance for a particular route.
280
281 .. _bgp-route-flap-dampening:
282
283 Route Flap Dampening
284 --------------------
285
286 .. clicmd:: bgp dampening (1-45) (1-20000) (1-20000) (1-255)
287
288 This command enables BGP route-flap dampening and specifies dampening parameters.
289
290 half-life
291 Half-life time for the penalty
292
293 reuse-threshold
294 Value to start reusing a route
295
296 suppress-threshold
297 Value to start suppressing a route
298
299 max-suppress
300 Maximum duration to suppress a stable route
301
302 The route-flap damping algorithm is compatible with :rfc:`2439`. The use of
303 this command is not recommended nowadays.
304
305 .. seealso::
306 https://www.ripe.net/publications/docs/ripe-378
307
308 .. _bgp-med:
309
310 Multi-Exit Discriminator
311 ------------------------
312
313 The BGP :abbr:`MED (Multi-Exit Discriminator)` attribute has properties which
314 can cause subtle convergence problems in BGP. These properties and problems
315 have proven to be hard to understand, at least historically, and may still not
316 be widely understood. The following attempts to collect together and present
317 what is known about MED, to help operators and FRR users in designing and
318 configuring their networks.
319
320 The BGP :abbr:`MED` attribute is intended to allow one AS to indicate its
321 preferences for its ingress points to another AS. The MED attribute will not be
322 propagated on to another AS by the receiving AS - it is 'non-transitive' in the
323 BGP sense.
324
325 E.g., if AS X and AS Y have 2 different BGP peering points, then AS X might set
326 a MED of 100 on routes advertised at one and a MED of 200 at the other. When AS
327 Y selects between otherwise equal routes to or via AS X, AS Y should prefer to
328 take the path via the lower MED peering of 100 with AS X. Setting the MED
329 allows an AS to influence the routing taken to it within another, neighbouring
330 AS.
331
332 In this use of MED it is not really meaningful to compare the MED value on
333 routes where the next AS on the paths differs. E.g., if AS Y also had a route
334 for some destination via AS Z in addition to the routes from AS X, and AS Z had
335 also set a MED, it wouldn't make sense for AS Y to compare AS Z's MED values to
336 those of AS X. The MED values have been set by different administrators, with
337 different frames of reference.
338
339 The default behaviour of BGP therefore is to not compare MED values across
340 routes received from different neighbouring ASes. In FRR this is done by
341 comparing the neighbouring, left-most AS in the received AS_PATHs of the routes
342 and only comparing MED if those are the same.
343
344 Unfortunately, this behaviour of MED, of sometimes being compared across routes
345 and sometimes not, depending on the properties of those other routes, means MED
346 can cause the order of preference over all the routes to be undefined. That is,
347 given routes A, B, and C, if A is preferred to B, and B is preferred to C, then
348 a well-defined order should mean the preference is transitive (in the sense of
349 orders [#med-transitivity-rant]_) and that A would be preferred to C.
350
351 However, when MED is involved this need not be the case. With MED it is
352 possible that C is actually preferred over A. So A is preferred to B, B is
353 preferred to C, but C is preferred to A. This can be true even where BGP
354 defines a deterministic 'most preferred' route out of the full set of A,B,C.
355 With MED, for any given set of routes there may be a deterministically
356 preferred route, but there need not be any way to arrange them into any order
357 of preference. With unmodified MED, the order of preference of routes literally
358 becomes undefined.
359
360 That MED can induce non-transitive preferences over routes can cause issues.
361 Firstly, it may be perceived to cause routing table churn locally at speakers;
362 secondly, and more seriously, it may cause routing instability in iBGP
363 topologies, where sets of speakers continually oscillate between different
364 paths.
365
366 The first issue arises from how speakers often implement routing decisions.
367 Though BGP defines a selection process that will deterministically select the
368 same route as best at any given speaker, even with MED, that process requires
369 evaluating all routes together. For performance and ease of implementation
370 reasons, many implementations evaluate route preferences in a pair-wise fashion
371 instead. Given there is no well-defined order when MED is involved, the best
372 route that will be chosen becomes subject to implementation details, such as
373 the order the routes are stored in. That may be (locally) non-deterministic,
374 e.g.: it may be the order the routes were received in.
375
376 This indeterminism may be considered undesirable, though it need not cause
377 problems. It may mean additional routing churn is perceived, as sometimes more
378 updates may be produced than at other times in reaction to some event .
379
380 This first issue can be fixed with a more deterministic route selection that
381 ensures routes are ordered by the neighbouring AS during selection.
382 :clicmd:`bgp deterministic-med`. This may reduce the number of updates as routes
383 are received, and may in some cases reduce routing churn. Though, it could
384 equally deterministically produce the largest possible set of updates in
385 response to the most common sequence of received updates.
386
387 A deterministic order of evaluation tends to imply an additional overhead of
388 sorting over any set of n routes to a destination. The implementation of
389 deterministic MED in FRR scales significantly worse than most sorting
390 algorithms at present, with the number of paths to a given destination. That
391 number is often low enough to not cause any issues, but where there are many
392 paths, the deterministic comparison may quickly become increasingly expensive
393 in terms of CPU.
394
395 Deterministic local evaluation can *not* fix the second, more major, issue of
396 MED however. Which is that the non-transitive preference of routes MED can
397 cause may lead to routing instability or oscillation across multiple speakers
398 in iBGP topologies. This can occur with full-mesh iBGP, but is particularly
399 problematic in non-full-mesh iBGP topologies that further reduce the routing
400 information known to each speaker. This has primarily been documented with iBGP
401 route-reflection topologies. However, any route-hiding technologies potentially
402 could also exacerbate oscillation with MED.
403
404 This second issue occurs where speakers each have only a subset of routes, and
405 there are cycles in the preferences between different combinations of routes -
406 as the undefined order of preference of MED allows - and the routes are
407 distributed in a way that causes the BGP speakers to 'chase' those cycles. This
408 can occur even if all speakers use a deterministic order of evaluation in route
409 selection.
410
411 E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and from
412 speaker 3 in AS Y; while speaker 5 in AS A might receive that route from
413 speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 at speaker
414 3. I.e, using ASN:ID:MED to label the speakers:
415
416 ::
417
418 .
419 /---------------\\
420 X:2------|--A:4-------A:5--|-Y:1:200
421 Y:3:100--|-/ |
422 \\---------------/
423
424
425
426 Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then based
427 on the RFC4271 decision process speaker 4 will choose X:2 over Y:3:100, based
428 on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. Speaker 5 will
429 continue to prefer Y:1:200 based on the ID, and advertise this to speaker 4.
430 Speaker 4 will now have the full set of routes, and the Y:1:200 it receives
431 from 5 will beat X:2, but when speaker 4 compares Y:1:200 to Y:3:100 the MED
432 check now becomes active as the ASes match, and now Y:3:100 is preferred.
433 Speaker 4 therefore now advertises Y:3:100 to 5, which will also agrees that
434 Y:3:100 is preferred to Y:1:200, and so withdraws the latter route from 4.
435 Speaker 4 now has only X:2 and Y:3:100, and X:2 beats Y:3:100, and so speaker 4
436 implicitly updates its route to speaker 5 to X:2. Speaker 5 sees that Y:1:200
437 beats X:2 based on the ID, and advertises Y:1:200 to speaker 4, and the cycle
438 continues.
439
440 The root cause is the lack of a clear order of preference caused by how MED
441 sometimes is and sometimes is not compared, leading to this cycle in the
442 preferences between the routes:
443
444 ::
445
446 .
447 /---> X:2 ---beats---> Y:3:100 --\\
448 | |
449 | |
450 \\---beats--- Y:1:200 <---beats---/
451
452
453
454 This particular type of oscillation in full-mesh iBGP topologies can be
455 avoided by speakers preferring already selected, external routes rather than
456 choosing to update to new a route based on a post-MED metric (e.g. router-ID),
457 at the cost of a non-deterministic selection process. FRR implements this, as
458 do many other implementations, so long as it is not overridden by setting
459 :clicmd:`bgp bestpath compare-routerid`, and see also
460 :ref:`bgp-route-selection`.
461
462 However, more complex and insidious cycles of oscillation are possible with
463 iBGP route-reflection, which are not so easily avoided. These have been
464 documented in various places. See, e.g.:
465
466 - [bgp-route-osci-cond]_
467 - [stable-flexible-ibgp]_
468 - [ibgp-correctness]_
469
470 for concrete examples and further references.
471
472 There is as of this writing *no* known way to use MED for its original purpose;
473 *and* reduce routing information in iBGP topologies; *and* be sure to avoid the
474 instability problems of MED due the non-transitive routing preferences it can
475 induce; in general on arbitrary networks.
476
477 There may be iBGP topology specific ways to reduce the instability risks, even
478 while using MED, e.g.: by constraining the reflection topology and by tuning
479 IGP costs between route-reflector clusters, see :rfc:`3345` for details. In the
480 near future, the Add-Path extension to BGP may also solve MED oscillation while
481 still allowing MED to be used as intended, by distributing "best-paths per
482 neighbour AS". This would be at the cost of distributing at least as many
483 routes to all speakers as a full-mesh iBGP would, if not more, while also
484 imposing similar CPU overheads as the "Deterministic MED" feature at each
485 Add-Path reflector.
486
487 More generally, the instability problems that MED can introduce on more
488 complex, non-full-mesh, iBGP topologies may be avoided either by:
489
490 - Setting :clicmd:`bgp always-compare-med`, however this allows MED to be compared
491 across values set by different neighbour ASes, which may not produce
492 coherent desirable results, of itself.
493 - Effectively ignoring MED by setting MED to the same value (e.g.: 0) using
494 :clicmd:`set metric METRIC` on all received routes, in combination with
495 setting :clicmd:`bgp always-compare-med` on all speakers. This is the simplest
496 and most performant way to avoid MED oscillation issues, where an AS is happy
497 not to allow neighbours to inject this problematic metric.
498
499 As MED is evaluated after the AS_PATH length check, another possible use for
500 MED is for intra-AS steering of routes with equal AS_PATH length, as an
501 extension of the last case above. As MED is evaluated before IGP metric, this
502 can allow cold-potato routing to be implemented to send traffic to preferred
503 hand-offs with neighbours, rather than the closest hand-off according to the
504 IGP metric.
505
506 Note that even if action is taken to address the MED non-transitivity issues,
507 other oscillations may still be possible. E.g., on IGP cost if iBGP and IGP
508 topologies are at cross-purposes with each other - see the Flavel and Roughan
509 paper above for an example. Hence the guideline that the iBGP topology should
510 follow the IGP topology.
511
512 .. index:: bgp deterministic-med
513 .. clicmd:: bgp deterministic-med
514
515 Carry out route-selection in way that produces deterministic answers
516 locally, even in the face of MED and the lack of a well-defined order of
517 preference it can induce on routes. Without this option the preferred route
518 with MED may be determined largely by the order that routes were received
519 in.
520
521 Setting this option will have a performance cost that may be noticeable when
522 there are many routes for each destination. Currently in FRR it is
523 implemented in a way that scales poorly as the number of routes per
524 destination increases.
525
526 The default is that this option is not set.
527
528 Note that there are other sources of indeterminism in the route selection
529 process, specifically, the preference for older and already selected routes
530 from eBGP peers, :ref:`bgp-route-selection`.
531
532 .. index:: bgp always-compare-med
533 .. clicmd:: bgp always-compare-med
534
535 Always compare the MED on routes, even when they were received from
536 different neighbouring ASes. Setting this option makes the order of
537 preference of routes more defined, and should eliminate MED induced
538 oscillations.
539
540 If using this option, it may also be desirable to use
541 :clicmd:`set metric METRIC` to set MED to 0 on routes received from external
542 neighbours.
543
544 This option can be used, together with :clicmd:`set metric METRIC` to use
545 MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g.,
546 desired exit points.
547
548 .. _bgp-network:
549
550 Networks
551 --------
552
553 .. index:: network A.B.C.D/M
554 .. clicmd:: network A.B.C.D/M
555
556 This command adds the announcement network.
557
558 .. code-block:: frr
559
560 router bgp 1
561 address-family ipv4 unicast
562 network 10.0.0.0/8
563 exit-address-family
564
565 This configuration example says that network 10.0.0.0/8 will be
566 announced to all neighbors. Some vendors' routers don't advertise
567 routes if they aren't present in their IGP routing tables; `bgpd`
568 doesn't care about IGP routes when announcing its routes.
569
570 .. index:: no network A.B.C.D/M
571 .. clicmd:: no network A.B.C.D/M
572
573 .. _bgp-route-aggregation:
574
575 Route Aggregation
576 -----------------
577
578 .. index:: aggregate-address A.B.C.D/M
579 .. clicmd:: aggregate-address A.B.C.D/M
580
581 This command specifies an aggregate address.
582
583 .. index:: aggregate-address A.B.C.D/M as-set
584 .. clicmd:: aggregate-address A.B.C.D/M as-set
585
586 This command specifies an aggregate address. Resulting routes include
587 AS set.
588
589 .. index:: aggregate-address A.B.C.D/M summary-only
590 .. clicmd:: aggregate-address A.B.C.D/M summary-only
591
592 This command specifies an aggregate address. Aggregated routes will
593 not be announce.
594
595 .. index:: no aggregate-address A.B.C.D/M
596 .. clicmd:: no aggregate-address A.B.C.D/M
597
598 .. _bgp-redistribute-to-bgp:
599
600 Redistribution
601 --------------
602
603 .. index:: redistribute kernel
604 .. clicmd:: redistribute kernel
605
606 Redistribute kernel route to BGP process.
607
608 .. index:: redistribute static
609 .. clicmd:: redistribute static
610
611 Redistribute static route to BGP process.
612
613 .. index:: redistribute connected
614 .. clicmd:: redistribute connected
615
616 Redistribute connected route to BGP process.
617
618 .. index:: redistribute rip
619 .. clicmd:: redistribute rip
620
621 Redistribute RIP route to BGP process.
622
623 .. index:: redistribute ospf
624 .. clicmd:: redistribute ospf
625
626 Redistribute OSPF route to BGP process.
627
628 .. index:: redistribute vpn
629 .. clicmd:: redistribute vpn
630
631 Redistribute VNC routes to BGP process.
632
633 .. index:: update-delay MAX-DELAY
634 .. clicmd:: update-delay MAX-DELAY
635
636 .. index:: update-delay MAX-DELAY ESTABLISH-WAIT
637 .. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT
638
639 This feature is used to enable read-only mode on BGP process restart or when
640 BGP process is cleared using 'clear ip bgp \*'. When applicable, read-only
641 mode would begin as soon as the first peer reaches Established status and a
642 timer for max-delay seconds is started.
643
644 During this mode BGP doesn't run any best-path or generate any updates to its
645 peers. This mode continues until:
646
647 1. All the configured peers, except the shutdown peers, have sent explicit EOR
648 (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
649 Established is considered an implicit-EOR.
650 If the establish-wait optional value is given, then BGP will wait for
651 peers to reach established from the beginning of the update-delay till the
652 establish-wait period is over, i.e. the minimum set of established peers for
653 which EOR is expected would be peers established during the establish-wait
654 window, not necessarily all the configured neighbors.
655 2. max-delay period is over.
656
657 On hitting any of the above two conditions, BGP resumes the decision process
658 and generates updates to its peers.
659
660 Default max-delay is 0, i.e. the feature is off by default.
661
662 .. index:: table-map ROUTE-MAP-NAME
663 .. clicmd:: table-map ROUTE-MAP-NAME
664
665 This feature is used to apply a route-map on route updates from BGP to
666 Zebra. All the applicable match operations are allowed, such as match on
667 prefix, next-hop, communities, etc. Set operations for this attach-point are
668 limited to metric and next-hop only. Any operation of this feature does not
669 affect BGPs internal RIB.
670
671 Supported for ipv4 and ipv6 address families. It works on multi-paths as
672 well, however, metric setting is based on the best-path only.
673
674 .. _bgp-peers:
675
676 Peers
677 -----
678
679 .. _bgp-defining-peers:
680
681 Defining Peers
682 ^^^^^^^^^^^^^^
683
684 .. index:: neighbor PEER remote-as ASN
685 .. clicmd:: neighbor PEER remote-as ASN
686
687 Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address
688 or an IPv6 address or an interface to use for the connection.
689
690 .. code-block:: frr
691
692 router bgp 1
693 neighbor 10.0.0.1 remote-as 2
694
695 In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1.
696
697 This command must be the first command used when configuring a neighbor. If
698 the remote-as is not specified, *bgpd* will complain like this: ::
699
700 can't find neighbor 10.0.0.1
701
702 .. index:: neighbor PEER remote-as internal
703 .. clicmd:: neighbor PEER remote-as internal
704
705 Create a peer as you would when you specify an ASN, except that if the
706 peers ASN is different than mine as specified under the :clicmd:`router bgp ASN`
707 command the connection will be denied.
708
709 .. index:: neighbor PEER remote-as external
710 .. clicmd:: neighbor PEER remote-as external
711
712 Create a peer as you would when you specify an ASN, except that if the
713 peers ASN is the same as mine as specified under the :clicmd:`router bgp ASN`
714 command the connection will be denied.
715
716 .. _bgp-configuring-peers:
717
718 Configuring Peers
719 ^^^^^^^^^^^^^^^^^
720
721 .. index:: neighbor PEER shutdown
722 .. clicmd:: neighbor PEER shutdown
723
724 .. index:: no neighbor PEER shutdown
725 .. clicmd:: no neighbor PEER shutdown
726
727 Shutdown the peer. We can delete the neighbor's configuration by
728 ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor
729 will be deleted. When you want to preserve the configuration, but want to
730 drop the BGP peer, use this syntax.
731
732 .. index:: neighbor PEER ebgp-multihop
733 .. clicmd:: neighbor PEER ebgp-multihop
734
735 .. index:: no neighbor PEER ebgp-multihop
736 .. clicmd:: no neighbor PEER ebgp-multihop
737
738
739 .. index:: neighbor PEER description ...
740 .. clicmd:: neighbor PEER description ...
741
742
743 .. index:: no neighbor PEER description ...
744 .. clicmd:: no neighbor PEER description ...
745
746 Set description of the peer.
747
748 .. index:: neighbor PEER version VERSION
749 .. clicmd:: neighbor PEER version VERSION
750
751 Set up the neighbor's BGP version. `version` can be `4`, `4+` or `4-`. BGP
752 version `4` is the default value used for BGP peering. BGP version `4+`
753 means that the neighbor supports Multiprotocol Extensions for BGP-4. BGP
754 version `4-` is similar but the neighbor speaks the old Internet-Draft
755 revision 00's Multiprotocol Extensions for BGP-4. Some routing software is
756 still using this version.
757
758 .. index:: neighbor PEER interface IFNAME
759 .. clicmd:: neighbor PEER interface IFNAME
760
761
762 .. index:: no neighbor PEER interface IFNAME
763 .. clicmd:: no neighbor PEER interface IFNAME
764
765 When you connect to a BGP peer over an IPv6 link-local address, you have to
766 specify the IFNAME of the interface used for the connection. To specify
767 IPv4 session addresses, see the ``neighbor PEER update-source`` command
768 below.
769
770 This command is deprecated and may be removed in a future release. Its use
771 should be avoided.
772
773 .. index:: neighbor PEER next-hop-self [all]
774 .. clicmd:: neighbor PEER next-hop-self [all]
775
776
777 .. index:: no neighbor PEER next-hop-self [all]
778 .. clicmd:: no neighbor PEER next-hop-self [all]
779
780 This command specifies an announced route's nexthop as being equivalent to
781 the address of the bgp router if it is learned via eBGP. If the optional
782 keyword `all` is specified the modification is done also for routes learned
783 via iBGP.
784
785 .. index:: neighbor PEER update-source <IFNAME|ADDRESS>
786 .. clicmd:: neighbor PEER update-source <IFNAME|ADDRESS>
787
788
789 .. index:: no neighbor PEER update-source
790 .. clicmd:: no neighbor PEER update-source
791
792 Specify the IPv4 source address to use for the :abbr:`BGP` session to this
793 neighbour, may be specified as either an IPv4 address directly or as an
794 interface name (in which case the *zebra* daemon MUST be running in order
795 for *bgpd* to be able to retrieve interface state).
796
797 .. code-block:: frr
798
799 router bgp 64555
800 neighbor foo update-source 192.168.0.1
801 neighbor bar update-source lo0
802
803
804 .. index:: neighbor PEER default-originate
805 .. clicmd:: neighbor PEER default-originate
806
807 .. index:: no neighbor PEER default-originate
808 .. clicmd:: no neighbor PEER default-originate
809
810 *bgpd*'s default is to not announce the default route (0.0.0.0/0) even if it
811 is in routing table. When you want to announce default routes to the peer,
812 use this command.
813
814 .. index:: neighbor PEER port PORT
815 .. clicmd:: neighbor PEER port PORT
816
817 .. index:: neighbor PEER send-community
818 .. clicmd:: neighbor PEER send-community
819
820 .. index:: neighbor PEER weight WEIGHT
821 .. clicmd:: neighbor PEER weight WEIGHT
822
823
824 .. index:: no neighbor PEER weight WEIGHT
825 .. clicmd:: no neighbor PEER weight WEIGHT
826
827 This command specifies a default `weight` value for the neighbor's routes.
828
829 .. index:: neighbor PEER maximum-prefix NUMBER
830 .. clicmd:: neighbor PEER maximum-prefix NUMBER
831
832
833 .. index:: no neighbor PEER maximum-prefix NUMBER
834 .. clicmd:: no neighbor PEER maximum-prefix NUMBER
835
836
837 .. index:: neighbor PEER local-as AS-NUMBER
838 .. clicmd:: neighbor PEER local-as AS-NUMBER
839
840
841 .. index:: neighbor PEER local-as AS-NUMBER no-prepend
842 .. clicmd:: neighbor PEER local-as AS-NUMBER no-prepend
843
844
845 .. index:: neighbor PEER local-as AS-NUMBER no-prepend replace-as
846 .. clicmd:: neighbor PEER local-as AS-NUMBER no-prepend replace-as
847
848
849 .. index:: no neighbor PEER local-as
850 .. clicmd:: no neighbor PEER local-as
851
852 Specify an alternate AS for this BGP process when interacting with the
853 specified peer. With no modifiers, the specified local-as is prepended to
854 the received AS_PATH when receiving routing updates from the peer, and
855 prepended to the outgoing AS_PATH (after the process local AS) when
856 transmitting local routes to the peer.
857
858 If the no-prepend attribute is specified, then the supplied local-as is not
859 prepended to the received AS_PATH.
860
861 If the replace-as attribute is specified, then only the supplied local-as is
862 prepended to the AS_PATH when transmitting local-route updates to this peer.
863
864 Note that replace-as can only be specified if no-prepend is.
865
866 This command is only allowed for eBGP peers.
867
868 .. index:: neighbor PEER ttl-security hops NUMBER
869 .. clicmd:: neighbor PEER ttl-security hops NUMBER
870
871
872 .. index:: no neighbor PEER ttl-security hops NUMBER
873 .. clicmd:: no neighbor PEER ttl-security hops NUMBER
874
875 This command enforces Generalized TTL Security Mechanism (GTSM), as
876 specified in RFC 5082. With this command, only neighbors that are the
877 specified number of hops away will be allowed to become neighbors. This
878 command is mutually exclusive with *ebgp-multihop*.
879
880 .. _bgp-peer-filtering:
881
882 Peer Filtering
883 ^^^^^^^^^^^^^^
884
885 .. index:: neighbor PEER distribute-list NAME [in|out]
886 .. clicmd:: neighbor PEER distribute-list NAME [in|out]
887
888 This command specifies a distribute-list for the peer. `direct` is
889 ``in`` or ``out``.
890
891 .. index:: neighbor PEER prefix-list NAME [in|out]
892 .. clicmd:: neighbor PEER prefix-list NAME [in|out]
893
894 .. index:: neighbor PEER filter-list NAME [in|out]
895 .. clicmd:: neighbor PEER filter-list NAME [in|out]
896
897 .. index:: neighbor PEER route-map NAME [in|out]
898 .. clicmd:: neighbor PEER route-map NAME [in|out]
899
900 Apply a route-map on the neighbor. `direct` must be `in` or `out`.
901
902 .. index:: bgp route-reflector allow-outbound-policy
903 .. clicmd:: bgp route-reflector allow-outbound-policy
904
905 By default, attribute modification via route-map policy out is not reflected
906 on reflected routes. This option allows the modifications to be reflected as
907 well. Once enabled, it affects all reflected routes.
908
909 .. _bgp-peer-group:
910
911 Peer Groups
912 ^^^^^^^^^^^
913
914 .. index:: neighbor WORD peer-group
915 .. clicmd:: neighbor WORD peer-group
916
917 This command defines a new peer group.
918
919 .. index:: neighbor PEER peer-group WORD
920 .. clicmd:: neighbor PEER peer-group WORD
921
922 This command bind specific peer to peer group WORD.
923
924 Capability Negotiation
925 ^^^^^^^^^^^^^^^^^^^^^^
926
927 .. index:: neighbor PEER strict-capability-match
928 .. clicmd:: neighbor PEER strict-capability-match
929
930 .. index:: no neighbor PEER strict-capability-match
931 .. clicmd:: no neighbor PEER strict-capability-match
932
933 Strictly compares remote capabilities and local capabilities. If
934 capabilities are different, send Unsupported Capability error then reset
935 connection.
936
937 You may want to disable sending Capability Negotiation OPEN message optional
938 parameter to the peer when remote peer does not implement Capability
939 Negotiation. Please use *dont-capability-negotiate* command to disable the
940 feature.
941
942 .. index:: neighbor PEER dont-capability-negotiate
943 .. clicmd:: neighbor PEER dont-capability-negotiate
944
945 .. index:: no neighbor PEER dont-capability-negotiate
946 .. clicmd:: no neighbor PEER dont-capability-negotiate
947
948 Suppress sending Capability Negotiation as OPEN message optional parameter
949 to the peer. This command only affects the peer is configured other than
950 IPv4 unicast configuration.
951
952 When remote peer does not have capability negotiation feature, remote peer
953 will not send any capabilities at all. In that case, bgp configures the peer
954 with configured capabilities.
955
956 You may prefer locally configured capabilities more than the negotiated
957 capabilities even though remote peer sends capabilities. If the peer is
958 configured by *override-capability*, *bgpd* ignores received capabilities
959 then override negotiated capabilities with configured values.
960
961 .. index:: neighbor PEER override-capability
962 .. clicmd:: neighbor PEER override-capability
963
964 .. index:: no neighbor PEER override-capability
965 .. clicmd:: no neighbor PEER override-capability
966
967 Override the result of Capability Negotiation with local configuration.
968 Ignore remote peer's capability value.
969
970 .. _bgp-as-path-access-lists:
971
972 AS Path Access Lists
973 --------------------
974
975 AS path access list is user defined AS path.
976
977 .. index:: ip as-path access-list WORD permit|deny LINE
978 .. clicmd:: ip as-path access-list WORD permit|deny LINE
979
980 This command defines a new AS path access list.
981
982 .. index:: no ip as-path access-list WORD
983 .. clicmd:: no ip as-path access-list WORD
984
985 .. index:: no ip as-path access-list WORD permit|deny LINE
986 .. clicmd:: no ip as-path access-list WORD permit|deny LINE
987
988 .. _bgp-using-as-path-in-route-map:
989
990 Using AS Path in Route Map
991 --------------------------
992
993 .. index:: match as-path WORD
994 .. clicmd:: match as-path WORD
995
996
997 .. index:: set as-path prepend AS-PATH
998 .. clicmd:: set as-path prepend AS-PATH
999
1000 Prepend the given string of AS numbers to the AS_PATH.
1001
1002 .. index:: set as-path prepend last-as NUM
1003 .. clicmd:: set as-path prepend last-as NUM
1004
1005 Prepend the existing last AS number (the leftmost ASN) to the AS_PATH.
1006
1007 .. _bgp-communities-attribute:
1008
1009 Communities Attribute
1010 ---------------------
1011
1012 The BGP communities attribute is widely used for implementing policy routing.
1013 Network operators can manipulate BGP communities attribute based on their
1014 network policy. BGP communities attribute is defined in :rfc:`1997` and
1015 :rfc:`1998`. It is an optional transitive attribute, therefore local policy can
1016 travel through different autonomous system.
1017
1018 The communities attribute is a set of communities values. Each community value
1019 is 4 octet long. The following format is used to define the community value.
1020
1021 ``AS:VAL``
1022 This format represents 4 octet communities value. ``AS`` is high order 2
1023 octet in digit format. ``VAL`` is low order 2 octet in digit format. This
1024 format is useful to define AS oriented policy value. For example,
1025 ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
1026 neighboring peer.
1027
1028 ``internet``
1029 ``internet`` represents well-known communities value 0.
1030
1031 ``no-export``
1032 ``no-export`` represents well-known communities value ``NO_EXPORT``
1033 ``0xFFFFFF01``. All routes carry this value must not be advertised to
1034 outside a BGP confederation boundary. If neighboring BGP peer is part of BGP
1035 confederation, the peer is considered as inside a BGP confederation
1036 boundary, so the route will be announced to the peer.
1037
1038 ``no-advertise``
1039 ``no-advertise`` represents well-known communities value ``NO_ADVERTISE``
1040 ``0xFFFFFF02``. All routes carry this value must not be advertise to other
1041 BGP peers.
1042
1043 ``local-AS``
1044 ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED``
1045 ``0xFFFFFF03``. All routes carry this value must not be advertised to
1046 external BGP peers. Even if the neighboring router is part of confederation,
1047 it is considered as external BGP peer, so the route will not be announced to
1048 the peer.
1049
1050 When the communities attribute is received duplicate community values in the
1051 attribute are ignored and value is sorted in numerical order.
1052
1053 .. _bgp-community-lists:
1054
1055 Community Lists
1056 ^^^^^^^^^^^^^^^
1057 Community lists are user defined lists of community attribute values. These
1058 lists can be used for matching or manipulating the communities attribute in
1059 UPDATE messages.
1060
1061 There are two types of community list:
1062
1063 standard
1064 This type accepts an explicit value for the atttribute.
1065
1066 expanded
1067 This type accepts a regular expression. Because the regex must be
1068 interpreted on each use expanded community lists are slower than standard
1069 lists.
1070
1071 .. index:: ip community-list standard NAME permit|deny COMMUNITY
1072 .. clicmd:: ip community-list standard NAME permit|deny COMMUNITY
1073
1074 This command defines a new standard community list. ``COMMUNITY`` is
1075 communities value. The ``COMMUNITY`` is compiled into community structure.
1076 We can define multiple community list under same name. In that case match
1077 will happen user defined order. Once the community list matches to
1078 communities attribute in BGP updates it return permit or deny by the
1079 community list definition. When there is no matched entry, deny will be
1080 returned. When ``COMMUNITY`` is empty it matches to any routes.
1081
1082 .. index:: ip community-list expanded NAME permit|deny COMMUNITY
1083 .. clicmd:: ip community-list expanded NAME permit|deny COMMUNITY
1084
1085 This command defines a new expanded community list. ``COMMUNITY`` is a
1086 string expression of communities attribute. ``COMMUNITY`` can be a regular
1087 expression (:ref:`bgp-regular-expressions`) to match the communities
1088 attribute in BGP updates.
1089
1090 .. deprecated:: 5.0
1091 It is recommended to use the more explicit versions of this command.
1092
1093 .. index:: ip community-list NAME permit|deny COMMUNITY
1094 .. clicmd:: ip community-list NAME permit|deny COMMUNITY
1095
1096 When the community list type is not specified, the community list type is
1097 automatically detected. If ``COMMUNITY`` can be compiled into communities
1098 attribute, the community list is defined as a standard community list.
1099 Otherwise it is defined as an expanded community list. This feature is left
1100 for backward compatibility. Use of this feature is not recommended.
1101
1102
1103 .. index:: no ip community-list [standard|expanded] NAME
1104 .. clicmd:: no ip community-list [standard|expanded] NAME
1105
1106 Deletes the community list specified by ``NAME``. All community lists share
1107 the same namespace, so it's not necessary to specify ``standard`` or
1108 ``expanded``; these modifiers are purely aesthetic.
1109
1110 .. index:: show ip community-list [NAME]
1111 .. clicmd:: show ip community-list [NAME]
1112
1113 Displays community list information. When ``NAME`` is specified the
1114 specified community list's information is shown.
1115
1116 ::
1117
1118 # show ip community-list
1119 Named Community standard list CLIST
1120 permit 7675:80 7675:100 no-export
1121 deny internet
1122 Named Community expanded list EXPAND
1123 permit :
1124
1125 # show ip community-list CLIST
1126 Named Community standard list CLIST
1127 permit 7675:80 7675:100 no-export
1128 deny internet
1129
1130
1131 .. _bgp-numbered-community-lists:
1132
1133 Numbered Community Lists
1134 ^^^^^^^^^^^^^^^^^^^^^^^^
1135
1136 When number is used for BGP community list name, the number has
1137 special meanings. Community list number in the range from 1 and 99 is
1138 standard community list. Community list number in the range from 100
1139 to 199 is expanded community list. These community lists are called
1140 as numbered community lists. On the other hand normal community lists
1141 is called as named community lists.
1142
1143 .. index:: ip community-list (1-99) permit|deny COMMUNITY
1144 .. clicmd:: ip community-list (1-99) permit|deny COMMUNITY
1145
1146 This command defines a new community list. The argument to (1-99) defines
1147 the list identifier.
1148
1149 .. index:: ip community-list (100-199) permit|deny COMMUNITY
1150 .. clicmd:: ip community-list (100-199) permit|deny COMMUNITY
1151
1152 This command defines a new expanded community list. The argument to
1153 (100-199) defines the list identifier.
1154
1155 .. _bgp-using-communities-in-route-map:
1156
1157 Using Communities in Route Maps
1158 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1159
1160 In :ref:`route-map` we can match on or set the BGP communities attribute. Using
1161 this feature network operator can implement their network policy based on BGP
1162 communities attribute.
1163
1164 The ollowing commands can be used in route maps:
1165
1166 .. index:: match community WORD exact-match [exact-match]
1167 .. clicmd:: match community WORD exact-match [exact-match]
1168
1169 This command perform match to BGP updates using community list WORD. When
1170 the one of BGP communities value match to the one of communities value in
1171 community list, it is match. When `exact-match` keyword is specified, match
1172 happen only when BGP updates have completely same communities value
1173 specified in the community list.
1174
1175 .. index:: set community <none|COMMUNITY> additive
1176 .. clicmd:: set community <none|COMMUNITY> additive
1177
1178 This command sets the community value in BGP updates. If the attribute is
1179 already configured, the newly provided value replaces the old one unless the
1180 ``additive`` keyword is specified, in which case the new value is appended
1181 to the existing value.
1182
1183 If ``none`` is specified as the community value, the communities attribute
1184 is not sent.
1185
1186 .. index:: set comm-list WORD delete
1187 .. clicmd:: set comm-list WORD delete
1188
1189 This command remove communities value from BGP communities attribute. The
1190 ``word`` is community list name. When BGP route's communities value matches
1191 to the community list ``word``, the communities value is removed. When all
1192 of communities value is removed eventually, the BGP update's communities
1193 attribute is completely removed.
1194
1195 .. _bgp-communities-example:
1196
1197 Example Configuration
1198 ^^^^^^^^^^^^^^^^^^^^^
1199
1200 The following configuration is exemplary of the most typical usage of BGP
1201 communities attribute. In the example, AS 7675 provides an upstream Internet
1202 connection to AS 100. When the following configuration exists in AS 7675, the
1203 network operator of AS 100 can set local preference in AS 7675 network by
1204 setting BGP communities attribute to the updates.
1205
1206 .. code-block:: frr
1207
1208 router bgp 7675
1209 neighbor 192.168.0.1 remote-as 100
1210 address-family ipv4 unicast
1211 neighbor 192.168.0.1 route-map RMAP in
1212 exit-address-family
1213 !
1214 ip community-list 70 permit 7675:70
1215 ip community-list 70 deny
1216 ip community-list 80 permit 7675:80
1217 ip community-list 80 deny
1218 ip community-list 90 permit 7675:90
1219 ip community-list 90 deny
1220 !
1221 route-map RMAP permit 10
1222 match community 70
1223 set local-preference 70
1224 !
1225 route-map RMAP permit 20
1226 match community 80
1227 set local-preference 80
1228 !
1229 route-map RMAP permit 30
1230 match community 90
1231 set local-preference 90
1232
1233
1234 The following configuration announces ``10.0.0.0/8`` from AS 100 to AS 7675.
1235 The route has communities value ``7675:80`` so when above configuration exists
1236 in AS 7675, the announced routes' local preference value will be set to 80.
1237
1238 .. code-block:: frr
1239
1240 router bgp 100
1241 network 10.0.0.0/8
1242 neighbor 192.168.0.2 remote-as 7675
1243 address-family ipv4 unicast
1244 neighbor 192.168.0.2 route-map RMAP out
1245 exit-address-family
1246 !
1247 ip prefix-list PLIST permit 10.0.0.0/8
1248 !
1249 route-map RMAP permit 10
1250 match ip address prefix-list PLIST
1251 set community 7675:80
1252
1253
1254 The following configuration is an example of BGP route filtering using
1255 communities attribute. This configuration only permit BGP routes which has BGP
1256 communities value ``0:80`` or ``0:90``. The network operator can set special
1257 internal communities value at BGP border router, then limit the BGP route
1258 announcements into the internal network.
1259
1260 .. code-block:: frr
1261
1262 router bgp 7675
1263 neighbor 192.168.0.1 remote-as 100
1264 address-family ipv4 unicast
1265 neighbor 192.168.0.1 route-map RMAP in
1266 exit-address-family
1267 !
1268 ip community-list 1 permit 0:80 0:90
1269 !
1270 route-map RMAP permit in
1271 match community 1
1272
1273
1274 The following example filters BGP routes which have a community value of
1275 ``1:1``. When there is no match community-list returns ``deny``. To avoid
1276 filtering all routes, a ``permit`` line is set at the end of the
1277 community-list.
1278
1279 .. code-block:: frr
1280
1281 router bgp 7675
1282 neighbor 192.168.0.1 remote-as 100
1283 address-family ipv4 unicast
1284 neighbor 192.168.0.1 route-map RMAP in
1285 exit-address-family
1286 !
1287 ip community-list standard FILTER deny 1:1
1288 ip community-list standard FILTER permit
1289 !
1290 route-map RMAP permit 10
1291 match community FILTER
1292
1293
1294 The communities value keyword ``internet`` has special meanings in standard
1295 community lists. In the below example ``internet`` matches all BGP routes even
1296 if the route does not have communities attribute at all. So community list
1297 ``INTERNET`` is the same as ``FILTER`` in the previous example.
1298
1299 .. code-block:: frr
1300
1301 ip community-list standard INTERNET deny 1:1
1302 ip community-list standard INTERNET permit internet
1303
1304
1305 The following configuration is an example of communities value deletion. With
1306 this configuration the community values ``100:1`` and ``100:2`` are removed
1307 from BGP updates. For communities value deletion, only ``permit``
1308 community-list is used. ``deny`` community-list is ignored.
1309
1310 .. code-block:: frr
1311
1312 router bgp 7675
1313 neighbor 192.168.0.1 remote-as 100
1314 address-family ipv4 unicast
1315 neighbor 192.168.0.1 route-map RMAP in
1316 exit-address-family
1317 !
1318 ip community-list standard DEL permit 100:1 100:2
1319 !
1320 route-map RMAP permit 10
1321 set comm-list DEL delete
1322
1323
1324 .. _bgp-extended-communities-attribute:
1325
1326 Extended Communities Attribute
1327 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1328
1329 BGP extended communities attribute is introduced with MPLS VPN/BGP technology.
1330 MPLS VPN/BGP expands capability of network infrastructure to provide VPN
1331 functionality. At the same time it requires a new framework for policy routing.
1332 With BGP Extended Communities Attribute we can use Route Target or Site of
1333 Origin for implementing network policy for MPLS VPN/BGP.
1334
1335 BGP Extended Communities Attribute is similar to BGP Communities Attribute. It
1336 is an optional transitive attribute. BGP Extended Communities Attribute can
1337 carry multiple Extended Community value. Each Extended Community value is
1338 eight octet length.
1339
1340 BGP Extended Communities Attribute provides an extended range compared with BGP
1341 Communities Attribute. Adding to that there is a type field in each value to
1342 provides community space structure.
1343
1344 There are two format to define Extended Community value. One is AS based format
1345 the other is IP address based format.
1346
1347 ``AS:VAL``
1348 This is a format to define AS based Extended Community value. ``AS`` part
1349 is 2 octets Global Administrator subfield in Extended Community value.
1350 ``VAL`` part is 4 octets Local Administrator subfield. ``7675:100``
1351 represents AS 7675 policy value 100.
1352
1353 ``IP-Address:VAL``
1354 This is a format to define IP address based Extended Community value.
1355 ``IP-Address`` part is 4 octets Global Administrator subfield. ``VAL`` part
1356 is 2 octets Local Administrator subfield.
1357
1358 .. _bgp-extended-community-lists:
1359
1360 Extended Community Lists
1361 ^^^^^^^^^^^^^^^^^^^^^^^^
1362
1363 .. index:: ip extcommunity-list standard NAME permit|deny EXTCOMMUNITY
1364 .. clicmd:: ip extcommunity-list standard NAME permit|deny EXTCOMMUNITY
1365
1366 This command defines a new standard extcommunity-list. `extcommunity` is
1367 extended communities value. The `extcommunity` is compiled into extended
1368 community structure. We can define multiple extcommunity-list under same
1369 name. In that case match will happen user defined order. Once the
1370 extcommunity-list matches to extended communities attribute in BGP updates
1371 it return permit or deny based upon the extcommunity-list definition. When
1372 there is no matched entry, deny will be returned. When `extcommunity` is
1373 empty it matches to any routes.
1374
1375 .. index:: ip extcommunity-list expanded NAME permit|deny LINE
1376 .. clicmd:: ip extcommunity-list expanded NAME permit|deny LINE
1377
1378 This command defines a new expanded extcommunity-list. `line` is a string
1379 expression of extended communities attribute. `line` can be a regular
1380 expression (:ref:`bgp-regular-expressions`) to match an extended communities
1381 attribute in BGP updates.
1382
1383 .. index:: no ip extcommunity-list NAME
1384 .. clicmd:: no ip extcommunity-list NAME
1385
1386 .. index:: no ip extcommunity-list standard NAME
1387 .. clicmd:: no ip extcommunity-list standard NAME
1388
1389 .. index:: no ip extcommunity-list expanded NAME
1390 .. clicmd:: no ip extcommunity-list expanded NAME
1391
1392 These commands delete extended community lists specified by `name`. All of
1393 extended community lists shares a single name space. So extended community
1394 lists can be removed simply specifying the name.
1395
1396 .. index:: show ip extcommunity-list
1397 .. clicmd:: show ip extcommunity-list
1398
1399 .. index:: show ip extcommunity-list NAME
1400 .. clicmd:: show ip extcommunity-list NAME
1401
1402 This command displays current extcommunity-list information. When `name` is
1403 specified the community list's information is shown.::
1404
1405 # show ip extcommunity-list
1406
1407
1408 .. _bgp-extended-communities-in-route-map:
1409
1410 BGP Extended Communities in Route Map
1411 """""""""""""""""""""""""""""""""""""
1412
1413 .. index:: match extcommunity WORD
1414 .. clicmd:: match extcommunity WORD
1415
1416 .. index:: set extcommunity rt EXTCOMMUNITY
1417 .. clicmd:: set extcommunity rt EXTCOMMUNITY
1418
1419 This command set Route Target value.
1420
1421 .. index:: set extcommunity soo EXTCOMMUNITY
1422 .. clicmd:: set extcommunity soo EXTCOMMUNITY
1423
1424 This command set Site of Origin value.
1425
1426 .. _bgp-large-communities-attribute:
1427
1428 Large Communities Attribute
1429 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1430
1431 The BGP Large Communities attribute was introduced in Feb 2017 with
1432 :rfc:`8092`.
1433
1434 The BGP Large Communities Attribute is similar to the BGP Communities Attribute
1435 except that it has 3 components instead of two and each of which are 4 octets
1436 in length. Large Communities bring additional functionality and convenience
1437 over traditional communities, specifically the fact that the ``GLOBAL`` part
1438 below is now 4 octets wide allowing seamless use in networks using 4-byte ASNs.
1439
1440 ``GLOBAL:LOCAL1:LOCAL2``
1441 This is the format to define Large Community values. Referencing :rfc:`8195`
1442 the values are commonly referred to as follows:
1443
1444 - The ``GLOBAL`` part is a 4 octet Global Administrator field, commonly used
1445 as the operators AS number.
1446 - The ``LOCAL1`` part is a 4 octet Local Data Part 1 subfield referred to as
1447 a function.
1448 - The ``LOCAL2`` part is a 4 octet Local Data Part 2 field and referred to
1449 as the parameter subfield.
1450
1451 As an example, ``65551:1:10`` represents AS 65551 function 1 and parameter
1452 10. The referenced RFC above gives some guidelines on recommended usage.
1453
1454 .. _bgp-large-community-lists:
1455
1456 Large Community Lists
1457 """""""""""""""""""""
1458
1459 Two types of large community lists are supported, namely `standard` and
1460 `expanded`.
1461
1462 .. index:: ip large-community-list standard NAME permit|deny LARGE-COMMUNITY
1463 .. clicmd:: ip large-community-list standard NAME permit|deny LARGE-COMMUNITY
1464
1465 This command defines a new standard large-community-list. `large-community`
1466 is the Large Community value. We can add multiple large communities under
1467 same name. In that case the match will happen in the user defined order.
1468 Once the large-community-list matches the Large Communities attribute in BGP
1469 updates it will return permit or deny based upon the large-community-list
1470 definition. When there is no matched entry, a deny will be returned. When
1471 `large-community` is empty it matches any routes.
1472
1473 .. index:: ip large-community-list expanded NAME permit|deny LINE
1474 .. clicmd:: ip large-community-list expanded NAME permit|deny LINE
1475
1476 This command defines a new expanded large-community-list. Where `line` is a
1477 string matching expression, it will be compared to the entire Large
1478 Communities attribute as a string, with each large-community in order from
1479 lowest to highest. `line` can also be a regular expression which matches
1480 this Large Community attribute.
1481
1482 .. index:: no ip large-community-list NAME
1483 .. clicmd:: no ip large-community-list NAME
1484
1485 .. index:: no ip large-community-list standard NAME
1486 .. clicmd:: no ip large-community-list standard NAME
1487
1488 .. index:: no ip large-community-list expanded NAME
1489 .. clicmd:: no ip large-community-list expanded NAME
1490
1491 These commands delete Large Community lists specified by `name`. All Large
1492 Community lists share a single namespace. This means Large Community lists
1493 can be removed by simply specifying the name.
1494
1495 .. index:: show ip large-community-list
1496 .. clicmd:: show ip large-community-list
1497
1498 .. index:: show ip large-community-list NAME
1499 .. clicmd:: show ip large-community-list NAME
1500
1501 This command display current large-community-list information. When
1502 `name` is specified the community list information is shown.
1503
1504 .. index:: show ip bgp large-community-info
1505 .. clicmd:: show ip bgp large-community-info
1506
1507 This command displays the current large communities in use.
1508
1509 .. _bgp-large-communities-in-route-map:
1510
1511 Large Communities in Route Map
1512 """"""""""""""""""""""""""""""
1513
1514 .. index:: match large-community LINE
1515 .. clicmd:: match large-community LINE
1516
1517 Where `line` can be a simple string to match, or a regular expression. It
1518 is very important to note that this match occurs on the entire
1519 large-community string as a whole, where each large-community is ordered
1520 from lowest to highest.
1521
1522 .. index:: set large-community LARGE-COMMUNITY
1523 .. clicmd:: set large-community LARGE-COMMUNITY
1524
1525 .. index:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
1526 .. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY
1527
1528 .. index:: set large-community LARGE-COMMUNITY additive
1529 .. clicmd:: set large-community LARGE-COMMUNITY additive
1530
1531 These commands are used for setting large-community values. The first
1532 command will overwrite any large-communities currently present.
1533 The second specifies two large-communities, which overwrites the current
1534 large-community list. The third will add a large-community value without
1535 overwriting other values. Multiple large-community values can be specified.
1536
1537
1538 .. _bgp-vrfs:
1539
1540 VRFs
1541 ----
1542
1543 BGP supports multiple VRF instances with the following command:
1544
1545 .. index:: router bgp ASN vrf VRFNAME
1546 .. clicmd:: router bgp ASN vrf VRFNAME
1547
1548 ``VRFNAME`` is matched against VRFs configured in the kernel. When
1549 ``vrf VRFNAME`` is not specified, the BGP protocol process belongs to the
1550 default VRF.
1551
1552 With VRF, you can isolate networking information. Having BGP VRF allows you to
1553 have several BGP instances on the same system process. This solution solves
1554 scalabiliy issues where the network administrator had previously to run
1555 separately several BGP processes on each namespace. Now, not only BGP VRF
1556 solves this, but also this method applies to both kind of VRFs backend: default
1557 VRF from Linux kernel or network namespaces. Also, having separate BGP
1558 instances does not imply that the AS number has to be different. For internal
1559 purposes, it is possible to do iBGP peering from two differents network
1560 namespaces.
1561
1562 VRF Route Leaking
1563 ^^^^^^^^^^^^^^^^^
1564
1565 BGP routes may be leaked (i.e. copied) between a unicast VRF RIB and the VPN
1566 SAFI RIB of the default VRF for use in MPLS-based L3VPNs. Unicast routes may
1567 also be leaked between any VRFs (including the unicast RIB of the default BGP
1568 instanced). A shortcut syntax is also available for specifying leaking from one
1569 VRF to another VRF using the default instance's VPN RIB as the intemediary. A
1570 common application of the VRF-VRF feature is to connect a customer's private
1571 routing domain to a provider's VPN service. Leaking is configured from the
1572 point of view of an individual VRF: ``import`` refers to routes leaked from VPN
1573 to a unicast VRF, whereas ``export`` refers to routes leaked from a unicast VRF
1574 to VPN.
1575
1576 Required parameters
1577 """""""""""""""""""
1578
1579 Routes exported from a unicast VRF to the VPN RIB must be augmented by two
1580 parameters:
1581
1582 - an :abbr:`RD (Route Distinguisher)`
1583 - an :abbr:`RTLIST (Route-target List)`
1584
1585 Configuration for these exported routes must, at a minimum, specify these two
1586 parameters.
1587
1588 Routes imported from the VPN RIB to a unicast VRF are selected according to
1589 their RTLISTs. Routes whose RTLIST contains at least one route-target in
1590 common with the configured import RTLIST are leaked. Configuration for these
1591 imported routes must specify an RTLIST to be matched.
1592
1593 The RD, which carries no semantic value, is intended to make the route unique
1594 in the VPN RIB among all routes of its prefix that originate from all the
1595 customers and sites that are attached to the provider's VPN service.
1596 Accordingly, each site of each customer is typically assigned an RD that is
1597 unique across the entire provider network.
1598
1599 The RTLIST is a set of route-target extended community values whose purpose is
1600 to specify route-leaking policy. Typically, a customer is assigned a single
1601 route-target value for import and export to be used at all customer sites. This
1602 configuration specifies a simple topology wherein a customer has a single
1603 routing domain which is shared across all its sites. More complex routing
1604 topologies are possible through use of additional route-targets to augment the
1605 leaking of sets of routes in various ways.
1606
1607 When using the shortcut syntax for vrf-to-vrf leaking, the RD and RT are
1608 auto-derived.
1609
1610 General configuration
1611 """""""""""""""""""""
1612
1613 Configuration of route leaking between a unicast VRF RIB and the VPN SAFI RIB
1614 of the default VRF is accomplished via commands in the context of a VRF
1615 address-family:
1616
1617 .. index:: rd vpn export AS:NN|IP:nn
1618 .. clicmd:: rd vpn export AS:NN|IP:nn
1619
1620 Specifies the route distinguisher to be added to a route exported from the
1621 current unicast VRF to VPN.
1622
1623 .. index:: no rd vpn export [AS:NN|IP:nn]
1624 .. clicmd:: no rd vpn export [AS:NN|IP:nn]
1625
1626 Deletes any previously-configured export route distinguisher.
1627
1628 .. index:: rt vpn import|export|both RTLIST...
1629 .. clicmd:: rt vpn import|export|both RTLIST...
1630
1631 Specifies the route-target list to be attached to a route (export) or the
1632 route-target list to match against (import) when exporting/importing between
1633 the current unicast VRF and VPN.
1634
1635 The RTLIST is a space-separated list of route-targets, which are BGP
1636 extended community values as described in
1637 :ref:`bgp-extended-communities-attribute`.
1638
1639 .. index:: no rt vpn import|export|both [RTLIST...]
1640 .. clicmd:: no rt vpn import|export|both [RTLIST...]
1641
1642 Deletes any previously-configured import or export route-target list.
1643
1644 .. index:: label vpn export (0..1048575)|auto
1645 .. clicmd:: label vpn export (0..1048575)|auto
1646
1647 Specifies an optional MPLS label to be attached to a route exported from the
1648 current unicast VRF to VPN. If label is specified as ``auto``, the label
1649 value is automatically assigned from a pool maintained by the zebra
1650 daemon. If zebra is not running, automatic label assignment will not
1651 complete, which will block corresponding route export.
1652
1653 .. index:: no label vpn export [(0..1048575)|auto]
1654 .. clicmd:: no label vpn export [(0..1048575)|auto]
1655
1656 Deletes any previously-configured export label.
1657
1658 .. index:: nexthop vpn export A.B.C.D|X:X::X:X
1659 .. clicmd:: nexthop vpn export A.B.C.D|X:X::X:X
1660
1661 Specifies an optional nexthop value to be assigned to a route exported from
1662 the current unicast VRF to VPN. If left unspecified, the nexthop will be set
1663 to 0.0.0.0 or 0:0::0:0 (self).
1664
1665 .. index:: no nexthop vpn export [A.B.C.D|X:X::X:X]
1666 .. clicmd:: no nexthop vpn export [A.B.C.D|X:X::X:X]
1667
1668 Deletes any previously-configured export nexthop.
1669
1670 .. index:: route-map vpn import|export MAP
1671 .. clicmd:: route-map vpn import|export MAP
1672
1673 Specifies an optional route-map to be applied to routes imported or exported
1674 between the current unicast VRF and VPN.
1675
1676 .. index:: no route-map vpn import|export [MAP]
1677 .. clicmd:: no route-map vpn import|export [MAP]
1678
1679 Deletes any previously-configured import or export route-map.
1680
1681 .. index:: import|export vpn
1682 .. clicmd:: import|export vpn
1683
1684 Enables import or export of routes between the current unicast VRF and VPN.
1685
1686 .. index:: no import|export vpn
1687 .. clicmd:: no import|export vpn
1688
1689 Disables import or export of routes between the current unicast VRF and VPN.
1690
1691 .. index:: import vrf VRFNAME
1692 .. clicmd:: import vrf VRFNAME
1693
1694 Shortcut syntax for specifying automatic leaking from vrf VRFNAME to
1695 the current VRF using the VPN RIB as intermediary. The RD and RT
1696 are auto derived and should not be specified explicitly for either the
1697 source or destination VRF's.
1698
1699 This shortcut syntax mode is not compatible with the explicit
1700 `import vpn` and `export vpn` statements for the two VRF's involved.
1701 The CLI will disallow attempts to configure incompatible leaking
1702 modes.
1703
1704 .. index:: no import vrf VRFNAME
1705 .. clicmd:: no import vrf VRFNAME
1706
1707 Disables automatic leaking from vrf VRFNAME to the current VRF using
1708 the VPN RIB as intermediary.
1709
1710 .. _bgp-instances-and-views:
1711
1712 Instances and Views
1713 -------------------
1714
1715 A BGP *instance* is a normal BGP process. Routes selected by BGP are installed
1716 into the kernel routing table.
1717
1718 .. note::
1719 In previous versions of FRR, running multiple AS's from the same BGP process
1720 was not supported; in order to run multiple AS's it was necessary to run
1721 multiple BGP processes. This had to be explicitly configured with the
1722 ``bgp multiple-instance`` command. Recent versions of FRR support multiple
1723 BGP AS's within the same process by simply defining multiple
1724 ``router bgp X`` blocks, so the ``multiple-instance`` command is now
1725 unnecessary and deprecated.
1726
1727 .. index:: router bgp AS-NUMBER
1728 .. clicmd:: router bgp AS-NUMBER
1729
1730 Make a new BGP instance. You can use an arbitrary word for the `name`.
1731
1732 .. code-block:: frr
1733
1734 router bgp 1
1735 neighbor 10.0.0.1 remote-as 2
1736 neighbor 10.0.0.2 remote-as 3
1737 !
1738 router bgp 2
1739 neighbor 10.0.0.3 remote-as 4
1740 neighbor 10.0.0.4 remote-as 5
1741
1742 .. deprecated:: 5.0
1743 This command does nothing and can be safely removed.
1744
1745 .. index:: bgp multiple-instance
1746 .. clicmd:: bgp multiple-instance
1747
1748 Enable BGP multiple instance feature. Because this is now the default
1749 configuration this command will not be displayed in the running
1750 configuration.
1751
1752 .. deprecated:: 5.0
1753 This command does nothing and can be safely removed.
1754
1755 .. index:: no bgp multiple-instance
1756 .. clicmd:: no bgp multiple-instance
1757
1758 In previous versions of FRR, this command disabled the BGP multiple instance
1759 feature. This functionality is automatically turned on when BGP multiple
1760 instances or views exist so this command no longer does anything.
1761
1762 BGP views are almost same as normal BGP processes, except that routes selected
1763 by BGP are not installed into the kernel routing table. The view functionality
1764 allows the exchange of BGP routing information only without affecting the
1765 kernel routing tables.
1766
1767 .. index:: router bgp AS-NUMBER view NAME
1768 .. clicmd:: router bgp AS-NUMBER view NAME
1769
1770 Make a new BGP view. You can use arbitrary word for the ``NAME``. Routes selected by the view are not installed into the kernel routing table.
1771 view's route selection result does not go to the kernel routing table.
1772
1773 With this command, you can setup Route Server like below.
1774
1775 .. code-block:: frr
1776
1777 !
1778 router bgp 1 view 1
1779 neighbor 10.0.0.1 remote-as 2
1780 neighbor 10.0.0.2 remote-as 3
1781 !
1782 router bgp 2 view 2
1783 neighbor 10.0.0.3 remote-as 4
1784 neighbor 10.0.0.4 remote-as 5
1785
1786 .. index:: show ip bgp view NAME
1787 .. clicmd:: show ip bgp view NAME
1788
1789 Display the routing table of BGP view ``NAME``.
1790
1791 .. _bgp-cisco-compatibility:
1792
1793 Cisco Compatibility
1794 -------------------
1795
1796 FRR has commands that change some configuration syntax and default behavior to
1797 behave more closely to Cisco conventions. These are deprecated and will be
1798 removed in a future version of FRR.
1799
1800 .. deprecated:: 5.0
1801 Please transition to using the FRR specific syntax for your configuration.
1802
1803 .. index:: bgp config-type cisco
1804 .. clicmd:: bgp config-type cisco
1805
1806 Cisco compatible BGP configuration output.
1807
1808 When this configuration line is specified:
1809
1810 - ``no synchronization`` is displayed. This command does nothing and is for
1811 display purposes only.
1812 - ``no auto-summary`` is displayed.
1813 - The ``network`` and ``aggregate-address`` arguments are displayed as:
1814
1815 ::
1816
1817 A.B.C.D M.M.M.M
1818
1819 FRR: network 10.0.0.0/8
1820 Cisco: network 10.0.0.0
1821
1822 FRR: aggregate-address 192.168.0.0/24
1823 Cisco: aggregate-address 192.168.0.0 255.255.255.0
1824
1825 Community attribute handling is also different. If no configuration is
1826 specified community attribute and extended community attribute are sent to
1827 the neighbor. If a user manually disables the feature, the community
1828 attribute is not sent to the neighbor. When ``bgp config-type cisco`` is
1829 specified, the community attribute is not sent to the neighbor by default.
1830 To send the community attribute user has to specify
1831 :clicmd:`neighbor A.B.C.D send-community` like so:
1832
1833 .. code-block:: frr
1834
1835 !
1836 router bgp 1
1837 neighbor 10.0.0.1 remote-as 1
1838 address-family ipv4 unicast
1839 no neighbor 10.0.0.1 send-community
1840 exit-address-family
1841 !
1842 router bgp 1
1843 neighbor 10.0.0.1 remote-as 1
1844 address-family ipv4 unicast
1845 neighbor 10.0.0.1 send-community
1846 exit-address-family
1847 !
1848
1849 .. deprecated:: 5.0
1850 Please transition to using the FRR specific syntax for your configuration.
1851
1852 .. index:: bgp config-type zebra
1853 .. clicmd:: bgp config-type zebra
1854
1855 FRR style BGP configuration. This is the default.
1856
1857 .. _bgp-debugging:
1858
1859 Debugging
1860 ---------
1861
1862 .. index:: show debug
1863 .. clicmd:: show debug
1864
1865 Show all enabled debugs.
1866
1867 .. index:: [no] debug bgp neighbor-events
1868 .. clicmd:: [no] debug bgp neighbor-events
1869
1870 Enable or disable debugging for neighbor events. This provides general
1871 information on BGP events such as peer connection / disconnection, session
1872 establishment / teardown, and capability negotiation.
1873
1874 .. index:: [no] debug bgp updates
1875 .. clicmd:: [no] debug bgp updates
1876
1877 Enable or disable debugging for BGP updates. This provides information on
1878 BGP UPDATE messages transmitted and received between local and remote
1879 instances.
1880
1881 .. index:: [no] debug bgp keepalives
1882 .. clicmd:: [no] debug bgp keepalives
1883
1884 Enable or disable debugging for BGP keepalives. This provides information on
1885 BGP KEEPALIVE messages transmitted and received between local and remote
1886 instances.
1887
1888 .. index:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
1889 .. clicmd:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>
1890
1891 Enable or disable debugging for bestpath selection on the specified prefix.
1892
1893 .. index:: [no] debug bgp nht
1894 .. clicmd:: [no] debug bgp nht
1895
1896 Enable or disable debugging of BGP nexthop tracking.
1897
1898 .. index:: [no] debug bgp update-groups
1899 .. clicmd:: [no] debug bgp update-groups
1900
1901 Enable or disable debugging of dynamic update groups. This provides general
1902 information on group creation, deletion, join and prune events.
1903
1904 .. index:: [no] debug bgp zebra
1905 .. clicmd:: [no] debug bgp zebra
1906
1907 Enable or disable debugging of communications between *bgpd* and *zebra*.
1908
1909 Dumping Messages and Routing Tables
1910 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1911
1912 .. index:: dump bgp all PATH [INTERVAL]
1913 .. clicmd:: dump bgp all PATH [INTERVAL]
1914
1915 .. index:: dump bgp all-et PATH [INTERVAL]
1916 .. clicmd:: dump bgp all-et PATH [INTERVAL]
1917
1918 .. index:: no dump bgp all [PATH] [INTERVAL]
1919 .. clicmd:: no dump bgp all [PATH] [INTERVAL]
1920
1921 Dump all BGP packet and events to `path` file.
1922 If `interval` is set, a new file will be created for echo `interval` of
1923 seconds. The path `path` can be set with date and time formatting
1924 (strftime). The type ‘all-et’ enables support for Extended Timestamp Header
1925 (:ref:`packet-binary-dump-format`).
1926
1927 .. index:: dump bgp updates PATH [INTERVAL]
1928 .. clicmd:: dump bgp updates PATH [INTERVAL]
1929
1930 .. index:: dump bgp updates-et PATH [INTERVAL]
1931 .. clicmd:: dump bgp updates-et PATH [INTERVAL]
1932
1933 .. index:: no dump bgp updates [PATH] [INTERVAL]
1934 .. clicmd:: no dump bgp updates [PATH] [INTERVAL]
1935
1936 Dump only BGP updates messages to `path` file.
1937 If `interval` is set, a new file will be created for echo `interval` of
1938 seconds. The path `path` can be set with date and time formatting
1939 (strftime). The type ‘updates-et’ enables support for Extended Timestamp
1940 Header (:ref:`packet-binary-dump-format`).
1941
1942 .. index:: dump bgp routes-mrt PATH
1943 .. clicmd:: dump bgp routes-mrt PATH
1944
1945 .. index:: dump bgp routes-mrt PATH INTERVAL
1946 .. clicmd:: dump bgp routes-mrt PATH INTERVAL
1947
1948 .. index:: no dump bgp route-mrt [PATH] [INTERVAL]
1949 .. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL]
1950
1951 Dump whole BGP routing table to `path`. This is heavy process. The path
1952 `path` can be set with date and time formatting (strftime). If `interval` is
1953 set, a new file will be created for echo `interval` of seconds.
1954
1955 Note: the interval variable can also be set using hours and minutes: 04h20m00.
1956
1957
1958 .. _bgp-other-commands:
1959
1960 Other BGP Commands
1961 ------------------
1962
1963 .. index:: clear bgp ipv4|ipv6 \*
1964 .. clicmd:: clear bgp ipv4|ipv6 \*
1965
1966 Clear all address family peers.
1967
1968 .. index:: clear bgp ipv4|ipv6 PEER
1969 .. clicmd:: clear bgp ipv4|ipv6 PEER
1970
1971 Clear peers which have addresses of X.X.X.X
1972
1973 .. index:: clear bgp ipv4|ipv6 PEER soft in
1974 .. clicmd:: clear bgp ipv4|ipv6 PEER soft in
1975
1976 Clear peer using soft reconfiguration.
1977
1978
1979 .. _bgp-displaying-bgp-information:
1980
1981 Displaying BGP Information
1982 ==========================
1983
1984 .. index:: show ip bgp
1985 .. clicmd:: show ip bgp
1986
1987 .. index:: show ip bgp A.B.C.D
1988 .. clicmd:: show ip bgp A.B.C.D
1989
1990 .. index:: show ip bgp X:X::X:X
1991 .. clicmd:: show ip bgp X:X::X:X
1992
1993 These commands display BGP routes. When no route is specified, the default
1994 is to display all IPv4 BGP routes.
1995
1996 ::
1997
1998 BGP table version is 0, local router ID is 10.1.1.1
1999 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
2000 Origin codes: i - IGP, e - EGP, ? - incomplete
2001
2002 Network Next Hop Metric LocPrf Weight Path
2003 \*> 1.1.1.1/32 0.0.0.0 0 32768 i
2004
2005 Total number of prefixes 1
2006
2007 .. index:: show ip bgp regexp LINE
2008 .. clicmd:: show ip bgp regexp LINE
2009
2010 This command displays BGP routes using AS path regular expression
2011 (:ref:`bgp-regular-expressions`).
2012
2013 .. index:: show bgp <ipv4|ipv6> summary
2014 .. clicmd:: show bgp <ipv4|ipv6> summary
2015
2016 Show a bgp peer summary for the specified address family.
2017
2018 .. index:: show bgp <ipv4|ipv6> neighbor [PEER]
2019 .. clicmd:: show bgp <ipv4|ipv6> neighbor [PEER]
2020
2021 This command shows information on a specific BGP `peer`.
2022
2023 .. index:: show bgp <ipv4|ipv6> dampening dampened-paths
2024 .. clicmd:: show bgp <ipv4|ipv6> dampening dampened-paths
2025
2026 Display paths suppressed due to dampening.
2027
2028 .. index:: show bgp <ipv4|ipv6> dampening flap-statistics
2029 .. clicmd:: show bgp <ipv4|ipv6> dampening flap-statistics
2030
2031 Display flap statistics of routes.
2032
2033 .. _bgp-display-routes-by-community:
2034
2035 Displaying Routes by Community Attribute
2036 ----------------------------------------
2037
2038 The following commands allow displaying routes based on their community
2039 attribute.
2040
2041 .. index:: show [ip] bgp <ipv4|ipv6> community
2042 .. clicmd:: show [ip] bgp <ipv4|ipv6> community
2043
2044 .. index:: show [ip] bgp <ipv4|ipv6> community COMMUNITY
2045 .. clicmd:: show [ip] bgp <ipv4|ipv6> community COMMUNITY
2046
2047 .. index:: show [ip] bgp <ipv4|ipv6> community COMMUNITY exact-match
2048 .. clicmd:: show [ip] bgp <ipv4|ipv6> community COMMUNITY exact-match
2049
2050 These commands display BGP routes which have the community attribute.
2051 attribute. When ``COMMUNITY`` is specified, BGP routes that match that
2052 community are displayed. When `exact-match` is specified, it display only
2053 routes that have an exact match.
2054
2055 .. index:: show [ip] bgp <ipv4|ipv6> community-list WORD
2056 .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD
2057
2058 .. index:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
2059 .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match
2060
2061 These commands display BGP routes for the address family specified that
2062 match the specified community list. When `exact-match` is specified, it
2063 displays only routes that have an exact match.
2064
2065 .. _bgp-display-routes-by-as-path:
2066
2067 Displaying Routes by AS Path
2068 ----------------------------
2069
2070 .. index:: show bgp ipv4|ipv6 regexp LINE
2071 .. clicmd:: show bgp ipv4|ipv6 regexp LINE
2072
2073 This commands displays BGP routes that matches a regular
2074 expression `line` (:ref:`bgp-regular-expressions`).
2075
2076 .. index:: show ip bgp ipv4 vpn
2077 .. clicmd:: show ip bgp ipv4 vpn
2078
2079 .. index:: show ip bgp ipv6 vpn
2080 .. clicmd:: show ip bgp ipv6 vpn
2081
2082 Print active IPV4 or IPV6 routes advertised via the VPN SAFI.
2083
2084 .. index:: show bgp ipv4 vpn summary
2085 .. clicmd:: show bgp ipv4 vpn summary
2086
2087 .. index:: show bgp ipv6 vpn summary
2088 .. clicmd:: show bgp ipv6 vpn summary
2089
2090 Print a summary of neighbor connections for the specified AFI/SAFI combination.
2091
2092
2093 .. _bgp-route-reflector:
2094
2095 Route Reflector
2096 ===============
2097
2098 .. note:: This documentation is woefully incomplete.
2099
2100 .. index:: bgp cluster-id A.B.C.D
2101 .. clicmd:: bgp cluster-id A.B.C.D
2102
2103 .. index:: neighbor PEER route-reflector-client
2104 .. clicmd:: neighbor PEER route-reflector-client
2105
2106 .. index:: no neighbor PEER route-reflector-client
2107 .. clicmd:: no neighbor PEER route-reflector-client
2108
2109
2110 .. _routing-policy:
2111
2112 Routing Policy
2113 ==============
2114
2115 You can set different routing policy for a peer. For example, you can set
2116 different filter for a peer.
2117
2118 .. code-block:: frr
2119
2120 bgp multiple-instance
2121 !
2122 router bgp 1 view 1
2123 neighbor 10.0.0.1 remote-as 2
2124 address-family ipv4 unicast
2125 neighbor 10.0.0.1 distribute-list 1 in
2126 exit-address-family
2127 !
2128 router bgp 1 view 2
2129 neighbor 10.0.0.1 remote-as 2
2130 address-family ipv4 unicast
2131 neighbor 10.0.0.1 distribute-list 2 in
2132 exit-address-family
2133
2134 This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2.
2135 When the update is inserted into view 1, distribute-list 1 is applied. On the
2136 other hand, when the update is inserted into view 2, distribute-list 2 is
2137 applied.
2138
2139
2140 .. _bgp-regular-expressions:
2141
2142 BGP Regular Expressions
2143 =======================
2144
2145 BGP regular expressions are based on :t:`POSIX 1003.2` regular expressions. The
2146 following description is just a quick subset of the POSIX regular expressions.
2147
2148
2149 .\*
2150 Matches any single character.
2151
2152 \*
2153 Matches 0 or more occurrences of pattern.
2154
2155 \+
2156 Matches 1 or more occurrences of pattern.
2157
2158 ?
2159 Match 0 or 1 occurrences of pattern.
2160
2161 ^
2162 Matches the beginning of the line.
2163
2164 $
2165 Matches the end of the line.
2166
2167 _
2168 The ``_`` character has special meanings in BGP regular expressions. It
2169 matches to space and comma , and AS set delimiter ``{`` and ``}`` and AS
2170 confederation delimiter ``(`` and ``)``. And it also matches to the
2171 beginning of the line and the end of the line. So ``_`` can be used for AS
2172 value boundaries match. This character technically evaluates to
2173 ``(^|[,{}()]|$)``.
2174
2175
2176 .. _bgp-configuration-examples:
2177
2178 Miscellaneous Configuration Examples
2179 ====================================
2180
2181 Example of a session to an upstream, advertising only one prefix to it.
2182
2183 .. code-block:: frr
2184
2185 router bgp 64512
2186 bgp router-id 10.236.87.1
2187 neighbor upstream peer-group
2188 neighbor upstream remote-as 64515
2189 neighbor upstream capability dynamic
2190 neighbor 10.1.1.1 peer-group upstream
2191 neighbor 10.1.1.1 description ACME ISP
2192
2193 address-family ipv4 unicast
2194 network 10.236.87.0/24
2195 neighbor upstream prefix-list pl-allowed-adv out
2196 exit-address-family
2197 !
2198 ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
2199 ip prefix-list pl-allowed-adv seq 10 deny any
2200
2201 A more complex example including upstream, peer and customer sessions
2202 advertising global prefixes and NO_EXPORT prefixes and providing actions for
2203 customer routes based on community values. Extensive use is made of route-maps
2204 and the 'call' feature to support selective advertising of prefixes. This
2205 example is intended as guidance only, it has NOT been tested and almost
2206 certainly contains silly mistakes, if not serious flaws.
2207
2208 .. code-block:: frr
2209
2210 router bgp 64512
2211 bgp router-id 10.236.87.1
2212 neighbor upstream capability dynamic
2213 neighbor cust capability dynamic
2214 neighbor peer capability dynamic
2215 neighbor 10.1.1.1 remote-as 64515
2216 neighbor 10.1.1.1 peer-group upstream
2217 neighbor 10.2.1.1 remote-as 64516
2218 neighbor 10.2.1.1 peer-group upstream
2219 neighbor 10.3.1.1 remote-as 64517
2220 neighbor 10.3.1.1 peer-group cust-default
2221 neighbor 10.3.1.1 description customer1
2222 neighbor 10.4.1.1 remote-as 64518
2223 neighbor 10.4.1.1 peer-group cust
2224 neighbor 10.4.1.1 description customer2
2225 neighbor 10.5.1.1 remote-as 64519
2226 neighbor 10.5.1.1 peer-group peer
2227 neighbor 10.5.1.1 description peer AS 1
2228 neighbor 10.6.1.1 remote-as 64520
2229 neighbor 10.6.1.1 peer-group peer
2230 neighbor 10.6.1.1 description peer AS 2
2231
2232 address-family ipv4 unicast
2233 network 10.123.456.0/24
2234 network 10.123.456.128/25 route-map rm-no-export
2235 neighbor upstream route-map rm-upstream-out out
2236 neighbor cust route-map rm-cust-in in
2237 neighbor cust route-map rm-cust-out out
2238 neighbor cust send-community both
2239 neighbor peer route-map rm-peer-in in
2240 neighbor peer route-map rm-peer-out out
2241 neighbor peer send-community both
2242 neighbor 10.3.1.1 prefix-list pl-cust1-network in
2243 neighbor 10.4.1.1 prefix-list pl-cust2-network in
2244 neighbor 10.5.1.1 prefix-list pl-peer1-network in
2245 neighbor 10.6.1.1 prefix-list pl-peer2-network in
2246 exit-address-family
2247 !
2248 ip prefix-list pl-default permit 0.0.0.0/0
2249 !
2250 ip prefix-list pl-upstream-peers permit 10.1.1.1/32
2251 ip prefix-list pl-upstream-peers permit 10.2.1.1/32
2252 !
2253 ip prefix-list pl-cust1-network permit 10.3.1.0/24
2254 ip prefix-list pl-cust1-network permit 10.3.2.0/24
2255 !
2256 ip prefix-list pl-cust2-network permit 10.4.1.0/24
2257 !
2258 ip prefix-list pl-peer1-network permit 10.5.1.0/24
2259 ip prefix-list pl-peer1-network permit 10.5.2.0/24
2260 ip prefix-list pl-peer1-network permit 192.168.0.0/24
2261 !
2262 ip prefix-list pl-peer2-network permit 10.6.1.0/24
2263 ip prefix-list pl-peer2-network permit 10.6.2.0/24
2264 ip prefix-list pl-peer2-network permit 192.168.1.0/24
2265 ip prefix-list pl-peer2-network permit 192.168.2.0/24
2266 ip prefix-list pl-peer2-network permit 172.16.1/24
2267 !
2268 ip as-path access-list asp-own-as permit ^$
2269 ip as-path access-list asp-own-as permit _64512_
2270 !
2271 ! #################################################################
2272 ! Match communities we provide actions for, on routes receives from
2273 ! customers. Communities values of <our-ASN>:X, with X, have actions:
2274 !
2275 ! 100 - blackhole the prefix
2276 ! 200 - set no_export
2277 ! 300 - advertise only to other customers
2278 ! 400 - advertise only to upstreams
2279 ! 500 - set no_export when advertising to upstreams
2280 ! 2X00 - set local_preference to X00
2281 !
2282 ! blackhole the prefix of the route
2283 ip community-list standard cm-blackhole permit 64512:100
2284 !
2285 ! set no-export community before advertising
2286 ip community-list standard cm-set-no-export permit 64512:200
2287 !
2288 ! advertise only to other customers
2289 ip community-list standard cm-cust-only permit 64512:300
2290 !
2291 ! advertise only to upstreams
2292 ip community-list standard cm-upstream-only permit 64512:400
2293 !
2294 ! advertise to upstreams with no-export
2295 ip community-list standard cm-upstream-noexport permit 64512:500
2296 !
2297 ! set local-pref to least significant 3 digits of the community
2298 ip community-list standard cm-prefmod-100 permit 64512:2100
2299 ip community-list standard cm-prefmod-200 permit 64512:2200
2300 ip community-list standard cm-prefmod-300 permit 64512:2300
2301 ip community-list standard cm-prefmod-400 permit 64512:2400
2302 ip community-list expanded cme-prefmod-range permit 64512:2...
2303 !
2304 ! Informational communities
2305 !
2306 ! 3000 - learned from upstream
2307 ! 3100 - learned from customer
2308 ! 3200 - learned from peer
2309 !
2310 ip community-list standard cm-learnt-upstream permit 64512:3000
2311 ip community-list standard cm-learnt-cust permit 64512:3100
2312 ip community-list standard cm-learnt-peer permit 64512:3200
2313 !
2314 ! ###################################################################
2315 ! Utility route-maps
2316 !
2317 ! These utility route-maps generally should not used to permit/deny
2318 ! routes, i.e. they do not have meaning as filters, and hence probably
2319 ! should be used with 'on-match next'. These all finish with an empty
2320 ! permit entry so as not interfere with processing in the caller.
2321 !
2322 route-map rm-no-export permit 10
2323 set community additive no-export
2324 route-map rm-no-export permit 20
2325 !
2326 route-map rm-blackhole permit 10
2327 description blackhole, up-pref and ensure it cant escape this AS
2328 set ip next-hop 127.0.0.1
2329 set local-preference 10
2330 set community additive no-export
2331 route-map rm-blackhole permit 20
2332 !
2333 ! Set local-pref as requested
2334 route-map rm-prefmod permit 10
2335 match community cm-prefmod-100
2336 set local-preference 100
2337 route-map rm-prefmod permit 20
2338 match community cm-prefmod-200
2339 set local-preference 200
2340 route-map rm-prefmod permit 30
2341 match community cm-prefmod-300
2342 set local-preference 300
2343 route-map rm-prefmod permit 40
2344 match community cm-prefmod-400
2345 set local-preference 400
2346 route-map rm-prefmod permit 50
2347 !
2348 ! Community actions to take on receipt of route.
2349 route-map rm-community-in permit 10
2350 description check for blackholing, no point continuing if it matches.
2351 match community cm-blackhole
2352 call rm-blackhole
2353 route-map rm-community-in permit 20
2354 match community cm-set-no-export
2355 call rm-no-export
2356 on-match next
2357 route-map rm-community-in permit 30
2358 match community cme-prefmod-range
2359 call rm-prefmod
2360 route-map rm-community-in permit 40
2361 !
2362 ! #####################################################################
2363 ! Community actions to take when advertising a route.
2364 ! These are filtering route-maps,
2365 !
2366 ! Deny customer routes to upstream with cust-only set.
2367 route-map rm-community-filt-to-upstream deny 10
2368 match community cm-learnt-cust
2369 match community cm-cust-only
2370 route-map rm-community-filt-to-upstream permit 20
2371 !
2372 ! Deny customer routes to other customers with upstream-only set.
2373 route-map rm-community-filt-to-cust deny 10
2374 match community cm-learnt-cust
2375 match community cm-upstream-only
2376 route-map rm-community-filt-to-cust permit 20
2377 !
2378 ! ###################################################################
2379 ! The top-level route-maps applied to sessions. Further entries could
2380 ! be added obviously..
2381 !
2382 ! Customers
2383 route-map rm-cust-in permit 10
2384 call rm-community-in
2385 on-match next
2386 route-map rm-cust-in permit 20
2387 set community additive 64512:3100
2388 route-map rm-cust-in permit 30
2389 !
2390 route-map rm-cust-out permit 10
2391 call rm-community-filt-to-cust
2392 on-match next
2393 route-map rm-cust-out permit 20
2394 !
2395 ! Upstream transit ASes
2396 route-map rm-upstream-out permit 10
2397 description filter customer prefixes which are marked cust-only
2398 call rm-community-filt-to-upstream
2399 on-match next
2400 route-map rm-upstream-out permit 20
2401 description only customer routes are provided to upstreams/peers
2402 match community cm-learnt-cust
2403 !
2404 ! Peer ASes
2405 ! outbound policy is same as for upstream
2406 route-map rm-peer-out permit 10
2407 call rm-upstream-out
2408 !
2409 route-map rm-peer-in permit 10
2410 set community additive 64512:3200
2411
2412
2413 Example of how to set up a 6-Bone connection.
2414
2415 .. code-block:: frr
2416
2417 ! bgpd configuration
2418 ! ==================
2419 !
2420 ! MP-BGP configuration
2421 !
2422 router bgp 7675
2423 bgp router-id 10.0.0.1
2424 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number`
2425 !
2426 address-family ipv6
2427 network 3ffe:506::/32
2428 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate
2429 neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
2430 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number`
2431 neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
2432 exit-address-family
2433 !
2434 ipv6 access-list all permit any
2435 !
2436 ! Set output nexthop address.
2437 !
2438 route-map set-nexthop permit 10
2439 match ipv6 address all
2440 set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
2441 set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
2442 !
2443 log file bgpd.log
2444 !
2445
2446
2447 .. include:: routeserver.rst
2448
2449 .. include:: rpki.rst
2450
2451 .. include:: flowspec.rst
2452
2453 .. [#med-transitivity-rant] For some set of objects to have an order, there *must* be some binary ordering relation that is defined for *every* combination of those objects, and that relation *must* be transitive. I.e.:, if the relation operator is <, and if a < b and b < c then that relation must carry over and it *must* be that a < c for the objects to have an order. The ordering relation may allow for equality, i.e. a < b and b < a may both be true and imply that a and b are equal in the order and not distinguished by it, in which case the set has a partial order. Otherwise, if there is an order, all the objects have a distinct place in the order and the set has a total order)
2454 .. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
2455 .. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
2456 .. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002