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