]>
Commit | Line | Data |
---|---|---|
0efdf0fe | 1 | .. _bgp: |
42fc5d26 QY |
2 | |
3 | *** | |
4 | BGP | |
5 | *** | |
6 | ||
8fcedbd2 | 7 | :abbr:`BGP` stands for Border Gateway Protocol. The latest BGP version is 4. |
d1e7591e | 8 | BGP-4 is one of the Exterior Gateway Protocols and the de facto standard |
8fcedbd2 QY |
9 | interdomain routing protocol. BGP-4 is described in :rfc:`1771` and updated by |
10 | :rfc:`4271`. :rfc:`2858` adds multiprotocol support to BGP-4. | |
42fc5d26 | 11 | |
0efdf0fe | 12 | .. _starting-bgp: |
42fc5d26 QY |
13 | |
14 | Starting BGP | |
15 | ============ | |
16 | ||
8fcedbd2 QY |
17 | The default configuration file of *bgpd* is :file:`bgpd.conf`. *bgpd* searches |
18 | the current directory first, followed by |INSTALL_PREFIX_ETC|/bgpd.conf. All of | |
19 | *bgpd*'s commands must be configured in :file:`bgpd.conf` when the integrated | |
20 | config is not being used. | |
42fc5d26 | 21 | |
c1a54c05 | 22 | *bgpd* specific invocation options are described below. Common options may also |
0efdf0fe | 23 | be 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 | |
d1aed873 | 34 | Specify specific IP addresses for bgpd to listen on, rather than its default |
c0868e8b | 35 | of ``0.0.0.0`` / ``::``. This can be useful to constrain bgpd to an internal |
d1aed873 AMR |
36 | address, or to run multiple bgpd processes on one host. Multiple addresses |
37 | can be specified. | |
38 | ||
39 | In the following example, bgpd is started listening for connections on the | |
40 | addresses 100.0.1.2 and fd00::2:2. The options -d (runs in daemon mode) and | |
41 | -f (uses specific configuration file) are also used in this example as we | |
42 | are likely to run multiple bgpd instances, each one with different | |
43 | configurations, when using -l option. | |
42fc5d26 | 44 | |
c17537f9 MBG |
45 | Note that this option implies the --no_kernel option, and no learned routes will be installed into the linux kernel. |
46 | ||
d1aed873 AMR |
47 | .. code-block:: shell |
48 | ||
49 | # /usr/lib/frr/bgpd -d -f /some-folder/bgpd.conf -l 100.0.1.2 -l fd00::2:2 | |
50 | ||
11a9a236 DS |
51 | .. option:: -n, --no_kernel |
52 | ||
53 | Do not install learned routes into the linux kernel. This option is useful | |
54 | for a route-reflector environment or if you are running multiple bgp | |
55 | processes in the same namespace. This option is different than the --no_zebra | |
56 | option in that a ZAPI connection is made. | |
57 | ||
8dad2243 DS |
58 | This option can also be toggled during runtime by using the |
59 | ``[no] bgp no-rib`` commands in VTY shell. | |
60 | ||
61 | Note that this option will persist after saving the configuration during | |
62 | runtime, unless unset by the ``no bgp no-rib`` command in VTY shell prior to | |
63 | a configuration write operation. | |
64 | ||
11a9a236 DS |
65 | .. option:: -S, --skip_runas |
66 | ||
67 | Skip the normal process of checking capabilities and changing user and group | |
68 | information. | |
69 | ||
70 | .. option:: -e, --ecmp | |
71 | ||
72 | Run BGP with a limited ecmp capability, that is different than what BGP | |
73 | was compiled with. The value specified must be greater than 0 and less | |
74 | than or equal to the MULTIPATH_NUM specified on compilation. | |
75 | ||
76 | .. option:: -Z, --no_zebra | |
77 | ||
78 | Do not communicate with zebra at all. This is different than the --no_kernel | |
79 | option in that we do not even open a ZAPI connection to the zebra process. | |
80 | ||
81 | .. option:: -s, --socket_size | |
82 | ||
83 | When opening tcp connections to our peers, set the socket send buffer | |
84 | size that the kernel will use for the peers socket. This option | |
85 | is only really useful at a very large scale. Experimentation should | |
86 | be done to see if this is helping or not at the scale you are running | |
87 | at. | |
88 | ||
89 | LABEL MANAGER | |
90 | ------------- | |
91 | ||
92 | .. option:: -I, --int_num | |
93 | ||
94 | Set zclient id. This is required when using Zebra label manager in proxy mode. | |
95 | ||
8fcedbd2 | 96 | .. _bgp-basic-concepts: |
42fc5d26 | 97 | |
8fcedbd2 QY |
98 | Basic Concepts |
99 | ============== | |
42fc5d26 | 100 | |
8fcedbd2 | 101 | .. _bgp-autonomous-systems: |
c3c5a71f | 102 | |
8fcedbd2 QY |
103 | Autonomous Systems |
104 | ------------------ | |
42fc5d26 | 105 | |
c0868e8b QY |
106 | From :rfc:`1930`: |
107 | ||
108 | An AS is a connected group of one or more IP prefixes run by one or more | |
109 | network operators which has a SINGLE and CLEARLY DEFINED routing policy. | |
110 | ||
111 | Each AS has an identifying number associated with it called an :abbr:`ASN | |
112 | (Autonomous System Number)`. This is a two octet value ranging in value from 1 | |
113 | to 65535. The AS numbers 64512 through 65535 are defined as private AS numbers. | |
114 | Private AS numbers must not be advertised on the global Internet. | |
115 | ||
116 | The :abbr:`ASN (Autonomous System Number)` is one of the essential elements of | |
8fcedbd2 | 117 | BGP. BGP is a distance vector routing protocol, and the AS-Path framework |
c0868e8b | 118 | provides distance vector metric and loop detection to BGP. |
42fc5d26 | 119 | |
c0868e8b | 120 | .. seealso:: :rfc:`1930` |
42fc5d26 | 121 | |
8fcedbd2 | 122 | .. _bgp-address-families: |
42fc5d26 | 123 | |
8fcedbd2 QY |
124 | Address Families |
125 | ---------------- | |
42fc5d26 | 126 | |
c0868e8b QY |
127 | Multiprotocol extensions enable BGP to carry routing information for multiple |
128 | network layer protocols. BGP supports an Address Family Identifier (AFI) for | |
129 | IPv4 and IPv6. Support is also provided for multiple sets of per-AFI | |
130 | information via the BGP Subsequent Address Family Identifier (SAFI). FRR | |
131 | supports SAFIs for unicast information, labeled information (:rfc:`3107` and | |
132 | :rfc:`8277`), and Layer 3 VPN information (:rfc:`4364` and :rfc:`4659`). | |
c3c5a71f | 133 | |
8fcedbd2 | 134 | .. _bgp-route-selection: |
42fc5d26 | 135 | |
8fcedbd2 QY |
136 | Route Selection |
137 | --------------- | |
42fc5d26 | 138 | |
8fcedbd2 QY |
139 | The route selection process used by FRR's BGP implementation uses the following |
140 | decision criterion, starting at the top of the list and going towards the | |
141 | bottom until one of the factors can be used. | |
42fc5d26 | 142 | |
8fcedbd2 | 143 | 1. **Weight check** |
42fc5d26 | 144 | |
c1a54c05 | 145 | Prefer higher local weight routes to lower routes. |
42fc5d26 | 146 | |
8fcedbd2 QY |
147 | 2. **Local preference check** |
148 | ||
c1a54c05 | 149 | Prefer higher local preference routes to lower. |
42fc5d26 | 150 | |
8fcedbd2 QY |
151 | 3. **Local route check** |
152 | ||
c1a54c05 | 153 | Prefer local routes (statics, aggregates, redistributed) to received routes. |
42fc5d26 | 154 | |
8fcedbd2 QY |
155 | 4. **AS path length check** |
156 | ||
c1a54c05 | 157 | Prefer shortest hop-count AS_PATHs. |
42fc5d26 | 158 | |
8fcedbd2 QY |
159 | 5. **Origin check** |
160 | ||
c1a54c05 QY |
161 | Prefer the lowest origin type route. That is, prefer IGP origin routes to |
162 | EGP, to Incomplete routes. | |
42fc5d26 | 163 | |
8fcedbd2 QY |
164 | 6. **MED check** |
165 | ||
c1a54c05 | 166 | Where routes with a MED were received from the same AS, prefer the route |
0efdf0fe | 167 | with the lowest MED. :ref:`bgp-med`. |
42fc5d26 | 168 | |
8fcedbd2 QY |
169 | 7. **External check** |
170 | ||
c1a54c05 QY |
171 | Prefer the route received from an external, eBGP peer over routes received |
172 | from other types of peers. | |
42fc5d26 | 173 | |
8fcedbd2 QY |
174 | 8. **IGP cost check** |
175 | ||
c1a54c05 | 176 | Prefer the route with the lower IGP cost. |
42fc5d26 | 177 | |
8fcedbd2 QY |
178 | 9. **Multi-path check** |
179 | ||
c1a54c05 QY |
180 | If multi-pathing is enabled, then check whether the routes not yet |
181 | distinguished in preference may be considered equal. If | |
9e146a81 | 182 | :clicmd:`bgp bestpath as-path multipath-relax` is set, all such routes are |
c1a54c05 QY |
183 | considered equal, otherwise routes received via iBGP with identical AS_PATHs |
184 | or routes received from eBGP neighbours in the same AS are considered equal. | |
42fc5d26 | 185 | |
8fcedbd2 QY |
186 | 10. **Already-selected external check** |
187 | ||
07738543 QY |
188 | Where both routes were received from eBGP peers, then prefer the route |
189 | which is already selected. Note that this check is not applied if | |
190 | :clicmd:`bgp bestpath compare-routerid` is configured. This check can | |
191 | prevent some cases of oscillation. | |
192 | ||
8fcedbd2 QY |
193 | 11. **Router-ID check** |
194 | ||
07738543 QY |
195 | Prefer the route with the lowest `router-ID`. If the route has an |
196 | `ORIGINATOR_ID` attribute, through iBGP reflection, then that router ID is | |
197 | used, otherwise the `router-ID` of the peer the route was received from is | |
198 | used. | |
199 | ||
8fcedbd2 QY |
200 | 12. **Cluster-List length check** |
201 | ||
07738543 QY |
202 | The route with the shortest cluster-list length is used. The cluster-list |
203 | reflects the iBGP reflection path the route has taken. | |
204 | ||
8fcedbd2 QY |
205 | 13. **Peer address** |
206 | ||
07738543 QY |
207 | Prefer the route received from the peer with the higher transport layer |
208 | address, as a last-resort tie-breaker. | |
42fc5d26 | 209 | |
8fcedbd2 QY |
210 | .. _bgp-capability-negotiation: |
211 | ||
212 | Capability Negotiation | |
213 | ---------------------- | |
214 | ||
215 | When adding IPv6 routing information exchange feature to BGP. There were some | |
216 | proposals. :abbr:`IETF (Internet Engineering Task Force)` | |
217 | :abbr:`IDR (Inter Domain Routing)` adopted a proposal called Multiprotocol | |
218 | Extension for BGP. The specification is described in :rfc:`2283`. The protocol | |
219 | does not define new protocols. It defines new attributes to existing BGP. When | |
220 | it is used exchanging IPv6 routing information it is called BGP-4+. When it is | |
221 | used for exchanging multicast routing information it is called MBGP. | |
222 | ||
223 | *bgpd* supports Multiprotocol Extension for BGP. So if a remote peer supports | |
224 | the protocol, *bgpd* can exchange IPv6 and/or multicast routing information. | |
225 | ||
226 | Traditional BGP did not have the feature to detect a remote peer's | |
227 | capabilities, e.g. whether it can handle prefix types other than IPv4 unicast | |
228 | routes. This was a big problem using Multiprotocol Extension for BGP in an | |
229 | operational network. :rfc:`2842` adopted a feature called Capability | |
230 | Negotiation. *bgpd* use this Capability Negotiation to detect the remote peer's | |
231 | capabilities. If a peer is only configured as an IPv4 unicast neighbor, *bgpd* | |
232 | does not send these Capability Negotiation packets (at least not unless other | |
233 | optional BGP features require capability negotiation). | |
234 | ||
235 | By default, FRR will bring up peering with minimal common capability for the | |
236 | both sides. For example, if the local router has unicast and multicast | |
237 | capabilities and the remote router only has unicast capability the local router | |
238 | will establish the connection with unicast only capability. When there are no | |
239 | common capabilities, FRR sends Unsupported Capability error and then resets the | |
240 | connection. | |
241 | ||
8fcedbd2 QY |
242 | .. _bgp-router-configuration: |
243 | ||
244 | BGP Router Configuration | |
245 | ======================== | |
246 | ||
247 | ASN and Router ID | |
248 | ----------------- | |
249 | ||
250 | First of all you must configure BGP router with the :clicmd:`router bgp ASN` | |
251 | command. The AS number is an identifier for the autonomous system. The BGP | |
252 | protocol uses the AS number for detecting whether the BGP connection is | |
253 | internal or external. | |
254 | ||
8fcedbd2 QY |
255 | .. clicmd:: router bgp ASN |
256 | ||
257 | Enable a BGP protocol process with the specified ASN. After | |
258 | this statement you can input any `BGP Commands`. | |
259 | ||
8fcedbd2 QY |
260 | .. clicmd:: bgp router-id A.B.C.D |
261 | ||
262 | This command specifies the router-ID. If *bgpd* connects to *zebra* it gets | |
263 | interface and address information. In that case default router ID value is | |
264 | selected as the largest IP Address of the interfaces. When `router zebra` is | |
265 | not enabled *bgpd* can't get interface information so `router-id` is set to | |
266 | 0.0.0.0. So please set router-id by hand. | |
267 | ||
c8a5e5e1 QY |
268 | |
269 | .. _bgp-multiple-autonomous-systems: | |
270 | ||
271 | Multiple Autonomous Systems | |
272 | --------------------------- | |
273 | ||
274 | FRR's BGP implementation is capable of running multiple autonomous systems at | |
275 | once. Each configured AS corresponds to a :ref:`zebra-vrf`. In the past, to get | |
276 | the same functionality the network administrator had to run a new *bgpd* | |
277 | process; using VRFs allows multiple autonomous systems to be handled in a | |
278 | single process. | |
279 | ||
280 | When using multiple autonomous systems, all router config blocks after the | |
281 | first one must specify a VRF to be the target of BGP's route selection. This | |
282 | VRF must be unique within respect to all other VRFs being used for the same | |
283 | purpose, i.e. two different autonomous systems cannot use the same VRF. | |
284 | However, the same AS can be used with different VRFs. | |
285 | ||
286 | .. note:: | |
287 | ||
288 | The separated nature of VRFs makes it possible to peer a single *bgpd* | |
edde3ce9 QY |
289 | process to itself, on one machine. Note that this can be done fully within |
290 | BGP without a corresponding VRF in the kernel or Zebra, which enables some | |
291 | practical use cases such as :ref:`route reflectors <bgp-route-reflector>` | |
292 | and route servers. | |
c8a5e5e1 QY |
293 | |
294 | Configuration of additional autonomous systems, or of a router that targets a | |
295 | specific VRF, is accomplished with the following command: | |
296 | ||
c8a5e5e1 QY |
297 | .. clicmd:: router bgp ASN vrf VRFNAME |
298 | ||
299 | ``VRFNAME`` is matched against VRFs configured in the kernel. When ``vrf | |
300 | VRFNAME`` is not specified, the BGP protocol process belongs to the default | |
301 | VRF. | |
302 | ||
303 | An example configuration with multiple autonomous systems might look like this: | |
304 | ||
305 | .. code-block:: frr | |
306 | ||
307 | router bgp 1 | |
308 | neighbor 10.0.0.1 remote-as 20 | |
309 | neighbor 10.0.0.2 remote-as 30 | |
310 | ! | |
311 | router bgp 2 vrf blue | |
312 | neighbor 10.0.0.3 remote-as 40 | |
313 | neighbor 10.0.0.4 remote-as 50 | |
314 | ! | |
315 | router bgp 3 vrf red | |
316 | neighbor 10.0.0.5 remote-as 60 | |
317 | neighbor 10.0.0.6 remote-as 70 | |
318 | ... | |
319 | ||
c8a5e5e1 QY |
320 | .. seealso:: :ref:`bgp-vrf-route-leaking` |
321 | .. seealso:: :ref:`zebra-vrf` | |
322 | ||
323 | ||
324 | .. _bgp-views: | |
325 | ||
326 | Views | |
327 | ----- | |
328 | ||
329 | In addition to supporting multiple autonomous systems, FRR's BGP implementation | |
330 | also supports *views*. | |
331 | ||
332 | BGP views are almost the same as normal BGP processes, except that routes | |
195c7461 QY |
333 | selected by BGP are not installed into the kernel routing table. Each BGP view |
334 | provides an independent set of routing information which is only distributed | |
335 | via BGP. Multiple views can be supported, and BGP view information is always | |
336 | independent from other routing protocols and Zebra/kernel routes. BGP views use | |
337 | the core instance (i.e., default VRF) for communication with peers. | |
edde3ce9 | 338 | |
c8a5e5e1 QY |
339 | .. clicmd:: router bgp AS-NUMBER view NAME |
340 | ||
341 | Make a new BGP view. You can use an arbitrary word for the ``NAME``. Routes | |
342 | selected by the view are not installed into the kernel routing table. | |
343 | ||
344 | With this command, you can setup Route Server like below. | |
345 | ||
346 | .. code-block:: frr | |
347 | ||
348 | ! | |
349 | router bgp 1 view 1 | |
350 | neighbor 10.0.0.1 remote-as 2 | |
351 | neighbor 10.0.0.2 remote-as 3 | |
352 | ! | |
353 | router bgp 2 view 2 | |
354 | neighbor 10.0.0.3 remote-as 4 | |
355 | neighbor 10.0.0.4 remote-as 5 | |
356 | ||
c8a5e5e1 QY |
357 | .. clicmd:: show [ip] bgp view NAME |
358 | ||
359 | Display the routing table of BGP view ``NAME``. | |
360 | ||
361 | ||
8fcedbd2 QY |
362 | Route Selection |
363 | --------------- | |
c3c5a71f | 364 | |
29adcd50 | 365 | .. clicmd:: bgp bestpath as-path confed |
42fc5d26 | 366 | |
c1a54c05 QY |
367 | This command specifies that the length of confederation path sets and |
368 | sequences should should be taken into account during the BGP best path | |
369 | decision process. | |
42fc5d26 | 370 | |
29adcd50 | 371 | .. clicmd:: bgp bestpath as-path multipath-relax |
42fc5d26 | 372 | |
c1a54c05 QY |
373 | This command specifies that BGP decision process should consider paths |
374 | of equal AS_PATH length candidates for multipath computation. Without | |
375 | the knob, the entire AS_PATH must match for multipath computation. | |
c3c5a71f | 376 | |
29adcd50 | 377 | .. clicmd:: bgp bestpath compare-routerid |
42fc5d26 | 378 | |
c1a54c05 QY |
379 | Ensure that when comparing routes where both are equal on most metrics, |
380 | including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken | |
381 | based on router-ID. | |
42fc5d26 | 382 | |
c1a54c05 QY |
383 | If this option is enabled, then the already-selected check, where |
384 | already selected eBGP routes are preferred, is skipped. | |
42fc5d26 | 385 | |
c1a54c05 QY |
386 | If a route has an `ORIGINATOR_ID` attribute because it has been reflected, |
387 | that `ORIGINATOR_ID` will be used. Otherwise, the router-ID of the peer the | |
388 | route was received from will be used. | |
42fc5d26 | 389 | |
c1a54c05 QY |
390 | The advantage of this is that the route-selection (at this point) will be |
391 | more deterministic. The disadvantage is that a few or even one lowest-ID | |
d1e7591e | 392 | router may attract all traffic to otherwise-equal paths because of this |
c1a54c05 QY |
393 | check. It may increase the possibility of MED or IGP oscillation, unless |
394 | other measures were taken to avoid these. The exact behaviour will be | |
395 | sensitive to the iBGP and reflection topology. | |
42fc5d26 | 396 | |
ee88563a JM |
397 | .. clicmd:: bgp bestpath peer-type multipath-relax |
398 | ||
399 | This command specifies that BGP decision process should consider paths | |
400 | from all peers for multipath computation. If this option is enabled, | |
401 | paths learned from any of eBGP, iBGP, or confederation neighbors will | |
402 | be multipath if they are otherwise considered equal cost. | |
403 | ||
4a09f22f DS |
404 | .. clicmd:: maximum-paths (1-128) |
405 | ||
406 | Sets the maximum-paths value used for ecmp calculations for this | |
407 | bgp instance in EBGP. The maximum value listed, 128, can be limited by | |
408 | the ecmp cli for bgp or if the daemon was compiled with a lower | |
409 | ecmp value. This value can also be set in ipv4/ipv6 unicast/labeled | |
410 | unicast to only affect those particular afi/safi's. | |
411 | ||
412 | .. clicmd:: maximum-paths ibgp (1-128) [equal-cluster-length] | |
413 | ||
414 | Sets the maximum-paths value used for ecmp calculations for this | |
415 | bgp instance in IBGP. The maximum value listed, 128, can be limited by | |
416 | the ecmp cli for bgp or if the daemon was compiled with a lower | |
417 | ecmp value. This value can also be set in ipv4/ipv6 unicast/labeled | |
418 | unicast to only affect those particular afi/safi's. | |
419 | ||
8fcedbd2 QY |
420 | .. _bgp-distance: |
421 | ||
422 | Administrative Distance Metrics | |
423 | ------------------------------- | |
424 | ||
8fcedbd2 QY |
425 | .. clicmd:: distance bgp (1-255) (1-255) (1-255) |
426 | ||
427 | This command change distance value of BGP. The arguments are the distance | |
428 | values for for external routes, internal routes and local routes | |
429 | respectively. | |
430 | ||
8fcedbd2 QY |
431 | .. clicmd:: distance (1-255) A.B.C.D/M |
432 | ||
8fcedbd2 QY |
433 | .. clicmd:: distance (1-255) A.B.C.D/M WORD |
434 | ||
435 | Sets the administrative distance for a particular route. | |
42fc5d26 | 436 | |
713c64dd DA |
437 | .. _bgp-requires-policy: |
438 | ||
439 | Require policy on EBGP | |
440 | ------------------------------- | |
441 | ||
03750f1e | 442 | .. clicmd:: bgp ebgp-requires-policy |
713c64dd | 443 | |
8955d9e5 | 444 | This command requires incoming and outgoing filters to be applied |
b56f274a DS |
445 | for eBGP sessions as part of RFC-8212 compliance. Without the incoming |
446 | filter, no routes will be accepted. Without the outgoing filter, no | |
447 | routes will be announced. | |
8955d9e5 | 448 | |
b56f274a DS |
449 | This is enabled by default for the traditional configuration and |
450 | turned off by default for datacenter configuration. | |
713c64dd | 451 | |
b3cbe765 DA |
452 | When you enable/disable this option you MUST clear the session. |
453 | ||
62c42b0e DA |
454 | When the incoming or outgoing filter is missing you will see |
455 | "(Policy)" sign under ``show bgp summary``: | |
456 | ||
457 | .. code-block:: frr | |
458 | ||
459 | exit1# show bgp summary | |
460 | ||
6cac2fcc | 461 | IPv4 Unicast Summary (VRF default): |
62c42b0e DA |
462 | BGP router identifier 10.10.10.1, local AS number 65001 vrf-id 0 |
463 | BGP table version 4 | |
464 | RIB entries 7, using 1344 bytes of memory | |
465 | Peers 2, using 43 KiB of memory | |
466 | ||
467 | Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt | |
468 | 192.168.0.2 4 65002 8 10 0 0 0 00:03:09 5 (Policy) | |
469 | fe80:1::2222 4 65002 9 11 0 0 0 00:03:09 (Policy) (Policy) | |
470 | ||
b56f274a DS |
471 | Additionally a `show bgp neighbor` command would indicate in the `For address family:` |
472 | block that: | |
473 | ||
474 | .. code-block:: frr | |
475 | ||
476 | exit1# show bgp neighbor | |
477 | ... | |
478 | For address family: IPv4 Unicast | |
479 | Update group 1, subgroup 1 | |
480 | Packet Queue length 0 | |
481 | Inbound soft reconfiguration allowed | |
482 | Community attribute sent to this neighbor(all) | |
483 | Inbound updates discarded due to missing policy | |
484 | Outbound updates discarded due to missing policy | |
485 | 0 accepted prefixes | |
486 | ||
f0c81afe | 487 | Reject routes with AS_SET or AS_CONFED_SET types |
5031d886 | 488 | ------------------------------------------------ |
f0c81afe | 489 | |
03750f1e | 490 | .. clicmd:: bgp reject-as-sets |
f0c81afe DA |
491 | |
492 | This command enables rejection of incoming and outgoing routes having AS_SET or AS_CONFED_SET type. | |
493 | ||
105227af DA |
494 | Suppress duplicate updates |
495 | -------------------------- | |
496 | ||
03750f1e | 497 | .. clicmd:: bgp suppress-duplicates |
105227af DA |
498 | |
499 | For example, BGP routers can generate multiple identical announcements with | |
500 | empty community attributes if stripped at egress. This is an undesired behavior. | |
501 | Suppress duplicate updates if the route actually not changed. | |
502 | Default: enabled. | |
503 | ||
835e9c5d DA |
504 | Disable checking if nexthop is connected on EBGP sessions |
505 | --------------------------------------------------------- | |
506 | ||
03750f1e | 507 | .. clicmd:: bgp disable-ebgp-connected-route-check |
835e9c5d DA |
508 | |
509 | This command is used to disable the connection verification process for EBGP peering sessions | |
510 | that are reachable by a single hop but are configured on a loopback interface or otherwise | |
511 | configured with a non-directly connected IP address. | |
512 | ||
0efdf0fe | 513 | .. _bgp-route-flap-dampening: |
42fc5d26 | 514 | |
8fcedbd2 QY |
515 | Route Flap Dampening |
516 | -------------------- | |
42fc5d26 | 517 | |
03750f1e | 518 | .. clicmd:: bgp dampening [(1-45) [(1-20000) (1-20000) (1-255)]] |
c1a54c05 | 519 | |
54b34709 DS |
520 | This command enables (with optionally specified dampening parameters) or |
521 | disables route-flap dampening for all routes of a BGP instance. | |
522 | ||
03750f1e | 523 | .. clicmd:: neighbor PEER dampening [(1-45) [(1-20000) (1-20000) (1-255)]] |
54b34709 DS |
524 | |
525 | This command enables (with optionally specified dampening parameters) or | |
526 | disables route-flap dampening for all routes learned from a BGP peer. | |
527 | ||
03750f1e | 528 | .. clicmd:: neighbor GROUP dampening [(1-45) [(1-20000) (1-20000) (1-255)]] |
54b34709 DS |
529 | |
530 | This command enables (with optionally specified dampening parameters) or | |
531 | disables route-flap dampening for all routes learned from peers of a peer | |
532 | group. | |
42fc5d26 | 533 | |
c1a54c05 | 534 | half-life |
54b34709 | 535 | Half-life time for the penalty in minutes (default value: 15). |
42fc5d26 | 536 | |
c1a54c05 | 537 | reuse-threshold |
54b34709 | 538 | Value to start reusing a route (default value: 750). |
42fc5d26 | 539 | |
c1a54c05 | 540 | suppress-threshold |
54b34709 | 541 | Value to start suppressing a route (default value: 2000). |
42fc5d26 | 542 | |
c1a54c05 | 543 | max-suppress |
54b34709 DS |
544 | Maximum duration to suppress a stable route in minutes (default value: |
545 | 60). | |
42fc5d26 | 546 | |
c1a54c05 | 547 | The route-flap damping algorithm is compatible with :rfc:`2439`. The use of |
54b34709 | 548 | these commands is not recommended nowadays. |
42fc5d26 | 549 | |
319a7d06 DA |
550 | At the moment, route-flap dampening is not working per VRF and is working only |
551 | for IPv4 unicast and multicast. | |
552 | ||
54b34709 DS |
553 | With different parameter sets configurable for BGP instances, peer groups and |
554 | peers, the active dampening profile for a route is chosen on the fly, | |
555 | allowing for various changes in configuration (i.e. peer group memberships) | |
556 | during runtime. The parameter sets are taking precedence in the following | |
557 | order: | |
558 | ||
559 | 1. Peer | |
560 | 2. Peer group | |
561 | 3. BGP instance | |
562 | ||
563 | The negating commands do not allow to exclude a peer/peer group from a peer | |
564 | group/BGP instances configuration. | |
565 | ||
c1a54c05 | 566 | .. seealso:: |
8fcedbd2 | 567 | https://www.ripe.net/publications/docs/ripe-378 |
42fc5d26 | 568 | |
0efdf0fe | 569 | .. _bgp-med: |
42fc5d26 | 570 | |
8fcedbd2 QY |
571 | Multi-Exit Discriminator |
572 | ------------------------ | |
42fc5d26 | 573 | |
8fcedbd2 | 574 | The BGP :abbr:`MED (Multi-Exit Discriminator)` attribute has properties which |
c1a54c05 QY |
575 | can cause subtle convergence problems in BGP. These properties and problems |
576 | have proven to be hard to understand, at least historically, and may still not | |
577 | be widely understood. The following attempts to collect together and present | |
578 | what is known about MED, to help operators and FRR users in designing and | |
579 | configuring their networks. | |
42fc5d26 | 580 | |
07a17e6d QY |
581 | The BGP :abbr:`MED` attribute is intended to allow one AS to indicate its |
582 | preferences for its ingress points to another AS. The MED attribute will not be | |
583 | propagated on to another AS by the receiving AS - it is 'non-transitive' in the | |
584 | BGP sense. | |
42fc5d26 | 585 | |
c1a54c05 QY |
586 | E.g., if AS X and AS Y have 2 different BGP peering points, then AS X might set |
587 | a MED of 100 on routes advertised at one and a MED of 200 at the other. When AS | |
588 | Y selects between otherwise equal routes to or via AS X, AS Y should prefer to | |
589 | take the path via the lower MED peering of 100 with AS X. Setting the MED | |
590 | allows an AS to influence the routing taken to it within another, neighbouring | |
591 | AS. | |
42fc5d26 QY |
592 | |
593 | In this use of MED it is not really meaningful to compare the MED value on | |
c1a54c05 QY |
594 | routes where the next AS on the paths differs. E.g., if AS Y also had a route |
595 | for some destination via AS Z in addition to the routes from AS X, and AS Z had | |
596 | also set a MED, it wouldn't make sense for AS Y to compare AS Z's MED values to | |
597 | those of AS X. The MED values have been set by different administrators, with | |
598 | different frames of reference. | |
42fc5d26 QY |
599 | |
600 | The default behaviour of BGP therefore is to not compare MED values across | |
dc1046f7 | 601 | routes received from different neighbouring ASes. In FRR this is done by |
c1a54c05 QY |
602 | comparing the neighbouring, left-most AS in the received AS_PATHs of the routes |
603 | and only comparing MED if those are the same. | |
604 | ||
605 | Unfortunately, this behaviour of MED, of sometimes being compared across routes | |
606 | and sometimes not, depending on the properties of those other routes, means MED | |
607 | can cause the order of preference over all the routes to be undefined. That is, | |
608 | given routes A, B, and C, if A is preferred to B, and B is preferred to C, then | |
609 | a well-defined order should mean the preference is transitive (in the sense of | |
013f9762 | 610 | orders [#med-transitivity-rant]_) and that A would be preferred to C. |
42fc5d26 | 611 | |
c3c5a71f QY |
612 | However, when MED is involved this need not be the case. With MED it is |
613 | possible that C is actually preferred over A. So A is preferred to B, B is | |
614 | preferred to C, but C is preferred to A. This can be true even where BGP | |
c1a54c05 QY |
615 | defines a deterministic 'most preferred' route out of the full set of A,B,C. |
616 | With MED, for any given set of routes there may be a deterministically | |
617 | preferred route, but there need not be any way to arrange them into any order | |
618 | of preference. With unmodified MED, the order of preference of routes literally | |
619 | becomes undefined. | |
42fc5d26 | 620 | |
c3c5a71f | 621 | That MED can induce non-transitive preferences over routes can cause issues. |
c1a54c05 QY |
622 | Firstly, it may be perceived to cause routing table churn locally at speakers; |
623 | secondly, and more seriously, it may cause routing instability in iBGP | |
624 | topologies, where sets of speakers continually oscillate between different | |
625 | paths. | |
42fc5d26 | 626 | |
c3c5a71f | 627 | The first issue arises from how speakers often implement routing decisions. |
c1a54c05 QY |
628 | Though BGP defines a selection process that will deterministically select the |
629 | same route as best at any given speaker, even with MED, that process requires | |
630 | evaluating all routes together. For performance and ease of implementation | |
631 | reasons, many implementations evaluate route preferences in a pair-wise fashion | |
632 | instead. Given there is no well-defined order when MED is involved, the best | |
633 | route that will be chosen becomes subject to implementation details, such as | |
634 | the order the routes are stored in. That may be (locally) non-deterministic, | |
635 | e.g.: it may be the order the routes were received in. | |
42fc5d26 QY |
636 | |
637 | This indeterminism may be considered undesirable, though it need not cause | |
c1a54c05 QY |
638 | problems. It may mean additional routing churn is perceived, as sometimes more |
639 | updates may be produced than at other times in reaction to some event . | |
42fc5d26 QY |
640 | |
641 | This first issue can be fixed with a more deterministic route selection that | |
c3c5a71f | 642 | ensures routes are ordered by the neighbouring AS during selection. |
9e146a81 | 643 | :clicmd:`bgp deterministic-med`. This may reduce the number of updates as routes |
c1a54c05 QY |
644 | are received, and may in some cases reduce routing churn. Though, it could |
645 | equally deterministically produce the largest possible set of updates in | |
646 | response to the most common sequence of received updates. | |
42fc5d26 QY |
647 | |
648 | A deterministic order of evaluation tends to imply an additional overhead of | |
c3c5a71f | 649 | sorting over any set of n routes to a destination. The implementation of |
dc1046f7 | 650 | deterministic MED in FRR scales significantly worse than most sorting |
c1a54c05 QY |
651 | algorithms at present, with the number of paths to a given destination. That |
652 | number is often low enough to not cause any issues, but where there are many | |
653 | paths, the deterministic comparison may quickly become increasingly expensive | |
654 | in terms of CPU. | |
655 | ||
656 | Deterministic local evaluation can *not* fix the second, more major, issue of | |
657 | MED however. Which is that the non-transitive preference of routes MED can | |
658 | cause may lead to routing instability or oscillation across multiple speakers | |
659 | in iBGP topologies. This can occur with full-mesh iBGP, but is particularly | |
660 | problematic in non-full-mesh iBGP topologies that further reduce the routing | |
661 | information known to each speaker. This has primarily been documented with iBGP | |
749afd7d RF |
662 | :ref:`route-reflection <bgp-route-reflector>` topologies. However, any |
663 | route-hiding technologies potentially could also exacerbate oscillation with MED. | |
c1a54c05 QY |
664 | |
665 | This second issue occurs where speakers each have only a subset of routes, and | |
666 | there are cycles in the preferences between different combinations of routes - | |
667 | as the undefined order of preference of MED allows - and the routes are | |
668 | distributed in a way that causes the BGP speakers to 'chase' those cycles. This | |
669 | can occur even if all speakers use a deterministic order of evaluation in route | |
670 | selection. | |
671 | ||
672 | E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and from | |
673 | speaker 3 in AS Y; while speaker 5 in AS A might receive that route from | |
674 | speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 at speaker | |
675 | 3. I.e, using ASN:ID:MED to label the speakers: | |
42fc5d26 QY |
676 | |
677 | :: | |
678 | ||
c1a54c05 QY |
679 | . |
680 | /---------------\\ | |
42fc5d26 | 681 | X:2------|--A:4-------A:5--|-Y:1:200 |
c1a54c05 QY |
682 | Y:3:100--|-/ | |
683 | \\---------------/ | |
c3c5a71f | 684 | |
42fc5d26 | 685 | |
42fc5d26 | 686 | |
c1a54c05 QY |
687 | Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then based |
688 | on the RFC4271 decision process speaker 4 will choose X:2 over Y:3:100, based | |
689 | on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. Speaker 5 will | |
690 | continue to prefer Y:1:200 based on the ID, and advertise this to speaker 4. | |
691 | Speaker 4 will now have the full set of routes, and the Y:1:200 it receives | |
692 | from 5 will beat X:2, but when speaker 4 compares Y:1:200 to Y:3:100 the MED | |
693 | check now becomes active as the ASes match, and now Y:3:100 is preferred. | |
694 | Speaker 4 therefore now advertises Y:3:100 to 5, which will also agrees that | |
695 | Y:3:100 is preferred to Y:1:200, and so withdraws the latter route from 4. | |
696 | Speaker 4 now has only X:2 and Y:3:100, and X:2 beats Y:3:100, and so speaker 4 | |
697 | implicitly updates its route to speaker 5 to X:2. Speaker 5 sees that Y:1:200 | |
698 | beats X:2 based on the ID, and advertises Y:1:200 to speaker 4, and the cycle | |
699 | continues. | |
42fc5d26 QY |
700 | |
701 | The root cause is the lack of a clear order of preference caused by how MED | |
702 | sometimes is and sometimes is not compared, leading to this cycle in the | |
703 | preferences between the routes: | |
704 | ||
705 | :: | |
706 | ||
c1a54c05 QY |
707 | . |
708 | /---> X:2 ---beats---> Y:3:100 --\\ | |
709 | | | | |
710 | | | | |
711 | \\---beats--- Y:1:200 <---beats---/ | |
c3c5a71f | 712 | |
42fc5d26 | 713 | |
42fc5d26 QY |
714 | |
715 | This particular type of oscillation in full-mesh iBGP topologies can be | |
716 | avoided by speakers preferring already selected, external routes rather than | |
c1a54c05 QY |
717 | choosing to update to new a route based on a post-MED metric (e.g. router-ID), |
718 | at the cost of a non-deterministic selection process. FRR implements this, as | |
719 | do many other implementations, so long as it is not overridden by setting | |
9e146a81 | 720 | :clicmd:`bgp bestpath compare-routerid`, and see also |
8fcedbd2 | 721 | :ref:`bgp-route-selection`. |
42fc5d26 QY |
722 | |
723 | However, more complex and insidious cycles of oscillation are possible with | |
c3c5a71f | 724 | iBGP route-reflection, which are not so easily avoided. These have been |
c1a54c05 QY |
725 | documented in various places. See, e.g.: |
726 | ||
727 | - [bgp-route-osci-cond]_ | |
728 | - [stable-flexible-ibgp]_ | |
729 | - [ibgp-correctness]_ | |
730 | ||
731 | for concrete examples and further references. | |
732 | ||
733 | There is as of this writing *no* known way to use MED for its original purpose; | |
734 | *and* reduce routing information in iBGP topologies; *and* be sure to avoid the | |
735 | instability problems of MED due the non-transitive routing preferences it can | |
736 | induce; in general on arbitrary networks. | |
737 | ||
738 | There may be iBGP topology specific ways to reduce the instability risks, even | |
739 | while using MED, e.g.: by constraining the reflection topology and by tuning | |
013f9762 | 740 | IGP costs between route-reflector clusters, see :rfc:`3345` for details. In the |
c1a54c05 QY |
741 | near future, the Add-Path extension to BGP may also solve MED oscillation while |
742 | still allowing MED to be used as intended, by distributing "best-paths per | |
743 | neighbour AS". This would be at the cost of distributing at least as many | |
744 | routes to all speakers as a full-mesh iBGP would, if not more, while also | |
745 | imposing similar CPU overheads as the "Deterministic MED" feature at each | |
746 | Add-Path reflector. | |
42fc5d26 QY |
747 | |
748 | More generally, the instability problems that MED can introduce on more | |
749 | complex, non-full-mesh, iBGP topologies may be avoided either by: | |
750 | ||
013f9762 | 751 | - Setting :clicmd:`bgp always-compare-med`, however this allows MED to be compared |
42fc5d26 QY |
752 | across values set by different neighbour ASes, which may not produce |
753 | coherent desirable results, of itself. | |
4b44467c | 754 | - Effectively ignoring MED by setting MED to the same value (e.g.: 0) using |
013f9762 QY |
755 | :clicmd:`set metric METRIC` on all received routes, in combination with |
756 | setting :clicmd:`bgp always-compare-med` on all speakers. This is the simplest | |
42fc5d26 QY |
757 | and most performant way to avoid MED oscillation issues, where an AS is happy |
758 | not to allow neighbours to inject this problematic metric. | |
759 | ||
42fc5d26 QY |
760 | As MED is evaluated after the AS_PATH length check, another possible use for |
761 | MED is for intra-AS steering of routes with equal AS_PATH length, as an | |
c1a54c05 QY |
762 | extension of the last case above. As MED is evaluated before IGP metric, this |
763 | can allow cold-potato routing to be implemented to send traffic to preferred | |
764 | hand-offs with neighbours, rather than the closest hand-off according to the | |
765 | IGP metric. | |
766 | ||
767 | Note that even if action is taken to address the MED non-transitivity issues, | |
768 | other oscillations may still be possible. E.g., on IGP cost if iBGP and IGP | |
769 | topologies are at cross-purposes with each other - see the Flavel and Roughan | |
770 | paper above for an example. Hence the guideline that the iBGP topology should | |
771 | follow the IGP topology. | |
772 | ||
29adcd50 | 773 | .. clicmd:: bgp deterministic-med |
42fc5d26 | 774 | |
c1a54c05 QY |
775 | Carry out route-selection in way that produces deterministic answers |
776 | locally, even in the face of MED and the lack of a well-defined order of | |
777 | preference it can induce on routes. Without this option the preferred route | |
778 | with MED may be determined largely by the order that routes were received | |
779 | in. | |
42fc5d26 | 780 | |
c1a54c05 QY |
781 | Setting this option will have a performance cost that may be noticeable when |
782 | there are many routes for each destination. Currently in FRR it is | |
783 | implemented in a way that scales poorly as the number of routes per | |
784 | destination increases. | |
42fc5d26 | 785 | |
c1a54c05 | 786 | The default is that this option is not set. |
42fc5d26 QY |
787 | |
788 | Note that there are other sources of indeterminism in the route selection | |
789 | process, specifically, the preference for older and already selected routes | |
8fcedbd2 | 790 | from eBGP peers, :ref:`bgp-route-selection`. |
42fc5d26 | 791 | |
29adcd50 | 792 | .. clicmd:: bgp always-compare-med |
42fc5d26 | 793 | |
c1a54c05 QY |
794 | Always compare the MED on routes, even when they were received from |
795 | different neighbouring ASes. Setting this option makes the order of | |
796 | preference of routes more defined, and should eliminate MED induced | |
797 | oscillations. | |
42fc5d26 | 798 | |
c1a54c05 | 799 | If using this option, it may also be desirable to use |
9e146a81 | 800 | :clicmd:`set metric METRIC` to set MED to 0 on routes received from external |
c1a54c05 | 801 | neighbours. |
42fc5d26 | 802 | |
9e146a81 QY |
803 | This option can be used, together with :clicmd:`set metric METRIC` to use |
804 | MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g., | |
805 | desired exit points. | |
42fc5d26 | 806 | |
efcb2ebb | 807 | |
808 | .. _bgp-graceful-restart: | |
809 | ||
810 | Graceful Restart | |
811 | ---------------- | |
812 | ||
813 | BGP graceful restart functionality as defined in | |
814 | `RFC-4724 <https://tools.ietf.org/html/rfc4724/>`_ defines the mechanisms that | |
815 | allows BGP speaker to continue to forward data packets along known routes | |
816 | while the routing protocol information is being restored. | |
817 | ||
818 | ||
819 | Usually, when BGP on a router restarts, all the BGP peers detect that the | |
820 | session went down and then came up. This "down/up" transition results in a | |
821 | "routing flap" and causes BGP route re-computation, generation of BGP routing | |
822 | updates, and unnecessary churn to the forwarding tables. | |
823 | ||
824 | The following functionality is provided by graceful restart: | |
825 | ||
826 | 1. The feature allows the restarting router to indicate to the helping peer the | |
827 | routes it can preserve in its forwarding plane during control plane restart | |
828 | by sending graceful restart capability in the OPEN message sent during | |
829 | session establishment. | |
830 | 2. The feature allows helping router to advertise to all other peers the routes | |
831 | received from the restarting router which are preserved in the forwarding | |
832 | plane of the restarting router during control plane restart. | |
833 | ||
834 | ||
835 | :: | |
836 | ||
837 | ||
838 | ||
839 | (R1)-----------------------------------------------------------------(R2) | |
840 | ||
841 | 1. BGP Graceful Restart Capability exchanged between R1 & R2. | |
842 | ||
843 | <---------------------------------------------------------------------> | |
844 | ||
845 | 2. Kill BGP Process at R1. | |
846 | ||
847 | ----------------------------------------------------------------------> | |
848 | ||
849 | 3. R2 Detects the above BGP Restart & verifies BGP Restarting | |
850 | Capability of R1. | |
851 | ||
852 | 4. Start BGP Process at R1. | |
853 | ||
854 | 5. Re-establish the BGP session between R1 & R2. | |
855 | ||
856 | <---------------------------------------------------------------------> | |
857 | ||
858 | 6. R2 Send initial route updates, followed by End-Of-Rib. | |
859 | ||
860 | <---------------------------------------------------------------------- | |
861 | ||
862 | 7. R1 was waiting for End-Of-Rib from R2 & which has been received | |
863 | now. | |
864 | ||
865 | 8. R1 now runs BGP Best-Path algorithm. Send Initial BGP Update, | |
866 | followed by End-Of Rib | |
867 | ||
868 | <---------------------------------------------------------------------> | |
869 | ||
870 | ||
4907bcd8 | 871 | .. _bgp-GR-preserve-forwarding-state: |
872 | ||
873 | BGP-GR Preserve-Forwarding State | |
874 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
875 | ||
876 | BGP OPEN message carrying optional capabilities for Graceful Restart has | |
877 | 8 bit “Flags for Address Family” for given AFI and SAFI. This field contains | |
878 | bit flags relating to routes that were advertised with the given AFI and SAFI. | |
879 | ||
880 | .. code-block:: frr | |
881 | ||
882 | 0 1 2 3 4 5 6 7 | |
883 | +-+-+-+-+-+-+-+-+ | |
884 | |F| Reserved | | |
885 | +-+-+-+-+-+-+-+-+ | |
886 | ||
887 | The most significant bit is defined as the Forwarding State (F) bit, which | |
888 | can be used to indicate whether the forwarding state for routes that were | |
889 | advertised with the given AFI and SAFI has indeed been preserved during the | |
890 | previous BGP restart. When set (value 1), the bit indicates that the | |
891 | forwarding state has been preserved. | |
892 | The remaining bits are reserved and MUST be set to zero by the sender and | |
893 | ignored by the receiver. | |
894 | ||
4907bcd8 | 895 | .. clicmd:: bgp graceful-restart preserve-fw-state |
896 | ||
897 | FRR gives us the option to enable/disable the "F" flag using this specific | |
898 | vty command. However, it doesn't have the option to enable/disable | |
899 | this flag only for specific AFI/SAFI i.e. when this command is used, it | |
900 | applied to all the supported AFI/SAFI combinations for this peer. | |
901 | ||
efcb2ebb | 902 | .. _bgp-end-of-rib-message: |
903 | ||
904 | End-of-RIB (EOR) message | |
905 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
906 | ||
907 | An UPDATE message with no reachable Network Layer Reachability Information | |
908 | (NLRI) and empty withdrawn NLRI is specified as the End-of-RIB marker that can | |
909 | be used by a BGP speaker to indicate to its peer the completion of the initial | |
910 | routing update after the session is established. | |
911 | ||
912 | For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message | |
913 | with the minimum length. For any other address family, it is an UPDATE message | |
914 | that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for | |
915 | that <AFI, SAFI>. | |
916 | ||
917 | Although the End-of-RIB marker is specified for the purpose of BGP graceful | |
918 | restart, it is noted that the generation of such a marker upon completion of | |
919 | the initial update would be useful for routing convergence in general, and thus | |
920 | the practice is recommended. | |
921 | ||
922 | .. _bgp-route-selection-deferral-timer: | |
923 | ||
924 | Route Selection Deferral Timer | |
925 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
926 | ||
927 | Specifies the time the restarting router defers the route selection process | |
928 | after restart. | |
929 | ||
930 | Restarting Router : The usage of route election deferral timer is specified | |
931 | in https://tools.ietf.org/html/rfc4724#section-4.1 | |
932 | ||
933 | Once the session between the Restarting Speaker and the Receiving Speaker is | |
934 | re-established, the Restarting Speaker will receive and process BGP messages | |
935 | from its peers. | |
936 | ||
937 | However, it MUST defer route selection for an address family until it either. | |
938 | ||
939 | 1. Receives the End-of-RIB marker from all its peers (excluding the ones with | |
940 | the "Restart State" bit set in the received capability and excluding the ones | |
941 | that do not advertise the graceful restart capability). | |
942 | 2. The Selection_Deferral_Timer timeout. | |
943 | ||
efcb2ebb | 944 | .. clicmd:: bgp graceful-restart select-defer-time (0-3600) |
945 | ||
946 | This is command, will set deferral time to value specified. | |
947 | ||
948 | ||
efcb2ebb | 949 | .. clicmd:: bgp graceful-restart rib-stale-time (1-3600) |
950 | ||
951 | This is command, will set the time for which stale routes are kept in RIB. | |
952 | ||
2b3de9e5 DA |
953 | .. clicmd:: bgp graceful-restart stalepath-time (1-4095) |
954 | ||
955 | This is command, will set the max time (in seconds) to hold onto | |
956 | restarting peer's stale paths. | |
957 | ||
958 | It also controls Enhanced Route-Refresh timer. | |
959 | ||
960 | If this command is configured and the router does not receive a Route-Refresh EoRR | |
961 | message, the router removes the stale routes from the BGP table after the timer | |
962 | expires. The stale path timer is started when the router receives a Route-Refresh | |
963 | BoRR message. | |
964 | ||
efcb2ebb | 965 | .. _bgp-per-peer-graceful-restart: |
966 | ||
967 | BGP Per Peer Graceful Restart | |
968 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
969 | ||
970 | Ability to enable and disable graceful restart, helper and no GR at all mode | |
971 | functionality at peer level. | |
972 | ||
973 | So bgp graceful restart can be enabled at modes global BGP level or at per | |
974 | peer level. There are two FSM, one for BGP GR global mode and other for peer | |
975 | per GR. | |
976 | ||
977 | Default global mode is helper and default peer per mode is inherit from global. | |
978 | If per peer mode is configured, the GR mode of this particular peer will | |
979 | override the global mode. | |
980 | ||
2ba1fe69 | 981 | .. _bgp-GR-global-mode-cmd: |
efcb2ebb | 982 | |
983 | BGP GR Global Mode Commands | |
984 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
985 | ||
efcb2ebb | 986 | .. clicmd:: bgp graceful-restart |
987 | ||
988 | This command will enable BGP graceful restart ifunctionality at the global | |
989 | level. | |
990 | ||
efcb2ebb | 991 | .. clicmd:: bgp graceful-restart disable |
992 | ||
993 | This command will disable both the functionality graceful restart and helper | |
994 | mode. | |
995 | ||
996 | ||
997 | .. _bgp-GR-peer-mode-cmd: | |
998 | ||
999 | BGP GR Peer Mode Commands | |
1000 | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1001 | ||
efcb2ebb | 1002 | .. clicmd:: neighbor A.B.C.D graceful-restart |
1003 | ||
1004 | This command will enable BGP graceful restart ifunctionality at the peer | |
1005 | level. | |
1006 | ||
efcb2ebb | 1007 | .. clicmd:: neighbor A.B.C.D graceful-restart-helper |
1008 | ||
1009 | This command will enable BGP graceful restart helper only functionality | |
1010 | at the peer level. | |
1011 | ||
efcb2ebb | 1012 | .. clicmd:: neighbor A.B.C.D graceful-restart-disable |
1013 | ||
1014 | This command will disable the entire BGP graceful restart functionality | |
1015 | at the peer level. | |
1016 | ||
1017 | ||
df465afe DS |
1018 | .. _bgp-shutdown: |
1019 | ||
1020 | Administrative Shutdown | |
1021 | ----------------------- | |
1022 | ||
03750f1e | 1023 | .. clicmd:: bgp shutdown [message MSG...] |
df465afe DS |
1024 | |
1025 | Administrative shutdown of all peers of a bgp instance. Drop all BGP peers, | |
1026 | but preserve their configurations. The peers are notified in accordance with | |
1027 | `RFC 8203 <https://tools.ietf.org/html/rfc8203/>`_ by sending a | |
1028 | ``NOTIFICATION`` message with error code ``Cease`` and subcode | |
1029 | ``Administrative Shutdown`` prior to terminating connections. This global | |
1030 | shutdown is independent of the neighbor shutdown, meaning that individually | |
1031 | shut down peers will not be affected by lifting it. | |
1032 | ||
1033 | An optional shutdown message `MSG` can be specified. | |
1034 | ||
1035 | ||
0efdf0fe | 1036 | .. _bgp-network: |
42fc5d26 | 1037 | |
8fcedbd2 QY |
1038 | Networks |
1039 | -------- | |
42fc5d26 | 1040 | |
c1a54c05 | 1041 | .. clicmd:: network A.B.C.D/M |
42fc5d26 | 1042 | |
9eb95b3b | 1043 | This command adds the announcement network. |
c3c5a71f | 1044 | |
9eb95b3b QY |
1045 | .. code-block:: frr |
1046 | ||
1047 | router bgp 1 | |
1048 | address-family ipv4 unicast | |
1049 | network 10.0.0.0/8 | |
1050 | exit-address-family | |
42fc5d26 | 1051 | |
c1a54c05 QY |
1052 | This configuration example says that network 10.0.0.0/8 will be |
1053 | announced to all neighbors. Some vendors' routers don't advertise | |
1054 | routes if they aren't present in their IGP routing tables; `bgpd` | |
1055 | doesn't care about IGP routes when announcing its routes. | |
c3c5a71f | 1056 | |
42fc5d26 | 1057 | |
03750f1e | 1058 | .. clicmd:: bgp network import-check |
f990a416 DS |
1059 | |
1060 | This configuration modifies the behavior of the network statement. | |
1061 | If you have this configured the underlying network must exist in | |
1062 | the rib. If you have the [no] form configured then BGP will not | |
1063 | check for the networks existence in the rib. For versions 7.3 and | |
1064 | before frr defaults for datacenter were the network must exist, | |
1065 | traditional did not check for existence. For versions 7.4 and beyond | |
1066 | both traditional and datacenter the network must exist. | |
1067 | ||
ef1b6319 | 1068 | .. _bgp-ipv6-support: |
547ba033 MH |
1069 | |
1070 | IPv6 Support | |
1071 | ------------ | |
1072 | ||
03750f1e | 1073 | .. clicmd:: neighbor A.B.C.D activate |
547ba033 | 1074 | |
ef1b6319 | 1075 | This configuration modifies whether to enable an address family for a |
547ba033 MH |
1076 | specific neighbor. By default only the IPv4 unicast address family is |
1077 | enabled. | |
1078 | ||
1079 | .. code-block:: frr | |
1080 | ||
1081 | router bgp 1 | |
1082 | address-family ipv6 unicast | |
1083 | neighbor 2001:0DB8::1 activate | |
1084 | network 2001:0DB8:5009::/64 | |
1085 | exit-address-family | |
1086 | ||
1087 | This configuration example says that network 2001:0DB8:5009::/64 will be | |
1088 | announced and enables the neighbor 2001:0DB8::1 to receive this announcement. | |
1089 | ||
547ba033 MH |
1090 | By default, only the IPv4 unicast address family is announced to all |
1091 | neighbors. Using the 'no bgp default ipv4-unicast' configuration overrides | |
1092 | this default so that all address families need to be enabled explicitly. | |
1093 | ||
1094 | .. code-block:: frr | |
1095 | ||
1096 | router bgp 1 | |
1097 | no bgp default ipv4-unicast | |
1098 | neighbor 10.10.10.1 remote-as 2 | |
1099 | neighbor 2001:0DB8::1 remote-as 3 | |
1100 | address-family ipv4 unicast | |
1101 | neighbor 10.10.10.1 activate | |
1102 | network 192.168.1.0/24 | |
1103 | exit-address-family | |
1104 | address-family ipv6 unicast | |
1105 | neighbor 2001:0DB8::1 activate | |
1106 | network 2001:0DB8:5009::/64 | |
1107 | exit-address-family | |
1108 | ||
1109 | This configuration demonstrates how the 'no bgp default ipv4-unicast' might | |
1110 | be used in a setup with two upstreams where each of the upstreams should only | |
1111 | receive either IPv4 or IPv6 annocuments. | |
1112 | ||
2c853e5e DA |
1113 | Using the ``bgp default ipv6-unicast`` configuration, IPv6 unicast |
1114 | address family is enabled by default for all new neighbors. | |
1115 | ||
547ba033 | 1116 | |
8fcedbd2 | 1117 | .. _bgp-route-aggregation: |
42fc5d26 QY |
1118 | |
1119 | Route Aggregation | |
1120 | ----------------- | |
1121 | ||
5101fece | 1122 | .. _bgp-route-aggregation-ipv4: |
1123 | ||
1124 | Route Aggregation-IPv4 Address Family | |
1125 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1126 | ||
c1a54c05 | 1127 | .. clicmd:: aggregate-address A.B.C.D/M |
c3c5a71f | 1128 | |
c1a54c05 | 1129 | This command specifies an aggregate address. |
42fc5d26 | 1130 | |
ac2201bb DA |
1131 | .. clicmd:: aggregate-address A.B.C.D/M route-map NAME |
1132 | ||
1133 | Apply a route-map for an aggregated prefix. | |
1134 | ||
a87d2ef7 DA |
1135 | .. clicmd:: aggregate-address A.B.C.D/M origin <egp|igp|incomplete> |
1136 | ||
1137 | Override ORIGIN for an aggregated prefix. | |
1138 | ||
c1a54c05 | 1139 | .. clicmd:: aggregate-address A.B.C.D/M as-set |
42fc5d26 | 1140 | |
c1a54c05 QY |
1141 | This command specifies an aggregate address. Resulting routes include |
1142 | AS set. | |
42fc5d26 | 1143 | |
c1a54c05 | 1144 | .. clicmd:: aggregate-address A.B.C.D/M summary-only |
c3c5a71f | 1145 | |
d1e7591e | 1146 | This command specifies an aggregate address. Aggregated routes will |
b91bf5bd | 1147 | not be announced. |
42fc5d26 | 1148 | |
01338ba1 RZ |
1149 | .. clicmd:: aggregate-address A.B.C.D/M matching-MED-only |
1150 | ||
1151 | Configure the aggregated address to only be created when the routes MED | |
1152 | match, otherwise no aggregated route will be created. | |
1153 | ||
8fbb9c95 RZ |
1154 | .. clicmd:: aggregate-address A.B.C.D/M suppress-map NAME |
1155 | ||
1156 | Similar to `summary-only`, but will only suppress more specific routes that | |
1157 | are matched by the selected route-map. | |
1158 | ||
ac2201bb | 1159 | |
03750f1e QY |
1160 | This configuration example sets up an ``aggregate-address`` under the ipv4 |
1161 | address-family. | |
5101fece | 1162 | |
1163 | .. code-block:: frr | |
1164 | ||
1165 | router bgp 1 | |
1166 | address-family ipv4 unicast | |
1167 | aggregate-address 10.0.0.0/8 | |
1168 | aggregate-address 20.0.0.0/8 as-set | |
1169 | aggregate-address 40.0.0.0/8 summary-only | |
ac2201bb | 1170 | aggregate-address 50.0.0.0/8 route-map aggr-rmap |
5101fece | 1171 | exit-address-family |
1172 | ||
1173 | ||
1174 | .. _bgp-route-aggregation-ipv6: | |
1175 | ||
1176 | Route Aggregation-IPv6 Address Family | |
1177 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1178 | ||
5101fece | 1179 | .. clicmd:: aggregate-address X:X::X:X/M |
1180 | ||
1181 | This command specifies an aggregate address. | |
1182 | ||
ac2201bb DA |
1183 | .. clicmd:: aggregate-address X:X::X:X/M route-map NAME |
1184 | ||
1185 | Apply a route-map for an aggregated prefix. | |
1186 | ||
a87d2ef7 DA |
1187 | .. clicmd:: aggregate-address X:X::X:X/M origin <egp|igp|incomplete> |
1188 | ||
1189 | Override ORIGIN for an aggregated prefix. | |
1190 | ||
5101fece | 1191 | .. clicmd:: aggregate-address X:X::X:X/M as-set |
1192 | ||
1193 | This command specifies an aggregate address. Resulting routes include | |
1194 | AS set. | |
1195 | ||
5101fece | 1196 | .. clicmd:: aggregate-address X:X::X:X/M summary-only |
1197 | ||
1198 | This command specifies an aggregate address. Aggregated routes will | |
b91bf5bd | 1199 | not be announced. |
5101fece | 1200 | |
01338ba1 RZ |
1201 | .. clicmd:: aggregate-address X:X::X:X/M matching-MED-only |
1202 | ||
1203 | Configure the aggregated address to only be created when the routes MED | |
1204 | match, otherwise no aggregated route will be created. | |
1205 | ||
8fbb9c95 RZ |
1206 | .. clicmd:: aggregate-address X:X::X:X/M suppress-map NAME |
1207 | ||
1208 | Similar to `summary-only`, but will only suppress more specific routes that | |
1209 | are matched by the selected route-map. | |
01338ba1 | 1210 | |
5101fece | 1211 | |
03750f1e QY |
1212 | This configuration example sets up an ``aggregate-address`` under the ipv6 |
1213 | address-family. | |
5101fece | 1214 | |
1215 | .. code-block:: frr | |
1216 | ||
1217 | router bgp 1 | |
1218 | address-family ipv6 unicast | |
1219 | aggregate-address 10::0/64 | |
ac2201bb DA |
1220 | aggregate-address 20::0/64 as-set |
1221 | aggregate-address 40::0/64 summary-only | |
1222 | aggregate-address 50::0/64 route-map aggr-rmap | |
5101fece | 1223 | exit-address-family |
c3c5a71f | 1224 | |
03750f1e | 1225 | |
8fcedbd2 | 1226 | .. _bgp-redistribute-to-bgp: |
42fc5d26 | 1227 | |
8fcedbd2 QY |
1228 | Redistribution |
1229 | -------------- | |
42fc5d26 | 1230 | |
a874b986 QY |
1231 | Redistribution configuration should be placed under the ``address-family`` |
1232 | section for the specific AF to redistribute into. Protocol availability for | |
1233 | redistribution is determined by BGP AF; for example, you cannot redistribute | |
1234 | OSPFv3 into ``address-family ipv4 unicast`` as OSPFv3 supports IPv6. | |
1235 | ||
1236 | .. clicmd:: redistribute <babel|connected|eigrp|isis|kernel|openfabric|ospf|ospf6|rip|ripng|sharp|static|table> [metric (0-4294967295)] [route-map WORD] | |
1237 | ||
03750f1e | 1238 | Redistribute routes from other protocols into BGP. |
42fc5d26 | 1239 | |
245d354f DA |
1240 | .. clicmd:: redistribute vnc-direct |
1241 | ||
1242 | Redistribute VNC direct (not via zebra) routes to BGP process. | |
1243 | ||
d70583f7 D |
1244 | .. clicmd:: bgp update-delay MAX-DELAY |
1245 | ||
d70583f7 D |
1246 | .. clicmd:: bgp update-delay MAX-DELAY ESTABLISH-WAIT |
1247 | ||
1248 | This feature is used to enable read-only mode on BGP process restart or when | |
1249 | a BGP process is cleared using 'clear ip bgp \*'. Note that this command is | |
1250 | configured at the global level and applies to all bgp instances/vrfs. It | |
1251 | cannot be used at the same time as the "update-delay" command described below, | |
1252 | which is entered in each bgp instance/vrf desired to delay update installation | |
1253 | and advertisements. The global and per-vrf approaches to defining update-delay | |
1254 | are mutually exclusive. | |
1255 | ||
1256 | When applicable, read-only mode would begin as soon as the first peer reaches | |
1257 | Established status and a timer for max-delay seconds is started. During this | |
1258 | mode BGP doesn't run any best-path or generate any updates to its peers. This | |
1259 | mode continues until: | |
1260 | ||
1261 | 1. All the configured peers, except the shutdown peers, have sent explicit EOR | |
1262 | (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached | |
1263 | Established is considered an implicit-EOR. | |
1264 | If the establish-wait optional value is given, then BGP will wait for | |
1265 | peers to reach established from the beginning of the update-delay till the | |
1266 | establish-wait period is over, i.e. the minimum set of established peers for | |
1267 | which EOR is expected would be peers established during the establish-wait | |
1268 | window, not necessarily all the configured neighbors. | |
1269 | 2. max-delay period is over. | |
1270 | ||
1271 | On hitting any of the above two conditions, BGP resumes the decision process | |
1272 | and generates updates to its peers. | |
1273 | ||
1274 | Default max-delay is 0, i.e. the feature is off by default. | |
1275 | ||
1276 | ||
c1a54c05 | 1277 | .. clicmd:: update-delay MAX-DELAY |
c3c5a71f | 1278 | |
c1a54c05 | 1279 | .. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT |
c3c5a71f | 1280 | |
c1a54c05 | 1281 | This feature is used to enable read-only mode on BGP process restart or when |
d70583f7 D |
1282 | a BGP process is cleared using 'clear ip bgp \*'. Note that this command is |
1283 | configured under the specific bgp instance/vrf that the feaure is enabled for. | |
1284 | It cannot be used at the same time as the global "bgp update-delay" described | |
1285 | above, which is entered at the global level and applies to all bgp instances. | |
1286 | The global and per-vrf approaches to defining update-delay are mutually | |
1287 | exclusive. | |
1288 | ||
1289 | When applicable, read-only mode would begin as soon as the first peer reaches | |
1290 | Established status and a timer for max-delay seconds is started. During this | |
1291 | mode BGP doesn't run any best-path or generate any updates to its peers. This | |
1292 | mode continues until: | |
42fc5d26 | 1293 | |
c1a54c05 QY |
1294 | 1. All the configured peers, except the shutdown peers, have sent explicit EOR |
1295 | (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached | |
1296 | Established is considered an implicit-EOR. | |
1297 | If the establish-wait optional value is given, then BGP will wait for | |
d1e7591e | 1298 | peers to reach established from the beginning of the update-delay till the |
c1a54c05 QY |
1299 | establish-wait period is over, i.e. the minimum set of established peers for |
1300 | which EOR is expected would be peers established during the establish-wait | |
1301 | window, not necessarily all the configured neighbors. | |
1302 | 2. max-delay period is over. | |
42fc5d26 | 1303 | |
c1a54c05 QY |
1304 | On hitting any of the above two conditions, BGP resumes the decision process |
1305 | and generates updates to its peers. | |
42fc5d26 | 1306 | |
c1a54c05 | 1307 | Default max-delay is 0, i.e. the feature is off by default. |
c3c5a71f | 1308 | |
c1a54c05 | 1309 | .. clicmd:: table-map ROUTE-MAP-NAME |
42fc5d26 | 1310 | |
c1a54c05 QY |
1311 | This feature is used to apply a route-map on route updates from BGP to |
1312 | Zebra. All the applicable match operations are allowed, such as match on | |
1313 | prefix, next-hop, communities, etc. Set operations for this attach-point are | |
1314 | limited to metric and next-hop only. Any operation of this feature does not | |
1315 | affect BGPs internal RIB. | |
42fc5d26 | 1316 | |
c1a54c05 QY |
1317 | Supported for ipv4 and ipv6 address families. It works on multi-paths as |
1318 | well, however, metric setting is based on the best-path only. | |
42fc5d26 | 1319 | |
8fcedbd2 | 1320 | .. _bgp-peers: |
42fc5d26 | 1321 | |
8fcedbd2 QY |
1322 | Peers |
1323 | ----- | |
42fc5d26 | 1324 | |
8fcedbd2 | 1325 | .. _bgp-defining-peers: |
42fc5d26 | 1326 | |
8fcedbd2 QY |
1327 | Defining Peers |
1328 | ^^^^^^^^^^^^^^ | |
42fc5d26 | 1329 | |
c1a54c05 | 1330 | .. clicmd:: neighbor PEER remote-as ASN |
42fc5d26 | 1331 | |
c1a54c05 | 1332 | Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address |
9eb95b3b | 1333 | or an IPv6 address or an interface to use for the connection. |
76bd1499 | 1334 | |
9eb95b3b QY |
1335 | .. code-block:: frr |
1336 | ||
1337 | router bgp 1 | |
1338 | neighbor 10.0.0.1 remote-as 2 | |
76bd1499 | 1339 | |
c1a54c05 | 1340 | In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1. |
76bd1499 | 1341 | |
c1a54c05 | 1342 | This command must be the first command used when configuring a neighbor. If |
9eb95b3b | 1343 | the remote-as is not specified, *bgpd* will complain like this: :: |
76bd1499 | 1344 | |
c1a54c05 | 1345 | can't find neighbor 10.0.0.1 |
c3c5a71f | 1346 | |
5413757f DS |
1347 | .. clicmd:: neighbor PEER remote-as internal |
1348 | ||
1349 | Create a peer as you would when you specify an ASN, except that if the | |
1350 | peers ASN is different than mine as specified under the :clicmd:`router bgp ASN` | |
1351 | command the connection will be denied. | |
1352 | ||
5413757f DS |
1353 | .. clicmd:: neighbor PEER remote-as external |
1354 | ||
1355 | Create a peer as you would when you specify an ASN, except that if the | |
1356 | peers ASN is the same as mine as specified under the :clicmd:`router bgp ASN` | |
1357 | command the connection will be denied. | |
42fc5d26 | 1358 | |
03750f1e | 1359 | .. clicmd:: bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME |
d79e0e08 QY |
1360 | |
1361 | Accept connections from any peers in the specified prefix. Configuration | |
1362 | from the specified peer-group is used to configure these peers. | |
1363 | ||
1364 | .. note:: | |
1365 | ||
1366 | When using BGP listen ranges, if the associated peer group has TCP MD5 | |
1367 | authentication configured, your kernel must support this on prefixes. On | |
1368 | Linux, this support was added in kernel version 4.14. If your kernel does | |
1369 | not support this feature you will get a warning in the log file, and the | |
1370 | listen range will only accept connections from peers without MD5 configured. | |
1371 | ||
1372 | Additionally, we have observed that when using this option at scale (several | |
1373 | hundred peers) the kernel may hit its option memory limit. In this situation | |
1374 | you will see error messages like: | |
1375 | ||
1376 | ``bgpd: sockopt_tcp_signature: setsockopt(23): Cannot allocate memory`` | |
1377 | ||
1378 | In this case you need to increase the value of the sysctl | |
1379 | ``net.core.optmem_max`` to allow the kernel to allocate the necessary option | |
1380 | memory. | |
1381 | ||
5b1b6b8b PG |
1382 | .. clicmd:: bgp listen limit <1-65535> |
1383 | ||
1384 | Define the maximum number of peers accepted for one BGP instance. This | |
1385 | limit is set to 100 by default. Increasing this value will really be | |
1386 | possible if more file descriptors are available in the BGP process. This | |
1387 | value is defined by the underlying system (ulimit value), and can be | |
1388 | overriden by `--limit-fds`. More information is available in chapter | |
1389 | (:ref:`common-invocation-options`). | |
1390 | ||
03750f1e | 1391 | .. clicmd:: coalesce-time (0-4294967295) |
ced26d3d DS |
1392 | |
1393 | The time in milliseconds that BGP will delay before deciding what peers | |
1394 | can be put into an update-group together in order to generate a single | |
1395 | update for them. The default time is 1000. | |
91052810 | 1396 | |
8fcedbd2 | 1397 | .. _bgp-configuring-peers: |
42fc5d26 | 1398 | |
8fcedbd2 QY |
1399 | Configuring Peers |
1400 | ^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 1401 | |
03750f1e | 1402 | .. clicmd:: neighbor PEER shutdown [message MSG...] [rtt (1-65535) [count (1-255)]] |
c3c5a71f | 1403 | |
c1a54c05 QY |
1404 | Shutdown the peer. We can delete the neighbor's configuration by |
1405 | ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor | |
1406 | will be deleted. When you want to preserve the configuration, but want to | |
1407 | drop the BGP peer, use this syntax. | |
c3c5a71f | 1408 | |
70335e0a RZ |
1409 | Optionally you can specify a shutdown message `MSG`. |
1410 | ||
56c07345 | 1411 | Also, you can specify optionally ``rtt`` in milliseconds to automatically |
91052810 DA |
1412 | shutdown the peer if round-trip-time becomes higher than defined. |
1413 | ||
56c07345 | 1414 | Additional ``count`` parameter is the number of keepalive messages to count |
91052810 DA |
1415 | before shutdown the peer if round-trip-time becomes higher than defined. |
1416 | ||
03750f1e | 1417 | .. clicmd:: neighbor PEER disable-connected-check |
c3c5a71f | 1418 | |
c0868e8b QY |
1419 | Allow peerings between directly connected eBGP peers using loopback |
1420 | addresses. | |
c3c5a71f | 1421 | |
03750f1e | 1422 | .. clicmd:: neighbor PEER ebgp-multihop |
42fc5d26 | 1423 | |
164786a9 QY |
1424 | Specifying ``ebgp-multihop`` allows sessions with eBGP neighbors to |
1425 | establish when they are multiple hops away. When the neighbor is not | |
1426 | directly connected and this knob is not enabled, the session will not | |
1427 | establish. | |
1428 | ||
15e6881e DA |
1429 | If the peer's IP address is not in the RIB and is reachable via the |
1430 | default route, then you have to enable ``ip nht resolve-via-default``. | |
1431 | ||
03750f1e | 1432 | .. clicmd:: neighbor PEER description ... |
42fc5d26 | 1433 | |
c1a54c05 | 1434 | Set description of the peer. |
42fc5d26 | 1435 | |
03750f1e | 1436 | .. clicmd:: neighbor PEER version VERSION |
42fc5d26 | 1437 | |
4da7fda3 QY |
1438 | Set up the neighbor's BGP version. `version` can be `4`, `4+` or `4-`. BGP |
1439 | version `4` is the default value used for BGP peering. BGP version `4+` | |
1440 | means that the neighbor supports Multiprotocol Extensions for BGP-4. BGP | |
1441 | version `4-` is similar but the neighbor speaks the old Internet-Draft | |
1442 | revision 00's Multiprotocol Extensions for BGP-4. Some routing software is | |
1443 | still using this version. | |
42fc5d26 | 1444 | |
03750f1e | 1445 | .. clicmd:: neighbor PEER interface IFNAME |
42fc5d26 | 1446 | |
c1a54c05 QY |
1447 | When you connect to a BGP peer over an IPv6 link-local address, you have to |
1448 | specify the IFNAME of the interface used for the connection. To specify | |
1449 | IPv4 session addresses, see the ``neighbor PEER update-source`` command | |
1450 | below. | |
42fc5d26 | 1451 | |
c1a54c05 QY |
1452 | This command is deprecated and may be removed in a future release. Its use |
1453 | should be avoided. | |
42fc5d26 | 1454 | |
da4d6777 QY |
1455 | .. clicmd:: neighbor PEER interface remote-as <internal|external|ASN> |
1456 | ||
1457 | Configure an unnumbered BGP peer. ``PEER`` should be an interface name. The | |
1458 | session will be established via IPv6 link locals. Use ``internal`` for iBGP | |
1459 | and ``external`` for eBGP sessions, or specify an ASN if you wish. | |
1460 | ||
42d623ac | 1461 | .. clicmd:: neighbor PEER next-hop-self [force] |
42fc5d26 | 1462 | |
c1a54c05 | 1463 | This command specifies an announced route's nexthop as being equivalent to |
42d623ac TA |
1464 | the address of the bgp router if it is learned via eBGP. This will also |
1465 | bypass third-party next-hops in favor of the local bgp address. If the | |
1466 | optional keyword ``force`` is specified the modification is done also for | |
1467 | routes learned via iBGP. | |
42fc5d26 | 1468 | |
8b0d734b | 1469 | .. clicmd:: neighbor PEER attribute-unchanged [{as-path|next-hop|med}] |
1470 | ||
1471 | This command specifies attributes to be left unchanged for advertisements | |
1472 | sent to a peer. Use this to leave the next-hop unchanged in ipv6 | |
1473 | configurations, as the route-map directive to leave the next-hop unchanged | |
1474 | is only available for ipv4. | |
1475 | ||
03750f1e | 1476 | .. clicmd:: neighbor PEER update-source <IFNAME|ADDRESS> |
42fc5d26 | 1477 | |
c1a54c05 QY |
1478 | Specify the IPv4 source address to use for the :abbr:`BGP` session to this |
1479 | neighbour, may be specified as either an IPv4 address directly or as an | |
1480 | interface name (in which case the *zebra* daemon MUST be running in order | |
9eb95b3b QY |
1481 | for *bgpd* to be able to retrieve interface state). |
1482 | ||
1483 | .. code-block:: frr | |
42fc5d26 | 1484 | |
c1a54c05 QY |
1485 | router bgp 64555 |
1486 | neighbor foo update-source 192.168.0.1 | |
1487 | neighbor bar update-source lo0 | |
42fc5d26 | 1488 | |
42fc5d26 | 1489 | |
03750f1e | 1490 | .. clicmd:: neighbor PEER default-originate |
42fc5d26 | 1491 | |
4da7fda3 QY |
1492 | *bgpd*'s default is to not announce the default route (0.0.0.0/0) even if it |
1493 | is in routing table. When you want to announce default routes to the peer, | |
1494 | use this command. | |
42fc5d26 | 1495 | |
c1a54c05 | 1496 | .. clicmd:: neighbor PEER port PORT |
42fc5d26 | 1497 | |
03750f1e | 1498 | .. clicmd:: neighbor PEER password PASSWORD |
e7c105a7 DS |
1499 | |
1500 | Set a MD5 password to be used with the tcp socket that is being used | |
1501 | to connect to the remote peer. Please note if you are using this | |
1502 | command with a large number of peers on linux you should consider | |
1503 | modifying the `net.core.optmem_max` sysctl to a larger value to | |
1504 | avoid out of memory errors from the linux kernel. | |
1505 | ||
c1a54c05 | 1506 | .. clicmd:: neighbor PEER send-community |
42fc5d26 | 1507 | |
03750f1e | 1508 | .. clicmd:: neighbor PEER weight WEIGHT |
42fc5d26 | 1509 | |
c1a54c05 | 1510 | This command specifies a default `weight` value for the neighbor's routes. |
42fc5d26 | 1511 | |
03750f1e | 1512 | .. clicmd:: neighbor PEER maximum-prefix NUMBER [force] |
42fc5d26 | 1513 | |
886026c8 QY |
1514 | Sets a maximum number of prefixes we can receive from a given peer. If this |
1515 | number is exceeded, the BGP session will be destroyed. | |
1516 | ||
1517 | In practice, it is generally preferable to use a prefix-list to limit what | |
1518 | prefixes are received from the peer instead of using this knob. Tearing down | |
1519 | the BGP session when a limit is exceeded is far more destructive than merely | |
1520 | rejecting undesired prefixes. The prefix-list method is also much more | |
1521 | granular and offers much smarter matching criterion than number of received | |
1522 | prefixes, making it more suited to implementing policy. | |
1523 | ||
56c07345 | 1524 | If ``force`` is set, then ALL prefixes are counted for maximum instead of |
c1bcac1d DA |
1525 | accepted only. This is useful for cases where an inbound filter is applied, |
1526 | but you want maximum-prefix to act on ALL (including filtered) prefixes. This | |
1527 | option requires `soft-reconfiguration inbound` to be enabled for the peer. | |
1528 | ||
03750f1e | 1529 | .. clicmd:: neighbor PEER maximum-prefix-out NUMBER |
edf98aa3 DA |
1530 | |
1531 | Sets a maximum number of prefixes we can send to a given peer. | |
1532 | ||
f5399474 DA |
1533 | Since sent prefix count is managed by update-groups, this option |
1534 | creates a separate update-group for outgoing updates. | |
1535 | ||
03750f1e | 1536 | .. clicmd:: neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as] |
42fc5d26 | 1537 | |
c1a54c05 QY |
1538 | Specify an alternate AS for this BGP process when interacting with the |
1539 | specified peer. With no modifiers, the specified local-as is prepended to | |
1540 | the received AS_PATH when receiving routing updates from the peer, and | |
1541 | prepended to the outgoing AS_PATH (after the process local AS) when | |
1542 | transmitting local routes to the peer. | |
42fc5d26 | 1543 | |
c1a54c05 QY |
1544 | If the no-prepend attribute is specified, then the supplied local-as is not |
1545 | prepended to the received AS_PATH. | |
c3c5a71f | 1546 | |
c1a54c05 QY |
1547 | If the replace-as attribute is specified, then only the supplied local-as is |
1548 | prepended to the AS_PATH when transmitting local-route updates to this peer. | |
c3c5a71f | 1549 | |
c1a54c05 | 1550 | Note that replace-as can only be specified if no-prepend is. |
c3c5a71f | 1551 | |
c1a54c05 | 1552 | This command is only allowed for eBGP peers. |
c3c5a71f | 1553 | |
03750f1e | 1554 | .. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> as-override |
252c5590 RZ |
1555 | |
1556 | Override AS number of the originating router with the local AS number. | |
1557 | ||
1558 | Usually this configuration is used in PEs (Provider Edge) to replace | |
1559 | the incoming customer AS number so the connected CE (Customer Edge) | |
1560 | can use the same AS number as the other customer sites. This allows | |
1561 | customers of the provider network to use the same AS number across | |
1562 | their sites. | |
1563 | ||
1564 | This command is only allowed for eBGP peers. | |
1565 | ||
03750f1e | 1566 | .. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>] |
ae1e0f32 RZ |
1567 | |
1568 | Accept incoming routes with AS path containing AS number with the same value | |
1569 | as the current system AS. | |
1570 | ||
1571 | This is used when you want to use the same AS number in your sites, but you | |
1572 | can't connect them directly. This is an alternative to | |
1573 | `neighbor WORD as-override`. | |
1574 | ||
1575 | The parameter `(1-10)` configures the amount of accepted occurences of the | |
1576 | system AS number in AS path. | |
1577 | ||
1578 | The parameter `origin` configures BGP to only accept routes originated with | |
1579 | the same AS number as the system. | |
1580 | ||
1581 | This command is only allowed for eBGP peers. | |
1582 | ||
03750f1e | 1583 | .. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths |
e03bf6fc RZ |
1584 | |
1585 | Configure BGP to send all known paths to neighbor in order to preserve multi | |
1586 | path capabilities inside a network. | |
1587 | ||
03750f1e | 1588 | .. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS |
e03bf6fc RZ |
1589 | |
1590 | Configure BGP to send best known paths to neighbor in order to preserve multi | |
1591 | path capabilities inside a network. | |
1592 | ||
03750f1e | 1593 | .. clicmd:: neighbor PEER ttl-security hops NUMBER |
c3c5a71f | 1594 | |
c1a54c05 QY |
1595 | This command enforces Generalized TTL Security Mechanism (GTSM), as |
1596 | specified in RFC 5082. With this command, only neighbors that are the | |
1597 | specified number of hops away will be allowed to become neighbors. This | |
d1e7591e | 1598 | command is mutually exclusive with *ebgp-multihop*. |
42fc5d26 | 1599 | |
03750f1e | 1600 | .. clicmd:: neighbor PEER capability extended-nexthop |
19f2b5e8 DS |
1601 | |
1602 | Allow bgp to negotiate the extended-nexthop capability with it's peer. | |
1603 | If you are peering over a v6 LL address then this capability is turned | |
1604 | on automatically. If you are peering over a v6 Global Address then | |
1605 | turning on this command will allow BGP to install v4 routes with | |
1606 | v6 nexthops if you do not have v4 configured on interfaces. | |
1607 | ||
03750f1e | 1608 | .. clicmd:: bgp fast-external-failover |
eb938189 DS |
1609 | |
1610 | This command causes bgp to not take down ebgp peers immediately | |
1611 | when a link flaps. `bgp fast-external-failover` is the default | |
1612 | and will not be displayed as part of a `show run`. The no form | |
1613 | of the command turns off this ability. | |
1614 | ||
03750f1e | 1615 | .. clicmd:: bgp default ipv4-unicast |
bc132029 | 1616 | |
5441ad10 TA |
1617 | This command allows the user to specify that the IPv4 Unicast address |
1618 | family is turned on by default or not. This command defaults to on | |
1619 | and is not displayed. | |
bc132029 DS |
1620 | The `no bgp default ipv4-unicast` form of the command is displayed. |
1621 | ||
5441ad10 TA |
1622 | .. clicmd:: bgp default ipv4-multicast |
1623 | ||
1624 | This command allows the user to specify that the IPv4 Multicast address | |
1625 | family is turned on by default or not. This command defaults to off | |
1626 | and is not displayed. | |
1627 | The `bgp default ipv4-multicast` form of the command is displayed. | |
1628 | ||
1629 | .. clicmd:: bgp default ipv4-vpn | |
1630 | ||
1631 | This command allows the user to specify that the IPv4 MPLS VPN address | |
1632 | family is turned on by default or not. This command defaults to off | |
1633 | and is not displayed. | |
1634 | The `bgp default ipv4-vpn` form of the command is displayed. | |
1635 | ||
1636 | .. clicmd:: bgp default ipv4-flowspec | |
1637 | ||
1638 | This command allows the user to specify that the IPv4 Flowspec address | |
1639 | family is turned on by default or not. This command defaults to off | |
1640 | and is not displayed. | |
1641 | The `bgp default ipv4-flowspec` form of the command is displayed. | |
1642 | ||
2c853e5e DA |
1643 | .. clicmd:: bgp default ipv6-unicast |
1644 | ||
5441ad10 TA |
1645 | This command allows the user to specify that the IPv6 Unicast address |
1646 | family is turned on by default or not. This command defaults to off | |
1647 | and is not displayed. | |
2c853e5e DA |
1648 | The `bgp default ipv6-unicast` form of the command is displayed. |
1649 | ||
5441ad10 TA |
1650 | .. clicmd:: bgp default ipv6-multicast |
1651 | ||
1652 | This command allows the user to specify that the IPv6 Multicast address | |
1653 | family is turned on by default or not. This command defaults to off | |
1654 | and is not displayed. | |
1655 | The `bgp default ipv6-multicast` form of the command is displayed. | |
1656 | ||
1657 | .. clicmd:: bgp default ipv6-vpn | |
1658 | ||
1659 | This command allows the user to specify that the IPv6 MPLS VPN address | |
1660 | family is turned on by default or not. This command defaults to off | |
1661 | and is not displayed. | |
1662 | The `bgp default ipv6-vpn` form of the command is displayed. | |
1663 | ||
1664 | .. clicmd:: bgp default ipv6-flowspec | |
1665 | ||
1666 | This command allows the user to specify that the IPv6 Flowspec address | |
1667 | family is turned on by default or not. This command defaults to off | |
1668 | and is not displayed. | |
1669 | The `bgp default ipv6-flowspec` form of the command is displayed. | |
1670 | ||
1671 | .. clicmd:: bgp default l2vpn-evpn | |
1672 | ||
1673 | This command allows the user to specify that the L2VPN EVPN address | |
1674 | family is turned on by default or not. This command defaults to off | |
1675 | and is not displayed. | |
1676 | The `bgp default l2vpn-evpn` form of the command is displayed. | |
1677 | ||
03750f1e | 1678 | .. clicmd:: bgp default show-hostname |
7d981695 DA |
1679 | |
1680 | This command shows the hostname of the peer in certain BGP commands | |
1681 | outputs. It's easier to troubleshoot if you have a number of BGP peers. | |
1682 | ||
03750f1e | 1683 | .. clicmd:: bgp default show-nexthop-hostname |
7d981695 DA |
1684 | |
1685 | This command shows the hostname of the next-hop in certain BGP commands | |
1686 | outputs. It's easier to troubleshoot if you have a number of BGP peers | |
1687 | and a number of routes to check. | |
1688 | ||
03750f1e | 1689 | .. clicmd:: neighbor PEER advertisement-interval (0-600) |
e10dda57 DS |
1690 | |
1691 | Setup the minimum route advertisement interval(mrai) for the | |
1692 | peer in question. This number is between 0 and 600 seconds, | |
1693 | with the default advertisement interval being 0. | |
1694 | ||
0c969c0f QY |
1695 | .. clicmd:: neighbor PEER timers (0-65535) (0-65535) |
1696 | ||
1697 | Set keepalive and hold timers for a neighbor. The first value is keepalive | |
1698 | and the second is hold time. | |
1699 | ||
1700 | .. clicmd:: neighbor PEER connect (1-65535) | |
1701 | ||
1702 | Set connect timer for a neighbor. The connect timer controls how long BGP | |
1703 | waits between connection attempts to a neighbor. | |
1704 | ||
03750f1e | 1705 | .. clicmd:: neighbor PEER timers delayopen (1-240) |
94abf9b4 DS |
1706 | |
1707 | This command allows the user enable the | |
1708 | `RFC 4271 <https://tools.ietf.org/html/rfc4271/>` DelayOpenTimer with the | |
1709 | specified interval or disable it with the negating command for the peer. By | |
1710 | default, the DelayOpenTimer is disabled. The timer interval may be set to a | |
1711 | duration of 1 to 240 seconds. | |
1712 | ||
4e853678 DS |
1713 | Displaying Information about Peers |
1714 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1715 | ||
4e853678 DS |
1716 | .. clicmd:: show bgp <afi> <safi> neighbors WORD bestpath-routes [json] [wide] |
1717 | ||
1718 | For the given neighbor, WORD, that is specified list the routes selected | |
1719 | by BGP as having the best path. | |
1720 | ||
8fcedbd2 | 1721 | .. _bgp-peer-filtering: |
42fc5d26 | 1722 | |
8fcedbd2 QY |
1723 | Peer Filtering |
1724 | ^^^^^^^^^^^^^^ | |
42fc5d26 | 1725 | |
c1a54c05 | 1726 | .. clicmd:: neighbor PEER distribute-list NAME [in|out] |
42fc5d26 | 1727 | |
c1a54c05 QY |
1728 | This command specifies a distribute-list for the peer. `direct` is |
1729 | ``in`` or ``out``. | |
42fc5d26 | 1730 | |
29adcd50 | 1731 | .. clicmd:: neighbor PEER prefix-list NAME [in|out] |
42fc5d26 | 1732 | |
29adcd50 | 1733 | .. clicmd:: neighbor PEER filter-list NAME [in|out] |
42fc5d26 | 1734 | |
c1a54c05 | 1735 | .. clicmd:: neighbor PEER route-map NAME [in|out] |
42fc5d26 | 1736 | |
c1a54c05 | 1737 | Apply a route-map on the neighbor. `direct` must be `in` or `out`. |
42fc5d26 | 1738 | |
29adcd50 | 1739 | .. clicmd:: bgp route-reflector allow-outbound-policy |
42fc5d26 | 1740 | |
c1a54c05 QY |
1741 | By default, attribute modification via route-map policy out is not reflected |
1742 | on reflected routes. This option allows the modifications to be reflected as | |
1743 | well. Once enabled, it affects all reflected routes. | |
42fc5d26 | 1744 | |
03750f1e | 1745 | .. clicmd:: neighbor PEER sender-as-path-loop-detection |
583a9fd4 RZ |
1746 | |
1747 | Enable the detection of sender side AS path loops and filter the | |
1748 | bad routes before they are sent. | |
1749 | ||
1750 | This setting is disabled by default. | |
1751 | ||
0efdf0fe | 1752 | .. _bgp-peer-group: |
42fc5d26 | 1753 | |
8fcedbd2 QY |
1754 | Peer Groups |
1755 | ^^^^^^^^^^^ | |
42fc5d26 | 1756 | |
199ad5c4 LB |
1757 | Peer groups are used to help improve scaling by generating the same |
1758 | update information to all members of a peer group. Note that this means | |
1759 | that the routes generated by a member of a peer group will be sent back | |
1760 | to that originating peer with the originator identifier attribute set to | |
1761 | indicated the originating peer. All peers not associated with a | |
1762 | specific peer group are treated as belonging to a default peer group, | |
1763 | and will share updates. | |
1764 | ||
c1a54c05 | 1765 | .. clicmd:: neighbor WORD peer-group |
42fc5d26 | 1766 | |
c1a54c05 | 1767 | This command defines a new peer group. |
42fc5d26 | 1768 | |
d7b9898c | 1769 | .. clicmd:: neighbor PEER peer-group PGNAME |
c3c5a71f | 1770 | |
c1a54c05 | 1771 | This command bind specific peer to peer group WORD. |
42fc5d26 | 1772 | |
199ad5c4 LB |
1773 | .. clicmd:: neighbor PEER solo |
1774 | ||
1775 | This command is used to indicate that routes advertised by the peer | |
1776 | should not be reflected back to the peer. This command only is only | |
1777 | meaningful when there is a single peer defined in the peer-group. | |
1778 | ||
65c0fc12 DA |
1779 | .. clicmd:: show [ip] bgp peer-group [json] |
1780 | ||
1781 | This command displays configured BGP peer-groups. | |
1782 | ||
1783 | .. code-block:: frr | |
1784 | ||
1785 | exit1-debian-9# show bgp peer-group | |
1786 | ||
1787 | BGP peer-group test1, remote AS 65001 | |
1788 | Peer-group type is external | |
1789 | Configured address-families: IPv4 Unicast; IPv6 Unicast; | |
1790 | 1 IPv4 listen range(s) | |
1791 | 192.168.100.0/24 | |
1792 | 2 IPv6 listen range(s) | |
1793 | 2001:db8:1::/64 | |
1794 | 2001:db8:2::/64 | |
1795 | Peer-group members: | |
1796 | 192.168.200.1 Active | |
1797 | 2001:db8::1 Active | |
1798 | ||
1799 | BGP peer-group test2 | |
1800 | Peer-group type is external | |
1801 | Configured address-families: IPv4 Unicast; | |
1802 | ||
1803 | Optional ``json`` parameter is used to display JSON output. | |
1804 | ||
1805 | .. code-block:: frr | |
1806 | ||
1807 | { | |
1808 | "test1":{ | |
1809 | "remoteAs":65001, | |
1810 | "type":"external", | |
1811 | "addressFamiliesConfigured":[ | |
1812 | "IPv4 Unicast", | |
1813 | "IPv6 Unicast" | |
1814 | ], | |
1815 | "dynamicRanges":{ | |
1816 | "IPv4":{ | |
1817 | "count":1, | |
1818 | "ranges":[ | |
1819 | "192.168.100.0\/24" | |
1820 | ] | |
1821 | }, | |
1822 | "IPv6":{ | |
1823 | "count":2, | |
1824 | "ranges":[ | |
1825 | "2001:db8:1::\/64", | |
1826 | "2001:db8:2::\/64" | |
1827 | ] | |
1828 | } | |
1829 | }, | |
1830 | "members":{ | |
1831 | "192.168.200.1":{ | |
1832 | "status":"Active" | |
1833 | }, | |
1834 | "2001:db8::1":{ | |
1835 | "status":"Active" | |
1836 | } | |
1837 | } | |
1838 | }, | |
1839 | "test2":{ | |
1840 | "type":"external", | |
1841 | "addressFamiliesConfigured":[ | |
1842 | "IPv4 Unicast" | |
1843 | ] | |
1844 | } | |
1845 | } | |
1846 | ||
8fcedbd2 QY |
1847 | Capability Negotiation |
1848 | ^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 1849 | |
8fcedbd2 | 1850 | .. clicmd:: neighbor PEER strict-capability-match |
42fc5d26 | 1851 | |
c1a54c05 | 1852 | |
8fcedbd2 QY |
1853 | Strictly compares remote capabilities and local capabilities. If |
1854 | capabilities are different, send Unsupported Capability error then reset | |
1855 | connection. | |
42fc5d26 | 1856 | |
8fcedbd2 QY |
1857 | You may want to disable sending Capability Negotiation OPEN message optional |
1858 | parameter to the peer when remote peer does not implement Capability | |
1859 | Negotiation. Please use *dont-capability-negotiate* command to disable the | |
1860 | feature. | |
42fc5d26 | 1861 | |
03750f1e | 1862 | .. clicmd:: neighbor PEER dont-capability-negotiate |
42fc5d26 | 1863 | |
8fcedbd2 QY |
1864 | Suppress sending Capability Negotiation as OPEN message optional parameter |
1865 | to the peer. This command only affects the peer is configured other than | |
1866 | IPv4 unicast configuration. | |
42fc5d26 | 1867 | |
8fcedbd2 QY |
1868 | When remote peer does not have capability negotiation feature, remote peer |
1869 | will not send any capabilities at all. In that case, bgp configures the peer | |
1870 | with configured capabilities. | |
42fc5d26 | 1871 | |
8fcedbd2 QY |
1872 | You may prefer locally configured capabilities more than the negotiated |
1873 | capabilities even though remote peer sends capabilities. If the peer is | |
1874 | configured by *override-capability*, *bgpd* ignores received capabilities | |
1875 | then override negotiated capabilities with configured values. | |
42fc5d26 | 1876 | |
7cdc9530 DS |
1877 | Additionally the operator should be reminded that this feature fundamentally |
1878 | disables the ability to use widely deployed BGP features. BGP unnumbered, | |
1879 | hostname support, AS4, Addpath, Route Refresh, ORF, Dynamic Capabilities, | |
1880 | and graceful restart. | |
1881 | ||
8fcedbd2 | 1882 | .. clicmd:: neighbor PEER override-capability |
42fc5d26 | 1883 | |
c1a54c05 | 1884 | |
8fcedbd2 QY |
1885 | Override the result of Capability Negotiation with local configuration. |
1886 | Ignore remote peer's capability value. | |
42fc5d26 | 1887 | |
8fcedbd2 | 1888 | .. _bgp-as-path-access-lists: |
42fc5d26 | 1889 | |
8fcedbd2 QY |
1890 | AS Path Access Lists |
1891 | -------------------- | |
42fc5d26 QY |
1892 | |
1893 | AS path access list is user defined AS path. | |
1894 | ||
e6e62ee5 | 1895 | .. clicmd:: bgp as-path access-list WORD [seq (0-4294967295)] permit|deny LINE |
42fc5d26 | 1896 | |
c1a54c05 | 1897 | This command defines a new AS path access list. |
42fc5d26 | 1898 | |
b15e8360 | 1899 | .. clicmd:: show bgp as-path-access-list [json] |
42fc5d26 | 1900 | |
b15e8360 RW |
1901 | Display all BGP AS Path access lists. |
1902 | ||
1903 | If the ``json`` option is specified, output is displayed in JSON format. | |
1904 | ||
1905 | .. clicmd:: show bgp as-path-access-list WORD [json] | |
1906 | ||
1907 | Display the specified BGP AS Path access list. | |
1908 | ||
1909 | If the ``json`` option is specified, output is displayed in JSON format. | |
42fc5d26 | 1910 | |
125cec1a DA |
1911 | .. _bgp-bogon-filter-example: |
1912 | ||
1913 | Bogon ASN filter policy configuration example | |
1914 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1915 | ||
1916 | .. code-block:: frr | |
1917 | ||
1918 | bgp as-path access-list 99 permit _0_ | |
1919 | bgp as-path access-list 99 permit _23456_ | |
1920 | bgp as-path access-list 99 permit _1310[0-6][0-9]_|_13107[0-1]_ | |
e6e62ee5 | 1921 | bgp as-path access-list 99 seq 20 permit ^65 |
125cec1a | 1922 | |
8fcedbd2 | 1923 | .. _bgp-using-as-path-in-route-map: |
42fc5d26 QY |
1924 | |
1925 | Using AS Path in Route Map | |
1926 | -------------------------- | |
1927 | ||
03750f1e | 1928 | .. clicmd:: match as-path WORD |
42fc5d26 | 1929 | |
eb1f303d DS |
1930 | For a given as-path, WORD, match it on the BGP as-path given for the prefix |
1931 | and if it matches do normal route-map actions. The no form of the command | |
1932 | removes this match from the route-map. | |
42fc5d26 | 1933 | |
03750f1e | 1934 | .. clicmd:: set as-path prepend AS-PATH |
42fc5d26 | 1935 | |
eb1f303d DS |
1936 | Prepend the given string of AS numbers to the AS_PATH of the BGP path's NLRI. |
1937 | The no form of this command removes this set operation from the route-map. | |
42fc5d26 | 1938 | |
03750f1e | 1939 | .. clicmd:: set as-path prepend last-as NUM |
c1a54c05 QY |
1940 | |
1941 | Prepend the existing last AS number (the leftmost ASN) to the AS_PATH. | |
eb1f303d | 1942 | The no form of this command removes this set operation from the route-map. |
42fc5d26 | 1943 | |
0efdf0fe | 1944 | .. _bgp-communities-attribute: |
42fc5d26 | 1945 | |
8fcedbd2 QY |
1946 | Communities Attribute |
1947 | --------------------- | |
42fc5d26 | 1948 | |
8fcedbd2 | 1949 | The BGP communities attribute is widely used for implementing policy routing. |
c1a54c05 QY |
1950 | Network operators can manipulate BGP communities attribute based on their |
1951 | network policy. BGP communities attribute is defined in :rfc:`1997` and | |
1952 | :rfc:`1998`. It is an optional transitive attribute, therefore local policy can | |
1953 | travel through different autonomous system. | |
1954 | ||
8fcedbd2 QY |
1955 | The communities attribute is a set of communities values. Each community value |
1956 | is 4 octet long. The following format is used to define the community value. | |
c1a54c05 | 1957 | |
8fcedbd2 | 1958 | ``AS:VAL`` |
c1a54c05 QY |
1959 | This format represents 4 octet communities value. ``AS`` is high order 2 |
1960 | octet in digit format. ``VAL`` is low order 2 octet in digit format. This | |
1961 | format is useful to define AS oriented policy value. For example, | |
1962 | ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to | |
1963 | neighboring peer. | |
1964 | ||
8fcedbd2 QY |
1965 | ``internet`` |
1966 | ``internet`` represents well-known communities value 0. | |
c1a54c05 | 1967 | |
cae770d3 C |
1968 | ``graceful-shutdown`` |
1969 | ``graceful-shutdown`` represents well-known communities value | |
1970 | ``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements | |
1971 | the purpose Graceful BGP Session Shutdown to reduce the amount of | |
56f0bea7 | 1972 | lost traffic when taking BGP sessions down for maintenance. The use |
cae770d3 C |
1973 | of the community needs to be supported from your peers side to |
1974 | actually have any effect. | |
1975 | ||
1976 | ``accept-own`` | |
1977 | ``accept-own`` represents well-known communities value ``ACCEPT_OWN`` | |
1978 | ``0xFFFF0001`` ``65535:1``. :rfc:`7611` implements a way to signal | |
1979 | to a router to accept routes with a local nexthop address. This | |
1980 | can be the case when doing policing and having traffic having a | |
1981 | nexthop located in another VRF but still local interface to the | |
1982 | router. It is recommended to read the RFC for full details. | |
1983 | ||
1984 | ``route-filter-translated-v4`` | |
1985 | ``route-filter-translated-v4`` represents well-known communities value | |
1986 | ``ROUTE_FILTER_TRANSLATED_v4`` ``0xFFFF0002`` ``65535:2``. | |
1987 | ||
1988 | ``route-filter-v4`` | |
1989 | ``route-filter-v4`` represents well-known communities value | |
1990 | ``ROUTE_FILTER_v4`` ``0xFFFF0003`` ``65535:3``. | |
1991 | ||
1992 | ``route-filter-translated-v6`` | |
1993 | ``route-filter-translated-v6`` represents well-known communities value | |
1994 | ``ROUTE_FILTER_TRANSLATED_v6`` ``0xFFFF0004`` ``65535:4``. | |
1995 | ||
1996 | ``route-filter-v6`` | |
1997 | ``route-filter-v6`` represents well-known communities value | |
1998 | ``ROUTE_FILTER_v6`` ``0xFFFF0005`` ``65535:5``. | |
1999 | ||
2000 | ``llgr-stale`` | |
2001 | ``llgr-stale`` represents well-known communities value ``LLGR_STALE`` | |
2002 | ``0xFFFF0006`` ``65535:6``. | |
56f0bea7 | 2003 | Assigned and intended only for use with routers supporting the |
cae770d3 | 2004 | Long-lived Graceful Restart Capability as described in |
49606d58 | 2005 | [Draft-IETF-uttaro-idr-bgp-persistence]_. |
56f0bea7 | 2006 | Routers receiving routes with this community may (depending on |
cae770d3 C |
2007 | implementation) choose allow to reject or modify routes on the |
2008 | presence or absence of this community. | |
2009 | ||
2010 | ``no-llgr`` | |
2011 | ``no-llgr`` represents well-known communities value ``NO_LLGR`` | |
2012 | ``0xFFFF0007`` ``65535:7``. | |
56f0bea7 | 2013 | Assigned and intended only for use with routers supporting the |
cae770d3 | 2014 | Long-lived Graceful Restart Capability as described in |
49606d58 | 2015 | [Draft-IETF-uttaro-idr-bgp-persistence]_. |
56f0bea7 | 2016 | Routers receiving routes with this community may (depending on |
cae770d3 C |
2017 | implementation) choose allow to reject or modify routes on the |
2018 | presence or absence of this community. | |
2019 | ||
2020 | ``accept-own-nexthop`` | |
2021 | ``accept-own-nexthop`` represents well-known communities value | |
2022 | ``accept-own-nexthop`` ``0xFFFF0008`` ``65535:8``. | |
49606d58 | 2023 | [Draft-IETF-agrewal-idr-accept-own-nexthop]_ describes |
cae770d3 C |
2024 | how to tag and label VPN routes to be able to send traffic between VRFs |
2025 | via an internal layer 2 domain on the same PE device. Refer to | |
49606d58 | 2026 | [Draft-IETF-agrewal-idr-accept-own-nexthop]_ for full details. |
cae770d3 C |
2027 | |
2028 | ``blackhole`` | |
2029 | ``blackhole`` represents well-known communities value ``BLACKHOLE`` | |
2030 | ``0xFFFF029A`` ``65535:666``. :rfc:`7999` documents sending prefixes to | |
2031 | EBGP peers and upstream for the purpose of blackholing traffic. | |
2032 | Prefixes tagged with the this community should normally not be | |
10ae708b DA |
2033 | re-advertised from neighbors of the originating network. Upon receiving |
2034 | ``BLACKHOLE`` community from a BGP speaker, ``NO_ADVERTISE`` community | |
2035 | is added automatically. | |
cae770d3 | 2036 | |
8fcedbd2 | 2037 | ``no-export`` |
c1a54c05 QY |
2038 | ``no-export`` represents well-known communities value ``NO_EXPORT`` |
2039 | ``0xFFFFFF01``. All routes carry this value must not be advertised to | |
2040 | outside a BGP confederation boundary. If neighboring BGP peer is part of BGP | |
2041 | confederation, the peer is considered as inside a BGP confederation | |
2042 | boundary, so the route will be announced to the peer. | |
2043 | ||
8fcedbd2 | 2044 | ``no-advertise`` |
c1a54c05 QY |
2045 | ``no-advertise`` represents well-known communities value ``NO_ADVERTISE`` |
2046 | ``0xFFFFFF02``. All routes carry this value must not be advertise to other | |
2047 | BGP peers. | |
2048 | ||
8fcedbd2 | 2049 | ``local-AS`` |
c1a54c05 QY |
2050 | ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED`` |
2051 | ``0xFFFFFF03``. All routes carry this value must not be advertised to | |
2052 | external BGP peers. Even if the neighboring router is part of confederation, | |
2053 | it is considered as external BGP peer, so the route will not be announced to | |
2054 | the peer. | |
2055 | ||
cae770d3 C |
2056 | ``no-peer`` |
2057 | ``no-peer`` represents well-known communities value ``NOPEER`` | |
2058 | ``0xFFFFFF04`` ``65535:65284``. :rfc:`3765` is used to communicate to | |
2059 | another network how the originating network want the prefix propagated. | |
2060 | ||
aa9eafa4 QY |
2061 | When the communities attribute is received duplicate community values in the |
2062 | attribute are ignored and value is sorted in numerical order. | |
42fc5d26 | 2063 | |
49606d58 PG |
2064 | .. [Draft-IETF-uttaro-idr-bgp-persistence] <https://tools.ietf.org/id/draft-uttaro-idr-bgp-persistence-04.txt> |
2065 | .. [Draft-IETF-agrewal-idr-accept-own-nexthop] <https://tools.ietf.org/id/draft-agrewal-idr-accept-own-nexthop-00.txt> | |
2066 | ||
0efdf0fe | 2067 | .. _bgp-community-lists: |
42fc5d26 | 2068 | |
8fcedbd2 QY |
2069 | Community Lists |
2070 | ^^^^^^^^^^^^^^^ | |
aa9eafa4 QY |
2071 | Community lists are user defined lists of community attribute values. These |
2072 | lists can be used for matching or manipulating the communities attribute in | |
2073 | UPDATE messages. | |
42fc5d26 | 2074 | |
aa9eafa4 | 2075 | There are two types of community list: |
c1a54c05 | 2076 | |
aa9eafa4 | 2077 | standard |
56f0bea7 | 2078 | This type accepts an explicit value for the attribute. |
aa9eafa4 QY |
2079 | |
2080 | expanded | |
2081 | This type accepts a regular expression. Because the regex must be | |
2082 | interpreted on each use expanded community lists are slower than standard | |
2083 | lists. | |
42fc5d26 | 2084 | |
a64e0ee5 | 2085 | .. clicmd:: bgp community-list standard NAME permit|deny COMMUNITY |
42fc5d26 | 2086 | |
aa9eafa4 QY |
2087 | This command defines a new standard community list. ``COMMUNITY`` is |
2088 | communities value. The ``COMMUNITY`` is compiled into community structure. | |
2089 | We can define multiple community list under same name. In that case match | |
2090 | will happen user defined order. Once the community list matches to | |
2091 | communities attribute in BGP updates it return permit or deny by the | |
2092 | community list definition. When there is no matched entry, deny will be | |
2093 | returned. When ``COMMUNITY`` is empty it matches to any routes. | |
42fc5d26 | 2094 | |
a64e0ee5 | 2095 | .. clicmd:: bgp community-list expanded NAME permit|deny COMMUNITY |
42fc5d26 | 2096 | |
aa9eafa4 QY |
2097 | This command defines a new expanded community list. ``COMMUNITY`` is a |
2098 | string expression of communities attribute. ``COMMUNITY`` can be a regular | |
2099 | expression (:ref:`bgp-regular-expressions`) to match the communities | |
47f47873 PG |
2100 | attribute in BGP updates. The expanded community is only used to filter, |
2101 | not `set` actions. | |
42fc5d26 | 2102 | |
aa9eafa4 QY |
2103 | .. deprecated:: 5.0 |
2104 | It is recommended to use the more explicit versions of this command. | |
42fc5d26 | 2105 | |
a64e0ee5 | 2106 | .. clicmd:: bgp community-list NAME permit|deny COMMUNITY |
aa9eafa4 QY |
2107 | |
2108 | When the community list type is not specified, the community list type is | |
2109 | automatically detected. If ``COMMUNITY`` can be compiled into communities | |
2110 | attribute, the community list is defined as a standard community list. | |
2111 | Otherwise it is defined as an expanded community list. This feature is left | |
2112 | for backward compatibility. Use of this feature is not recommended. | |
42fc5d26 | 2113 | |
03750f1e QY |
2114 | Note that all community lists share the same namespace, so it's not |
2115 | necessary to specify ``standard`` or ``expanded``; these modifiers are | |
2116 | purely aesthetic. | |
42fc5d26 | 2117 | |
36dc43aa | 2118 | .. clicmd:: show bgp community-list [NAME detail] |
42fc5d26 | 2119 | |
aa9eafa4 QY |
2120 | Displays community list information. When ``NAME`` is specified the |
2121 | specified community list's information is shown. | |
c3c5a71f | 2122 | |
c1a54c05 | 2123 | :: |
76bd1499 | 2124 | |
a64e0ee5 | 2125 | # show bgp community-list |
c1a54c05 QY |
2126 | Named Community standard list CLIST |
2127 | permit 7675:80 7675:100 no-export | |
2128 | deny internet | |
2129 | Named Community expanded list EXPAND | |
2130 | permit : | |
76bd1499 | 2131 | |
36dc43aa | 2132 | # show bgp community-list CLIST detail |
c1a54c05 QY |
2133 | Named Community standard list CLIST |
2134 | permit 7675:80 7675:100 no-export | |
2135 | deny internet | |
42fc5d26 | 2136 | |
42fc5d26 | 2137 | |
8fcedbd2 | 2138 | .. _bgp-numbered-community-lists: |
42fc5d26 | 2139 | |
8fcedbd2 QY |
2140 | Numbered Community Lists |
2141 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 QY |
2142 | |
2143 | When number is used for BGP community list name, the number has | |
c3c5a71f QY |
2144 | special meanings. Community list number in the range from 1 and 99 is |
2145 | standard community list. Community list number in the range from 100 | |
2146 | to 199 is expanded community list. These community lists are called | |
2147 | as numbered community lists. On the other hand normal community lists | |
42fc5d26 QY |
2148 | is called as named community lists. |
2149 | ||
a64e0ee5 | 2150 | .. clicmd:: bgp community-list (1-99) permit|deny COMMUNITY |
42fc5d26 | 2151 | |
aa9eafa4 QY |
2152 | This command defines a new community list. The argument to (1-99) defines |
2153 | the list identifier. | |
42fc5d26 | 2154 | |
a64e0ee5 | 2155 | .. clicmd:: bgp community-list (100-199) permit|deny COMMUNITY |
42fc5d26 | 2156 | |
aa9eafa4 QY |
2157 | This command defines a new expanded community list. The argument to |
2158 | (100-199) defines the list identifier. | |
42fc5d26 | 2159 | |
6a89dd1e DA |
2160 | .. _bgp-community-alias: |
2161 | ||
2162 | Community alias | |
2163 | ^^^^^^^^^^^^^^^ | |
2164 | ||
2165 | BGP community aliases are useful to quickly identify what communities are set | |
2166 | for a specific prefix in a human-readable format. Especially handy for a huge | |
2167 | amount of communities. Accurately defined aliases can help you faster spot | |
2168 | things on the wire. | |
2169 | ||
2170 | .. clicmd:: bgp community alias NAME ALIAS | |
2171 | ||
2172 | This command creates an alias name for a community that will be used | |
2173 | later in various CLI outputs in a human-readable format. | |
2174 | ||
2175 | .. code-block:: frr | |
2176 | ||
2177 | ~# vtysh -c 'show run' | grep 'bgp community alias' | |
2178 | bgp community alias 65001:14 community-1 | |
2179 | bgp community alias 65001:123:1 lcommunity-1 | |
2180 | ||
2181 | ~# vtysh -c 'show ip bgp 172.16.16.1/32' | |
2182 | BGP routing table entry for 172.16.16.1/32, version 21 | |
2183 | Paths: (2 available, best #2, table default) | |
2184 | Advertised to non peer-group peers: | |
2185 | 65030 | |
2186 | 192.168.0.2 from 192.168.0.2 (172.16.16.1) | |
2187 | Origin incomplete, metric 0, valid, external, best (Neighbor IP) | |
2188 | Community: 65001:12 65001:13 community-1 65001:65534 | |
2189 | Large Community: lcommunity-1 65001:123:2 | |
2190 | Last update: Fri Apr 16 12:51:27 2021 | |
2191 | ||
9f977b2d DA |
2192 | .. clicmd:: show bgp [afi] [safi] [all] alias WORD [wide|json] |
2193 | ||
2194 | Display prefixes with matching BGP community alias. | |
2195 | ||
8fcedbd2 | 2196 | .. _bgp-using-communities-in-route-map: |
42fc5d26 | 2197 | |
8fcedbd2 QY |
2198 | Using Communities in Route Maps |
2199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 2200 | |
aa9eafa4 QY |
2201 | In :ref:`route-map` we can match on or set the BGP communities attribute. Using |
2202 | this feature network operator can implement their network policy based on BGP | |
2203 | communities attribute. | |
42fc5d26 | 2204 | |
b91bf5bd | 2205 | The following commands can be used in route maps: |
42fc5d26 | 2206 | |
80dd0954 DA |
2207 | .. clicmd:: match alias WORD |
2208 | ||
2209 | This command performs match to BGP updates using community alias WORD. When | |
2210 | the one of BGP communities value match to the one of community alias value in | |
2211 | community alias, it is match. | |
2212 | ||
aa9eafa4 | 2213 | .. clicmd:: match community WORD exact-match [exact-match] |
42fc5d26 | 2214 | |
c1a54c05 QY |
2215 | This command perform match to BGP updates using community list WORD. When |
2216 | the one of BGP communities value match to the one of communities value in | |
d1e7591e | 2217 | community list, it is match. When `exact-match` keyword is specified, match |
c1a54c05 QY |
2218 | happen only when BGP updates have completely same communities value |
2219 | specified in the community list. | |
42fc5d26 | 2220 | |
aa9eafa4 | 2221 | .. clicmd:: set community <none|COMMUNITY> additive |
42fc5d26 | 2222 | |
aa9eafa4 QY |
2223 | This command sets the community value in BGP updates. If the attribute is |
2224 | already configured, the newly provided value replaces the old one unless the | |
2225 | ``additive`` keyword is specified, in which case the new value is appended | |
2226 | to the existing value. | |
42fc5d26 | 2227 | |
aa9eafa4 QY |
2228 | If ``none`` is specified as the community value, the communities attribute |
2229 | is not sent. | |
42fc5d26 | 2230 | |
47f47873 PG |
2231 | It is not possible to set an expanded community list. |
2232 | ||
29adcd50 | 2233 | .. clicmd:: set comm-list WORD delete |
c1a54c05 | 2234 | |
aa9eafa4 QY |
2235 | This command remove communities value from BGP communities attribute. The |
2236 | ``word`` is community list name. When BGP route's communities value matches | |
2237 | to the community list ``word``, the communities value is removed. When all | |
2238 | of communities value is removed eventually, the BGP update's communities | |
2239 | attribute is completely removed. | |
42fc5d26 | 2240 | |
8fcedbd2 | 2241 | .. _bgp-communities-example: |
c1a54c05 | 2242 | |
8fcedbd2 QY |
2243 | Example Configuration |
2244 | ^^^^^^^^^^^^^^^^^^^^^ | |
9eb95b3b | 2245 | |
8fcedbd2 QY |
2246 | The following configuration is exemplary of the most typical usage of BGP |
2247 | communities attribute. In the example, AS 7675 provides an upstream Internet | |
2248 | connection to AS 100. When the following configuration exists in AS 7675, the | |
2249 | network operator of AS 100 can set local preference in AS 7675 network by | |
2250 | setting BGP communities attribute to the updates. | |
9eb95b3b QY |
2251 | |
2252 | .. code-block:: frr | |
c1a54c05 QY |
2253 | |
2254 | router bgp 7675 | |
2255 | neighbor 192.168.0.1 remote-as 100 | |
2256 | address-family ipv4 unicast | |
2257 | neighbor 192.168.0.1 route-map RMAP in | |
2258 | exit-address-family | |
2259 | ! | |
a64e0ee5 DA |
2260 | bgp community-list 70 permit 7675:70 |
2261 | bgp community-list 70 deny | |
2262 | bgp community-list 80 permit 7675:80 | |
2263 | bgp community-list 80 deny | |
2264 | bgp community-list 90 permit 7675:90 | |
2265 | bgp community-list 90 deny | |
c1a54c05 QY |
2266 | ! |
2267 | route-map RMAP permit 10 | |
2268 | match community 70 | |
2269 | set local-preference 70 | |
2270 | ! | |
2271 | route-map RMAP permit 20 | |
2272 | match community 80 | |
2273 | set local-preference 80 | |
2274 | ! | |
2275 | route-map RMAP permit 30 | |
2276 | match community 90 | |
2277 | set local-preference 90 | |
c3c5a71f | 2278 | |
42fc5d26 | 2279 | |
8fcedbd2 QY |
2280 | The following configuration announces ``10.0.0.0/8`` from AS 100 to AS 7675. |
2281 | The route has communities value ``7675:80`` so when above configuration exists | |
2282 | in AS 7675, the announced routes' local preference value will be set to 80. | |
9eb95b3b QY |
2283 | |
2284 | .. code-block:: frr | |
c1a54c05 QY |
2285 | |
2286 | router bgp 100 | |
2287 | network 10.0.0.0/8 | |
2288 | neighbor 192.168.0.2 remote-as 7675 | |
2289 | address-family ipv4 unicast | |
2290 | neighbor 192.168.0.2 route-map RMAP out | |
2291 | exit-address-family | |
2292 | ! | |
2293 | ip prefix-list PLIST permit 10.0.0.0/8 | |
2294 | ! | |
2295 | route-map RMAP permit 10 | |
2296 | match ip address prefix-list PLIST | |
2297 | set community 7675:80 | |
c3c5a71f | 2298 | |
42fc5d26 | 2299 | |
8fcedbd2 QY |
2300 | The following configuration is an example of BGP route filtering using |
2301 | communities attribute. This configuration only permit BGP routes which has BGP | |
2302 | communities value ``0:80`` or ``0:90``. The network operator can set special | |
2303 | internal communities value at BGP border router, then limit the BGP route | |
2304 | announcements into the internal network. | |
9eb95b3b QY |
2305 | |
2306 | .. code-block:: frr | |
42fc5d26 | 2307 | |
c1a54c05 QY |
2308 | router bgp 7675 |
2309 | neighbor 192.168.0.1 remote-as 100 | |
2310 | address-family ipv4 unicast | |
2311 | neighbor 192.168.0.1 route-map RMAP in | |
2312 | exit-address-family | |
2313 | ! | |
a64e0ee5 | 2314 | bgp community-list 1 permit 0:80 0:90 |
c1a54c05 QY |
2315 | ! |
2316 | route-map RMAP permit in | |
2317 | match community 1 | |
c3c5a71f | 2318 | |
42fc5d26 | 2319 | |
8fcedbd2 QY |
2320 | The following example filters BGP routes which have a community value of |
2321 | ``1:1``. When there is no match community-list returns ``deny``. To avoid | |
2322 | filtering all routes, a ``permit`` line is set at the end of the | |
2323 | community-list. | |
9eb95b3b QY |
2324 | |
2325 | .. code-block:: frr | |
42fc5d26 | 2326 | |
c1a54c05 QY |
2327 | router bgp 7675 |
2328 | neighbor 192.168.0.1 remote-as 100 | |
2329 | address-family ipv4 unicast | |
2330 | neighbor 192.168.0.1 route-map RMAP in | |
2331 | exit-address-family | |
2332 | ! | |
a64e0ee5 DA |
2333 | bgp community-list standard FILTER deny 1:1 |
2334 | bgp community-list standard FILTER permit | |
c1a54c05 QY |
2335 | ! |
2336 | route-map RMAP permit 10 | |
2337 | match community FILTER | |
c3c5a71f | 2338 | |
42fc5d26 | 2339 | |
8fcedbd2 QY |
2340 | The communities value keyword ``internet`` has special meanings in standard |
2341 | community lists. In the below example ``internet`` matches all BGP routes even | |
2342 | if the route does not have communities attribute at all. So community list | |
2343 | ``INTERNET`` is the same as ``FILTER`` in the previous example. | |
9eb95b3b QY |
2344 | |
2345 | .. code-block:: frr | |
42fc5d26 | 2346 | |
a64e0ee5 DA |
2347 | bgp community-list standard INTERNET deny 1:1 |
2348 | bgp community-list standard INTERNET permit internet | |
c3c5a71f | 2349 | |
42fc5d26 | 2350 | |
8fcedbd2 QY |
2351 | The following configuration is an example of communities value deletion. With |
2352 | this configuration the community values ``100:1`` and ``100:2`` are removed | |
2353 | from BGP updates. For communities value deletion, only ``permit`` | |
2354 | community-list is used. ``deny`` community-list is ignored. | |
9eb95b3b QY |
2355 | |
2356 | .. code-block:: frr | |
42fc5d26 | 2357 | |
c1a54c05 QY |
2358 | router bgp 7675 |
2359 | neighbor 192.168.0.1 remote-as 100 | |
2360 | address-family ipv4 unicast | |
2361 | neighbor 192.168.0.1 route-map RMAP in | |
2362 | exit-address-family | |
2363 | ! | |
a64e0ee5 | 2364 | bgp community-list standard DEL permit 100:1 100:2 |
c1a54c05 QY |
2365 | ! |
2366 | route-map RMAP permit 10 | |
2367 | set comm-list DEL delete | |
c3c5a71f | 2368 | |
42fc5d26 | 2369 | |
0efdf0fe | 2370 | .. _bgp-extended-communities-attribute: |
42fc5d26 | 2371 | |
8fcedbd2 QY |
2372 | Extended Communities Attribute |
2373 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 2374 | |
c1a54c05 QY |
2375 | BGP extended communities attribute is introduced with MPLS VPN/BGP technology. |
2376 | MPLS VPN/BGP expands capability of network infrastructure to provide VPN | |
2377 | functionality. At the same time it requires a new framework for policy routing. | |
2378 | With BGP Extended Communities Attribute we can use Route Target or Site of | |
2379 | Origin for implementing network policy for MPLS VPN/BGP. | |
42fc5d26 | 2380 | |
c1a54c05 QY |
2381 | BGP Extended Communities Attribute is similar to BGP Communities Attribute. It |
2382 | is an optional transitive attribute. BGP Extended Communities Attribute can | |
2383 | carry multiple Extended Community value. Each Extended Community value is | |
2384 | eight octet length. | |
42fc5d26 | 2385 | |
c1a54c05 QY |
2386 | BGP Extended Communities Attribute provides an extended range compared with BGP |
2387 | Communities Attribute. Adding to that there is a type field in each value to | |
2388 | provides community space structure. | |
42fc5d26 | 2389 | |
c1a54c05 QY |
2390 | There are two format to define Extended Community value. One is AS based format |
2391 | the other is IP address based format. | |
42fc5d26 | 2392 | |
8fcedbd2 QY |
2393 | ``AS:VAL`` |
2394 | This is a format to define AS based Extended Community value. ``AS`` part | |
2395 | is 2 octets Global Administrator subfield in Extended Community value. | |
2396 | ``VAL`` part is 4 octets Local Administrator subfield. ``7675:100`` | |
2397 | represents AS 7675 policy value 100. | |
42fc5d26 | 2398 | |
8fcedbd2 | 2399 | ``IP-Address:VAL`` |
c1a54c05 | 2400 | This is a format to define IP address based Extended Community value. |
8fcedbd2 QY |
2401 | ``IP-Address`` part is 4 octets Global Administrator subfield. ``VAL`` part |
2402 | is 2 octets Local Administrator subfield. | |
42fc5d26 | 2403 | |
0efdf0fe | 2404 | .. _bgp-extended-community-lists: |
42fc5d26 | 2405 | |
8fcedbd2 QY |
2406 | Extended Community Lists |
2407 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 2408 | |
a64e0ee5 | 2409 | .. clicmd:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY |
42fc5d26 | 2410 | |
4da7fda3 QY |
2411 | This command defines a new standard extcommunity-list. `extcommunity` is |
2412 | extended communities value. The `extcommunity` is compiled into extended | |
2413 | community structure. We can define multiple extcommunity-list under same | |
2414 | name. In that case match will happen user defined order. Once the | |
2415 | extcommunity-list matches to extended communities attribute in BGP updates | |
2416 | it return permit or deny based upon the extcommunity-list definition. When | |
2417 | there is no matched entry, deny will be returned. When `extcommunity` is | |
2418 | empty it matches to any routes. | |
42fc5d26 | 2419 | |
a64e0ee5 | 2420 | .. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE |
42fc5d26 | 2421 | |
4da7fda3 QY |
2422 | This command defines a new expanded extcommunity-list. `line` is a string |
2423 | expression of extended communities attribute. `line` can be a regular | |
2424 | expression (:ref:`bgp-regular-expressions`) to match an extended communities | |
2425 | attribute in BGP updates. | |
42fc5d26 | 2426 | |
03750f1e QY |
2427 | Note that all extended community lists shares a single name space, so it's |
2428 | not necessary to specify their type when creating or destroying them. | |
42fc5d26 | 2429 | |
03750f1e | 2430 | .. clicmd:: show bgp extcommunity-list [NAME detail] |
c1a54c05 | 2431 | |
4da7fda3 | 2432 | This command displays current extcommunity-list information. When `name` is |
03750f1e | 2433 | specified the community list's information is shown. |
c3c5a71f | 2434 | |
42fc5d26 | 2435 | |
0efdf0fe | 2436 | .. _bgp-extended-communities-in-route-map: |
42fc5d26 QY |
2437 | |
2438 | BGP Extended Communities in Route Map | |
8fcedbd2 | 2439 | """"""""""""""""""""""""""""""""""""" |
42fc5d26 | 2440 | |
29adcd50 | 2441 | .. clicmd:: match extcommunity WORD |
42fc5d26 | 2442 | |
29adcd50 | 2443 | .. clicmd:: set extcommunity rt EXTCOMMUNITY |
42fc5d26 | 2444 | |
c1a54c05 | 2445 | This command set Route Target value. |
42fc5d26 | 2446 | |
29adcd50 | 2447 | .. clicmd:: set extcommunity soo EXTCOMMUNITY |
c1a54c05 QY |
2448 | |
2449 | This command set Site of Origin value. | |
42fc5d26 | 2450 | |
ed647ed2 | 2451 | .. clicmd:: set extcommunity bandwidth <(1-25600) | cumulative | num-multipaths> [non-transitive] |
2452 | ||
2453 | This command sets the BGP link-bandwidth extended community for the prefix | |
2454 | (best path) for which it is applied. The link-bandwidth can be specified as | |
2455 | an ``explicit value`` (specified in Mbps), or the router can be told to use | |
2456 | the ``cumulative bandwidth`` of all multipaths for the prefix or to compute | |
2457 | it based on the ``number of multipaths``. The link bandwidth extended | |
2458 | community is encoded as ``transitive`` unless the set command explicitly | |
2459 | configures it as ``non-transitive``. | |
2460 | ||
2461 | .. seealso:: :ref:`wecmp_linkbw` | |
47f47873 PG |
2462 | |
2463 | Note that the extended expanded community is only used for `match` rule, not for | |
2464 | `set` actions. | |
2465 | ||
0efdf0fe | 2466 | .. _bgp-large-communities-attribute: |
42fc5d26 | 2467 | |
8fcedbd2 QY |
2468 | Large Communities Attribute |
2469 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 QY |
2470 | |
2471 | The BGP Large Communities attribute was introduced in Feb 2017 with | |
c1a54c05 | 2472 | :rfc:`8092`. |
42fc5d26 | 2473 | |
8fcedbd2 QY |
2474 | The BGP Large Communities Attribute is similar to the BGP Communities Attribute |
2475 | except that it has 3 components instead of two and each of which are 4 octets | |
2476 | in length. Large Communities bring additional functionality and convenience | |
2477 | over traditional communities, specifically the fact that the ``GLOBAL`` part | |
2478 | below is now 4 octets wide allowing seamless use in networks using 4-byte ASNs. | |
2479 | ||
2480 | ``GLOBAL:LOCAL1:LOCAL2`` | |
2481 | This is the format to define Large Community values. Referencing :rfc:`8195` | |
2482 | the values are commonly referred to as follows: | |
2483 | ||
2484 | - The ``GLOBAL`` part is a 4 octet Global Administrator field, commonly used | |
2485 | as the operators AS number. | |
2486 | - The ``LOCAL1`` part is a 4 octet Local Data Part 1 subfield referred to as | |
2487 | a function. | |
2488 | - The ``LOCAL2`` part is a 4 octet Local Data Part 2 field and referred to | |
2489 | as the parameter subfield. | |
2490 | ||
2491 | As an example, ``65551:1:10`` represents AS 65551 function 1 and parameter | |
2492 | 10. The referenced RFC above gives some guidelines on recommended usage. | |
42fc5d26 | 2493 | |
0efdf0fe | 2494 | .. _bgp-large-community-lists: |
42fc5d26 | 2495 | |
8fcedbd2 QY |
2496 | Large Community Lists |
2497 | """"""""""""""""""""" | |
42fc5d26 QY |
2498 | |
2499 | Two types of large community lists are supported, namely `standard` and | |
2500 | `expanded`. | |
2501 | ||
a64e0ee5 | 2502 | .. clicmd:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY |
42fc5d26 | 2503 | |
4da7fda3 QY |
2504 | This command defines a new standard large-community-list. `large-community` |
2505 | is the Large Community value. We can add multiple large communities under | |
2506 | same name. In that case the match will happen in the user defined order. | |
2507 | Once the large-community-list matches the Large Communities attribute in BGP | |
2508 | updates it will return permit or deny based upon the large-community-list | |
2509 | definition. When there is no matched entry, a deny will be returned. When | |
2510 | `large-community` is empty it matches any routes. | |
42fc5d26 | 2511 | |
a64e0ee5 | 2512 | .. clicmd:: bgp large-community-list expanded NAME permit|deny LINE |
42fc5d26 | 2513 | |
4da7fda3 QY |
2514 | This command defines a new expanded large-community-list. Where `line` is a |
2515 | string matching expression, it will be compared to the entire Large | |
2516 | Communities attribute as a string, with each large-community in order from | |
2517 | lowest to highest. `line` can also be a regular expression which matches | |
2518 | this Large Community attribute. | |
42fc5d26 | 2519 | |
03750f1e QY |
2520 | Note that all community lists share the same namespace, so it's not |
2521 | necessary to specify ``standard`` or ``expanded``; these modifiers are | |
2522 | purely aesthetic. | |
42fc5d26 | 2523 | |
a64e0ee5 | 2524 | .. clicmd:: show bgp large-community-list |
42fc5d26 | 2525 | |
36dc43aa | 2526 | .. clicmd:: show bgp large-community-list NAME detail |
42fc5d26 | 2527 | |
c1a54c05 QY |
2528 | This command display current large-community-list information. When |
2529 | `name` is specified the community list information is shown. | |
42fc5d26 | 2530 | |
29adcd50 | 2531 | .. clicmd:: show ip bgp large-community-info |
c1a54c05 QY |
2532 | |
2533 | This command displays the current large communities in use. | |
42fc5d26 | 2534 | |
0efdf0fe | 2535 | .. _bgp-large-communities-in-route-map: |
42fc5d26 | 2536 | |
8fcedbd2 QY |
2537 | Large Communities in Route Map |
2538 | """""""""""""""""""""""""""""" | |
42fc5d26 | 2539 | |
03ff9a14 | 2540 | .. clicmd:: match large-community LINE [exact-match] |
42fc5d26 | 2541 | |
4da7fda3 QY |
2542 | Where `line` can be a simple string to match, or a regular expression. It |
2543 | is very important to note that this match occurs on the entire | |
c1a54c05 | 2544 | large-community string as a whole, where each large-community is ordered |
03ff9a14 | 2545 | from lowest to highest. When `exact-match` keyword is specified, match |
2546 | happen only when BGP updates have completely same large communities value | |
2547 | specified in the large community list. | |
42fc5d26 | 2548 | |
29adcd50 | 2549 | .. clicmd:: set large-community LARGE-COMMUNITY |
42fc5d26 | 2550 | |
29adcd50 | 2551 | .. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY |
42fc5d26 | 2552 | |
29adcd50 | 2553 | .. clicmd:: set large-community LARGE-COMMUNITY additive |
c1a54c05 QY |
2554 | |
2555 | These commands are used for setting large-community values. The first | |
2556 | command will overwrite any large-communities currently present. | |
2557 | The second specifies two large-communities, which overwrites the current | |
2558 | large-community list. The third will add a large-community value without | |
2559 | overwriting other values. Multiple large-community values can be specified. | |
42fc5d26 | 2560 | |
47f47873 PG |
2561 | Note that the large expanded community is only used for `match` rule, not for |
2562 | `set` actions. | |
b572f826 | 2563 | |
c8a5e5e1 | 2564 | .. _bgp-l3vpn-vrfs: |
b572f826 | 2565 | |
c8a5e5e1 QY |
2566 | L3VPN VRFs |
2567 | ---------- | |
b572f826 | 2568 | |
c8a5e5e1 QY |
2569 | *bgpd* supports :abbr:`L3VPN (Layer 3 Virtual Private Networks)` :abbr:`VRFs |
2570 | (Virtual Routing and Forwarding)` for IPv4 :rfc:`4364` and IPv6 :rfc:`4659`. | |
2571 | L3VPN routes, and their associated VRF MPLS labels, can be distributed to VPN | |
2572 | SAFI neighbors in the *default*, i.e., non VRF, BGP instance. VRF MPLS labels | |
2573 | are reached using *core* MPLS labels which are distributed using LDP or BGP | |
2574 | labeled unicast. *bgpd* also supports inter-VRF route leaking. | |
b572f826 | 2575 | |
b572f826 | 2576 | |
c8a5e5e1 | 2577 | .. _bgp-vrf-route-leaking: |
8fcedbd2 QY |
2578 | |
2579 | VRF Route Leaking | |
c8a5e5e1 | 2580 | ----------------- |
8fcedbd2 QY |
2581 | |
2582 | BGP routes may be leaked (i.e. copied) between a unicast VRF RIB and the VPN | |
f90115c5 LB |
2583 | SAFI RIB of the default VRF for use in MPLS-based L3VPNs. Unicast routes may |
2584 | also be leaked between any VRFs (including the unicast RIB of the default BGP | |
2585 | instanced). A shortcut syntax is also available for specifying leaking from one | |
2586 | VRF to another VRF using the default instance's VPN RIB as the intemediary. A | |
2587 | common application of the VRF-VRF feature is to connect a customer's private | |
8fcedbd2 QY |
2588 | routing domain to a provider's VPN service. Leaking is configured from the |
2589 | point of view of an individual VRF: ``import`` refers to routes leaked from VPN | |
2590 | to a unicast VRF, whereas ``export`` refers to routes leaked from a unicast VRF | |
2591 | to VPN. | |
2592 | ||
2593 | Required parameters | |
c8a5e5e1 | 2594 | ^^^^^^^^^^^^^^^^^^^ |
b572f826 | 2595 | |
4da7fda3 QY |
2596 | Routes exported from a unicast VRF to the VPN RIB must be augmented by two |
2597 | parameters: | |
2598 | ||
2599 | - an :abbr:`RD (Route Distinguisher)` | |
2600 | - an :abbr:`RTLIST (Route-target List)` | |
2601 | ||
2602 | Configuration for these exported routes must, at a minimum, specify these two | |
2603 | parameters. | |
2604 | ||
2605 | Routes imported from the VPN RIB to a unicast VRF are selected according to | |
2606 | their RTLISTs. Routes whose RTLIST contains at least one route-target in | |
2607 | common with the configured import RTLIST are leaked. Configuration for these | |
2608 | imported routes must specify an RTLIST to be matched. | |
2609 | ||
2610 | The RD, which carries no semantic value, is intended to make the route unique | |
2611 | in the VPN RIB among all routes of its prefix that originate from all the | |
2612 | customers and sites that are attached to the provider's VPN service. | |
2613 | Accordingly, each site of each customer is typically assigned an RD that is | |
2614 | unique across the entire provider network. | |
2615 | ||
2616 | The RTLIST is a set of route-target extended community values whose purpose is | |
2617 | to specify route-leaking policy. Typically, a customer is assigned a single | |
2618 | route-target value for import and export to be used at all customer sites. This | |
2619 | configuration specifies a simple topology wherein a customer has a single | |
2620 | routing domain which is shared across all its sites. More complex routing | |
2621 | topologies are possible through use of additional route-targets to augment the | |
2622 | leaking of sets of routes in various ways. | |
b572f826 | 2623 | |
e967a1d0 DS |
2624 | When using the shortcut syntax for vrf-to-vrf leaking, the RD and RT are |
2625 | auto-derived. | |
fb3d9f3e | 2626 | |
8fcedbd2 | 2627 | General configuration |
c8a5e5e1 | 2628 | ^^^^^^^^^^^^^^^^^^^^^ |
b572f826 | 2629 | |
f90115c5 | 2630 | Configuration of route leaking between a unicast VRF RIB and the VPN SAFI RIB |
4da7fda3 QY |
2631 | of the default VRF is accomplished via commands in the context of a VRF |
2632 | address-family: | |
b572f826 | 2633 | |
b572f826 PZ |
2634 | .. clicmd:: rd vpn export AS:NN|IP:nn |
2635 | ||
4da7fda3 QY |
2636 | Specifies the route distinguisher to be added to a route exported from the |
2637 | current unicast VRF to VPN. | |
b572f826 | 2638 | |
b572f826 PZ |
2639 | .. clicmd:: rt vpn import|export|both RTLIST... |
2640 | ||
4da7fda3 QY |
2641 | Specifies the route-target list to be attached to a route (export) or the |
2642 | route-target list to match against (import) when exporting/importing between | |
2643 | the current unicast VRF and VPN. | |
b572f826 | 2644 | |
4da7fda3 QY |
2645 | The RTLIST is a space-separated list of route-targets, which are BGP |
2646 | extended community values as described in | |
b572f826 PZ |
2647 | :ref:`bgp-extended-communities-attribute`. |
2648 | ||
e70e9f8e | 2649 | .. clicmd:: label vpn export (0..1048575)|auto |
b572f826 | 2650 | |
8a2124f7 | 2651 | Enables an MPLS label to be attached to a route exported from the current |
2652 | unicast VRF to VPN. If the value specified is ``auto``, the label value is | |
2653 | automatically assigned from a pool maintained by the Zebra daemon. If Zebra | |
2654 | is not running, or if this command is not configured, automatic label | |
2655 | assignment will not complete, which will block corresponding route export. | |
b572f826 | 2656 | |
b572f826 PZ |
2657 | .. clicmd:: nexthop vpn export A.B.C.D|X:X::X:X |
2658 | ||
4da7fda3 QY |
2659 | Specifies an optional nexthop value to be assigned to a route exported from |
2660 | the current unicast VRF to VPN. If left unspecified, the nexthop will be set | |
2661 | to 0.0.0.0 or 0:0::0:0 (self). | |
b572f826 | 2662 | |
b572f826 PZ |
2663 | .. clicmd:: route-map vpn import|export MAP |
2664 | ||
4da7fda3 | 2665 | Specifies an optional route-map to be applied to routes imported or exported |
d1e7591e | 2666 | between the current unicast VRF and VPN. |
b572f826 | 2667 | |
b572f826 PZ |
2668 | .. clicmd:: import|export vpn |
2669 | ||
d1e7591e | 2670 | Enables import or export of routes between the current unicast VRF and VPN. |
b572f826 | 2671 | |
fb3d9f3e DS |
2672 | .. clicmd:: import vrf VRFNAME |
2673 | ||
e967a1d0 DS |
2674 | Shortcut syntax for specifying automatic leaking from vrf VRFNAME to |
2675 | the current VRF using the VPN RIB as intermediary. The RD and RT | |
2676 | are auto derived and should not be specified explicitly for either the | |
2677 | source or destination VRF's. | |
2678 | ||
2679 | This shortcut syntax mode is not compatible with the explicit | |
2680 | `import vpn` and `export vpn` statements for the two VRF's involved. | |
2681 | The CLI will disallow attempts to configure incompatible leaking | |
2682 | modes. | |
fb3d9f3e | 2683 | |
4ccd4033 HS |
2684 | .. _bgp-l3vpn-srv6: |
2685 | ||
2686 | L3VPN SRv6 | |
2687 | ---------- | |
2688 | ||
2689 | .. clicmd:: segment-routing srv6 | |
2690 | ||
2691 | Use SRv6 backend with BGP L3VPN, and go to its configuration node. | |
2692 | ||
2693 | .. clicmd:: locator NAME | |
2694 | ||
2695 | Specify the SRv6 locator to be used for SRv6 L3VPN. The Locator name must | |
2696 | be set in zebra, but user can set it in any order. | |
42fc5d26 | 2697 | |
b6c34e85 CS |
2698 | .. _bgp-evpn: |
2699 | ||
2700 | Ethernet Virtual Network - EVPN | |
2701 | ------------------------------- | |
2702 | ||
0a4e0034 JAG |
2703 | Note: When using EVPN features and if you have a large number of hosts, make |
2704 | sure to adjust the size of the arp neighbor cache to avoid neighbor table | |
2705 | overflow and/or excessive garbage collection. On Linux, the size of the table | |
2706 | and garbage collection frequency can be controlled via the following | |
2707 | sysctl configurations: | |
2708 | ||
2709 | .. code-block:: shell | |
2710 | ||
2711 | net.ipv4.neigh.default.gc_thresh1 | |
2712 | net.ipv4.neigh.default.gc_thresh2 | |
2713 | net.ipv4.neigh.default.gc_thresh3 | |
2714 | ||
2715 | net.ipv6.neigh.default.gc_thresh1 | |
2716 | net.ipv6.neigh.default.gc_thresh2 | |
2717 | net.ipv6.neigh.default.gc_thresh3 | |
2718 | ||
2719 | For more information, see ``man 7 arp``. | |
2720 | ||
b6c34e85 CS |
2721 | .. _bgp-evpn-advertise-pip: |
2722 | ||
2723 | EVPN advertise-PIP | |
2724 | ^^^^^^^^^^^^^^^^^^ | |
2725 | ||
2726 | In a EVPN symmetric routing MLAG deployment, all EVPN routes advertised | |
2727 | with anycast-IP as next-hop IP and anycast MAC as the Router MAC (RMAC - in | |
2728 | BGP EVPN Extended-Community). | |
2729 | EVPN picks up the next-hop IP from the VxLAN interface's local tunnel IP and | |
2730 | the RMAC is obtained from the MAC of the L3VNI's SVI interface. | |
2731 | Note: Next-hop IP is used for EVPN routes whether symmetric routing is | |
2732 | deployed or not but the RMAC is only relevant for symmetric routing scenario. | |
2733 | ||
2734 | Current behavior is not ideal for Prefix (type-5) and self (type-2) | |
2735 | routes. This is because the traffic from remote VTEPs routed sub optimally | |
2736 | if they land on the system where the route does not belong. | |
2737 | ||
2738 | The advertise-pip feature advertises Prefix (type-5) and self (type-2) | |
2739 | routes with system's individual (primary) IP as the next-hop and individual | |
2740 | (system) MAC as Router-MAC (RMAC), while leaving the behavior unchanged for | |
2741 | other EVPN routes. | |
2742 | ||
2743 | To support this feature there needs to have ability to co-exist a | |
2744 | (system-MAC, system-IP) pair with a (anycast-MAC, anycast-IP) pair with the | |
2745 | ability to terminate VxLAN-encapsulated packets received for either pair on | |
0a4e0034 | 2746 | the same L3VNI (i.e associated VLAN). This capability is needed per tenant |
b6c34e85 CS |
2747 | VRF instance. |
2748 | ||
0a4e0034 | 2749 | To derive the system-MAC and the anycast MAC, there must be a |
b6c34e85 CS |
2750 | separate/additional MAC-VLAN interface corresponding to L3VNI’s SVI. |
2751 | The SVI interface’s MAC address can be interpreted as system-MAC | |
2752 | and MAC-VLAN interface's MAC as anycast MAC. | |
2753 | ||
2754 | To derive system-IP and anycast-IP, the default BGP instance's router-id is used | |
2755 | as system-IP and the VxLAN interface’s local tunnel IP as the anycast-IP. | |
2756 | ||
2757 | User has an option to configure the system-IP and/or system-MAC value if the | |
2758 | auto derived value is not preferred. | |
2759 | ||
2760 | Note: By default, advertise-pip feature is enabled and user has an option to | |
0a4e0034 | 2761 | disable the feature via configuration CLI. Once the feature is disabled under |
b6c34e85 CS |
2762 | bgp vrf instance or MAC-VLAN interface is not configured, all the routes follow |
2763 | the same behavior of using same next-hop and RMAC values. | |
2764 | ||
03750f1e | 2765 | .. clicmd:: advertise-pip [ip <addr> [mac <addr>]] |
b6c34e85 CS |
2766 | |
2767 | Enables or disables advertise-pip feature, specifiy system-IP and/or system-MAC | |
2768 | parameters. | |
2769 | ||
a927f5bc JAG |
2770 | EVPN advertise-svi-ip |
2771 | ^^^^^^^^^^^^^^^^^^^^^ | |
0a4e0034 | 2772 | Typically, the SVI IP address is reused on VTEPs across multiple racks. However, |
a927f5bc | 2773 | if you have unique SVI IP addresses that you want to be reachable you can use the |
0a4e0034 JAG |
2774 | advertise-svi-ip option. This option advertises the SVI IP/MAC address as a type-2 |
2775 | route and eliminates the need for any flooding over VXLAN to reach the IP from a | |
2776 | remote VTEP. | |
2777 | ||
a927f5bc | 2778 | .. clicmd:: advertise-svi-ip |
0a4e0034 JAG |
2779 | |
2780 | Note that you should not enable both the advertise-svi-ip and the advertise-default-gw | |
2781 | at the same time. | |
2782 | ||
40f4507d AD |
2783 | .. _bgp-evpn-overlay-index-gateway-ip: |
2784 | ||
2785 | EVPN Overlay Index Gateway IP | |
2786 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
2787 | Draft https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement-11 | |
2788 | explains the use of overlay indexes for recursive route resolution for EVPN | |
2789 | type-5 route. | |
2790 | ||
2791 | We support gateway IP overlay index. | |
2792 | A gateway IP, advertised with EVPN prefix route, is used to find an EVPN MAC/IP | |
2793 | route with its IP field same as the gateway IP. This MAC/IP entry provides the | |
2794 | nexthop VTEP and the tunnel information required for the VxLAN encapsulation. | |
2795 | ||
2796 | Functionality: | |
2797 | ||
2798 | :: | |
2799 | ||
2800 | . +--------+ BGP +--------+ BGP +--------+ +--------+ | |
2801 | SN1 | | IPv4 | | EVPN | | | | | |
2802 | ======+ Host1 +------+ PE1 +------+ PE2 +------+ Host2 + | |
2803 | | | | | | | | | | |
2804 | +--------+ +--------+ +--------+ +--------+ | |
2805 | ||
2806 | Consider above topology where prefix SN1 is connected behind host1. Host1 | |
2807 | advertises SN1 to PE1 over BGP IPv4 session. PE1 advertises SN1 to PE2 using | |
2808 | EVPN type-5 route with host1 IP as the gateway IP. PE1 also advertises | |
2809 | Host1 MAC/IP as type-2 route which is used to resolve host1 gateway IP. | |
2810 | ||
2811 | PE2 receives this type-5 route and imports it into the vrf based on route | |
2812 | targets. BGP prefix imported into the vrf uses gateway IP as its BGP nexthop. | |
2813 | This route is installed into zebra if following conditions are satisfied: | |
7aa6fb2d | 2814 | |
40f4507d AD |
2815 | 1. Gateway IP nexthop is L3 reachable. |
2816 | 2. PE2 has received EVPN type-2 route with IP field set to gateway IP. | |
2817 | ||
2818 | Topology requirements: | |
7aa6fb2d | 2819 | |
40f4507d AD |
2820 | 1. This feature is supported for asymmetric routing model only. While |
2821 | sending packets to SN1, ingress PE (PE2) performs routing and | |
2822 | egress PE (PE1) performs only bridging. | |
2823 | 2. This feature supports only tratitional(non vlan-aware) bridge model. Bridge | |
2824 | interface associated with L2VNI is an L3 interface. i.e., this interface is | |
2825 | configured with an address in the L2VNI subnet. Note that the gateway IP | |
2826 | should also have an address in the same subnet. | |
2827 | 3. As this feature works in asymmetric routing model, all L2VNIs and corresponding | |
2828 | VxLAN and bridge interfaces should be present at all the PEs. | |
2829 | 4. L3VNI configuration is required to generate and import EVPN type-5 routes. | |
2830 | L3VNI VxLAN and bridge interfaces also should be present. | |
2831 | ||
2832 | A PE can use one of the following two mechanisms to advertise an EVPN type-5 | |
2833 | route with gateway IP. | |
2834 | ||
2835 | 1. CLI to add gateway IP while generating EVPN type-5 route from a BGP IPv4/IPv6 | |
2836 | prefix: | |
2837 | ||
5c54512e | 2838 | .. clicmd:: advertise <ipv4|ipv6> unicast [gateway-ip] |
40f4507d AD |
2839 | |
2840 | When this CLI is configured for a BGP vrf under L2VPN EVPN address family, EVPN | |
2841 | type-5 routes are generated for BGP prefixes in the vrf. Nexthop of the BGP | |
2842 | prefix becomes the gateway IP of the corresponding type-5 route. | |
2843 | ||
2844 | If the above command is configured without the "gateway-ip" keyword, type-5 | |
2845 | routes are generated without overlay index. | |
2846 | ||
2847 | 2. Add gateway IP to EVPN type-5 route using a route-map: | |
2848 | ||
5c54512e | 2849 | .. clicmd:: set evpn gateway-ip <ipv4|ipv6> <addr> |
40f4507d AD |
2850 | |
2851 | When route-map with above set clause is applied as outbound policy in BGP, it | |
2852 | will set the gateway-ip in EVPN type-5 NLRI. | |
2853 | ||
2854 | Example configuration: | |
2855 | ||
2856 | .. code-block:: frr | |
2857 | ||
2858 | router bgp 100 | |
2859 | neighbor 192.168.0.1 remote-as 101 | |
2860 | ! | |
2861 | address-family ipv4 l2vpn evpn | |
2862 | neighbor 192.168.0.1 route-map RMAP out | |
2863 | exit-address-family | |
2864 | ! | |
2865 | route-map RMAP permit 10 | |
2866 | set evpn gateway-ip 10.0.0.1 | |
2867 | set evpn gateway-ip 10::1 | |
2868 | ||
2869 | A PE that receives a type-5 route with gateway IP overlay index should have | |
2870 | "enable-resolve-overlay-index" configuration enabled to recursively resolve the | |
2871 | overlay index nexthop and install the prefix into zebra. | |
2872 | ||
5c54512e | 2873 | .. clicmd:: enable-resolve-overlay-index |
40f4507d AD |
2874 | |
2875 | Example configuration: | |
2876 | ||
2877 | .. code-block:: frr | |
2878 | ||
2879 | router bgp 65001 | |
2880 | bgp router-id 192.168.100.1 | |
2881 | no bgp ebgp-requires-policy | |
2882 | neighbor 10.0.1.2 remote-as 65002 | |
2883 | ! | |
2884 | address-family l2vpn evpn | |
2885 | neighbor 10.0.1.2 activate | |
2886 | advertise-all-vni | |
2887 | enable-resolve-overlay-index | |
2888 | exit-address-family | |
2889 | ! | |
2890 | ||
77457939 AK |
2891 | EVPN Multihoming |
2892 | ^^^^^^^^^^^^^^^^ | |
2893 | ||
2894 | All-Active Multihoming is used for redundancy and load sharing. Servers | |
2895 | are attached to two or more PEs and the links are bonded (link-aggregation). | |
2896 | This group of server links is referred to as an Ethernet Segment. | |
2897 | ||
2898 | Ethernet Segments | |
2899 | """"""""""""""""" | |
2900 | An Ethernet Segment can be configured by specifying a system-MAC and a | |
2901 | local discriminatior against the bond interface on the PE (via zebra) - | |
2902 | ||
03750f1e | 2903 | .. clicmd:: evpn mh es-id (1-16777215) |
77457939 | 2904 | |
03750f1e | 2905 | .. clicmd:: evpn mh es-sys-mac X:X:X:X:X:X |
77457939 AK |
2906 | |
2907 | The sys-mac and local discriminator are used for generating a 10-byte, | |
2908 | Type-3 Ethernet Segment ID. | |
2909 | ||
2910 | Type-1 (EAS-per-ES and EAD-per-EVI) routes are used to advertise the locally | |
2911 | attached ESs and to learn off remote ESs in the network. Local Type-2/MAC-IP | |
2912 | routes are also advertised with a destination ESI allowing for MAC-IP syncing | |
2913 | between Ethernet Segment peers. | |
2914 | Reference: RFC 7432, RFC 8365 | |
2915 | ||
2916 | EVPN-MH is intended as a replacement for MLAG or Anycast VTEPs. In | |
2917 | multihoming each PE has an unique VTEP address which requires the introduction | |
2918 | of a new dataplane construct, MAC-ECMP. Here a MAC/FDB entry can point to a | |
2919 | list of remote PEs/VTEPs. | |
2920 | ||
2921 | BUM handling | |
2922 | """""""""""" | |
2923 | Type-4 (ESR) routes are used for Designated Forwarder (DF) election. DFs | |
2924 | forward BUM traffic received via the overlay network. This implementation | |
2925 | uses a preference based DF election specified by draft-ietf-bess-evpn-pref-df. | |
2926 | The DF preference is configurable per-ES (via zebra) - | |
2927 | ||
03750f1e | 2928 | .. clicmd:: evpn mh es-df-pref (1-16777215) |
77457939 AK |
2929 | |
2930 | BUM traffic is rxed via the overlay by all PEs attached to a server but | |
2931 | only the DF can forward the de-capsulated traffic to the access port. To | |
2932 | accomodate that non-DF filters are installed in the dataplane to drop | |
2933 | the traffic. | |
2934 | ||
2935 | Similarly traffic received from ES peers via the overlay cannot be forwarded | |
2936 | to the server. This is split-horizon-filtering with local bias. | |
2937 | ||
fe8293c3 AK |
2938 | Knobs for interop |
2939 | """"""""""""""""" | |
2940 | Some vendors do not send EAD-per-EVI routes. To interop with them we | |
2941 | need to relax the dependency on EAD-per-EVI routes and activate a remote | |
2942 | ES-PE based on just the EAD-per-ES route. | |
2943 | ||
2944 | Note that by default we advertise and expect EAD-per-EVI routes. | |
2945 | ||
03750f1e | 2946 | .. clicmd:: disable-ead-evi-rx |
fe8293c3 | 2947 | |
03750f1e | 2948 | .. clicmd:: disable-ead-evi-tx |
fe8293c3 | 2949 | |
77457939 AK |
2950 | Fast failover |
2951 | """"""""""""" | |
2952 | As the primary purpose of EVPN-MH is redundancy keeping the failover efficient | |
2953 | is a recurring theme in the implementation. Following sub-features have | |
2954 | been introduced for the express purpose of efficient ES failovers. | |
2955 | ||
2956 | - Layer-2 Nexthop Groups and MAC-ECMP via L2NHG. | |
2957 | ||
2958 | - Host routes (for symmetric IRB) via L3NHG. | |
2959 | On dataplanes that support layer3 nexthop groups the feature can be turned | |
2960 | on via the following BGP config - | |
2961 | ||
03750f1e | 2962 | .. clicmd:: use-es-l3nhg |
77457939 AK |
2963 | |
2964 | - Local ES (MAC/Neigh) failover via ES-redirect. | |
2965 | On dataplanes that do not have support for ES-redirect the feature can be | |
2966 | turned off via the following zebra config - | |
2967 | ||
03750f1e | 2968 | .. clicmd:: evpn mh redirect-off |
77457939 AK |
2969 | |
2970 | Uplink/Core tracking | |
2971 | """""""""""""""""""" | |
2972 | When all the underlay links go down the PE no longer has access to the VxLAN | |
2973 | +overlay. To prevent blackholing of traffic the server/ES links are | |
2974 | protodowned on the PE. A link can be setup for uplink tracking via the | |
2975 | following zebra configuration - | |
2976 | ||
03750f1e | 2977 | .. clicmd:: evpn mh uplink |
77457939 AK |
2978 | |
2979 | Proxy advertisements | |
2980 | """""""""""""""""""" | |
2981 | To handle hitless upgrades support for proxy advertisement has been added | |
2982 | as specified by draft-rbickhart-evpn-ip-mac-proxy-adv. This allows a PE | |
2983 | (say PE1) to proxy advertise a MAC-IP rxed from an ES peer (say PE2). When | |
2984 | the ES peer (PE2) goes down PE1 continues to advertise hosts learnt from PE2 | |
2985 | for a holdtime during which it attempts to establish local reachability of | |
2986 | the host. This holdtime is configurable via the following zebra commands - | |
2987 | ||
03750f1e | 2988 | .. clicmd:: evpn mh neigh-holdtime (0-86400) |
77457939 | 2989 | |
03750f1e | 2990 | .. clicmd:: evpn mh mac-holdtime (0-86400) |
77457939 AK |
2991 | |
2992 | Startup delay | |
2993 | """"""""""""" | |
2994 | When a switch is rebooted we wait for a brief period to allow the underlay | |
2995 | and EVPN network to converge before enabling the ESs. For this duration the | |
2996 | ES bonds are held protodown. The startup delay is configurable via the | |
2997 | following zebra command - | |
2998 | ||
03750f1e | 2999 | .. clicmd:: evpn mh startup-delay (0-3600) |
77457939 | 3000 | |
ee9d0f09 PG |
3001 | +Support with VRF network namespace backend |
3002 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
3003 | It is possible to separate overlay networks contained in VXLAN interfaces from | |
3004 | underlay networks by using VRFs. VRF-lite and VRF-netns backends can be used for | |
3005 | that. In the latter case, it is necessary to set both bridge and vxlan interface | |
3006 | in the same network namespace, as below example illustrates: | |
3007 | ||
3008 | .. code-block:: shell | |
3009 | ||
3010 | # linux shell | |
3011 | ip netns add vrf1 | |
3012 | ip link add name vxlan101 type vxlan id 101 dstport 4789 dev eth0 local 10.1.1.1 | |
3013 | ip link set dev vxlan101 netns vrf1 | |
3014 | ip netns exec vrf1 ip link set dev lo up | |
3015 | ip netns exec vrf1 brctl addbr bridge101 | |
3016 | ip netns exec vrf1 brctl addif bridge101 vxlan101 | |
3017 | ||
3018 | This makes it possible to separate not only layer 3 networks like VRF-lite networks. | |
3019 | Also, VRF netns based make possible to separate layer 2 networks on separate VRF | |
3020 | instances. | |
89b97c33 | 3021 | |
7f7940e6 MK |
3022 | .. _bgp-conditional-advertisement: |
3023 | ||
3024 | BGP Conditional Advertisement | |
3025 | ----------------------------- | |
3026 | The BGP conditional advertisement feature uses the ``non-exist-map`` or the | |
3027 | ``exist-map`` and the ``advertise-map`` keywords of the neighbor advertise-map | |
3028 | command in order to track routes by the route prefix. | |
3029 | ||
3030 | ``non-exist-map`` | |
3031 | 1. If a route prefix is not present in the output of non-exist-map command, | |
3032 | then advertise the route specified by the advertise-map command. | |
3033 | ||
3034 | 2. If a route prefix is present in the output of non-exist-map command, | |
3035 | then do not advertise the route specified by the addvertise-map command. | |
3036 | ||
3037 | ``exist-map`` | |
3038 | 1. If a route prefix is present in the output of exist-map command, | |
3039 | then advertise the route specified by the advertise-map command. | |
3040 | ||
3041 | 2. If a route prefix is not present in the output of exist-map command, | |
3042 | then do not advertise the route specified by the advertise-map command. | |
3043 | ||
3044 | This feature is useful when some prefixes are advertised to one of its peers | |
3045 | only if the information from the other peer is not present (due to failure in | |
3046 | peering session or partial reachability etc). | |
3047 | ||
3048 | The conditional BGP announcements are sent in addition to the normal | |
3049 | announcements that a BGP router sends to its peer. | |
3050 | ||
3051 | The conditional advertisement process is triggered by the BGP scanner process, | |
389e4f92 QY |
3052 | which runs every 60 by default. This means that the maximum time for the |
3053 | conditional advertisement to take effect is the value of the process timer. | |
3054 | ||
3055 | As an optimization, while the process always runs on each timer expiry, it | |
3056 | determines whether or not the conditional advertisement policy or the routing | |
3057 | table has changed; if neither have changed, no processing is necessary and the | |
3058 | scanner exits early. | |
7f7940e6 | 3059 | |
03750f1e | 3060 | .. clicmd:: neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME |
7f7940e6 | 3061 | |
fa36596c | 3062 | This command enables BGP scanner process to monitor routes specified by |
7f7940e6 | 3063 | exist-map or non-exist-map command in BGP table and conditionally advertises |
fa36596c | 3064 | the routes specified by advertise-map command. |
7f7940e6 | 3065 | |
389e4f92 QY |
3066 | .. clicmd:: bgp conditional-advertisement timer (5-240) |
3067 | ||
3068 | Set the period to rerun the conditional advertisement scanner process. The | |
3069 | default is 60 seconds. | |
3070 | ||
7f7940e6 MK |
3071 | Sample Configuration |
3072 | ^^^^^^^^^^^^^^^^^^^^^ | |
3073 | .. code-block:: frr | |
3074 | ||
fa36596c MK |
3075 | interface enp0s9 |
3076 | ip address 10.10.10.2/24 | |
3077 | ! | |
3078 | interface enp0s10 | |
3079 | ip address 10.10.20.2/24 | |
3080 | ! | |
7f7940e6 | 3081 | interface lo |
fa36596c | 3082 | ip address 203.0.113.1/32 |
7f7940e6 MK |
3083 | ! |
3084 | router bgp 2 | |
3085 | bgp log-neighbor-changes | |
3086 | no bgp ebgp-requires-policy | |
3087 | neighbor 10.10.10.1 remote-as 1 | |
3088 | neighbor 10.10.20.3 remote-as 3 | |
3089 | ! | |
3090 | address-family ipv4 unicast | |
7f7940e6 | 3091 | neighbor 10.10.10.1 soft-reconfiguration inbound |
7f7940e6 | 3092 | neighbor 10.10.20.3 soft-reconfiguration inbound |
fa36596c | 3093 | neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP |
7f7940e6 MK |
3094 | exit-address-family |
3095 | ! | |
fa36596c MK |
3096 | ip prefix-list DEFAULT seq 5 permit 192.0.2.5/32 |
3097 | ip prefix-list DEFAULT seq 10 permit 192.0.2.1/32 | |
3098 | ip prefix-list EXIST seq 5 permit 10.10.10.10/32 | |
3099 | ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0 | |
3100 | ip prefix-list IP1 seq 5 permit 10.139.224.0/20 | |
3101 | ! | |
3102 | bgp community-list standard DC-ROUTES seq 5 permit 64952:3008 | |
3103 | bgp community-list standard DC-ROUTES seq 10 permit 64671:501 | |
3104 | bgp community-list standard DC-ROUTES seq 15 permit 64950:3009 | |
3105 | bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200 | |
7f7940e6 | 3106 | ! |
fa36596c MK |
3107 | route-map ADV-MAP permit 10 |
3108 | match ip address prefix-list IP1 | |
7f7940e6 | 3109 | ! |
fa36596c MK |
3110 | route-map ADV-MAP permit 20 |
3111 | match community DC-ROUTES | |
3112 | ! | |
3113 | route-map EXIST-MAP permit 10 | |
3114 | match community DEFAULT-ROUTE | |
3115 | match ip address prefix-list DEFAULT-ROUTE | |
7f7940e6 MK |
3116 | ! |
3117 | ||
3118 | Sample Output | |
3119 | ^^^^^^^^^^^^^ | |
3120 | ||
fa36596c | 3121 | When default route is present in R2'2 BGP table, 10.139.224.0/20 and 192.0.2.1/32 are not advertised to R3. |
7f7940e6 MK |
3122 | |
3123 | .. code-block:: frr | |
3124 | ||
3125 | Router2# show ip bgp | |
fa36596c | 3126 | BGP table version is 20, local router ID is 203.0.113.1, vrf id 0 |
7f7940e6 MK |
3127 | Default local pref 100, local AS 2 |
3128 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
3129 | i internal, r RIB-failure, S Stale, R Removed | |
3130 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self | |
3131 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3132 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3133 | |
fa36596c MK |
3134 | Network Next Hop Metric LocPrf Weight Path |
3135 | *> 0.0.0.0/0 10.10.10.1 0 0 1 i | |
3136 | *> 10.139.224.0/20 10.10.10.1 0 0 1 ? | |
3137 | *> 192.0.2.1/32 10.10.10.1 0 0 1 i | |
3138 | *> 192.0.2.5/32 10.10.10.1 0 0 1 i | |
7f7940e6 MK |
3139 | |
3140 | Displayed 4 routes and 4 total paths | |
fa36596c | 3141 | Router2# show ip bgp neighbors 10.10.20.3 |
7f7940e6 MK |
3142 | |
3143 | !--- Output suppressed. | |
3144 | ||
3145 | For address family: IPv4 Unicast | |
fa36596c | 3146 | Update group 7, subgroup 7 |
7f7940e6 MK |
3147 | Packet Queue length 0 |
3148 | Inbound soft reconfiguration allowed | |
3149 | Community attribute sent to this neighbor(all) | |
fa36596c MK |
3150 | Condition NON_EXIST, Condition-map *EXIST-MAP, Advertise-map *ADV-MAP, status: Withdraw |
3151 | 0 accepted prefixes | |
7f7940e6 MK |
3152 | |
3153 | !--- Output suppressed. | |
3154 | ||
fa36596c MK |
3155 | Router2# show ip bgp neighbors 10.10.20.3 advertised-routes |
3156 | BGP table version is 20, local router ID is 203.0.113.1, vrf id 0 | |
7f7940e6 MK |
3157 | Default local pref 100, local AS 2 |
3158 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
fa36596c | 3159 | i internal, r RIB-failure, S Stale, R Removed |
7f7940e6 MK |
3160 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self |
3161 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3162 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3163 | |
fa36596c MK |
3164 | Network Next Hop Metric LocPrf Weight Path |
3165 | *> 0.0.0.0/0 0.0.0.0 0 1 i | |
3166 | *> 192.0.2.5/32 0.0.0.0 0 1 i | |
7f7940e6 | 3167 | |
fa36596c | 3168 | Total number of prefixes 2 |
7f7940e6 | 3169 | |
fa36596c | 3170 | When default route is not present in R2'2 BGP table, 10.139.224.0/20 and 192.0.2.1/32 are advertised to R3. |
7f7940e6 MK |
3171 | |
3172 | .. code-block:: frr | |
3173 | ||
3174 | Router2# show ip bgp | |
fa36596c | 3175 | BGP table version is 21, local router ID is 203.0.113.1, vrf id 0 |
7f7940e6 MK |
3176 | Default local pref 100, local AS 2 |
3177 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
3178 | i internal, r RIB-failure, S Stale, R Removed | |
3179 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self | |
3180 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3181 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3182 | |
fa36596c MK |
3183 | Network Next Hop Metric LocPrf Weight Path |
3184 | *> 10.139.224.0/20 10.10.10.1 0 0 1 ? | |
3185 | *> 192.0.2.1/32 10.10.10.1 0 0 1 i | |
3186 | *> 192.0.2.5/32 10.10.10.1 0 0 1 i | |
7f7940e6 MK |
3187 | |
3188 | Displayed 3 routes and 3 total paths | |
7f7940e6 | 3189 | |
fa36596c | 3190 | Router2# show ip bgp neighbors 10.10.20.3 |
7f7940e6 MK |
3191 | |
3192 | !--- Output suppressed. | |
3193 | ||
3194 | For address family: IPv4 Unicast | |
fa36596c | 3195 | Update group 7, subgroup 7 |
7f7940e6 MK |
3196 | Packet Queue length 0 |
3197 | Inbound soft reconfiguration allowed | |
3198 | Community attribute sent to this neighbor(all) | |
fa36596c MK |
3199 | Condition NON_EXIST, Condition-map *EXIST-MAP, Advertise-map *ADV-MAP, status: Advertise |
3200 | 0 accepted prefixes | |
7f7940e6 MK |
3201 | |
3202 | !--- Output suppressed. | |
3203 | ||
fa36596c MK |
3204 | Router2# show ip bgp neighbors 10.10.20.3 advertised-routes |
3205 | BGP table version is 21, local router ID is 203.0.113.1, vrf id 0 | |
7f7940e6 MK |
3206 | Default local pref 100, local AS 2 |
3207 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
3208 | i internal, r RIB-failure, S Stale, R Removed | |
3209 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self | |
3210 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3211 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3212 | |
fa36596c MK |
3213 | Network Next Hop Metric LocPrf Weight Path |
3214 | *> 10.139.224.0/20 0.0.0.0 0 1 ? | |
3215 | *> 192.0.2.1/32 0.0.0.0 0 1 i | |
3216 | *> 192.0.2.5/32 0.0.0.0 0 1 i | |
7f7940e6 MK |
3217 | |
3218 | Total number of prefixes 3 | |
fa36596c | 3219 | Router2# |
7f7940e6 | 3220 | |
8fcedbd2 QY |
3221 | .. _bgp-debugging: |
3222 | ||
3223 | Debugging | |
3224 | --------- | |
42fc5d26 | 3225 | |
29adcd50 | 3226 | .. clicmd:: show debug |
42fc5d26 | 3227 | |
8fcedbd2 | 3228 | Show all enabled debugs. |
42fc5d26 | 3229 | |
54422b46 DS |
3230 | .. clicmd:: show bgp listeners |
3231 | ||
3232 | Display Listen sockets and the vrf that created them. Useful for debugging of when | |
3233 | listen is not working and this is considered a developer debug statement. | |
3234 | ||
81313f43 RZ |
3235 | .. clicmd:: debug bgp bfd |
3236 | ||
3237 | Enable or disable debugging for BFD events. This will show BFD integration | |
3238 | library messages and BGP BFD integration messages that are mostly state | |
3239 | transitions and validation problems. | |
3240 | ||
03750f1e | 3241 | .. clicmd:: debug bgp neighbor-events |
42fc5d26 | 3242 | |
8fcedbd2 QY |
3243 | Enable or disable debugging for neighbor events. This provides general |
3244 | information on BGP events such as peer connection / disconnection, session | |
3245 | establishment / teardown, and capability negotiation. | |
42fc5d26 | 3246 | |
03750f1e | 3247 | .. clicmd:: debug bgp updates |
42fc5d26 | 3248 | |
8fcedbd2 QY |
3249 | Enable or disable debugging for BGP updates. This provides information on |
3250 | BGP UPDATE messages transmitted and received between local and remote | |
3251 | instances. | |
42fc5d26 | 3252 | |
03750f1e | 3253 | .. clicmd:: debug bgp keepalives |
42fc5d26 | 3254 | |
8fcedbd2 QY |
3255 | Enable or disable debugging for BGP keepalives. This provides information on |
3256 | BGP KEEPALIVE messages transmitted and received between local and remote | |
3257 | instances. | |
c1a54c05 | 3258 | |
03750f1e | 3259 | .. clicmd:: debug bgp bestpath <A.B.C.D/M|X:X::X:X/M> |
42fc5d26 | 3260 | |
8fcedbd2 | 3261 | Enable or disable debugging for bestpath selection on the specified prefix. |
42fc5d26 | 3262 | |
03750f1e | 3263 | .. clicmd:: debug bgp nht |
4da7fda3 | 3264 | |
8fcedbd2 | 3265 | Enable or disable debugging of BGP nexthop tracking. |
4da7fda3 | 3266 | |
03750f1e | 3267 | .. clicmd:: debug bgp update-groups |
4b44467c | 3268 | |
8fcedbd2 QY |
3269 | Enable or disable debugging of dynamic update groups. This provides general |
3270 | information on group creation, deletion, join and prune events. | |
4b44467c | 3271 | |
03750f1e | 3272 | .. clicmd:: debug bgp zebra |
42fc5d26 | 3273 | |
8fcedbd2 | 3274 | Enable or disable debugging of communications between *bgpd* and *zebra*. |
c3c5a71f | 3275 | |
8fcedbd2 QY |
3276 | Dumping Messages and Routing Tables |
3277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 3278 | |
8fcedbd2 | 3279 | .. clicmd:: dump bgp all PATH [INTERVAL] |
42fc5d26 | 3280 | |
8fcedbd2 | 3281 | .. clicmd:: dump bgp all-et PATH [INTERVAL] |
c3c5a71f | 3282 | |
42fc5d26 | 3283 | |
8fcedbd2 QY |
3284 | Dump all BGP packet and events to `path` file. |
3285 | If `interval` is set, a new file will be created for echo `interval` of | |
3286 | seconds. The path `path` can be set with date and time formatting | |
3287 | (strftime). The type ‘all-et’ enables support for Extended Timestamp Header | |
3288 | (:ref:`packet-binary-dump-format`). | |
c3c5a71f | 3289 | |
8fcedbd2 | 3290 | .. clicmd:: dump bgp updates PATH [INTERVAL] |
42fc5d26 | 3291 | |
8fcedbd2 | 3292 | .. clicmd:: dump bgp updates-et PATH [INTERVAL] |
42fc5d26 | 3293 | |
42fc5d26 | 3294 | |
8fcedbd2 QY |
3295 | Dump only BGP updates messages to `path` file. |
3296 | If `interval` is set, a new file will be created for echo `interval` of | |
3297 | seconds. The path `path` can be set with date and time formatting | |
3298 | (strftime). The type ‘updates-et’ enables support for Extended Timestamp | |
3299 | Header (:ref:`packet-binary-dump-format`). | |
42fc5d26 | 3300 | |
8fcedbd2 | 3301 | .. clicmd:: dump bgp routes-mrt PATH |
c3c5a71f | 3302 | |
8fcedbd2 | 3303 | .. clicmd:: dump bgp routes-mrt PATH INTERVAL |
42fc5d26 | 3304 | |
42fc5d26 | 3305 | |
8fcedbd2 QY |
3306 | Dump whole BGP routing table to `path`. This is heavy process. The path |
3307 | `path` can be set with date and time formatting (strftime). If `interval` is | |
3308 | set, a new file will be created for echo `interval` of seconds. | |
42fc5d26 | 3309 | |
8fcedbd2 | 3310 | Note: the interval variable can also be set using hours and minutes: 04h20m00. |
42fc5d26 | 3311 | |
c3c5a71f | 3312 | |
8fcedbd2 | 3313 | .. _bgp-other-commands: |
42fc5d26 | 3314 | |
8fcedbd2 QY |
3315 | Other BGP Commands |
3316 | ------------------ | |
42fc5d26 | 3317 | |
e312b6c6 QY |
3318 | The following are available in the top level *enable* mode: |
3319 | ||
dc912615 DS |
3320 | .. clicmd:: clear bgp \* |
3321 | ||
3322 | Clear all peers. | |
3323 | ||
8fcedbd2 | 3324 | .. clicmd:: clear bgp ipv4|ipv6 \* |
42fc5d26 | 3325 | |
dc912615 DS |
3326 | Clear all peers with this address-family activated. |
3327 | ||
dc912615 DS |
3328 | .. clicmd:: clear bgp ipv4|ipv6 unicast \* |
3329 | ||
3330 | Clear all peers with this address-family and sub-address-family activated. | |
42fc5d26 | 3331 | |
8fcedbd2 | 3332 | .. clicmd:: clear bgp ipv4|ipv6 PEER |
42fc5d26 | 3333 | |
dc912615 DS |
3334 | Clear peers with address of X.X.X.X and this address-family activated. |
3335 | ||
dc912615 DS |
3336 | .. clicmd:: clear bgp ipv4|ipv6 unicast PEER |
3337 | ||
3338 | Clear peer with address of X.X.X.X and this address-family and sub-address-family activated. | |
3339 | ||
dc912615 DS |
3340 | .. clicmd:: clear bgp ipv4|ipv6 PEER soft|in|out |
3341 | ||
3342 | Clear peer using soft reconfiguration in this address-family. | |
42fc5d26 | 3343 | |
dc912615 | 3344 | .. clicmd:: clear bgp ipv4|ipv6 unicast PEER soft|in|out |
42fc5d26 | 3345 | |
dc912615 | 3346 | Clear peer using soft reconfiguration in this address-family and sub-address-family. |
42fc5d26 | 3347 | |
e312b6c6 QY |
3348 | The following are available in the ``router bgp`` mode: |
3349 | ||
e312b6c6 QY |
3350 | .. clicmd:: write-quanta (1-64) |
3351 | ||
3352 | BGP message Tx I/O is vectored. This means that multiple packets are written | |
3353 | to the peer socket at the same time each I/O cycle, in order to minimize | |
3354 | system call overhead. This value controls how many are written at a time. | |
3355 | Under certain load conditions, reducing this value could make peer traffic | |
3356 | less 'bursty'. In practice, leave this settings on the default (64) unless | |
3357 | you truly know what you are doing. | |
3358 | ||
dad83b67 | 3359 | .. clicmd:: read-quanta (1-10) |
e312b6c6 QY |
3360 | |
3361 | Unlike Tx, BGP Rx traffic is not vectored. Packets are read off the wire one | |
3362 | at a time in a loop. This setting controls how many iterations the loop runs | |
3363 | for. As with write-quanta, it is best to leave this setting on the default. | |
42fc5d26 | 3364 | |
05bd726c | 3365 | The following command is available in ``config`` mode as well as in the |
3366 | ``router bgp`` mode: | |
3367 | ||
05bd726c | 3368 | .. clicmd:: bgp graceful-shutdown |
3369 | ||
3370 | The purpose of this command is to initiate BGP Graceful Shutdown which | |
3371 | is described in :rfc:`8326`. The use case for this is to minimize or | |
3372 | eliminate the amount of traffic loss in a network when a planned | |
3373 | maintenance activity such as software upgrade or hardware replacement | |
3374 | is to be performed on a router. The feature works by re-announcing | |
3375 | routes to eBGP peers with the GRACEFUL_SHUTDOWN community included. | |
3376 | Peers are then expected to treat such paths with the lowest preference. | |
3377 | This happens automatically on a receiver running FRR; with other | |
3378 | routing protocol stacks, an inbound policy may have to be configured. | |
3379 | In FRR, triggering graceful shutdown also results in announcing a | |
3380 | LOCAL_PREF of 0 to iBGP peers. | |
3381 | ||
3382 | Graceful shutdown can be configured per BGP instance or globally for | |
3383 | all of BGP. These two options are mutually exclusive. The no form of | |
3384 | the command causes graceful shutdown to be stopped, and routes will | |
3385 | be re-announced without the GRACEFUL_SHUTDOWN community and/or with | |
3386 | the usual LOCAL_PREF value. Note that if this option is saved to | |
3387 | the startup configuration, graceful shutdown will remain in effect | |
3388 | across restarts of *bgpd* and will need to be explicitly disabled. | |
3389 | ||
8fcedbd2 | 3390 | .. _bgp-displaying-bgp-information: |
42fc5d26 | 3391 | |
8fcedbd2 QY |
3392 | Displaying BGP Information |
3393 | ========================== | |
42fc5d26 | 3394 | |
e6f59415 PG |
3395 | The following four commands display the IPv6 and IPv4 routing tables, depending |
3396 | on whether or not the ``ip`` keyword is used. | |
3397 | Actually, :clicmd:`show ip bgp` command was used on older `Quagga` routing | |
3398 | daemon project, while :clicmd:`show bgp` command is the new format. The choice | |
3399 | has been done to keep old format with IPv4 routing table, while new format | |
3400 | displays IPv6 routing table. | |
3401 | ||
4c92d818 | 3402 | .. clicmd:: show ip bgp [all] [wide|json [detail]] |
42fc5d26 | 3403 | |
96f3485c | 3404 | .. clicmd:: show ip bgp A.B.C.D [json] |
c1a54c05 | 3405 | |
4c92d818 | 3406 | .. clicmd:: show bgp [all] [wide|json [detail]] |
e6f59415 | 3407 | |
96f3485c | 3408 | .. clicmd:: show bgp X:X::X:X [json] |
42fc5d26 | 3409 | |
8fcedbd2 | 3410 | These commands display BGP routes. When no route is specified, the default |
e6f59415 | 3411 | is to display all BGP routes. |
42fc5d26 | 3412 | |
8fcedbd2 | 3413 | :: |
c1a54c05 | 3414 | |
8fcedbd2 QY |
3415 | BGP table version is 0, local router ID is 10.1.1.1 |
3416 | Status codes: s suppressed, d damped, h history, * valid, > best, i - internal | |
3417 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
42fc5d26 | 3418 | |
8fcedbd2 QY |
3419 | Network Next Hop Metric LocPrf Weight Path |
3420 | \*> 1.1.1.1/32 0.0.0.0 0 32768 i | |
42fc5d26 | 3421 | |
8fcedbd2 | 3422 | Total number of prefixes 1 |
4da7fda3 | 3423 | |
56c07345 | 3424 | If ``wide`` option is specified, then the prefix table's width is increased |
986b0fc3 DA |
3425 | to fully display the prefix and the nexthop. |
3426 | ||
3427 | This is especially handy dealing with IPv6 prefixes and | |
3428 | if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. | |
3429 | ||
56c07345 | 3430 | If ``all`` option is specified, ``ip`` keyword is ignored, show bgp all and |
96f3485c MK |
3431 | show ip bgp all commands display routes for all AFIs and SAFIs. |
3432 | ||
56c07345 | 3433 | If ``json`` option is specified, output is displayed in JSON format. |
96f3485c | 3434 | |
4c92d818 DA |
3435 | If ``detail`` option is specified after ``json``, more verbose JSON output |
3436 | will be displayed. | |
3437 | ||
e6f59415 PG |
3438 | Some other commands provide additional options for filtering the output. |
3439 | ||
e6f59415 | 3440 | .. clicmd:: show [ip] bgp regexp LINE |
42fc5d26 | 3441 | |
8fcedbd2 QY |
3442 | This command displays BGP routes using AS path regular expression |
3443 | (:ref:`bgp-regular-expressions`). | |
42fc5d26 | 3444 | |
28b25b6b | 3445 | .. clicmd:: show [ip] bgp [all] summary [wide] [json] |
42fc5d26 | 3446 | |
8fcedbd2 | 3447 | Show a bgp peer summary for the specified address family. |
42fc5d26 | 3448 | |
e6f59415 PG |
3449 | The old command structure :clicmd:`show ip bgp` may be removed in the future |
3450 | and should no longer be used. In order to reach the other BGP routing tables | |
3451 | other than the IPv6 routing table given by :clicmd:`show bgp`, the new command | |
3452 | structure is extended with :clicmd:`show bgp [afi] [safi]`. | |
3453 | ||
28b25b6b DA |
3454 | ``wide`` option gives more output like ``LocalAS`` and extended ``Desc`` to |
3455 | 64 characters. | |
3456 | ||
3457 | .. code-block:: frr | |
3458 | ||
3459 | exit1# show ip bgp summary wide | |
3460 | ||
6cac2fcc | 3461 | IPv4 Unicast Summary (VRF default): |
28b25b6b DA |
3462 | BGP router identifier 192.168.100.1, local AS number 65534 vrf-id 0 |
3463 | BGP table version 3 | |
3464 | RIB entries 5, using 920 bytes of memory | |
3465 | Peers 1, using 27 KiB of memory | |
3466 | ||
3467 | Neighbor V AS LocalAS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc | |
3468 | 192.168.0.2 4 65030 123 15 22 0 0 0 00:07:00 0 1 us-east1-rs1.frrouting.org | |
3469 | ||
3470 | Total number of neighbors 1 | |
3471 | exit1# | |
3472 | ||
96f3485c | 3473 | .. clicmd:: show bgp [afi] [safi] [all] [wide|json] |
e6f59415 | 3474 | |
22bfb2a6 | 3475 | .. clicmd:: show bgp [<ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast|flowspec> | l2vpn evpn] |
e6f59415 PG |
3476 | |
3477 | These commands display BGP routes for the specific routing table indicated by | |
3478 | the selected afi and the selected safi. If no afi and no safi value is given, | |
6cfd16ad | 3479 | the command falls back to the default IPv6 routing table. |
6cfd16ad | 3480 | |
6cfd16ad TA |
3481 | .. clicmd:: show bgp l2vpn evpn route [type <macip|2|multicast|3|es|4|prefix|5>] |
3482 | ||
22bfb2a6 | 3483 | EVPN prefixes can also be filtered by EVPN route type. |
e6f59415 | 3484 | |
96f3485c | 3485 | .. clicmd:: show bgp [afi] [safi] [all] summary [json] |
e6f59415 PG |
3486 | |
3487 | Show a bgp peer summary for the specified address family, and subsequent | |
3488 | address-family. | |
3489 | ||
96f3485c | 3490 | .. clicmd:: show bgp [afi] [safi] [all] summary failed [json] |
3577f1c5 DD |
3491 | |
3492 | Show a bgp peer summary for peers that are not succesfully exchanging routes | |
3493 | for the specified address family, and subsequent address-family. | |
3494 | ||
96f3485c | 3495 | .. clicmd:: show bgp [afi] [safi] [all] summary established [json] |
1c027267 DA |
3496 | |
3497 | Show a bgp peer summary for peers that are succesfully exchanging routes | |
3498 | for the specified address family, and subsequent address-family. | |
3499 | ||
8c1d4cd5 LS |
3500 | .. clicmd:: show bgp [afi] [safi] [all] summary neighbor [PEER] [json] |
3501 | ||
3502 | Show a bgp summary for the specified peer, address family, and | |
3503 | subsequent address-family. The neighbor filter can be used in combination | |
3504 | with the failed, established filters. | |
3505 | ||
3506 | .. clicmd:: show bgp [afi] [safi] [all] summary remote-as <internal|external|ASN> [json] | |
3507 | ||
3508 | Show a bgp peer summary for the specified remote-as ASN or type (``internal`` | |
3509 | for iBGP and ``external`` for eBGP sessions), address family, and subsequent | |
3510 | address-family. The remote-as filter can be used in combination with the | |
3511 | failed, established filters. | |
3512 | ||
96c81f66 LS |
3513 | .. clicmd:: show bgp [afi] [safi] [all] summary terse [json] |
3514 | ||
3515 | Shorten the output. Do not show the following information about the BGP | |
3516 | instances: the number of RIB entries, the table version and the used memory. | |
3517 | The ``terse`` option can be used in combination with the remote-as, neighbor, | |
3518 | failed and established filters, and with the ``wide`` option as well. | |
3519 | ||
22bfb2a6 | 3520 | .. clicmd:: show bgp [afi] [safi] [neighbor [PEER] [routes|advertised-routes|received-routes] [json] |
9eb95b3b | 3521 | |
e6f59415 PG |
3522 | This command shows information on a specific BGP peer of the relevant |
3523 | afi and safi selected. | |
c1a54c05 | 3524 | |
22bfb2a6 TA |
3525 | The ``routes`` keyword displays only routes in this address-family's BGP |
3526 | table that were received by this peer and accepted by inbound policy. | |
3527 | ||
3528 | The ``advertised-routes`` keyword displays only the routes in this | |
3529 | address-family's BGP table that were permitted by outbound policy and | |
3530 | advertised to to this peer. | |
3531 | ||
3532 | The ``received-routes`` keyword displays all routes belonging to this | |
3533 | address-family (prior to inbound policy) that were received by this peer. | |
3534 | ||
96f3485c | 3535 | .. clicmd:: show bgp [afi] [safi] [all] dampening dampened-paths [wide|json] |
42fc5d26 | 3536 | |
e6f59415 PG |
3537 | Display paths suppressed due to dampening of the selected afi and safi |
3538 | selected. | |
42fc5d26 | 3539 | |
96f3485c | 3540 | .. clicmd:: show bgp [afi] [safi] [all] dampening flap-statistics [wide|json] |
c1a54c05 | 3541 | |
e6f59415 | 3542 | Display flap statistics of routes of the selected afi and safi selected. |
42fc5d26 | 3543 | |
244e6cab DA |
3544 | .. clicmd:: show bgp [afi] [safi] [all] version (1-4294967295) [wide|json] |
3545 | ||
3546 | Display prefixes with matching version numbers. The version number and | |
3547 | above having prefixes will be listed here. | |
3548 | ||
3549 | It helps to identify which prefixes were installed at some point. | |
3550 | ||
3551 | Here is an example of how to check what prefixes were installed starting | |
05653f49 | 3552 | with an arbitrary version: |
244e6cab | 3553 | |
01af2696 | 3554 | .. code-block:: shell |
244e6cab | 3555 | |
01af2696 DS |
3556 | # vtysh -c 'show bgp ipv4 unicast json' | jq '.tableVersion' |
3557 | 9 | |
3558 | # vtysh -c 'show ip bgp version 9 json' | jq -r '.routes | keys[]' | |
3559 | 192.168.3.0/24 | |
3560 | # vtysh -c 'show ip bgp version 8 json' | jq -r '.routes | keys[]' | |
3561 | 192.168.2.0/24 | |
3562 | 192.168.3.0/24 | |
244e6cab | 3563 | |
620e23e8 PG |
3564 | .. clicmd:: show bgp [afi] [safi] statistics |
3565 | ||
3566 | Display statistics of routes of the selected afi and safi. | |
3567 | ||
620e23e8 PG |
3568 | .. clicmd:: show bgp statistics-all |
3569 | ||
3570 | Display statistics of routes of all the afi and safi. | |
3571 | ||
96f3485c MK |
3572 | .. clicmd:: show [ip] bgp [afi] [safi] [all] cidr-only [wide|json] |
3573 | ||
3574 | Display routes with non-natural netmasks. | |
3575 | ||
96f3485c MK |
3576 | .. clicmd:: show [ip] bgp [afi] [safi] [all] neighbors A.B.C.D [advertised-routes|received-routes|filtered-routes] [json|wide] |
3577 | ||
3578 | Display the routes advertised to a BGP neighbor or received routes | |
3579 | from neighbor or filtered routes received from neighbor based on the | |
3580 | option specified. | |
3581 | ||
56c07345 | 3582 | If ``wide`` option is specified, then the prefix table's width is increased |
96f3485c MK |
3583 | to fully display the prefix and the nexthop. |
3584 | ||
3585 | This is especially handy dealing with IPv6 prefixes and | |
3586 | if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. | |
3587 | ||
56c07345 | 3588 | If ``all`` option is specified, ``ip`` keyword is ignored and, |
96f3485c | 3589 | routes displayed for all AFIs and SAFIs. |
56c07345 | 3590 | if afi is specified, with ``all`` option, routes will be displayed for |
96f3485c MK |
3591 | each SAFI in the selcted AFI |
3592 | ||
56c07345 | 3593 | If ``json`` option is specified, output is displayed in JSON format. |
96f3485c | 3594 | |
8fcedbd2 | 3595 | .. _bgp-display-routes-by-community: |
42fc5d26 | 3596 | |
8fcedbd2 QY |
3597 | Displaying Routes by Community Attribute |
3598 | ---------------------------------------- | |
42fc5d26 | 3599 | |
8fcedbd2 QY |
3600 | The following commands allow displaying routes based on their community |
3601 | attribute. | |
42fc5d26 | 3602 | |
96f3485c | 3603 | .. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community [wide|json] |
42fc5d26 | 3604 | |
96f3485c | 3605 | .. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY [wide|json] |
42fc5d26 | 3606 | |
96f3485c | 3607 | .. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY exact-match [wide|json] |
76bd1499 | 3608 | |
8fcedbd2 QY |
3609 | These commands display BGP routes which have the community attribute. |
3610 | attribute. When ``COMMUNITY`` is specified, BGP routes that match that | |
3611 | community are displayed. When `exact-match` is specified, it display only | |
3612 | routes that have an exact match. | |
c3c5a71f | 3613 | |
8fcedbd2 | 3614 | .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD |
42fc5d26 | 3615 | |
8fcedbd2 | 3616 | .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match |
42fc5d26 | 3617 | |
8fcedbd2 QY |
3618 | These commands display BGP routes for the address family specified that |
3619 | match the specified community list. When `exact-match` is specified, it | |
3620 | displays only routes that have an exact match. | |
42fc5d26 | 3621 | |
56c07345 | 3622 | If ``wide`` option is specified, then the prefix table's width is increased |
96f3485c MK |
3623 | to fully display the prefix and the nexthop. |
3624 | ||
3625 | This is especially handy dealing with IPv6 prefixes and | |
3626 | if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. | |
3627 | ||
56c07345 | 3628 | If ``all`` option is specified, ``ip`` keyword is ignored and, |
96f3485c | 3629 | routes displayed for all AFIs and SAFIs. |
56c07345 | 3630 | if afi is specified, with ``all`` option, routes will be displayed for |
96f3485c MK |
3631 | each SAFI in the selcted AFI |
3632 | ||
56c07345 | 3633 | If ``json`` option is specified, output is displayed in JSON format. |
e3ea6503 | 3634 | |
e3ea6503 PR |
3635 | .. clicmd:: show bgp labelpool <chunks|inuse|ledger|requests|summary> [json] |
3636 | ||
3637 | These commands display information about the BGP labelpool used for | |
3638 | the association of MPLS labels with routes for L3VPN and Labeled Unicast | |
3639 | ||
3640 | If ``chunks`` option is specified, output shows the current list of label | |
3641 | chunks granted to BGP by Zebra, indicating the start and end label in | |
3642 | each chunk | |
3643 | ||
3644 | If ``inuse`` option is specified, output shows the current inuse list of | |
3645 | label to prefix mappings | |
3646 | ||
3647 | If ``ledger`` option is specified, output shows ledger list of all | |
3648 | label requests made per prefix | |
3649 | ||
3650 | If ``requests`` option is specified, output shows current list of label | |
3651 | requests which have not yet been fulfilled by the labelpool | |
3652 | ||
3653 | If ``summary`` option is specified, output is a summary of the counts for | |
3654 | the chunks, inuse, ledger and requests list along with the count of | |
3655 | outstanding chunk requests to Zebra and the nummber of zebra reconnects | |
3656 | that have happened | |
3657 | ||
3658 | If ``json`` option is specified, output is displayed in JSON format. | |
96f3485c | 3659 | |
36a206db | 3660 | .. _bgp-display-routes-by-lcommunity: |
3661 | ||
3662 | Displaying Routes by Large Community Attribute | |
3663 | ---------------------------------------------- | |
3664 | ||
ac2201bb | 3665 | The following commands allow displaying routes based on their |
36a206db | 3666 | large community attribute. |
3667 | ||
36a206db | 3668 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community |
3669 | ||
36a206db | 3670 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY |
3671 | ||
36a206db | 3672 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match |
3673 | ||
36a206db | 3674 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json |
3675 | ||
3676 | These commands display BGP routes which have the large community attribute. | |
3677 | attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that | |
ac2201bb DA |
3678 | large community are displayed. When `exact-match` is specified, it display |
3679 | only routes that have an exact match. When `json` is specified, it display | |
36a206db | 3680 | routes in json format. |
3681 | ||
36a206db | 3682 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD |
3683 | ||
36a206db | 3684 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match |
3685 | ||
36a206db | 3686 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json |
3687 | ||
3688 | These commands display BGP routes for the address family specified that | |
ac2201bb DA |
3689 | match the specified large community list. When `exact-match` is specified, |
3690 | it displays only routes that have an exact match. When `json` is specified, | |
36a206db | 3691 | it display routes in json format. |
3692 | ||
8fcedbd2 | 3693 | .. _bgp-display-routes-by-as-path: |
42fc5d26 | 3694 | |
36a206db | 3695 | |
8fcedbd2 QY |
3696 | Displaying Routes by AS Path |
3697 | ---------------------------- | |
42fc5d26 | 3698 | |
8fcedbd2 | 3699 | .. clicmd:: show bgp ipv4|ipv6 regexp LINE |
76bd1499 | 3700 | |
8fcedbd2 QY |
3701 | This commands displays BGP routes that matches a regular |
3702 | expression `line` (:ref:`bgp-regular-expressions`). | |
3703 | ||
e6f59415 | 3704 | .. clicmd:: show [ip] bgp ipv4 vpn |
8fcedbd2 | 3705 | |
e6f59415 | 3706 | .. clicmd:: show [ip] bgp ipv6 vpn |
8fcedbd2 QY |
3707 | |
3708 | Print active IPV4 or IPV6 routes advertised via the VPN SAFI. | |
3709 | ||
8fcedbd2 QY |
3710 | .. clicmd:: show bgp ipv4 vpn summary |
3711 | ||
8fcedbd2 QY |
3712 | .. clicmd:: show bgp ipv6 vpn summary |
3713 | ||
3714 | Print a summary of neighbor connections for the specified AFI/SAFI combination. | |
3715 | ||
22bfb2a6 TA |
3716 | Displaying Routes by Route Distinguisher |
3717 | ---------------------------------------- | |
3718 | ||
3719 | .. clicmd:: show bgp [<ipv4|ipv6> vpn | l2vpn evpn [route]] rd <all|RD> | |
3720 | ||
3721 | For L3VPN and EVPN address-families, routes can be displayed on a per-RD | |
3722 | (Route Distinguisher) basis or for all RD's. | |
3723 | ||
3724 | .. clicmd:: show bgp l2vpn evpn rd <all|RD> [overlay | tags] | |
3725 | ||
3726 | Use the ``overlay`` or ``tags`` keywords to display the overlay/tag | |
3727 | information about the EVPN prefixes in the selected Route Distinguisher. | |
3728 | ||
3729 | .. clicmd:: show bgp l2vpn evpn route rd <all|RD> mac <MAC> [ip <MAC>] [json] | |
3730 | ||
3731 | For EVPN Type 2 (macip) routes, a MAC address (and optionally an IP address) | |
3732 | can be supplied to the command to only display matching prefixes in the | |
3733 | specified RD. | |
3734 | ||
09d78f10 DS |
3735 | Displaying Update Group Information |
3736 | ----------------------------------- | |
3737 | ||
6c5be52a | 3738 | .. clicmd:: show bgp update-groups [advertise-queue|advertised-routes|packet-queue] |
09d78f10 DS |
3739 | |
3740 | Display Information about each individual update-group being used. | |
3741 | If SUBGROUP-ID is specified only display about that particular group. If | |
3742 | advertise-queue is specified the list of routes that need to be sent | |
3743 | to the peers in the update-group is displayed, advertised-routes means | |
a64e0ee5 | 3744 | the list of routes we have sent to the peers in the update-group and |
09d78f10 DS |
3745 | packet-queue specifies the list of packets in the queue to be sent. |
3746 | ||
6c5be52a | 3747 | .. clicmd:: show bgp update-groups statistics |
09d78f10 DS |
3748 | |
3749 | Display Information about update-group events in FRR. | |
8fcedbd2 | 3750 | |
4ccd4033 HS |
3751 | Segment-Routing IPv6 |
3752 | -------------------- | |
3753 | ||
3754 | .. clicmd:: show bgp segment-routing srv6 | |
3755 | ||
3756 | This command displays information about SRv6 L3VPN in bgpd. Specifically, | |
3757 | what kind of Locator is being used, and its Locator chunk information. | |
3758 | And the SID of the SRv6 Function that is actually managed on bgpd. | |
3759 | In the following example, bgpd is using a Locator named loc1, and two SRv6 | |
3760 | Functions are managed to perform VPNv6 VRF redirect for vrf10 and vrf20. | |
3761 | ||
3762 | :: | |
3763 | ||
3764 | router# show bgp segment-routing srv6 | |
3765 | locator_name: loc1 | |
3766 | locator_chunks: | |
3767 | - 2001:db8:1:1::/64 | |
3768 | functions: | |
3769 | - sid: 2001:db8:1:1::100 | |
3770 | locator: loc1 | |
3771 | - sid: 2001:db8:1:1::200 | |
3772 | locator: loc1 | |
3773 | bgps: | |
3774 | - name: default | |
3775 | vpn_policy[AFI_IP].tovpn_sid: none | |
3776 | vpn_policy[AFI_IP6].tovpn_sid: none | |
3777 | - name: vrf10 | |
3778 | vpn_policy[AFI_IP].tovpn_sid: none | |
3779 | vpn_policy[AFI_IP6].tovpn_sid: 2001:db8:1:1::100 | |
3780 | - name: vrf20 | |
3781 | vpn_policy[AFI_IP].tovpn_sid: none | |
3782 | vpn_policy[AFI_IP6].tovpn_sid: 2001:db8:1:1::200 | |
3783 | ||
3784 | ||
8fcedbd2 QY |
3785 | .. _bgp-route-reflector: |
3786 | ||
3787 | Route Reflector | |
3788 | =============== | |
3789 | ||
749afd7d RF |
3790 | BGP routers connected inside the same AS through BGP belong to an internal |
3791 | BGP session, or IBGP. In order to prevent routing table loops, IBGP does not | |
3792 | advertise IBGP-learned routes to other routers in the same session. As such, | |
3793 | IBGP requires a full mesh of all peers. For large networks, this quickly becomes | |
3794 | unscalable. Introducing route reflectors removes the need for the full-mesh. | |
8fcedbd2 | 3795 | |
749afd7d RF |
3796 | When route reflectors are configured, these will reflect the routes announced |
3797 | by the peers configured as clients. A route reflector client is configured | |
3798 | with: | |
8fcedbd2 | 3799 | |
8fcedbd2 QY |
3800 | .. clicmd:: neighbor PEER route-reflector-client |
3801 | ||
c3c5a71f | 3802 | |
749afd7d RF |
3803 | To avoid single points of failure, multiple route reflectors can be configured. |
3804 | ||
3805 | A cluster is a collection of route reflectors and their clients, and is used | |
3806 | by route reflectors to avoid looping. | |
3807 | ||
749afd7d | 3808 | .. clicmd:: bgp cluster-id A.B.C.D |
42fc5d26 | 3809 | |
03750f1e | 3810 | .. clicmd:: bgp no-rib |
8dad2243 DS |
3811 | |
3812 | To set and unset the BGP daemon ``-n`` / ``--no_kernel`` options during runtime | |
3813 | to disable BGP route installation to the RIB (Zebra), the ``[no] bgp no-rib`` | |
3814 | commands can be used; | |
3815 | ||
3816 | Please note that setting the option during runtime will withdraw all routes in | |
3817 | the daemons RIB from Zebra and unsetting it will announce all routes in the | |
3818 | daemons RIB to Zebra. If the option is passed as a command line argument when | |
3819 | starting the daemon and the configuration gets saved, the option will persist | |
3820 | unless removed from the configuration with the negating command prior to the | |
3821 | configuration write operation. | |
3822 | ||
03750f1e | 3823 | .. clicmd:: bgp send-extra-data zebra |
9a06c157 | 3824 | |
3165cca9 | 3825 | This Command turns off the ability of BGP to send extra data to zebra. |
9a06c157 DS |
3826 | In this case it's the AS-Path being used for the path. The default behavior |
3827 | in BGP is to send this data and to turn it off enter the no form of the command. | |
3828 | If extra data was sent to zebra, and this command is turned on there is no | |
3829 | effort to clean up this data in the rib. | |
3830 | ||
1cc55938 S |
3831 | .. _bgp-suppress-fib: |
3832 | ||
3833 | Suppressing routes not installed in FIB | |
3834 | ======================================= | |
3835 | ||
3836 | The FRR implementation of BGP advertises prefixes learnt from a peer to other | |
3837 | peers even if the routes do not get installed in the FIB. There can be | |
3838 | scenarios where the hardware tables in some of the routers (along the path from | |
3839 | the source to destination) is full which will result in all routes not getting | |
3840 | installed in the FIB. If these routes are advertised to the downstream routers | |
3841 | then traffic will start flowing and will be dropped at the intermediate router. | |
3842 | ||
3843 | The solution is to provide a configurable option to check for the FIB install | |
3844 | status of the prefixes and advertise to peers if the prefixes are successfully | |
3845 | installed in the FIB. The advertisement of the prefixes are suppressed if it is | |
3846 | not installed in FIB. | |
3847 | ||
3848 | The following conditions apply will apply when checking for route installation | |
3849 | status in FIB: | |
0ea5223c | 3850 | |
1cc55938 S |
3851 | 1. The advertisement or suppression of routes based on FIB install status |
3852 | applies only for newly learnt routes from peer (routes which are not in | |
3853 | BGP local RIB). | |
3854 | 2. If the route received from peer already exists in BGP local RIB and route | |
3855 | attributes have changed (best path changed), the old path is deleted and | |
3856 | new path is installed in FIB. The FIB install status will not have any | |
3857 | effect. Therefore only when the route is received first time the checks | |
3858 | apply. | |
3859 | 3. The feature will not apply for routes learnt through other means like | |
3860 | redistribution to bgp from other protocols. This is applicable only to | |
3861 | peer learnt routes. | |
3862 | 4. If a route is installed in FIB and then gets deleted from the dataplane, | |
3863 | then routes will not be withdrawn from peers. This will be considered as | |
3864 | dataplane issue. | |
3865 | 5. The feature will slightly increase the time required to advertise the routes | |
3866 | to peers since the route install status needs to be received from the FIB | |
3867 | 6. If routes are received by the peer before the configuration is applied, then | |
3868 | the bgp sessions need to be reset for the configuration to take effect. | |
3869 | 7. If the route which is already installed in dataplane is removed for some | |
3870 | reason, sending withdraw message to peers is not currently supported. | |
3871 | ||
03750f1e | 3872 | .. clicmd:: bgp suppress-fib-pending |
8dad2243 | 3873 | |
4f4ba68c DS |
3874 | This command is applicable at the global level and at an individual |
3875 | bgp level. If applied at the global level all bgp instances will | |
3876 | wait for fib installation before announcing routes and there is no | |
3877 | way to turn it off for a particular bgp vrf. | |
3878 | ||
0efdf0fe | 3879 | .. _routing-policy: |
42fc5d26 | 3880 | |
8fcedbd2 QY |
3881 | Routing Policy |
3882 | ============== | |
42fc5d26 | 3883 | |
4da7fda3 | 3884 | You can set different routing policy for a peer. For example, you can set |
9eb95b3b QY |
3885 | different filter for a peer. |
3886 | ||
3887 | .. code-block:: frr | |
c1a54c05 | 3888 | |
c1a54c05 QY |
3889 | ! |
3890 | router bgp 1 view 1 | |
3891 | neighbor 10.0.0.1 remote-as 2 | |
3892 | address-family ipv4 unicast | |
3893 | neighbor 10.0.0.1 distribute-list 1 in | |
3894 | exit-address-family | |
3895 | ! | |
3896 | router bgp 1 view 2 | |
3897 | neighbor 10.0.0.1 remote-as 2 | |
3898 | address-family ipv4 unicast | |
3899 | neighbor 10.0.0.1 distribute-list 2 in | |
3900 | exit-address-family | |
c3c5a71f | 3901 | |
4da7fda3 QY |
3902 | This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2. |
3903 | When the update is inserted into view 1, distribute-list 1 is applied. On the | |
3904 | other hand, when the update is inserted into view 2, distribute-list 2 is | |
3905 | applied. | |
42fc5d26 | 3906 | |
42fc5d26 | 3907 | |
0efdf0fe | 3908 | .. _bgp-regular-expressions: |
42fc5d26 QY |
3909 | |
3910 | BGP Regular Expressions | |
3911 | ======================= | |
3912 | ||
8fcedbd2 QY |
3913 | BGP regular expressions are based on :t:`POSIX 1003.2` regular expressions. The |
3914 | following description is just a quick subset of the POSIX regular expressions. | |
42fc5d26 QY |
3915 | |
3916 | ||
8fcedbd2 | 3917 | .\* |
c1a54c05 | 3918 | Matches any single character. |
42fc5d26 | 3919 | |
8fcedbd2 | 3920 | \* |
c1a54c05 | 3921 | Matches 0 or more occurrences of pattern. |
42fc5d26 | 3922 | |
8fcedbd2 | 3923 | \+ |
c1a54c05 | 3924 | Matches 1 or more occurrences of pattern. |
42fc5d26 QY |
3925 | |
3926 | ? | |
c1a54c05 | 3927 | Match 0 or 1 occurrences of pattern. |
42fc5d26 QY |
3928 | |
3929 | ^ | |
c1a54c05 | 3930 | Matches the beginning of the line. |
42fc5d26 QY |
3931 | |
3932 | $ | |
c1a54c05 | 3933 | Matches the end of the line. |
42fc5d26 QY |
3934 | |
3935 | _ | |
8fcedbd2 QY |
3936 | The ``_`` character has special meanings in BGP regular expressions. It |
3937 | matches to space and comma , and AS set delimiter ``{`` and ``}`` and AS | |
3938 | confederation delimiter ``(`` and ``)``. And it also matches to the | |
3939 | beginning of the line and the end of the line. So ``_`` can be used for AS | |
3940 | value boundaries match. This character technically evaluates to | |
3941 | ``(^|[,{}()]|$)``. | |
42fc5d26 | 3942 | |
42fc5d26 | 3943 | |
c1a54c05 | 3944 | .. _bgp-configuration-examples: |
42fc5d26 | 3945 | |
8fcedbd2 QY |
3946 | Miscellaneous Configuration Examples |
3947 | ==================================== | |
42fc5d26 | 3948 | |
9eb95b3b QY |
3949 | Example of a session to an upstream, advertising only one prefix to it. |
3950 | ||
3951 | .. code-block:: frr | |
42fc5d26 | 3952 | |
c1a54c05 QY |
3953 | router bgp 64512 |
3954 | bgp router-id 10.236.87.1 | |
3955 | neighbor upstream peer-group | |
3956 | neighbor upstream remote-as 64515 | |
3957 | neighbor upstream capability dynamic | |
3958 | neighbor 10.1.1.1 peer-group upstream | |
3959 | neighbor 10.1.1.1 description ACME ISP | |
c3c5a71f | 3960 | |
c1a54c05 QY |
3961 | address-family ipv4 unicast |
3962 | network 10.236.87.0/24 | |
3963 | neighbor upstream prefix-list pl-allowed-adv out | |
3964 | exit-address-family | |
3965 | ! | |
3966 | ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25 | |
3967 | ip prefix-list pl-allowed-adv seq 10 deny any | |
42fc5d26 | 3968 | |
aa9eafa4 QY |
3969 | A more complex example including upstream, peer and customer sessions |
3970 | advertising global prefixes and NO_EXPORT prefixes and providing actions for | |
3971 | customer routes based on community values. Extensive use is made of route-maps | |
3972 | and the 'call' feature to support selective advertising of prefixes. This | |
3973 | example is intended as guidance only, it has NOT been tested and almost | |
3974 | certainly contains silly mistakes, if not serious flaws. | |
42fc5d26 | 3975 | |
9eb95b3b | 3976 | .. code-block:: frr |
42fc5d26 | 3977 | |
c1a54c05 QY |
3978 | router bgp 64512 |
3979 | bgp router-id 10.236.87.1 | |
3980 | neighbor upstream capability dynamic | |
3981 | neighbor cust capability dynamic | |
3982 | neighbor peer capability dynamic | |
3983 | neighbor 10.1.1.1 remote-as 64515 | |
3984 | neighbor 10.1.1.1 peer-group upstream | |
3985 | neighbor 10.2.1.1 remote-as 64516 | |
3986 | neighbor 10.2.1.1 peer-group upstream | |
3987 | neighbor 10.3.1.1 remote-as 64517 | |
3988 | neighbor 10.3.1.1 peer-group cust-default | |
3989 | neighbor 10.3.1.1 description customer1 | |
3990 | neighbor 10.4.1.1 remote-as 64518 | |
3991 | neighbor 10.4.1.1 peer-group cust | |
3992 | neighbor 10.4.1.1 description customer2 | |
3993 | neighbor 10.5.1.1 remote-as 64519 | |
3994 | neighbor 10.5.1.1 peer-group peer | |
3995 | neighbor 10.5.1.1 description peer AS 1 | |
3996 | neighbor 10.6.1.1 remote-as 64520 | |
3997 | neighbor 10.6.1.1 peer-group peer | |
3998 | neighbor 10.6.1.1 description peer AS 2 | |
3999 | ||
4000 | address-family ipv4 unicast | |
4001 | network 10.123.456.0/24 | |
4002 | network 10.123.456.128/25 route-map rm-no-export | |
4003 | neighbor upstream route-map rm-upstream-out out | |
4004 | neighbor cust route-map rm-cust-in in | |
4005 | neighbor cust route-map rm-cust-out out | |
4006 | neighbor cust send-community both | |
4007 | neighbor peer route-map rm-peer-in in | |
4008 | neighbor peer route-map rm-peer-out out | |
4009 | neighbor peer send-community both | |
4010 | neighbor 10.3.1.1 prefix-list pl-cust1-network in | |
4011 | neighbor 10.4.1.1 prefix-list pl-cust2-network in | |
4012 | neighbor 10.5.1.1 prefix-list pl-peer1-network in | |
4013 | neighbor 10.6.1.1 prefix-list pl-peer2-network in | |
4014 | exit-address-family | |
4015 | ! | |
4016 | ip prefix-list pl-default permit 0.0.0.0/0 | |
4017 | ! | |
4018 | ip prefix-list pl-upstream-peers permit 10.1.1.1/32 | |
4019 | ip prefix-list pl-upstream-peers permit 10.2.1.1/32 | |
4020 | ! | |
4021 | ip prefix-list pl-cust1-network permit 10.3.1.0/24 | |
4022 | ip prefix-list pl-cust1-network permit 10.3.2.0/24 | |
4023 | ! | |
4024 | ip prefix-list pl-cust2-network permit 10.4.1.0/24 | |
4025 | ! | |
4026 | ip prefix-list pl-peer1-network permit 10.5.1.0/24 | |
4027 | ip prefix-list pl-peer1-network permit 10.5.2.0/24 | |
4028 | ip prefix-list pl-peer1-network permit 192.168.0.0/24 | |
4029 | ! | |
4030 | ip prefix-list pl-peer2-network permit 10.6.1.0/24 | |
4031 | ip prefix-list pl-peer2-network permit 10.6.2.0/24 | |
4032 | ip prefix-list pl-peer2-network permit 192.168.1.0/24 | |
4033 | ip prefix-list pl-peer2-network permit 192.168.2.0/24 | |
4034 | ip prefix-list pl-peer2-network permit 172.16.1/24 | |
4035 | ! | |
e6e62ee5 CS |
4036 | bgp as-path access-list seq 5 asp-own-as permit ^$ |
4037 | bgp as-path access-list seq 10 asp-own-as permit _64512_ | |
c1a54c05 QY |
4038 | ! |
4039 | ! ################################################################# | |
4040 | ! Match communities we provide actions for, on routes receives from | |
4041 | ! customers. Communities values of <our-ASN>:X, with X, have actions: | |
4042 | ! | |
4043 | ! 100 - blackhole the prefix | |
4044 | ! 200 - set no_export | |
4045 | ! 300 - advertise only to other customers | |
4046 | ! 400 - advertise only to upstreams | |
4047 | ! 500 - set no_export when advertising to upstreams | |
4048 | ! 2X00 - set local_preference to X00 | |
4049 | ! | |
4050 | ! blackhole the prefix of the route | |
a64e0ee5 | 4051 | bgp community-list standard cm-blackhole permit 64512:100 |
c1a54c05 QY |
4052 | ! |
4053 | ! set no-export community before advertising | |
a64e0ee5 | 4054 | bgp community-list standard cm-set-no-export permit 64512:200 |
c1a54c05 QY |
4055 | ! |
4056 | ! advertise only to other customers | |
a64e0ee5 | 4057 | bgp community-list standard cm-cust-only permit 64512:300 |
c1a54c05 QY |
4058 | ! |
4059 | ! advertise only to upstreams | |
a64e0ee5 | 4060 | bgp community-list standard cm-upstream-only permit 64512:400 |
c1a54c05 QY |
4061 | ! |
4062 | ! advertise to upstreams with no-export | |
a64e0ee5 | 4063 | bgp community-list standard cm-upstream-noexport permit 64512:500 |
c1a54c05 QY |
4064 | ! |
4065 | ! set local-pref to least significant 3 digits of the community | |
a64e0ee5 DA |
4066 | bgp community-list standard cm-prefmod-100 permit 64512:2100 |
4067 | bgp community-list standard cm-prefmod-200 permit 64512:2200 | |
4068 | bgp community-list standard cm-prefmod-300 permit 64512:2300 | |
4069 | bgp community-list standard cm-prefmod-400 permit 64512:2400 | |
4070 | bgp community-list expanded cme-prefmod-range permit 64512:2... | |
c1a54c05 QY |
4071 | ! |
4072 | ! Informational communities | |
4073 | ! | |
4074 | ! 3000 - learned from upstream | |
4075 | ! 3100 - learned from customer | |
4076 | ! 3200 - learned from peer | |
4077 | ! | |
a64e0ee5 DA |
4078 | bgp community-list standard cm-learnt-upstream permit 64512:3000 |
4079 | bgp community-list standard cm-learnt-cust permit 64512:3100 | |
4080 | bgp community-list standard cm-learnt-peer permit 64512:3200 | |
c1a54c05 QY |
4081 | ! |
4082 | ! ################################################################### | |
4083 | ! Utility route-maps | |
4084 | ! | |
4085 | ! These utility route-maps generally should not used to permit/deny | |
4086 | ! routes, i.e. they do not have meaning as filters, and hence probably | |
4087 | ! should be used with 'on-match next'. These all finish with an empty | |
4088 | ! permit entry so as not interfere with processing in the caller. | |
4089 | ! | |
4090 | route-map rm-no-export permit 10 | |
4091 | set community additive no-export | |
4092 | route-map rm-no-export permit 20 | |
4093 | ! | |
4094 | route-map rm-blackhole permit 10 | |
f6aa36f5 | 4095 | description blackhole, up-pref and ensure it cannot escape this AS |
c1a54c05 QY |
4096 | set ip next-hop 127.0.0.1 |
4097 | set local-preference 10 | |
4098 | set community additive no-export | |
4099 | route-map rm-blackhole permit 20 | |
4100 | ! | |
4101 | ! Set local-pref as requested | |
4102 | route-map rm-prefmod permit 10 | |
4103 | match community cm-prefmod-100 | |
4104 | set local-preference 100 | |
4105 | route-map rm-prefmod permit 20 | |
4106 | match community cm-prefmod-200 | |
4107 | set local-preference 200 | |
4108 | route-map rm-prefmod permit 30 | |
4109 | match community cm-prefmod-300 | |
4110 | set local-preference 300 | |
4111 | route-map rm-prefmod permit 40 | |
4112 | match community cm-prefmod-400 | |
4113 | set local-preference 400 | |
4114 | route-map rm-prefmod permit 50 | |
4115 | ! | |
4116 | ! Community actions to take on receipt of route. | |
4117 | route-map rm-community-in permit 10 | |
4118 | description check for blackholing, no point continuing if it matches. | |
4119 | match community cm-blackhole | |
4120 | call rm-blackhole | |
4121 | route-map rm-community-in permit 20 | |
4122 | match community cm-set-no-export | |
4123 | call rm-no-export | |
4124 | on-match next | |
4125 | route-map rm-community-in permit 30 | |
4126 | match community cme-prefmod-range | |
4127 | call rm-prefmod | |
4128 | route-map rm-community-in permit 40 | |
4129 | ! | |
4130 | ! ##################################################################### | |
4131 | ! Community actions to take when advertising a route. | |
4132 | ! These are filtering route-maps, | |
4133 | ! | |
4134 | ! Deny customer routes to upstream with cust-only set. | |
4135 | route-map rm-community-filt-to-upstream deny 10 | |
4136 | match community cm-learnt-cust | |
4137 | match community cm-cust-only | |
4138 | route-map rm-community-filt-to-upstream permit 20 | |
4139 | ! | |
4140 | ! Deny customer routes to other customers with upstream-only set. | |
4141 | route-map rm-community-filt-to-cust deny 10 | |
4142 | match community cm-learnt-cust | |
4143 | match community cm-upstream-only | |
4144 | route-map rm-community-filt-to-cust permit 20 | |
4145 | ! | |
4146 | ! ################################################################### | |
4147 | ! The top-level route-maps applied to sessions. Further entries could | |
4148 | ! be added obviously.. | |
4149 | ! | |
4150 | ! Customers | |
4151 | route-map rm-cust-in permit 10 | |
4152 | call rm-community-in | |
4153 | on-match next | |
4154 | route-map rm-cust-in permit 20 | |
4155 | set community additive 64512:3100 | |
4156 | route-map rm-cust-in permit 30 | |
4157 | ! | |
4158 | route-map rm-cust-out permit 10 | |
4159 | call rm-community-filt-to-cust | |
4160 | on-match next | |
4161 | route-map rm-cust-out permit 20 | |
4162 | ! | |
4163 | ! Upstream transit ASes | |
4164 | route-map rm-upstream-out permit 10 | |
4165 | description filter customer prefixes which are marked cust-only | |
4166 | call rm-community-filt-to-upstream | |
4167 | on-match next | |
4168 | route-map rm-upstream-out permit 20 | |
4169 | description only customer routes are provided to upstreams/peers | |
4170 | match community cm-learnt-cust | |
4171 | ! | |
4172 | ! Peer ASes | |
4173 | ! outbound policy is same as for upstream | |
4174 | route-map rm-peer-out permit 10 | |
4175 | call rm-upstream-out | |
4176 | ! | |
4177 | route-map rm-peer-in permit 10 | |
4178 | set community additive 64512:3200 | |
c3c5a71f | 4179 | |
8fcedbd2 QY |
4180 | |
4181 | Example of how to set up a 6-Bone connection. | |
4182 | ||
4183 | .. code-block:: frr | |
4184 | ||
4185 | ! bgpd configuration | |
4186 | ! ================== | |
4187 | ! | |
4188 | ! MP-BGP configuration | |
4189 | ! | |
4190 | router bgp 7675 | |
4191 | bgp router-id 10.0.0.1 | |
4192 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number` | |
4193 | ! | |
4194 | address-family ipv6 | |
4195 | network 3ffe:506::/32 | |
4196 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate | |
4197 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out | |
4198 | neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number` | |
4199 | neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out | |
4200 | exit-address-family | |
4201 | ! | |
4202 | ipv6 access-list all permit any | |
4203 | ! | |
4204 | ! Set output nexthop address. | |
4205 | ! | |
4206 | route-map set-nexthop permit 10 | |
4207 | match ipv6 address all | |
4208 | set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225 | |
4209 | set ipv6 nexthop local fe80::2c0:4fff:fe68:a225 | |
4210 | ! | |
4211 | log file bgpd.log | |
4212 | ! | |
4213 | ||
4ab46701 AR |
4214 | .. _bgp-tcp-mss: |
4215 | ||
4216 | BGP tcp-mss support | |
4217 | =================== | |
4218 | TCP provides a mechanism for the user to specify the max segment size. | |
4219 | setsockopt API is used to set the max segment size for TCP session. We | |
4220 | can configure this as part of BGP neighbor configuration. | |
4221 | ||
4222 | This document explains how to avoid ICMP vulnerability issues by limiting | |
4223 | TCP max segment size when you are using MTU discovery. Using MTU discovery | |
4224 | on TCP paths is one method of avoiding BGP packet fragmentation. | |
4225 | ||
4226 | TCP negotiates a maximum segment size (MSS) value during session connection | |
4227 | establishment between two peers. The MSS value negotiated is primarily based | |
073b7664 DA |
4228 | on the maximum transmission unit (MTU) of the interfaces to which the |
4229 | communicating peers are directly connected. However, due to variations in | |
4230 | link MTU on the path taken by the TCP packets, some packets in the network | |
4ab46701 | 4231 | that are well within the MSS value might be fragmented when the packet size |
073b7664 | 4232 | exceeds the link's MTU. |
4ab46701 AR |
4233 | |
4234 | This feature is supported with TCP over IPv4 and TCP over IPv6. | |
4235 | ||
4236 | CLI Configuration: | |
4237 | ------------------ | |
4238 | Below configuration can be done in router bgp mode and allows the user to | |
4239 | configure the tcp-mss value per neighbor. The configuration gets applied | |
4240 | only after hard reset is performed on that neighbor. If we configure tcp-mss | |
4241 | on both the neighbors then both neighbors need to be reset. | |
4242 | ||
4243 | The configuration takes effect based on below rules, so there is a configured | |
4244 | tcp-mss and a synced tcp-mss value per TCP session. | |
4245 | ||
4246 | By default if the configuration is not done then the TCP max segment size is | |
4247 | set to the Maximum Transmission unit (MTU) – (IP/IP6 header size + TCP header | |
4248 | size + ethernet header). For IPv4 its MTU – (20 bytes IP header + 20 bytes TCP | |
4249 | header + 12 bytes ethernet header) and for IPv6 its MTU – (40 bytes IPv6 header | |
4250 | + 20 bytes TCP header + 12 bytes ethernet header). | |
4251 | ||
073b7664 | 4252 | If the config is done then it reduces 12-14 bytes for the ether header and |
4ab46701 AR |
4253 | uses it after synchronizing in TCP handshake. |
4254 | ||
4255 | .. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> tcp-mss (1-65535) | |
4256 | ||
4257 | When tcp-mss is configured kernel reduces 12-14 bytes for ethernet header. | |
4258 | E.g. if tcp-mss is configured as 150 the synced value will be 138. | |
4259 | ||
4260 | Note: configured and synced value is different since TCP module will reduce | |
4261 | 12 bytes for ethernet header. | |
4262 | ||
4263 | Running config: | |
4264 | --------------- | |
4265 | ||
4266 | .. code-block:: frr | |
4267 | ||
073b7664 | 4268 | frr# show running-config |
4ab46701 AR |
4269 | Building configuration... |
4270 | ||
4271 | Current configuration: | |
4272 | ! | |
4273 | router bgp 100 | |
4274 | bgp router-id 192.0.2.1 | |
4275 | neighbor 198.51.100.2 remote-as 100 | |
4276 | neighbor 198.51.100.2 tcp-mss 150 => new entry | |
4277 | neighbor 2001:DB8::2 remote-as 100 | |
4278 | neighbor 2001:DB8::2 tcp-mss 400 => new entry | |
4279 | ||
4280 | Show command: | |
4281 | ------------- | |
4282 | ||
4283 | .. code-block:: frr | |
4284 | ||
073b7664 | 4285 | frr# show bgp neighbors 198.51.100.2 |
4ab46701 AR |
4286 | BGP neighbor is 198.51.100.2, remote AS 100, local AS 100, internal link |
4287 | Hostname: frr | |
4288 | BGP version 4, remote router ID 192.0.2.2, local router ID 192.0.2.1 | |
4289 | BGP state = Established, up for 02:15:28 | |
4290 | Last read 00:00:28, Last write 00:00:28 | |
4291 | Hold time is 180, keepalive interval is 60 seconds | |
4292 | Configured tcp-mss is 150, synced tcp-mss is 138 => new display | |
4293 | ||
4294 | .. code-block:: frr | |
4295 | ||
073b7664 | 4296 | frr# show bgp neighbors 2001:DB8::2 |
4ab46701 AR |
4297 | BGP neighbor is 2001:DB8::2, remote AS 100, local AS 100, internal link |
4298 | Hostname: frr | |
4299 | BGP version 4, remote router ID 192.0.2.2, local router ID 192.0.2.1 | |
4300 | BGP state = Established, up for 02:16:34 | |
4301 | Last read 00:00:34, Last write 00:00:34 | |
4302 | Hold time is 180, keepalive interval is 60 seconds | |
4303 | Configured tcp-mss is 400, synced tcp-mss is 388 => new display | |
4304 | ||
4305 | Show command json output: | |
4306 | ------------------------- | |
4307 | ||
4308 | .. code-block:: frr | |
4309 | ||
073b7664 | 4310 | frr# show bgp neighbors 2001:DB8::2 json |
4ab46701 AR |
4311 | { |
4312 | "2001:DB8::2":{ | |
4313 | "remoteAs":100, | |
4314 | "localAs":100, | |
4315 | "nbrInternalLink":true, | |
4316 | "hostname":"frr", | |
4317 | "bgpVersion":4, | |
4318 | "remoteRouterId":"192.0.2.2", | |
4319 | "localRouterId":"192.0.2.1", | |
4320 | "bgpState":"Established", | |
4321 | "bgpTimerUpMsec":8349000, | |
4322 | "bgpTimerUpString":"02:19:09", | |
4323 | "bgpTimerUpEstablishedEpoch":1613054251, | |
4324 | "bgpTimerLastRead":9000, | |
4325 | "bgpTimerLastWrite":9000, | |
4326 | "bgpInUpdateElapsedTimeMsecs":8347000, | |
4327 | "bgpTimerHoldTimeMsecs":180000, | |
4328 | "bgpTimerKeepAliveIntervalMsecs":60000, | |
4329 | "bgpTcpMssConfigured":400, => new entry | |
4330 | "bgpTcpMssSynced":388, => new entry | |
4331 | ||
4332 | .. code-block:: frr | |
4333 | ||
073b7664 | 4334 | frr# show bgp neighbors 198.51.100.2 json |
4ab46701 AR |
4335 | { |
4336 | "198.51.100.2":{ | |
4337 | "remoteAs":100, | |
4338 | "localAs":100, | |
4339 | "nbrInternalLink":true, | |
4340 | "hostname":"frr", | |
4341 | "bgpVersion":4, | |
4342 | "remoteRouterId":"192.0.2.2", | |
4343 | "localRouterId":"192.0.2.1", | |
4344 | "bgpState":"Established", | |
4345 | "bgpTimerUpMsec":8370000, | |
4346 | "bgpTimerUpString":"02:19:30", | |
4347 | "bgpTimerUpEstablishedEpoch":1613054251, | |
4348 | "bgpTimerLastRead":30000, | |
4349 | "bgpTimerLastWrite":30000, | |
4350 | "bgpInUpdateElapsedTimeMsecs":8368000, | |
4351 | "bgpTimerHoldTimeMsecs":180000, | |
4352 | "bgpTimerKeepAliveIntervalMsecs":60000, | |
4353 | "bgpTcpMssConfigured":150, => new entry | |
4354 | "bgpTcpMssSynced":138, => new entry | |
8fcedbd2 | 4355 | |
9e146a81 | 4356 | .. include:: routeserver.rst |
f3817860 QY |
4357 | |
4358 | .. include:: rpki.rst | |
c1a54c05 | 4359 | |
ed647ed2 | 4360 | .. include:: wecmp_linkbw.rst |
4361 | ||
00458d01 PG |
4362 | .. include:: flowspec.rst |
4363 | ||
d1e7591e | 4364 | .. [#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 |
4365 | .. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345 |
4366 | .. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009 | |
4367 | .. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002 |