]>
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 | |
42fc5d26 | 1899 | |
42fc5d26 | 1900 | |
125cec1a DA |
1901 | .. _bgp-bogon-filter-example: |
1902 | ||
1903 | Bogon ASN filter policy configuration example | |
1904 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1905 | ||
1906 | .. code-block:: frr | |
1907 | ||
1908 | bgp as-path access-list 99 permit _0_ | |
1909 | bgp as-path access-list 99 permit _23456_ | |
1910 | bgp as-path access-list 99 permit _1310[0-6][0-9]_|_13107[0-1]_ | |
e6e62ee5 | 1911 | bgp as-path access-list 99 seq 20 permit ^65 |
125cec1a | 1912 | |
8fcedbd2 | 1913 | .. _bgp-using-as-path-in-route-map: |
42fc5d26 QY |
1914 | |
1915 | Using AS Path in Route Map | |
1916 | -------------------------- | |
1917 | ||
03750f1e | 1918 | .. clicmd:: match as-path WORD |
42fc5d26 | 1919 | |
eb1f303d DS |
1920 | For a given as-path, WORD, match it on the BGP as-path given for the prefix |
1921 | and if it matches do normal route-map actions. The no form of the command | |
1922 | removes this match from the route-map. | |
42fc5d26 | 1923 | |
03750f1e | 1924 | .. clicmd:: set as-path prepend AS-PATH |
42fc5d26 | 1925 | |
eb1f303d DS |
1926 | Prepend the given string of AS numbers to the AS_PATH of the BGP path's NLRI. |
1927 | The no form of this command removes this set operation from the route-map. | |
42fc5d26 | 1928 | |
03750f1e | 1929 | .. clicmd:: set as-path prepend last-as NUM |
c1a54c05 QY |
1930 | |
1931 | Prepend the existing last AS number (the leftmost ASN) to the AS_PATH. | |
eb1f303d | 1932 | The no form of this command removes this set operation from the route-map. |
42fc5d26 | 1933 | |
0efdf0fe | 1934 | .. _bgp-communities-attribute: |
42fc5d26 | 1935 | |
8fcedbd2 QY |
1936 | Communities Attribute |
1937 | --------------------- | |
42fc5d26 | 1938 | |
8fcedbd2 | 1939 | The BGP communities attribute is widely used for implementing policy routing. |
c1a54c05 QY |
1940 | Network operators can manipulate BGP communities attribute based on their |
1941 | network policy. BGP communities attribute is defined in :rfc:`1997` and | |
1942 | :rfc:`1998`. It is an optional transitive attribute, therefore local policy can | |
1943 | travel through different autonomous system. | |
1944 | ||
8fcedbd2 QY |
1945 | The communities attribute is a set of communities values. Each community value |
1946 | is 4 octet long. The following format is used to define the community value. | |
c1a54c05 | 1947 | |
8fcedbd2 | 1948 | ``AS:VAL`` |
c1a54c05 QY |
1949 | This format represents 4 octet communities value. ``AS`` is high order 2 |
1950 | octet in digit format. ``VAL`` is low order 2 octet in digit format. This | |
1951 | format is useful to define AS oriented policy value. For example, | |
1952 | ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to | |
1953 | neighboring peer. | |
1954 | ||
8fcedbd2 QY |
1955 | ``internet`` |
1956 | ``internet`` represents well-known communities value 0. | |
c1a54c05 | 1957 | |
cae770d3 C |
1958 | ``graceful-shutdown`` |
1959 | ``graceful-shutdown`` represents well-known communities value | |
1960 | ``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements | |
1961 | the purpose Graceful BGP Session Shutdown to reduce the amount of | |
56f0bea7 | 1962 | lost traffic when taking BGP sessions down for maintenance. The use |
cae770d3 C |
1963 | of the community needs to be supported from your peers side to |
1964 | actually have any effect. | |
1965 | ||
1966 | ``accept-own`` | |
1967 | ``accept-own`` represents well-known communities value ``ACCEPT_OWN`` | |
1968 | ``0xFFFF0001`` ``65535:1``. :rfc:`7611` implements a way to signal | |
1969 | to a router to accept routes with a local nexthop address. This | |
1970 | can be the case when doing policing and having traffic having a | |
1971 | nexthop located in another VRF but still local interface to the | |
1972 | router. It is recommended to read the RFC for full details. | |
1973 | ||
1974 | ``route-filter-translated-v4`` | |
1975 | ``route-filter-translated-v4`` represents well-known communities value | |
1976 | ``ROUTE_FILTER_TRANSLATED_v4`` ``0xFFFF0002`` ``65535:2``. | |
1977 | ||
1978 | ``route-filter-v4`` | |
1979 | ``route-filter-v4`` represents well-known communities value | |
1980 | ``ROUTE_FILTER_v4`` ``0xFFFF0003`` ``65535:3``. | |
1981 | ||
1982 | ``route-filter-translated-v6`` | |
1983 | ``route-filter-translated-v6`` represents well-known communities value | |
1984 | ``ROUTE_FILTER_TRANSLATED_v6`` ``0xFFFF0004`` ``65535:4``. | |
1985 | ||
1986 | ``route-filter-v6`` | |
1987 | ``route-filter-v6`` represents well-known communities value | |
1988 | ``ROUTE_FILTER_v6`` ``0xFFFF0005`` ``65535:5``. | |
1989 | ||
1990 | ``llgr-stale`` | |
1991 | ``llgr-stale`` represents well-known communities value ``LLGR_STALE`` | |
1992 | ``0xFFFF0006`` ``65535:6``. | |
56f0bea7 | 1993 | Assigned and intended only for use with routers supporting the |
cae770d3 | 1994 | Long-lived Graceful Restart Capability as described in |
49606d58 | 1995 | [Draft-IETF-uttaro-idr-bgp-persistence]_. |
56f0bea7 | 1996 | Routers receiving routes with this community may (depending on |
cae770d3 C |
1997 | implementation) choose allow to reject or modify routes on the |
1998 | presence or absence of this community. | |
1999 | ||
2000 | ``no-llgr`` | |
2001 | ``no-llgr`` represents well-known communities value ``NO_LLGR`` | |
2002 | ``0xFFFF0007`` ``65535:7``. | |
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 | ``accept-own-nexthop`` | |
2011 | ``accept-own-nexthop`` represents well-known communities value | |
2012 | ``accept-own-nexthop`` ``0xFFFF0008`` ``65535:8``. | |
49606d58 | 2013 | [Draft-IETF-agrewal-idr-accept-own-nexthop]_ describes |
cae770d3 C |
2014 | how to tag and label VPN routes to be able to send traffic between VRFs |
2015 | via an internal layer 2 domain on the same PE device. Refer to | |
49606d58 | 2016 | [Draft-IETF-agrewal-idr-accept-own-nexthop]_ for full details. |
cae770d3 C |
2017 | |
2018 | ``blackhole`` | |
2019 | ``blackhole`` represents well-known communities value ``BLACKHOLE`` | |
2020 | ``0xFFFF029A`` ``65535:666``. :rfc:`7999` documents sending prefixes to | |
2021 | EBGP peers and upstream for the purpose of blackholing traffic. | |
2022 | Prefixes tagged with the this community should normally not be | |
10ae708b DA |
2023 | re-advertised from neighbors of the originating network. Upon receiving |
2024 | ``BLACKHOLE`` community from a BGP speaker, ``NO_ADVERTISE`` community | |
2025 | is added automatically. | |
cae770d3 | 2026 | |
8fcedbd2 | 2027 | ``no-export`` |
c1a54c05 QY |
2028 | ``no-export`` represents well-known communities value ``NO_EXPORT`` |
2029 | ``0xFFFFFF01``. All routes carry this value must not be advertised to | |
2030 | outside a BGP confederation boundary. If neighboring BGP peer is part of BGP | |
2031 | confederation, the peer is considered as inside a BGP confederation | |
2032 | boundary, so the route will be announced to the peer. | |
2033 | ||
8fcedbd2 | 2034 | ``no-advertise`` |
c1a54c05 QY |
2035 | ``no-advertise`` represents well-known communities value ``NO_ADVERTISE`` |
2036 | ``0xFFFFFF02``. All routes carry this value must not be advertise to other | |
2037 | BGP peers. | |
2038 | ||
8fcedbd2 | 2039 | ``local-AS`` |
c1a54c05 QY |
2040 | ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED`` |
2041 | ``0xFFFFFF03``. All routes carry this value must not be advertised to | |
2042 | external BGP peers. Even if the neighboring router is part of confederation, | |
2043 | it is considered as external BGP peer, so the route will not be announced to | |
2044 | the peer. | |
2045 | ||
cae770d3 C |
2046 | ``no-peer`` |
2047 | ``no-peer`` represents well-known communities value ``NOPEER`` | |
2048 | ``0xFFFFFF04`` ``65535:65284``. :rfc:`3765` is used to communicate to | |
2049 | another network how the originating network want the prefix propagated. | |
2050 | ||
aa9eafa4 QY |
2051 | When the communities attribute is received duplicate community values in the |
2052 | attribute are ignored and value is sorted in numerical order. | |
42fc5d26 | 2053 | |
49606d58 PG |
2054 | .. [Draft-IETF-uttaro-idr-bgp-persistence] <https://tools.ietf.org/id/draft-uttaro-idr-bgp-persistence-04.txt> |
2055 | .. [Draft-IETF-agrewal-idr-accept-own-nexthop] <https://tools.ietf.org/id/draft-agrewal-idr-accept-own-nexthop-00.txt> | |
2056 | ||
0efdf0fe | 2057 | .. _bgp-community-lists: |
42fc5d26 | 2058 | |
8fcedbd2 QY |
2059 | Community Lists |
2060 | ^^^^^^^^^^^^^^^ | |
aa9eafa4 QY |
2061 | Community lists are user defined lists of community attribute values. These |
2062 | lists can be used for matching or manipulating the communities attribute in | |
2063 | UPDATE messages. | |
42fc5d26 | 2064 | |
aa9eafa4 | 2065 | There are two types of community list: |
c1a54c05 | 2066 | |
aa9eafa4 | 2067 | standard |
56f0bea7 | 2068 | This type accepts an explicit value for the attribute. |
aa9eafa4 QY |
2069 | |
2070 | expanded | |
2071 | This type accepts a regular expression. Because the regex must be | |
2072 | interpreted on each use expanded community lists are slower than standard | |
2073 | lists. | |
42fc5d26 | 2074 | |
a64e0ee5 | 2075 | .. clicmd:: bgp community-list standard NAME permit|deny COMMUNITY |
42fc5d26 | 2076 | |
aa9eafa4 QY |
2077 | This command defines a new standard community list. ``COMMUNITY`` is |
2078 | communities value. The ``COMMUNITY`` is compiled into community structure. | |
2079 | We can define multiple community list under same name. In that case match | |
2080 | will happen user defined order. Once the community list matches to | |
2081 | communities attribute in BGP updates it return permit or deny by the | |
2082 | community list definition. When there is no matched entry, deny will be | |
2083 | returned. When ``COMMUNITY`` is empty it matches to any routes. | |
42fc5d26 | 2084 | |
a64e0ee5 | 2085 | .. clicmd:: bgp community-list expanded NAME permit|deny COMMUNITY |
42fc5d26 | 2086 | |
aa9eafa4 QY |
2087 | This command defines a new expanded community list. ``COMMUNITY`` is a |
2088 | string expression of communities attribute. ``COMMUNITY`` can be a regular | |
2089 | expression (:ref:`bgp-regular-expressions`) to match the communities | |
47f47873 PG |
2090 | attribute in BGP updates. The expanded community is only used to filter, |
2091 | not `set` actions. | |
42fc5d26 | 2092 | |
aa9eafa4 QY |
2093 | .. deprecated:: 5.0 |
2094 | It is recommended to use the more explicit versions of this command. | |
42fc5d26 | 2095 | |
a64e0ee5 | 2096 | .. clicmd:: bgp community-list NAME permit|deny COMMUNITY |
aa9eafa4 QY |
2097 | |
2098 | When the community list type is not specified, the community list type is | |
2099 | automatically detected. If ``COMMUNITY`` can be compiled into communities | |
2100 | attribute, the community list is defined as a standard community list. | |
2101 | Otherwise it is defined as an expanded community list. This feature is left | |
2102 | for backward compatibility. Use of this feature is not recommended. | |
42fc5d26 | 2103 | |
03750f1e QY |
2104 | Note that all community lists share the same namespace, so it's not |
2105 | necessary to specify ``standard`` or ``expanded``; these modifiers are | |
2106 | purely aesthetic. | |
42fc5d26 | 2107 | |
36dc43aa | 2108 | .. clicmd:: show bgp community-list [NAME detail] |
42fc5d26 | 2109 | |
aa9eafa4 QY |
2110 | Displays community list information. When ``NAME`` is specified the |
2111 | specified community list's information is shown. | |
c3c5a71f | 2112 | |
c1a54c05 | 2113 | :: |
76bd1499 | 2114 | |
a64e0ee5 | 2115 | # show bgp community-list |
c1a54c05 QY |
2116 | Named Community standard list CLIST |
2117 | permit 7675:80 7675:100 no-export | |
2118 | deny internet | |
2119 | Named Community expanded list EXPAND | |
2120 | permit : | |
76bd1499 | 2121 | |
36dc43aa | 2122 | # show bgp community-list CLIST detail |
c1a54c05 QY |
2123 | Named Community standard list CLIST |
2124 | permit 7675:80 7675:100 no-export | |
2125 | deny internet | |
42fc5d26 | 2126 | |
42fc5d26 | 2127 | |
8fcedbd2 | 2128 | .. _bgp-numbered-community-lists: |
42fc5d26 | 2129 | |
8fcedbd2 QY |
2130 | Numbered Community Lists |
2131 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 QY |
2132 | |
2133 | When number is used for BGP community list name, the number has | |
c3c5a71f QY |
2134 | special meanings. Community list number in the range from 1 and 99 is |
2135 | standard community list. Community list number in the range from 100 | |
2136 | to 199 is expanded community list. These community lists are called | |
2137 | as numbered community lists. On the other hand normal community lists | |
42fc5d26 QY |
2138 | is called as named community lists. |
2139 | ||
a64e0ee5 | 2140 | .. clicmd:: bgp community-list (1-99) permit|deny COMMUNITY |
42fc5d26 | 2141 | |
aa9eafa4 QY |
2142 | This command defines a new community list. The argument to (1-99) defines |
2143 | the list identifier. | |
42fc5d26 | 2144 | |
a64e0ee5 | 2145 | .. clicmd:: bgp community-list (100-199) permit|deny COMMUNITY |
42fc5d26 | 2146 | |
aa9eafa4 QY |
2147 | This command defines a new expanded community list. The argument to |
2148 | (100-199) defines the list identifier. | |
42fc5d26 | 2149 | |
6a89dd1e DA |
2150 | .. _bgp-community-alias: |
2151 | ||
2152 | Community alias | |
2153 | ^^^^^^^^^^^^^^^ | |
2154 | ||
2155 | BGP community aliases are useful to quickly identify what communities are set | |
2156 | for a specific prefix in a human-readable format. Especially handy for a huge | |
2157 | amount of communities. Accurately defined aliases can help you faster spot | |
2158 | things on the wire. | |
2159 | ||
2160 | .. clicmd:: bgp community alias NAME ALIAS | |
2161 | ||
2162 | This command creates an alias name for a community that will be used | |
2163 | later in various CLI outputs in a human-readable format. | |
2164 | ||
2165 | .. code-block:: frr | |
2166 | ||
2167 | ~# vtysh -c 'show run' | grep 'bgp community alias' | |
2168 | bgp community alias 65001:14 community-1 | |
2169 | bgp community alias 65001:123:1 lcommunity-1 | |
2170 | ||
2171 | ~# vtysh -c 'show ip bgp 172.16.16.1/32' | |
2172 | BGP routing table entry for 172.16.16.1/32, version 21 | |
2173 | Paths: (2 available, best #2, table default) | |
2174 | Advertised to non peer-group peers: | |
2175 | 65030 | |
2176 | 192.168.0.2 from 192.168.0.2 (172.16.16.1) | |
2177 | Origin incomplete, metric 0, valid, external, best (Neighbor IP) | |
2178 | Community: 65001:12 65001:13 community-1 65001:65534 | |
2179 | Large Community: lcommunity-1 65001:123:2 | |
2180 | Last update: Fri Apr 16 12:51:27 2021 | |
2181 | ||
9f977b2d DA |
2182 | .. clicmd:: show bgp [afi] [safi] [all] alias WORD [wide|json] |
2183 | ||
2184 | Display prefixes with matching BGP community alias. | |
2185 | ||
8fcedbd2 | 2186 | .. _bgp-using-communities-in-route-map: |
42fc5d26 | 2187 | |
8fcedbd2 QY |
2188 | Using Communities in Route Maps |
2189 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 2190 | |
aa9eafa4 QY |
2191 | In :ref:`route-map` we can match on or set the BGP communities attribute. Using |
2192 | this feature network operator can implement their network policy based on BGP | |
2193 | communities attribute. | |
42fc5d26 | 2194 | |
b91bf5bd | 2195 | The following commands can be used in route maps: |
42fc5d26 | 2196 | |
80dd0954 DA |
2197 | .. clicmd:: match alias WORD |
2198 | ||
2199 | This command performs match to BGP updates using community alias WORD. When | |
2200 | the one of BGP communities value match to the one of community alias value in | |
2201 | community alias, it is match. | |
2202 | ||
aa9eafa4 | 2203 | .. clicmd:: match community WORD exact-match [exact-match] |
42fc5d26 | 2204 | |
c1a54c05 QY |
2205 | This command perform match to BGP updates using community list WORD. When |
2206 | the one of BGP communities value match to the one of communities value in | |
d1e7591e | 2207 | community list, it is match. When `exact-match` keyword is specified, match |
c1a54c05 QY |
2208 | happen only when BGP updates have completely same communities value |
2209 | specified in the community list. | |
42fc5d26 | 2210 | |
aa9eafa4 | 2211 | .. clicmd:: set community <none|COMMUNITY> additive |
42fc5d26 | 2212 | |
aa9eafa4 QY |
2213 | This command sets the community value in BGP updates. If the attribute is |
2214 | already configured, the newly provided value replaces the old one unless the | |
2215 | ``additive`` keyword is specified, in which case the new value is appended | |
2216 | to the existing value. | |
42fc5d26 | 2217 | |
aa9eafa4 QY |
2218 | If ``none`` is specified as the community value, the communities attribute |
2219 | is not sent. | |
42fc5d26 | 2220 | |
47f47873 PG |
2221 | It is not possible to set an expanded community list. |
2222 | ||
29adcd50 | 2223 | .. clicmd:: set comm-list WORD delete |
c1a54c05 | 2224 | |
aa9eafa4 QY |
2225 | This command remove communities value from BGP communities attribute. The |
2226 | ``word`` is community list name. When BGP route's communities value matches | |
2227 | to the community list ``word``, the communities value is removed. When all | |
2228 | of communities value is removed eventually, the BGP update's communities | |
2229 | attribute is completely removed. | |
42fc5d26 | 2230 | |
8fcedbd2 | 2231 | .. _bgp-communities-example: |
c1a54c05 | 2232 | |
8fcedbd2 QY |
2233 | Example Configuration |
2234 | ^^^^^^^^^^^^^^^^^^^^^ | |
9eb95b3b | 2235 | |
8fcedbd2 QY |
2236 | The following configuration is exemplary of the most typical usage of BGP |
2237 | communities attribute. In the example, AS 7675 provides an upstream Internet | |
2238 | connection to AS 100. When the following configuration exists in AS 7675, the | |
2239 | network operator of AS 100 can set local preference in AS 7675 network by | |
2240 | setting BGP communities attribute to the updates. | |
9eb95b3b QY |
2241 | |
2242 | .. code-block:: frr | |
c1a54c05 QY |
2243 | |
2244 | router bgp 7675 | |
2245 | neighbor 192.168.0.1 remote-as 100 | |
2246 | address-family ipv4 unicast | |
2247 | neighbor 192.168.0.1 route-map RMAP in | |
2248 | exit-address-family | |
2249 | ! | |
a64e0ee5 DA |
2250 | bgp community-list 70 permit 7675:70 |
2251 | bgp community-list 70 deny | |
2252 | bgp community-list 80 permit 7675:80 | |
2253 | bgp community-list 80 deny | |
2254 | bgp community-list 90 permit 7675:90 | |
2255 | bgp community-list 90 deny | |
c1a54c05 QY |
2256 | ! |
2257 | route-map RMAP permit 10 | |
2258 | match community 70 | |
2259 | set local-preference 70 | |
2260 | ! | |
2261 | route-map RMAP permit 20 | |
2262 | match community 80 | |
2263 | set local-preference 80 | |
2264 | ! | |
2265 | route-map RMAP permit 30 | |
2266 | match community 90 | |
2267 | set local-preference 90 | |
c3c5a71f | 2268 | |
42fc5d26 | 2269 | |
8fcedbd2 QY |
2270 | The following configuration announces ``10.0.0.0/8`` from AS 100 to AS 7675. |
2271 | The route has communities value ``7675:80`` so when above configuration exists | |
2272 | in AS 7675, the announced routes' local preference value will be set to 80. | |
9eb95b3b QY |
2273 | |
2274 | .. code-block:: frr | |
c1a54c05 QY |
2275 | |
2276 | router bgp 100 | |
2277 | network 10.0.0.0/8 | |
2278 | neighbor 192.168.0.2 remote-as 7675 | |
2279 | address-family ipv4 unicast | |
2280 | neighbor 192.168.0.2 route-map RMAP out | |
2281 | exit-address-family | |
2282 | ! | |
2283 | ip prefix-list PLIST permit 10.0.0.0/8 | |
2284 | ! | |
2285 | route-map RMAP permit 10 | |
2286 | match ip address prefix-list PLIST | |
2287 | set community 7675:80 | |
c3c5a71f | 2288 | |
42fc5d26 | 2289 | |
8fcedbd2 QY |
2290 | The following configuration is an example of BGP route filtering using |
2291 | communities attribute. This configuration only permit BGP routes which has BGP | |
2292 | communities value ``0:80`` or ``0:90``. The network operator can set special | |
2293 | internal communities value at BGP border router, then limit the BGP route | |
2294 | announcements into the internal network. | |
9eb95b3b QY |
2295 | |
2296 | .. code-block:: frr | |
42fc5d26 | 2297 | |
c1a54c05 QY |
2298 | router bgp 7675 |
2299 | neighbor 192.168.0.1 remote-as 100 | |
2300 | address-family ipv4 unicast | |
2301 | neighbor 192.168.0.1 route-map RMAP in | |
2302 | exit-address-family | |
2303 | ! | |
a64e0ee5 | 2304 | bgp community-list 1 permit 0:80 0:90 |
c1a54c05 QY |
2305 | ! |
2306 | route-map RMAP permit in | |
2307 | match community 1 | |
c3c5a71f | 2308 | |
42fc5d26 | 2309 | |
8fcedbd2 QY |
2310 | The following example filters BGP routes which have a community value of |
2311 | ``1:1``. When there is no match community-list returns ``deny``. To avoid | |
2312 | filtering all routes, a ``permit`` line is set at the end of the | |
2313 | community-list. | |
9eb95b3b QY |
2314 | |
2315 | .. code-block:: frr | |
42fc5d26 | 2316 | |
c1a54c05 QY |
2317 | router bgp 7675 |
2318 | neighbor 192.168.0.1 remote-as 100 | |
2319 | address-family ipv4 unicast | |
2320 | neighbor 192.168.0.1 route-map RMAP in | |
2321 | exit-address-family | |
2322 | ! | |
a64e0ee5 DA |
2323 | bgp community-list standard FILTER deny 1:1 |
2324 | bgp community-list standard FILTER permit | |
c1a54c05 QY |
2325 | ! |
2326 | route-map RMAP permit 10 | |
2327 | match community FILTER | |
c3c5a71f | 2328 | |
42fc5d26 | 2329 | |
8fcedbd2 QY |
2330 | The communities value keyword ``internet`` has special meanings in standard |
2331 | community lists. In the below example ``internet`` matches all BGP routes even | |
2332 | if the route does not have communities attribute at all. So community list | |
2333 | ``INTERNET`` is the same as ``FILTER`` in the previous example. | |
9eb95b3b QY |
2334 | |
2335 | .. code-block:: frr | |
42fc5d26 | 2336 | |
a64e0ee5 DA |
2337 | bgp community-list standard INTERNET deny 1:1 |
2338 | bgp community-list standard INTERNET permit internet | |
c3c5a71f | 2339 | |
42fc5d26 | 2340 | |
8fcedbd2 QY |
2341 | The following configuration is an example of communities value deletion. With |
2342 | this configuration the community values ``100:1`` and ``100:2`` are removed | |
2343 | from BGP updates. For communities value deletion, only ``permit`` | |
2344 | community-list is used. ``deny`` community-list is ignored. | |
9eb95b3b QY |
2345 | |
2346 | .. code-block:: frr | |
42fc5d26 | 2347 | |
c1a54c05 QY |
2348 | router bgp 7675 |
2349 | neighbor 192.168.0.1 remote-as 100 | |
2350 | address-family ipv4 unicast | |
2351 | neighbor 192.168.0.1 route-map RMAP in | |
2352 | exit-address-family | |
2353 | ! | |
a64e0ee5 | 2354 | bgp community-list standard DEL permit 100:1 100:2 |
c1a54c05 QY |
2355 | ! |
2356 | route-map RMAP permit 10 | |
2357 | set comm-list DEL delete | |
c3c5a71f | 2358 | |
42fc5d26 | 2359 | |
0efdf0fe | 2360 | .. _bgp-extended-communities-attribute: |
42fc5d26 | 2361 | |
8fcedbd2 QY |
2362 | Extended Communities Attribute |
2363 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 2364 | |
c1a54c05 QY |
2365 | BGP extended communities attribute is introduced with MPLS VPN/BGP technology. |
2366 | MPLS VPN/BGP expands capability of network infrastructure to provide VPN | |
2367 | functionality. At the same time it requires a new framework for policy routing. | |
2368 | With BGP Extended Communities Attribute we can use Route Target or Site of | |
2369 | Origin for implementing network policy for MPLS VPN/BGP. | |
42fc5d26 | 2370 | |
c1a54c05 QY |
2371 | BGP Extended Communities Attribute is similar to BGP Communities Attribute. It |
2372 | is an optional transitive attribute. BGP Extended Communities Attribute can | |
2373 | carry multiple Extended Community value. Each Extended Community value is | |
2374 | eight octet length. | |
42fc5d26 | 2375 | |
c1a54c05 QY |
2376 | BGP Extended Communities Attribute provides an extended range compared with BGP |
2377 | Communities Attribute. Adding to that there is a type field in each value to | |
2378 | provides community space structure. | |
42fc5d26 | 2379 | |
c1a54c05 QY |
2380 | There are two format to define Extended Community value. One is AS based format |
2381 | the other is IP address based format. | |
42fc5d26 | 2382 | |
8fcedbd2 QY |
2383 | ``AS:VAL`` |
2384 | This is a format to define AS based Extended Community value. ``AS`` part | |
2385 | is 2 octets Global Administrator subfield in Extended Community value. | |
2386 | ``VAL`` part is 4 octets Local Administrator subfield. ``7675:100`` | |
2387 | represents AS 7675 policy value 100. | |
42fc5d26 | 2388 | |
8fcedbd2 | 2389 | ``IP-Address:VAL`` |
c1a54c05 | 2390 | This is a format to define IP address based Extended Community value. |
8fcedbd2 QY |
2391 | ``IP-Address`` part is 4 octets Global Administrator subfield. ``VAL`` part |
2392 | is 2 octets Local Administrator subfield. | |
42fc5d26 | 2393 | |
0efdf0fe | 2394 | .. _bgp-extended-community-lists: |
42fc5d26 | 2395 | |
8fcedbd2 QY |
2396 | Extended Community Lists |
2397 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 2398 | |
a64e0ee5 | 2399 | .. clicmd:: bgp extcommunity-list standard NAME permit|deny EXTCOMMUNITY |
42fc5d26 | 2400 | |
4da7fda3 QY |
2401 | This command defines a new standard extcommunity-list. `extcommunity` is |
2402 | extended communities value. The `extcommunity` is compiled into extended | |
2403 | community structure. We can define multiple extcommunity-list under same | |
2404 | name. In that case match will happen user defined order. Once the | |
2405 | extcommunity-list matches to extended communities attribute in BGP updates | |
2406 | it return permit or deny based upon the extcommunity-list definition. When | |
2407 | there is no matched entry, deny will be returned. When `extcommunity` is | |
2408 | empty it matches to any routes. | |
42fc5d26 | 2409 | |
a64e0ee5 | 2410 | .. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE |
42fc5d26 | 2411 | |
4da7fda3 QY |
2412 | This command defines a new expanded extcommunity-list. `line` is a string |
2413 | expression of extended communities attribute. `line` can be a regular | |
2414 | expression (:ref:`bgp-regular-expressions`) to match an extended communities | |
2415 | attribute in BGP updates. | |
42fc5d26 | 2416 | |
03750f1e QY |
2417 | Note that all extended community lists shares a single name space, so it's |
2418 | not necessary to specify their type when creating or destroying them. | |
42fc5d26 | 2419 | |
03750f1e | 2420 | .. clicmd:: show bgp extcommunity-list [NAME detail] |
c1a54c05 | 2421 | |
4da7fda3 | 2422 | This command displays current extcommunity-list information. When `name` is |
03750f1e | 2423 | specified the community list's information is shown. |
c3c5a71f | 2424 | |
42fc5d26 | 2425 | |
0efdf0fe | 2426 | .. _bgp-extended-communities-in-route-map: |
42fc5d26 QY |
2427 | |
2428 | BGP Extended Communities in Route Map | |
8fcedbd2 | 2429 | """"""""""""""""""""""""""""""""""""" |
42fc5d26 | 2430 | |
29adcd50 | 2431 | .. clicmd:: match extcommunity WORD |
42fc5d26 | 2432 | |
29adcd50 | 2433 | .. clicmd:: set extcommunity rt EXTCOMMUNITY |
42fc5d26 | 2434 | |
c1a54c05 | 2435 | This command set Route Target value. |
42fc5d26 | 2436 | |
29adcd50 | 2437 | .. clicmd:: set extcommunity soo EXTCOMMUNITY |
c1a54c05 QY |
2438 | |
2439 | This command set Site of Origin value. | |
42fc5d26 | 2440 | |
ed647ed2 | 2441 | .. clicmd:: set extcommunity bandwidth <(1-25600) | cumulative | num-multipaths> [non-transitive] |
2442 | ||
2443 | This command sets the BGP link-bandwidth extended community for the prefix | |
2444 | (best path) for which it is applied. The link-bandwidth can be specified as | |
2445 | an ``explicit value`` (specified in Mbps), or the router can be told to use | |
2446 | the ``cumulative bandwidth`` of all multipaths for the prefix or to compute | |
2447 | it based on the ``number of multipaths``. The link bandwidth extended | |
2448 | community is encoded as ``transitive`` unless the set command explicitly | |
2449 | configures it as ``non-transitive``. | |
2450 | ||
2451 | .. seealso:: :ref:`wecmp_linkbw` | |
47f47873 PG |
2452 | |
2453 | Note that the extended expanded community is only used for `match` rule, not for | |
2454 | `set` actions. | |
2455 | ||
0efdf0fe | 2456 | .. _bgp-large-communities-attribute: |
42fc5d26 | 2457 | |
8fcedbd2 QY |
2458 | Large Communities Attribute |
2459 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 QY |
2460 | |
2461 | The BGP Large Communities attribute was introduced in Feb 2017 with | |
c1a54c05 | 2462 | :rfc:`8092`. |
42fc5d26 | 2463 | |
8fcedbd2 QY |
2464 | The BGP Large Communities Attribute is similar to the BGP Communities Attribute |
2465 | except that it has 3 components instead of two and each of which are 4 octets | |
2466 | in length. Large Communities bring additional functionality and convenience | |
2467 | over traditional communities, specifically the fact that the ``GLOBAL`` part | |
2468 | below is now 4 octets wide allowing seamless use in networks using 4-byte ASNs. | |
2469 | ||
2470 | ``GLOBAL:LOCAL1:LOCAL2`` | |
2471 | This is the format to define Large Community values. Referencing :rfc:`8195` | |
2472 | the values are commonly referred to as follows: | |
2473 | ||
2474 | - The ``GLOBAL`` part is a 4 octet Global Administrator field, commonly used | |
2475 | as the operators AS number. | |
2476 | - The ``LOCAL1`` part is a 4 octet Local Data Part 1 subfield referred to as | |
2477 | a function. | |
2478 | - The ``LOCAL2`` part is a 4 octet Local Data Part 2 field and referred to | |
2479 | as the parameter subfield. | |
2480 | ||
2481 | As an example, ``65551:1:10`` represents AS 65551 function 1 and parameter | |
2482 | 10. The referenced RFC above gives some guidelines on recommended usage. | |
42fc5d26 | 2483 | |
0efdf0fe | 2484 | .. _bgp-large-community-lists: |
42fc5d26 | 2485 | |
8fcedbd2 QY |
2486 | Large Community Lists |
2487 | """"""""""""""""""""" | |
42fc5d26 QY |
2488 | |
2489 | Two types of large community lists are supported, namely `standard` and | |
2490 | `expanded`. | |
2491 | ||
a64e0ee5 | 2492 | .. clicmd:: bgp large-community-list standard NAME permit|deny LARGE-COMMUNITY |
42fc5d26 | 2493 | |
4da7fda3 QY |
2494 | This command defines a new standard large-community-list. `large-community` |
2495 | is the Large Community value. We can add multiple large communities under | |
2496 | same name. In that case the match will happen in the user defined order. | |
2497 | Once the large-community-list matches the Large Communities attribute in BGP | |
2498 | updates it will return permit or deny based upon the large-community-list | |
2499 | definition. When there is no matched entry, a deny will be returned. When | |
2500 | `large-community` is empty it matches any routes. | |
42fc5d26 | 2501 | |
a64e0ee5 | 2502 | .. clicmd:: bgp large-community-list expanded NAME permit|deny LINE |
42fc5d26 | 2503 | |
4da7fda3 QY |
2504 | This command defines a new expanded large-community-list. Where `line` is a |
2505 | string matching expression, it will be compared to the entire Large | |
2506 | Communities attribute as a string, with each large-community in order from | |
2507 | lowest to highest. `line` can also be a regular expression which matches | |
2508 | this Large Community attribute. | |
42fc5d26 | 2509 | |
03750f1e QY |
2510 | Note that all community lists share the same namespace, so it's not |
2511 | necessary to specify ``standard`` or ``expanded``; these modifiers are | |
2512 | purely aesthetic. | |
42fc5d26 | 2513 | |
a64e0ee5 | 2514 | .. clicmd:: show bgp large-community-list |
42fc5d26 | 2515 | |
36dc43aa | 2516 | .. clicmd:: show bgp large-community-list NAME detail |
42fc5d26 | 2517 | |
c1a54c05 QY |
2518 | This command display current large-community-list information. When |
2519 | `name` is specified the community list information is shown. | |
42fc5d26 | 2520 | |
29adcd50 | 2521 | .. clicmd:: show ip bgp large-community-info |
c1a54c05 QY |
2522 | |
2523 | This command displays the current large communities in use. | |
42fc5d26 | 2524 | |
0efdf0fe | 2525 | .. _bgp-large-communities-in-route-map: |
42fc5d26 | 2526 | |
8fcedbd2 QY |
2527 | Large Communities in Route Map |
2528 | """""""""""""""""""""""""""""" | |
42fc5d26 | 2529 | |
03ff9a14 | 2530 | .. clicmd:: match large-community LINE [exact-match] |
42fc5d26 | 2531 | |
4da7fda3 QY |
2532 | Where `line` can be a simple string to match, or a regular expression. It |
2533 | is very important to note that this match occurs on the entire | |
c1a54c05 | 2534 | large-community string as a whole, where each large-community is ordered |
03ff9a14 | 2535 | from lowest to highest. When `exact-match` keyword is specified, match |
2536 | happen only when BGP updates have completely same large communities value | |
2537 | specified in the large community list. | |
42fc5d26 | 2538 | |
29adcd50 | 2539 | .. clicmd:: set large-community LARGE-COMMUNITY |
42fc5d26 | 2540 | |
29adcd50 | 2541 | .. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY |
42fc5d26 | 2542 | |
29adcd50 | 2543 | .. clicmd:: set large-community LARGE-COMMUNITY additive |
c1a54c05 QY |
2544 | |
2545 | These commands are used for setting large-community values. The first | |
2546 | command will overwrite any large-communities currently present. | |
2547 | The second specifies two large-communities, which overwrites the current | |
2548 | large-community list. The third will add a large-community value without | |
2549 | overwriting other values. Multiple large-community values can be specified. | |
42fc5d26 | 2550 | |
47f47873 PG |
2551 | Note that the large expanded community is only used for `match` rule, not for |
2552 | `set` actions. | |
b572f826 | 2553 | |
c8a5e5e1 | 2554 | .. _bgp-l3vpn-vrfs: |
b572f826 | 2555 | |
c8a5e5e1 QY |
2556 | L3VPN VRFs |
2557 | ---------- | |
b572f826 | 2558 | |
c8a5e5e1 QY |
2559 | *bgpd* supports :abbr:`L3VPN (Layer 3 Virtual Private Networks)` :abbr:`VRFs |
2560 | (Virtual Routing and Forwarding)` for IPv4 :rfc:`4364` and IPv6 :rfc:`4659`. | |
2561 | L3VPN routes, and their associated VRF MPLS labels, can be distributed to VPN | |
2562 | SAFI neighbors in the *default*, i.e., non VRF, BGP instance. VRF MPLS labels | |
2563 | are reached using *core* MPLS labels which are distributed using LDP or BGP | |
2564 | labeled unicast. *bgpd* also supports inter-VRF route leaking. | |
b572f826 | 2565 | |
b572f826 | 2566 | |
c8a5e5e1 | 2567 | .. _bgp-vrf-route-leaking: |
8fcedbd2 QY |
2568 | |
2569 | VRF Route Leaking | |
c8a5e5e1 | 2570 | ----------------- |
8fcedbd2 QY |
2571 | |
2572 | BGP routes may be leaked (i.e. copied) between a unicast VRF RIB and the VPN | |
f90115c5 LB |
2573 | SAFI RIB of the default VRF for use in MPLS-based L3VPNs. Unicast routes may |
2574 | also be leaked between any VRFs (including the unicast RIB of the default BGP | |
2575 | instanced). A shortcut syntax is also available for specifying leaking from one | |
2576 | VRF to another VRF using the default instance's VPN RIB as the intemediary. A | |
2577 | common application of the VRF-VRF feature is to connect a customer's private | |
8fcedbd2 QY |
2578 | routing domain to a provider's VPN service. Leaking is configured from the |
2579 | point of view of an individual VRF: ``import`` refers to routes leaked from VPN | |
2580 | to a unicast VRF, whereas ``export`` refers to routes leaked from a unicast VRF | |
2581 | to VPN. | |
2582 | ||
2583 | Required parameters | |
c8a5e5e1 | 2584 | ^^^^^^^^^^^^^^^^^^^ |
b572f826 | 2585 | |
4da7fda3 QY |
2586 | Routes exported from a unicast VRF to the VPN RIB must be augmented by two |
2587 | parameters: | |
2588 | ||
2589 | - an :abbr:`RD (Route Distinguisher)` | |
2590 | - an :abbr:`RTLIST (Route-target List)` | |
2591 | ||
2592 | Configuration for these exported routes must, at a minimum, specify these two | |
2593 | parameters. | |
2594 | ||
2595 | Routes imported from the VPN RIB to a unicast VRF are selected according to | |
2596 | their RTLISTs. Routes whose RTLIST contains at least one route-target in | |
2597 | common with the configured import RTLIST are leaked. Configuration for these | |
2598 | imported routes must specify an RTLIST to be matched. | |
2599 | ||
2600 | The RD, which carries no semantic value, is intended to make the route unique | |
2601 | in the VPN RIB among all routes of its prefix that originate from all the | |
2602 | customers and sites that are attached to the provider's VPN service. | |
2603 | Accordingly, each site of each customer is typically assigned an RD that is | |
2604 | unique across the entire provider network. | |
2605 | ||
2606 | The RTLIST is a set of route-target extended community values whose purpose is | |
2607 | to specify route-leaking policy. Typically, a customer is assigned a single | |
2608 | route-target value for import and export to be used at all customer sites. This | |
2609 | configuration specifies a simple topology wherein a customer has a single | |
2610 | routing domain which is shared across all its sites. More complex routing | |
2611 | topologies are possible through use of additional route-targets to augment the | |
2612 | leaking of sets of routes in various ways. | |
b572f826 | 2613 | |
e967a1d0 DS |
2614 | When using the shortcut syntax for vrf-to-vrf leaking, the RD and RT are |
2615 | auto-derived. | |
fb3d9f3e | 2616 | |
8fcedbd2 | 2617 | General configuration |
c8a5e5e1 | 2618 | ^^^^^^^^^^^^^^^^^^^^^ |
b572f826 | 2619 | |
f90115c5 | 2620 | Configuration of route leaking between a unicast VRF RIB and the VPN SAFI RIB |
4da7fda3 QY |
2621 | of the default VRF is accomplished via commands in the context of a VRF |
2622 | address-family: | |
b572f826 | 2623 | |
b572f826 PZ |
2624 | .. clicmd:: rd vpn export AS:NN|IP:nn |
2625 | ||
4da7fda3 QY |
2626 | Specifies the route distinguisher to be added to a route exported from the |
2627 | current unicast VRF to VPN. | |
b572f826 | 2628 | |
b572f826 PZ |
2629 | .. clicmd:: rt vpn import|export|both RTLIST... |
2630 | ||
4da7fda3 QY |
2631 | Specifies the route-target list to be attached to a route (export) or the |
2632 | route-target list to match against (import) when exporting/importing between | |
2633 | the current unicast VRF and VPN. | |
b572f826 | 2634 | |
4da7fda3 QY |
2635 | The RTLIST is a space-separated list of route-targets, which are BGP |
2636 | extended community values as described in | |
b572f826 PZ |
2637 | :ref:`bgp-extended-communities-attribute`. |
2638 | ||
e70e9f8e | 2639 | .. clicmd:: label vpn export (0..1048575)|auto |
b572f826 | 2640 | |
8a2124f7 | 2641 | Enables an MPLS label to be attached to a route exported from the current |
2642 | unicast VRF to VPN. If the value specified is ``auto``, the label value is | |
2643 | automatically assigned from a pool maintained by the Zebra daemon. If Zebra | |
2644 | is not running, or if this command is not configured, automatic label | |
2645 | assignment will not complete, which will block corresponding route export. | |
b572f826 | 2646 | |
b572f826 PZ |
2647 | .. clicmd:: nexthop vpn export A.B.C.D|X:X::X:X |
2648 | ||
4da7fda3 QY |
2649 | Specifies an optional nexthop value to be assigned to a route exported from |
2650 | the current unicast VRF to VPN. If left unspecified, the nexthop will be set | |
2651 | to 0.0.0.0 or 0:0::0:0 (self). | |
b572f826 | 2652 | |
b572f826 PZ |
2653 | .. clicmd:: route-map vpn import|export MAP |
2654 | ||
4da7fda3 | 2655 | Specifies an optional route-map to be applied to routes imported or exported |
d1e7591e | 2656 | between the current unicast VRF and VPN. |
b572f826 | 2657 | |
b572f826 PZ |
2658 | .. clicmd:: import|export vpn |
2659 | ||
d1e7591e | 2660 | Enables import or export of routes between the current unicast VRF and VPN. |
b572f826 | 2661 | |
fb3d9f3e DS |
2662 | .. clicmd:: import vrf VRFNAME |
2663 | ||
e967a1d0 DS |
2664 | Shortcut syntax for specifying automatic leaking from vrf VRFNAME to |
2665 | the current VRF using the VPN RIB as intermediary. The RD and RT | |
2666 | are auto derived and should not be specified explicitly for either the | |
2667 | source or destination VRF's. | |
2668 | ||
2669 | This shortcut syntax mode is not compatible with the explicit | |
2670 | `import vpn` and `export vpn` statements for the two VRF's involved. | |
2671 | The CLI will disallow attempts to configure incompatible leaking | |
2672 | modes. | |
fb3d9f3e | 2673 | |
4ccd4033 HS |
2674 | .. _bgp-l3vpn-srv6: |
2675 | ||
2676 | L3VPN SRv6 | |
2677 | ---------- | |
2678 | ||
2679 | .. clicmd:: segment-routing srv6 | |
2680 | ||
2681 | Use SRv6 backend with BGP L3VPN, and go to its configuration node. | |
2682 | ||
2683 | .. clicmd:: locator NAME | |
2684 | ||
2685 | Specify the SRv6 locator to be used for SRv6 L3VPN. The Locator name must | |
2686 | be set in zebra, but user can set it in any order. | |
42fc5d26 | 2687 | |
b6c34e85 CS |
2688 | .. _bgp-evpn: |
2689 | ||
2690 | Ethernet Virtual Network - EVPN | |
2691 | ------------------------------- | |
2692 | ||
0a4e0034 JAG |
2693 | Note: When using EVPN features and if you have a large number of hosts, make |
2694 | sure to adjust the size of the arp neighbor cache to avoid neighbor table | |
2695 | overflow and/or excessive garbage collection. On Linux, the size of the table | |
2696 | and garbage collection frequency can be controlled via the following | |
2697 | sysctl configurations: | |
2698 | ||
2699 | .. code-block:: shell | |
2700 | ||
2701 | net.ipv4.neigh.default.gc_thresh1 | |
2702 | net.ipv4.neigh.default.gc_thresh2 | |
2703 | net.ipv4.neigh.default.gc_thresh3 | |
2704 | ||
2705 | net.ipv6.neigh.default.gc_thresh1 | |
2706 | net.ipv6.neigh.default.gc_thresh2 | |
2707 | net.ipv6.neigh.default.gc_thresh3 | |
2708 | ||
2709 | For more information, see ``man 7 arp``. | |
2710 | ||
b6c34e85 CS |
2711 | .. _bgp-evpn-advertise-pip: |
2712 | ||
2713 | EVPN advertise-PIP | |
2714 | ^^^^^^^^^^^^^^^^^^ | |
2715 | ||
2716 | In a EVPN symmetric routing MLAG deployment, all EVPN routes advertised | |
2717 | with anycast-IP as next-hop IP and anycast MAC as the Router MAC (RMAC - in | |
2718 | BGP EVPN Extended-Community). | |
2719 | EVPN picks up the next-hop IP from the VxLAN interface's local tunnel IP and | |
2720 | the RMAC is obtained from the MAC of the L3VNI's SVI interface. | |
2721 | Note: Next-hop IP is used for EVPN routes whether symmetric routing is | |
2722 | deployed or not but the RMAC is only relevant for symmetric routing scenario. | |
2723 | ||
2724 | Current behavior is not ideal for Prefix (type-5) and self (type-2) | |
2725 | routes. This is because the traffic from remote VTEPs routed sub optimally | |
2726 | if they land on the system where the route does not belong. | |
2727 | ||
2728 | The advertise-pip feature advertises Prefix (type-5) and self (type-2) | |
2729 | routes with system's individual (primary) IP as the next-hop and individual | |
2730 | (system) MAC as Router-MAC (RMAC), while leaving the behavior unchanged for | |
2731 | other EVPN routes. | |
2732 | ||
2733 | To support this feature there needs to have ability to co-exist a | |
2734 | (system-MAC, system-IP) pair with a (anycast-MAC, anycast-IP) pair with the | |
2735 | ability to terminate VxLAN-encapsulated packets received for either pair on | |
0a4e0034 | 2736 | the same L3VNI (i.e associated VLAN). This capability is needed per tenant |
b6c34e85 CS |
2737 | VRF instance. |
2738 | ||
0a4e0034 | 2739 | To derive the system-MAC and the anycast MAC, there must be a |
b6c34e85 CS |
2740 | separate/additional MAC-VLAN interface corresponding to L3VNI’s SVI. |
2741 | The SVI interface’s MAC address can be interpreted as system-MAC | |
2742 | and MAC-VLAN interface's MAC as anycast MAC. | |
2743 | ||
2744 | To derive system-IP and anycast-IP, the default BGP instance's router-id is used | |
2745 | as system-IP and the VxLAN interface’s local tunnel IP as the anycast-IP. | |
2746 | ||
2747 | User has an option to configure the system-IP and/or system-MAC value if the | |
2748 | auto derived value is not preferred. | |
2749 | ||
2750 | Note: By default, advertise-pip feature is enabled and user has an option to | |
0a4e0034 | 2751 | disable the feature via configuration CLI. Once the feature is disabled under |
b6c34e85 CS |
2752 | bgp vrf instance or MAC-VLAN interface is not configured, all the routes follow |
2753 | the same behavior of using same next-hop and RMAC values. | |
2754 | ||
03750f1e | 2755 | .. clicmd:: advertise-pip [ip <addr> [mac <addr>]] |
b6c34e85 CS |
2756 | |
2757 | Enables or disables advertise-pip feature, specifiy system-IP and/or system-MAC | |
2758 | parameters. | |
2759 | ||
a927f5bc JAG |
2760 | EVPN advertise-svi-ip |
2761 | ^^^^^^^^^^^^^^^^^^^^^ | |
0a4e0034 | 2762 | Typically, the SVI IP address is reused on VTEPs across multiple racks. However, |
a927f5bc | 2763 | if you have unique SVI IP addresses that you want to be reachable you can use the |
0a4e0034 JAG |
2764 | advertise-svi-ip option. This option advertises the SVI IP/MAC address as a type-2 |
2765 | route and eliminates the need for any flooding over VXLAN to reach the IP from a | |
2766 | remote VTEP. | |
2767 | ||
a927f5bc | 2768 | .. clicmd:: advertise-svi-ip |
0a4e0034 JAG |
2769 | |
2770 | Note that you should not enable both the advertise-svi-ip and the advertise-default-gw | |
2771 | at the same time. | |
2772 | ||
40f4507d AD |
2773 | .. _bgp-evpn-overlay-index-gateway-ip: |
2774 | ||
2775 | EVPN Overlay Index Gateway IP | |
2776 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
2777 | Draft https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement-11 | |
2778 | explains the use of overlay indexes for recursive route resolution for EVPN | |
2779 | type-5 route. | |
2780 | ||
2781 | We support gateway IP overlay index. | |
2782 | A gateway IP, advertised with EVPN prefix route, is used to find an EVPN MAC/IP | |
2783 | route with its IP field same as the gateway IP. This MAC/IP entry provides the | |
2784 | nexthop VTEP and the tunnel information required for the VxLAN encapsulation. | |
2785 | ||
2786 | Functionality: | |
2787 | ||
2788 | :: | |
2789 | ||
2790 | . +--------+ BGP +--------+ BGP +--------+ +--------+ | |
2791 | SN1 | | IPv4 | | EVPN | | | | | |
2792 | ======+ Host1 +------+ PE1 +------+ PE2 +------+ Host2 + | |
2793 | | | | | | | | | | |
2794 | +--------+ +--------+ +--------+ +--------+ | |
2795 | ||
2796 | Consider above topology where prefix SN1 is connected behind host1. Host1 | |
2797 | advertises SN1 to PE1 over BGP IPv4 session. PE1 advertises SN1 to PE2 using | |
2798 | EVPN type-5 route with host1 IP as the gateway IP. PE1 also advertises | |
2799 | Host1 MAC/IP as type-2 route which is used to resolve host1 gateway IP. | |
2800 | ||
2801 | PE2 receives this type-5 route and imports it into the vrf based on route | |
2802 | targets. BGP prefix imported into the vrf uses gateway IP as its BGP nexthop. | |
2803 | This route is installed into zebra if following conditions are satisfied: | |
7aa6fb2d | 2804 | |
40f4507d AD |
2805 | 1. Gateway IP nexthop is L3 reachable. |
2806 | 2. PE2 has received EVPN type-2 route with IP field set to gateway IP. | |
2807 | ||
2808 | Topology requirements: | |
7aa6fb2d | 2809 | |
40f4507d AD |
2810 | 1. This feature is supported for asymmetric routing model only. While |
2811 | sending packets to SN1, ingress PE (PE2) performs routing and | |
2812 | egress PE (PE1) performs only bridging. | |
2813 | 2. This feature supports only tratitional(non vlan-aware) bridge model. Bridge | |
2814 | interface associated with L2VNI is an L3 interface. i.e., this interface is | |
2815 | configured with an address in the L2VNI subnet. Note that the gateway IP | |
2816 | should also have an address in the same subnet. | |
2817 | 3. As this feature works in asymmetric routing model, all L2VNIs and corresponding | |
2818 | VxLAN and bridge interfaces should be present at all the PEs. | |
2819 | 4. L3VNI configuration is required to generate and import EVPN type-5 routes. | |
2820 | L3VNI VxLAN and bridge interfaces also should be present. | |
2821 | ||
2822 | A PE can use one of the following two mechanisms to advertise an EVPN type-5 | |
2823 | route with gateway IP. | |
2824 | ||
2825 | 1. CLI to add gateway IP while generating EVPN type-5 route from a BGP IPv4/IPv6 | |
2826 | prefix: | |
2827 | ||
5c54512e | 2828 | .. clicmd:: advertise <ipv4|ipv6> unicast [gateway-ip] |
40f4507d AD |
2829 | |
2830 | When this CLI is configured for a BGP vrf under L2VPN EVPN address family, EVPN | |
2831 | type-5 routes are generated for BGP prefixes in the vrf. Nexthop of the BGP | |
2832 | prefix becomes the gateway IP of the corresponding type-5 route. | |
2833 | ||
2834 | If the above command is configured without the "gateway-ip" keyword, type-5 | |
2835 | routes are generated without overlay index. | |
2836 | ||
2837 | 2. Add gateway IP to EVPN type-5 route using a route-map: | |
2838 | ||
5c54512e | 2839 | .. clicmd:: set evpn gateway-ip <ipv4|ipv6> <addr> |
40f4507d AD |
2840 | |
2841 | When route-map with above set clause is applied as outbound policy in BGP, it | |
2842 | will set the gateway-ip in EVPN type-5 NLRI. | |
2843 | ||
2844 | Example configuration: | |
2845 | ||
2846 | .. code-block:: frr | |
2847 | ||
2848 | router bgp 100 | |
2849 | neighbor 192.168.0.1 remote-as 101 | |
2850 | ! | |
2851 | address-family ipv4 l2vpn evpn | |
2852 | neighbor 192.168.0.1 route-map RMAP out | |
2853 | exit-address-family | |
2854 | ! | |
2855 | route-map RMAP permit 10 | |
2856 | set evpn gateway-ip 10.0.0.1 | |
2857 | set evpn gateway-ip 10::1 | |
2858 | ||
2859 | A PE that receives a type-5 route with gateway IP overlay index should have | |
2860 | "enable-resolve-overlay-index" configuration enabled to recursively resolve the | |
2861 | overlay index nexthop and install the prefix into zebra. | |
2862 | ||
5c54512e | 2863 | .. clicmd:: enable-resolve-overlay-index |
40f4507d AD |
2864 | |
2865 | Example configuration: | |
2866 | ||
2867 | .. code-block:: frr | |
2868 | ||
2869 | router bgp 65001 | |
2870 | bgp router-id 192.168.100.1 | |
2871 | no bgp ebgp-requires-policy | |
2872 | neighbor 10.0.1.2 remote-as 65002 | |
2873 | ! | |
2874 | address-family l2vpn evpn | |
2875 | neighbor 10.0.1.2 activate | |
2876 | advertise-all-vni | |
2877 | enable-resolve-overlay-index | |
2878 | exit-address-family | |
2879 | ! | |
2880 | ||
77457939 AK |
2881 | EVPN Multihoming |
2882 | ^^^^^^^^^^^^^^^^ | |
2883 | ||
2884 | All-Active Multihoming is used for redundancy and load sharing. Servers | |
2885 | are attached to two or more PEs and the links are bonded (link-aggregation). | |
2886 | This group of server links is referred to as an Ethernet Segment. | |
2887 | ||
2888 | Ethernet Segments | |
2889 | """"""""""""""""" | |
2890 | An Ethernet Segment can be configured by specifying a system-MAC and a | |
2891 | local discriminatior against the bond interface on the PE (via zebra) - | |
2892 | ||
03750f1e | 2893 | .. clicmd:: evpn mh es-id (1-16777215) |
77457939 | 2894 | |
03750f1e | 2895 | .. clicmd:: evpn mh es-sys-mac X:X:X:X:X:X |
77457939 AK |
2896 | |
2897 | The sys-mac and local discriminator are used for generating a 10-byte, | |
2898 | Type-3 Ethernet Segment ID. | |
2899 | ||
2900 | Type-1 (EAS-per-ES and EAD-per-EVI) routes are used to advertise the locally | |
2901 | attached ESs and to learn off remote ESs in the network. Local Type-2/MAC-IP | |
2902 | routes are also advertised with a destination ESI allowing for MAC-IP syncing | |
2903 | between Ethernet Segment peers. | |
2904 | Reference: RFC 7432, RFC 8365 | |
2905 | ||
2906 | EVPN-MH is intended as a replacement for MLAG or Anycast VTEPs. In | |
2907 | multihoming each PE has an unique VTEP address which requires the introduction | |
2908 | of a new dataplane construct, MAC-ECMP. Here a MAC/FDB entry can point to a | |
2909 | list of remote PEs/VTEPs. | |
2910 | ||
2911 | BUM handling | |
2912 | """""""""""" | |
2913 | Type-4 (ESR) routes are used for Designated Forwarder (DF) election. DFs | |
2914 | forward BUM traffic received via the overlay network. This implementation | |
2915 | uses a preference based DF election specified by draft-ietf-bess-evpn-pref-df. | |
2916 | The DF preference is configurable per-ES (via zebra) - | |
2917 | ||
03750f1e | 2918 | .. clicmd:: evpn mh es-df-pref (1-16777215) |
77457939 AK |
2919 | |
2920 | BUM traffic is rxed via the overlay by all PEs attached to a server but | |
2921 | only the DF can forward the de-capsulated traffic to the access port. To | |
2922 | accomodate that non-DF filters are installed in the dataplane to drop | |
2923 | the traffic. | |
2924 | ||
2925 | Similarly traffic received from ES peers via the overlay cannot be forwarded | |
2926 | to the server. This is split-horizon-filtering with local bias. | |
2927 | ||
fe8293c3 AK |
2928 | Knobs for interop |
2929 | """"""""""""""""" | |
2930 | Some vendors do not send EAD-per-EVI routes. To interop with them we | |
2931 | need to relax the dependency on EAD-per-EVI routes and activate a remote | |
2932 | ES-PE based on just the EAD-per-ES route. | |
2933 | ||
2934 | Note that by default we advertise and expect EAD-per-EVI routes. | |
2935 | ||
03750f1e | 2936 | .. clicmd:: disable-ead-evi-rx |
fe8293c3 | 2937 | |
03750f1e | 2938 | .. clicmd:: disable-ead-evi-tx |
fe8293c3 | 2939 | |
77457939 AK |
2940 | Fast failover |
2941 | """"""""""""" | |
2942 | As the primary purpose of EVPN-MH is redundancy keeping the failover efficient | |
2943 | is a recurring theme in the implementation. Following sub-features have | |
2944 | been introduced for the express purpose of efficient ES failovers. | |
2945 | ||
2946 | - Layer-2 Nexthop Groups and MAC-ECMP via L2NHG. | |
2947 | ||
2948 | - Host routes (for symmetric IRB) via L3NHG. | |
2949 | On dataplanes that support layer3 nexthop groups the feature can be turned | |
2950 | on via the following BGP config - | |
2951 | ||
03750f1e | 2952 | .. clicmd:: use-es-l3nhg |
77457939 AK |
2953 | |
2954 | - Local ES (MAC/Neigh) failover via ES-redirect. | |
2955 | On dataplanes that do not have support for ES-redirect the feature can be | |
2956 | turned off via the following zebra config - | |
2957 | ||
03750f1e | 2958 | .. clicmd:: evpn mh redirect-off |
77457939 AK |
2959 | |
2960 | Uplink/Core tracking | |
2961 | """""""""""""""""""" | |
2962 | When all the underlay links go down the PE no longer has access to the VxLAN | |
2963 | +overlay. To prevent blackholing of traffic the server/ES links are | |
2964 | protodowned on the PE. A link can be setup for uplink tracking via the | |
2965 | following zebra configuration - | |
2966 | ||
03750f1e | 2967 | .. clicmd:: evpn mh uplink |
77457939 AK |
2968 | |
2969 | Proxy advertisements | |
2970 | """""""""""""""""""" | |
2971 | To handle hitless upgrades support for proxy advertisement has been added | |
2972 | as specified by draft-rbickhart-evpn-ip-mac-proxy-adv. This allows a PE | |
2973 | (say PE1) to proxy advertise a MAC-IP rxed from an ES peer (say PE2). When | |
2974 | the ES peer (PE2) goes down PE1 continues to advertise hosts learnt from PE2 | |
2975 | for a holdtime during which it attempts to establish local reachability of | |
2976 | the host. This holdtime is configurable via the following zebra commands - | |
2977 | ||
03750f1e | 2978 | .. clicmd:: evpn mh neigh-holdtime (0-86400) |
77457939 | 2979 | |
03750f1e | 2980 | .. clicmd:: evpn mh mac-holdtime (0-86400) |
77457939 AK |
2981 | |
2982 | Startup delay | |
2983 | """"""""""""" | |
2984 | When a switch is rebooted we wait for a brief period to allow the underlay | |
2985 | and EVPN network to converge before enabling the ESs. For this duration the | |
2986 | ES bonds are held protodown. The startup delay is configurable via the | |
2987 | following zebra command - | |
2988 | ||
03750f1e | 2989 | .. clicmd:: evpn mh startup-delay (0-3600) |
77457939 | 2990 | |
ee9d0f09 PG |
2991 | +Support with VRF network namespace backend |
2992 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
2993 | It is possible to separate overlay networks contained in VXLAN interfaces from | |
2994 | underlay networks by using VRFs. VRF-lite and VRF-netns backends can be used for | |
2995 | that. In the latter case, it is necessary to set both bridge and vxlan interface | |
2996 | in the same network namespace, as below example illustrates: | |
2997 | ||
2998 | .. code-block:: shell | |
2999 | ||
3000 | # linux shell | |
3001 | ip netns add vrf1 | |
3002 | ip link add name vxlan101 type vxlan id 101 dstport 4789 dev eth0 local 10.1.1.1 | |
3003 | ip link set dev vxlan101 netns vrf1 | |
3004 | ip netns exec vrf1 ip link set dev lo up | |
3005 | ip netns exec vrf1 brctl addbr bridge101 | |
3006 | ip netns exec vrf1 brctl addif bridge101 vxlan101 | |
3007 | ||
3008 | This makes it possible to separate not only layer 3 networks like VRF-lite networks. | |
3009 | Also, VRF netns based make possible to separate layer 2 networks on separate VRF | |
3010 | instances. | |
89b97c33 | 3011 | |
7f7940e6 MK |
3012 | .. _bgp-conditional-advertisement: |
3013 | ||
3014 | BGP Conditional Advertisement | |
3015 | ----------------------------- | |
3016 | The BGP conditional advertisement feature uses the ``non-exist-map`` or the | |
3017 | ``exist-map`` and the ``advertise-map`` keywords of the neighbor advertise-map | |
3018 | command in order to track routes by the route prefix. | |
3019 | ||
3020 | ``non-exist-map`` | |
3021 | 1. If a route prefix is not present in the output of non-exist-map command, | |
3022 | then advertise the route specified by the advertise-map command. | |
3023 | ||
3024 | 2. If a route prefix is present in the output of non-exist-map command, | |
3025 | then do not advertise the route specified by the addvertise-map command. | |
3026 | ||
3027 | ``exist-map`` | |
3028 | 1. If a route prefix is present in the output of exist-map command, | |
3029 | then advertise the route specified by the advertise-map command. | |
3030 | ||
3031 | 2. If a route prefix is not present in the output of exist-map command, | |
3032 | then do not advertise the route specified by the advertise-map command. | |
3033 | ||
3034 | This feature is useful when some prefixes are advertised to one of its peers | |
3035 | only if the information from the other peer is not present (due to failure in | |
3036 | peering session or partial reachability etc). | |
3037 | ||
3038 | The conditional BGP announcements are sent in addition to the normal | |
3039 | announcements that a BGP router sends to its peer. | |
3040 | ||
3041 | The conditional advertisement process is triggered by the BGP scanner process, | |
389e4f92 QY |
3042 | which runs every 60 by default. This means that the maximum time for the |
3043 | conditional advertisement to take effect is the value of the process timer. | |
3044 | ||
3045 | As an optimization, while the process always runs on each timer expiry, it | |
3046 | determines whether or not the conditional advertisement policy or the routing | |
3047 | table has changed; if neither have changed, no processing is necessary and the | |
3048 | scanner exits early. | |
7f7940e6 | 3049 | |
03750f1e | 3050 | .. clicmd:: neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME |
7f7940e6 | 3051 | |
fa36596c | 3052 | This command enables BGP scanner process to monitor routes specified by |
7f7940e6 | 3053 | exist-map or non-exist-map command in BGP table and conditionally advertises |
fa36596c | 3054 | the routes specified by advertise-map command. |
7f7940e6 | 3055 | |
389e4f92 QY |
3056 | .. clicmd:: bgp conditional-advertisement timer (5-240) |
3057 | ||
3058 | Set the period to rerun the conditional advertisement scanner process. The | |
3059 | default is 60 seconds. | |
3060 | ||
7f7940e6 MK |
3061 | Sample Configuration |
3062 | ^^^^^^^^^^^^^^^^^^^^^ | |
3063 | .. code-block:: frr | |
3064 | ||
fa36596c MK |
3065 | interface enp0s9 |
3066 | ip address 10.10.10.2/24 | |
3067 | ! | |
3068 | interface enp0s10 | |
3069 | ip address 10.10.20.2/24 | |
3070 | ! | |
7f7940e6 | 3071 | interface lo |
fa36596c | 3072 | ip address 203.0.113.1/32 |
7f7940e6 MK |
3073 | ! |
3074 | router bgp 2 | |
3075 | bgp log-neighbor-changes | |
3076 | no bgp ebgp-requires-policy | |
3077 | neighbor 10.10.10.1 remote-as 1 | |
3078 | neighbor 10.10.20.3 remote-as 3 | |
3079 | ! | |
3080 | address-family ipv4 unicast | |
7f7940e6 | 3081 | neighbor 10.10.10.1 soft-reconfiguration inbound |
7f7940e6 | 3082 | neighbor 10.10.20.3 soft-reconfiguration inbound |
fa36596c | 3083 | neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP |
7f7940e6 MK |
3084 | exit-address-family |
3085 | ! | |
fa36596c MK |
3086 | ip prefix-list DEFAULT seq 5 permit 192.0.2.5/32 |
3087 | ip prefix-list DEFAULT seq 10 permit 192.0.2.1/32 | |
3088 | ip prefix-list EXIST seq 5 permit 10.10.10.10/32 | |
3089 | ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0 | |
3090 | ip prefix-list IP1 seq 5 permit 10.139.224.0/20 | |
3091 | ! | |
3092 | bgp community-list standard DC-ROUTES seq 5 permit 64952:3008 | |
3093 | bgp community-list standard DC-ROUTES seq 10 permit 64671:501 | |
3094 | bgp community-list standard DC-ROUTES seq 15 permit 64950:3009 | |
3095 | bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200 | |
7f7940e6 | 3096 | ! |
fa36596c MK |
3097 | route-map ADV-MAP permit 10 |
3098 | match ip address prefix-list IP1 | |
7f7940e6 | 3099 | ! |
fa36596c MK |
3100 | route-map ADV-MAP permit 20 |
3101 | match community DC-ROUTES | |
3102 | ! | |
3103 | route-map EXIST-MAP permit 10 | |
3104 | match community DEFAULT-ROUTE | |
3105 | match ip address prefix-list DEFAULT-ROUTE | |
7f7940e6 MK |
3106 | ! |
3107 | ||
3108 | Sample Output | |
3109 | ^^^^^^^^^^^^^ | |
3110 | ||
fa36596c | 3111 | 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 |
3112 | |
3113 | .. code-block:: frr | |
3114 | ||
3115 | Router2# show ip bgp | |
fa36596c | 3116 | BGP table version is 20, local router ID is 203.0.113.1, vrf id 0 |
7f7940e6 MK |
3117 | Default local pref 100, local AS 2 |
3118 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
3119 | i internal, r RIB-failure, S Stale, R Removed | |
3120 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self | |
3121 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3122 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3123 | |
fa36596c MK |
3124 | Network Next Hop Metric LocPrf Weight Path |
3125 | *> 0.0.0.0/0 10.10.10.1 0 0 1 i | |
3126 | *> 10.139.224.0/20 10.10.10.1 0 0 1 ? | |
3127 | *> 192.0.2.1/32 10.10.10.1 0 0 1 i | |
3128 | *> 192.0.2.5/32 10.10.10.1 0 0 1 i | |
7f7940e6 MK |
3129 | |
3130 | Displayed 4 routes and 4 total paths | |
fa36596c | 3131 | Router2# show ip bgp neighbors 10.10.20.3 |
7f7940e6 MK |
3132 | |
3133 | !--- Output suppressed. | |
3134 | ||
3135 | For address family: IPv4 Unicast | |
fa36596c | 3136 | Update group 7, subgroup 7 |
7f7940e6 MK |
3137 | Packet Queue length 0 |
3138 | Inbound soft reconfiguration allowed | |
3139 | Community attribute sent to this neighbor(all) | |
fa36596c MK |
3140 | Condition NON_EXIST, Condition-map *EXIST-MAP, Advertise-map *ADV-MAP, status: Withdraw |
3141 | 0 accepted prefixes | |
7f7940e6 MK |
3142 | |
3143 | !--- Output suppressed. | |
3144 | ||
fa36596c MK |
3145 | Router2# show ip bgp neighbors 10.10.20.3 advertised-routes |
3146 | BGP table version is 20, local router ID is 203.0.113.1, vrf id 0 | |
7f7940e6 MK |
3147 | Default local pref 100, local AS 2 |
3148 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
fa36596c | 3149 | i internal, r RIB-failure, S Stale, R Removed |
7f7940e6 MK |
3150 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self |
3151 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3152 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3153 | |
fa36596c MK |
3154 | Network Next Hop Metric LocPrf Weight Path |
3155 | *> 0.0.0.0/0 0.0.0.0 0 1 i | |
3156 | *> 192.0.2.5/32 0.0.0.0 0 1 i | |
7f7940e6 | 3157 | |
fa36596c | 3158 | Total number of prefixes 2 |
7f7940e6 | 3159 | |
fa36596c | 3160 | 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 |
3161 | |
3162 | .. code-block:: frr | |
3163 | ||
3164 | Router2# show ip bgp | |
fa36596c | 3165 | BGP table version is 21, local router ID is 203.0.113.1, vrf id 0 |
7f7940e6 MK |
3166 | Default local pref 100, local AS 2 |
3167 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
3168 | i internal, r RIB-failure, S Stale, R Removed | |
3169 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self | |
3170 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3171 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3172 | |
fa36596c MK |
3173 | Network Next Hop Metric LocPrf Weight Path |
3174 | *> 10.139.224.0/20 10.10.10.1 0 0 1 ? | |
3175 | *> 192.0.2.1/32 10.10.10.1 0 0 1 i | |
3176 | *> 192.0.2.5/32 10.10.10.1 0 0 1 i | |
7f7940e6 MK |
3177 | |
3178 | Displayed 3 routes and 3 total paths | |
7f7940e6 | 3179 | |
fa36596c | 3180 | Router2# show ip bgp neighbors 10.10.20.3 |
7f7940e6 MK |
3181 | |
3182 | !--- Output suppressed. | |
3183 | ||
3184 | For address family: IPv4 Unicast | |
fa36596c | 3185 | Update group 7, subgroup 7 |
7f7940e6 MK |
3186 | Packet Queue length 0 |
3187 | Inbound soft reconfiguration allowed | |
3188 | Community attribute sent to this neighbor(all) | |
fa36596c MK |
3189 | Condition NON_EXIST, Condition-map *EXIST-MAP, Advertise-map *ADV-MAP, status: Advertise |
3190 | 0 accepted prefixes | |
7f7940e6 MK |
3191 | |
3192 | !--- Output suppressed. | |
3193 | ||
fa36596c MK |
3194 | Router2# show ip bgp neighbors 10.10.20.3 advertised-routes |
3195 | BGP table version is 21, local router ID is 203.0.113.1, vrf id 0 | |
7f7940e6 MK |
3196 | Default local pref 100, local AS 2 |
3197 | Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, | |
3198 | i internal, r RIB-failure, S Stale, R Removed | |
3199 | Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self | |
3200 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
0bcfc1a3 | 3201 | RPKI validation codes: V valid, I invalid, N Not found |
7f7940e6 | 3202 | |
fa36596c MK |
3203 | Network Next Hop Metric LocPrf Weight Path |
3204 | *> 10.139.224.0/20 0.0.0.0 0 1 ? | |
3205 | *> 192.0.2.1/32 0.0.0.0 0 1 i | |
3206 | *> 192.0.2.5/32 0.0.0.0 0 1 i | |
7f7940e6 MK |
3207 | |
3208 | Total number of prefixes 3 | |
fa36596c | 3209 | Router2# |
7f7940e6 | 3210 | |
8fcedbd2 QY |
3211 | .. _bgp-debugging: |
3212 | ||
3213 | Debugging | |
3214 | --------- | |
42fc5d26 | 3215 | |
29adcd50 | 3216 | .. clicmd:: show debug |
42fc5d26 | 3217 | |
8fcedbd2 | 3218 | Show all enabled debugs. |
42fc5d26 | 3219 | |
54422b46 DS |
3220 | .. clicmd:: show bgp listeners |
3221 | ||
3222 | Display Listen sockets and the vrf that created them. Useful for debugging of when | |
3223 | listen is not working and this is considered a developer debug statement. | |
3224 | ||
81313f43 RZ |
3225 | .. clicmd:: debug bgp bfd |
3226 | ||
3227 | Enable or disable debugging for BFD events. This will show BFD integration | |
3228 | library messages and BGP BFD integration messages that are mostly state | |
3229 | transitions and validation problems. | |
3230 | ||
03750f1e | 3231 | .. clicmd:: debug bgp neighbor-events |
42fc5d26 | 3232 | |
8fcedbd2 QY |
3233 | Enable or disable debugging for neighbor events. This provides general |
3234 | information on BGP events such as peer connection / disconnection, session | |
3235 | establishment / teardown, and capability negotiation. | |
42fc5d26 | 3236 | |
03750f1e | 3237 | .. clicmd:: debug bgp updates |
42fc5d26 | 3238 | |
8fcedbd2 QY |
3239 | Enable or disable debugging for BGP updates. This provides information on |
3240 | BGP UPDATE messages transmitted and received between local and remote | |
3241 | instances. | |
42fc5d26 | 3242 | |
03750f1e | 3243 | .. clicmd:: debug bgp keepalives |
42fc5d26 | 3244 | |
8fcedbd2 QY |
3245 | Enable or disable debugging for BGP keepalives. This provides information on |
3246 | BGP KEEPALIVE messages transmitted and received between local and remote | |
3247 | instances. | |
c1a54c05 | 3248 | |
03750f1e | 3249 | .. clicmd:: debug bgp bestpath <A.B.C.D/M|X:X::X:X/M> |
42fc5d26 | 3250 | |
8fcedbd2 | 3251 | Enable or disable debugging for bestpath selection on the specified prefix. |
42fc5d26 | 3252 | |
03750f1e | 3253 | .. clicmd:: debug bgp nht |
4da7fda3 | 3254 | |
8fcedbd2 | 3255 | Enable or disable debugging of BGP nexthop tracking. |
4da7fda3 | 3256 | |
03750f1e | 3257 | .. clicmd:: debug bgp update-groups |
4b44467c | 3258 | |
8fcedbd2 QY |
3259 | Enable or disable debugging of dynamic update groups. This provides general |
3260 | information on group creation, deletion, join and prune events. | |
4b44467c | 3261 | |
03750f1e | 3262 | .. clicmd:: debug bgp zebra |
42fc5d26 | 3263 | |
8fcedbd2 | 3264 | Enable or disable debugging of communications between *bgpd* and *zebra*. |
c3c5a71f | 3265 | |
8fcedbd2 QY |
3266 | Dumping Messages and Routing Tables |
3267 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
42fc5d26 | 3268 | |
8fcedbd2 | 3269 | .. clicmd:: dump bgp all PATH [INTERVAL] |
42fc5d26 | 3270 | |
8fcedbd2 | 3271 | .. clicmd:: dump bgp all-et PATH [INTERVAL] |
c3c5a71f | 3272 | |
42fc5d26 | 3273 | |
8fcedbd2 QY |
3274 | Dump all BGP packet and events to `path` file. |
3275 | If `interval` is set, a new file will be created for echo `interval` of | |
3276 | seconds. The path `path` can be set with date and time formatting | |
3277 | (strftime). The type ‘all-et’ enables support for Extended Timestamp Header | |
3278 | (:ref:`packet-binary-dump-format`). | |
c3c5a71f | 3279 | |
8fcedbd2 | 3280 | .. clicmd:: dump bgp updates PATH [INTERVAL] |
42fc5d26 | 3281 | |
8fcedbd2 | 3282 | .. clicmd:: dump bgp updates-et PATH [INTERVAL] |
42fc5d26 | 3283 | |
42fc5d26 | 3284 | |
8fcedbd2 QY |
3285 | Dump only BGP updates messages to `path` file. |
3286 | If `interval` is set, a new file will be created for echo `interval` of | |
3287 | seconds. The path `path` can be set with date and time formatting | |
3288 | (strftime). The type ‘updates-et’ enables support for Extended Timestamp | |
3289 | Header (:ref:`packet-binary-dump-format`). | |
42fc5d26 | 3290 | |
8fcedbd2 | 3291 | .. clicmd:: dump bgp routes-mrt PATH |
c3c5a71f | 3292 | |
8fcedbd2 | 3293 | .. clicmd:: dump bgp routes-mrt PATH INTERVAL |
42fc5d26 | 3294 | |
42fc5d26 | 3295 | |
8fcedbd2 QY |
3296 | Dump whole BGP routing table to `path`. This is heavy process. The path |
3297 | `path` can be set with date and time formatting (strftime). If `interval` is | |
3298 | set, a new file will be created for echo `interval` of seconds. | |
42fc5d26 | 3299 | |
8fcedbd2 | 3300 | Note: the interval variable can also be set using hours and minutes: 04h20m00. |
42fc5d26 | 3301 | |
c3c5a71f | 3302 | |
8fcedbd2 | 3303 | .. _bgp-other-commands: |
42fc5d26 | 3304 | |
8fcedbd2 QY |
3305 | Other BGP Commands |
3306 | ------------------ | |
42fc5d26 | 3307 | |
e312b6c6 QY |
3308 | The following are available in the top level *enable* mode: |
3309 | ||
dc912615 DS |
3310 | .. clicmd:: clear bgp \* |
3311 | ||
3312 | Clear all peers. | |
3313 | ||
8fcedbd2 | 3314 | .. clicmd:: clear bgp ipv4|ipv6 \* |
42fc5d26 | 3315 | |
dc912615 DS |
3316 | Clear all peers with this address-family activated. |
3317 | ||
dc912615 DS |
3318 | .. clicmd:: clear bgp ipv4|ipv6 unicast \* |
3319 | ||
3320 | Clear all peers with this address-family and sub-address-family activated. | |
42fc5d26 | 3321 | |
8fcedbd2 | 3322 | .. clicmd:: clear bgp ipv4|ipv6 PEER |
42fc5d26 | 3323 | |
dc912615 DS |
3324 | Clear peers with address of X.X.X.X and this address-family activated. |
3325 | ||
dc912615 DS |
3326 | .. clicmd:: clear bgp ipv4|ipv6 unicast PEER |
3327 | ||
3328 | Clear peer with address of X.X.X.X and this address-family and sub-address-family activated. | |
3329 | ||
dc912615 DS |
3330 | .. clicmd:: clear bgp ipv4|ipv6 PEER soft|in|out |
3331 | ||
3332 | Clear peer using soft reconfiguration in this address-family. | |
42fc5d26 | 3333 | |
dc912615 | 3334 | .. clicmd:: clear bgp ipv4|ipv6 unicast PEER soft|in|out |
42fc5d26 | 3335 | |
dc912615 | 3336 | Clear peer using soft reconfiguration in this address-family and sub-address-family. |
42fc5d26 | 3337 | |
e312b6c6 QY |
3338 | The following are available in the ``router bgp`` mode: |
3339 | ||
e312b6c6 QY |
3340 | .. clicmd:: write-quanta (1-64) |
3341 | ||
3342 | BGP message Tx I/O is vectored. This means that multiple packets are written | |
3343 | to the peer socket at the same time each I/O cycle, in order to minimize | |
3344 | system call overhead. This value controls how many are written at a time. | |
3345 | Under certain load conditions, reducing this value could make peer traffic | |
3346 | less 'bursty'. In practice, leave this settings on the default (64) unless | |
3347 | you truly know what you are doing. | |
3348 | ||
dad83b67 | 3349 | .. clicmd:: read-quanta (1-10) |
e312b6c6 QY |
3350 | |
3351 | Unlike Tx, BGP Rx traffic is not vectored. Packets are read off the wire one | |
3352 | at a time in a loop. This setting controls how many iterations the loop runs | |
3353 | for. As with write-quanta, it is best to leave this setting on the default. | |
42fc5d26 | 3354 | |
05bd726c | 3355 | The following command is available in ``config`` mode as well as in the |
3356 | ``router bgp`` mode: | |
3357 | ||
05bd726c | 3358 | .. clicmd:: bgp graceful-shutdown |
3359 | ||
3360 | The purpose of this command is to initiate BGP Graceful Shutdown which | |
3361 | is described in :rfc:`8326`. The use case for this is to minimize or | |
3362 | eliminate the amount of traffic loss in a network when a planned | |
3363 | maintenance activity such as software upgrade or hardware replacement | |
3364 | is to be performed on a router. The feature works by re-announcing | |
3365 | routes to eBGP peers with the GRACEFUL_SHUTDOWN community included. | |
3366 | Peers are then expected to treat such paths with the lowest preference. | |
3367 | This happens automatically on a receiver running FRR; with other | |
3368 | routing protocol stacks, an inbound policy may have to be configured. | |
3369 | In FRR, triggering graceful shutdown also results in announcing a | |
3370 | LOCAL_PREF of 0 to iBGP peers. | |
3371 | ||
3372 | Graceful shutdown can be configured per BGP instance or globally for | |
3373 | all of BGP. These two options are mutually exclusive. The no form of | |
3374 | the command causes graceful shutdown to be stopped, and routes will | |
3375 | be re-announced without the GRACEFUL_SHUTDOWN community and/or with | |
3376 | the usual LOCAL_PREF value. Note that if this option is saved to | |
3377 | the startup configuration, graceful shutdown will remain in effect | |
3378 | across restarts of *bgpd* and will need to be explicitly disabled. | |
3379 | ||
8fcedbd2 | 3380 | .. _bgp-displaying-bgp-information: |
42fc5d26 | 3381 | |
8fcedbd2 QY |
3382 | Displaying BGP Information |
3383 | ========================== | |
42fc5d26 | 3384 | |
e6f59415 PG |
3385 | The following four commands display the IPv6 and IPv4 routing tables, depending |
3386 | on whether or not the ``ip`` keyword is used. | |
3387 | Actually, :clicmd:`show ip bgp` command was used on older `Quagga` routing | |
3388 | daemon project, while :clicmd:`show bgp` command is the new format. The choice | |
3389 | has been done to keep old format with IPv4 routing table, while new format | |
3390 | displays IPv6 routing table. | |
3391 | ||
4c92d818 | 3392 | .. clicmd:: show ip bgp [all] [wide|json [detail]] |
42fc5d26 | 3393 | |
96f3485c | 3394 | .. clicmd:: show ip bgp A.B.C.D [json] |
c1a54c05 | 3395 | |
4c92d818 | 3396 | .. clicmd:: show bgp [all] [wide|json [detail]] |
e6f59415 | 3397 | |
96f3485c | 3398 | .. clicmd:: show bgp X:X::X:X [json] |
42fc5d26 | 3399 | |
8fcedbd2 | 3400 | These commands display BGP routes. When no route is specified, the default |
e6f59415 | 3401 | is to display all BGP routes. |
42fc5d26 | 3402 | |
8fcedbd2 | 3403 | :: |
c1a54c05 | 3404 | |
8fcedbd2 QY |
3405 | BGP table version is 0, local router ID is 10.1.1.1 |
3406 | Status codes: s suppressed, d damped, h history, * valid, > best, i - internal | |
3407 | Origin codes: i - IGP, e - EGP, ? - incomplete | |
42fc5d26 | 3408 | |
8fcedbd2 QY |
3409 | Network Next Hop Metric LocPrf Weight Path |
3410 | \*> 1.1.1.1/32 0.0.0.0 0 32768 i | |
42fc5d26 | 3411 | |
8fcedbd2 | 3412 | Total number of prefixes 1 |
4da7fda3 | 3413 | |
56c07345 | 3414 | If ``wide`` option is specified, then the prefix table's width is increased |
986b0fc3 DA |
3415 | to fully display the prefix and the nexthop. |
3416 | ||
3417 | This is especially handy dealing with IPv6 prefixes and | |
3418 | if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. | |
3419 | ||
56c07345 | 3420 | If ``all`` option is specified, ``ip`` keyword is ignored, show bgp all and |
96f3485c MK |
3421 | show ip bgp all commands display routes for all AFIs and SAFIs. |
3422 | ||
56c07345 | 3423 | If ``json`` option is specified, output is displayed in JSON format. |
96f3485c | 3424 | |
4c92d818 DA |
3425 | If ``detail`` option is specified after ``json``, more verbose JSON output |
3426 | will be displayed. | |
3427 | ||
e6f59415 PG |
3428 | Some other commands provide additional options for filtering the output. |
3429 | ||
e6f59415 | 3430 | .. clicmd:: show [ip] bgp regexp LINE |
42fc5d26 | 3431 | |
8fcedbd2 QY |
3432 | This command displays BGP routes using AS path regular expression |
3433 | (:ref:`bgp-regular-expressions`). | |
42fc5d26 | 3434 | |
28b25b6b | 3435 | .. clicmd:: show [ip] bgp [all] summary [wide] [json] |
42fc5d26 | 3436 | |
8fcedbd2 | 3437 | Show a bgp peer summary for the specified address family. |
42fc5d26 | 3438 | |
e6f59415 PG |
3439 | The old command structure :clicmd:`show ip bgp` may be removed in the future |
3440 | and should no longer be used. In order to reach the other BGP routing tables | |
3441 | other than the IPv6 routing table given by :clicmd:`show bgp`, the new command | |
3442 | structure is extended with :clicmd:`show bgp [afi] [safi]`. | |
3443 | ||
28b25b6b DA |
3444 | ``wide`` option gives more output like ``LocalAS`` and extended ``Desc`` to |
3445 | 64 characters. | |
3446 | ||
3447 | .. code-block:: frr | |
3448 | ||
3449 | exit1# show ip bgp summary wide | |
3450 | ||
6cac2fcc | 3451 | IPv4 Unicast Summary (VRF default): |
28b25b6b DA |
3452 | BGP router identifier 192.168.100.1, local AS number 65534 vrf-id 0 |
3453 | BGP table version 3 | |
3454 | RIB entries 5, using 920 bytes of memory | |
3455 | Peers 1, using 27 KiB of memory | |
3456 | ||
3457 | Neighbor V AS LocalAS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc | |
3458 | 192.168.0.2 4 65030 123 15 22 0 0 0 00:07:00 0 1 us-east1-rs1.frrouting.org | |
3459 | ||
3460 | Total number of neighbors 1 | |
3461 | exit1# | |
3462 | ||
96f3485c | 3463 | .. clicmd:: show bgp [afi] [safi] [all] [wide|json] |
e6f59415 | 3464 | |
22bfb2a6 | 3465 | .. clicmd:: show bgp [<ipv4|ipv6> <unicast|multicast|vpn|labeled-unicast|flowspec> | l2vpn evpn] |
e6f59415 PG |
3466 | |
3467 | These commands display BGP routes for the specific routing table indicated by | |
3468 | the selected afi and the selected safi. If no afi and no safi value is given, | |
6cfd16ad | 3469 | the command falls back to the default IPv6 routing table. |
6cfd16ad | 3470 | |
6cfd16ad TA |
3471 | .. clicmd:: show bgp l2vpn evpn route [type <macip|2|multicast|3|es|4|prefix|5>] |
3472 | ||
22bfb2a6 | 3473 | EVPN prefixes can also be filtered by EVPN route type. |
e6f59415 | 3474 | |
96f3485c | 3475 | .. clicmd:: show bgp [afi] [safi] [all] summary [json] |
e6f59415 PG |
3476 | |
3477 | Show a bgp peer summary for the specified address family, and subsequent | |
3478 | address-family. | |
3479 | ||
96f3485c | 3480 | .. clicmd:: show bgp [afi] [safi] [all] summary failed [json] |
3577f1c5 DD |
3481 | |
3482 | Show a bgp peer summary for peers that are not succesfully exchanging routes | |
3483 | for the specified address family, and subsequent address-family. | |
3484 | ||
96f3485c | 3485 | .. clicmd:: show bgp [afi] [safi] [all] summary established [json] |
1c027267 DA |
3486 | |
3487 | Show a bgp peer summary for peers that are succesfully exchanging routes | |
3488 | for the specified address family, and subsequent address-family. | |
3489 | ||
8c1d4cd5 LS |
3490 | .. clicmd:: show bgp [afi] [safi] [all] summary neighbor [PEER] [json] |
3491 | ||
3492 | Show a bgp summary for the specified peer, address family, and | |
3493 | subsequent address-family. The neighbor filter can be used in combination | |
3494 | with the failed, established filters. | |
3495 | ||
3496 | .. clicmd:: show bgp [afi] [safi] [all] summary remote-as <internal|external|ASN> [json] | |
3497 | ||
3498 | Show a bgp peer summary for the specified remote-as ASN or type (``internal`` | |
3499 | for iBGP and ``external`` for eBGP sessions), address family, and subsequent | |
3500 | address-family. The remote-as filter can be used in combination with the | |
3501 | failed, established filters. | |
3502 | ||
96c81f66 LS |
3503 | .. clicmd:: show bgp [afi] [safi] [all] summary terse [json] |
3504 | ||
3505 | Shorten the output. Do not show the following information about the BGP | |
3506 | instances: the number of RIB entries, the table version and the used memory. | |
3507 | The ``terse`` option can be used in combination with the remote-as, neighbor, | |
3508 | failed and established filters, and with the ``wide`` option as well. | |
3509 | ||
22bfb2a6 | 3510 | .. clicmd:: show bgp [afi] [safi] [neighbor [PEER] [routes|advertised-routes|received-routes] [json] |
9eb95b3b | 3511 | |
e6f59415 PG |
3512 | This command shows information on a specific BGP peer of the relevant |
3513 | afi and safi selected. | |
c1a54c05 | 3514 | |
22bfb2a6 TA |
3515 | The ``routes`` keyword displays only routes in this address-family's BGP |
3516 | table that were received by this peer and accepted by inbound policy. | |
3517 | ||
3518 | The ``advertised-routes`` keyword displays only the routes in this | |
3519 | address-family's BGP table that were permitted by outbound policy and | |
3520 | advertised to to this peer. | |
3521 | ||
3522 | The ``received-routes`` keyword displays all routes belonging to this | |
3523 | address-family (prior to inbound policy) that were received by this peer. | |
3524 | ||
96f3485c | 3525 | .. clicmd:: show bgp [afi] [safi] [all] dampening dampened-paths [wide|json] |
42fc5d26 | 3526 | |
e6f59415 PG |
3527 | Display paths suppressed due to dampening of the selected afi and safi |
3528 | selected. | |
42fc5d26 | 3529 | |
96f3485c | 3530 | .. clicmd:: show bgp [afi] [safi] [all] dampening flap-statistics [wide|json] |
c1a54c05 | 3531 | |
e6f59415 | 3532 | Display flap statistics of routes of the selected afi and safi selected. |
42fc5d26 | 3533 | |
244e6cab DA |
3534 | .. clicmd:: show bgp [afi] [safi] [all] version (1-4294967295) [wide|json] |
3535 | ||
3536 | Display prefixes with matching version numbers. The version number and | |
3537 | above having prefixes will be listed here. | |
3538 | ||
3539 | It helps to identify which prefixes were installed at some point. | |
3540 | ||
3541 | Here is an example of how to check what prefixes were installed starting | |
3542 | with an arbitrary version:: | |
3543 | ||
01af2696 | 3544 | .. code-block:: shell |
244e6cab | 3545 | |
01af2696 DS |
3546 | # vtysh -c 'show bgp ipv4 unicast json' | jq '.tableVersion' |
3547 | 9 | |
3548 | # vtysh -c 'show ip bgp version 9 json' | jq -r '.routes | keys[]' | |
3549 | 192.168.3.0/24 | |
3550 | # vtysh -c 'show ip bgp version 8 json' | jq -r '.routes | keys[]' | |
3551 | 192.168.2.0/24 | |
3552 | 192.168.3.0/24 | |
244e6cab | 3553 | |
620e23e8 PG |
3554 | .. clicmd:: show bgp [afi] [safi] statistics |
3555 | ||
3556 | Display statistics of routes of the selected afi and safi. | |
3557 | ||
620e23e8 PG |
3558 | .. clicmd:: show bgp statistics-all |
3559 | ||
3560 | Display statistics of routes of all the afi and safi. | |
3561 | ||
96f3485c MK |
3562 | .. clicmd:: show [ip] bgp [afi] [safi] [all] cidr-only [wide|json] |
3563 | ||
3564 | Display routes with non-natural netmasks. | |
3565 | ||
96f3485c MK |
3566 | .. clicmd:: show [ip] bgp [afi] [safi] [all] neighbors A.B.C.D [advertised-routes|received-routes|filtered-routes] [json|wide] |
3567 | ||
3568 | Display the routes advertised to a BGP neighbor or received routes | |
3569 | from neighbor or filtered routes received from neighbor based on the | |
3570 | option specified. | |
3571 | ||
56c07345 | 3572 | If ``wide`` option is specified, then the prefix table's width is increased |
96f3485c MK |
3573 | to fully display the prefix and the nexthop. |
3574 | ||
3575 | This is especially handy dealing with IPv6 prefixes and | |
3576 | if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. | |
3577 | ||
56c07345 | 3578 | If ``all`` option is specified, ``ip`` keyword is ignored and, |
96f3485c | 3579 | routes displayed for all AFIs and SAFIs. |
56c07345 | 3580 | if afi is specified, with ``all`` option, routes will be displayed for |
96f3485c MK |
3581 | each SAFI in the selcted AFI |
3582 | ||
56c07345 | 3583 | If ``json`` option is specified, output is displayed in JSON format. |
96f3485c | 3584 | |
8fcedbd2 | 3585 | .. _bgp-display-routes-by-community: |
42fc5d26 | 3586 | |
8fcedbd2 QY |
3587 | Displaying Routes by Community Attribute |
3588 | ---------------------------------------- | |
42fc5d26 | 3589 | |
8fcedbd2 QY |
3590 | The following commands allow displaying routes based on their community |
3591 | attribute. | |
42fc5d26 | 3592 | |
96f3485c | 3593 | .. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community [wide|json] |
42fc5d26 | 3594 | |
96f3485c | 3595 | .. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY [wide|json] |
42fc5d26 | 3596 | |
96f3485c | 3597 | .. clicmd:: show [ip] bgp <ipv4|ipv6> [all] community COMMUNITY exact-match [wide|json] |
76bd1499 | 3598 | |
8fcedbd2 QY |
3599 | These commands display BGP routes which have the community attribute. |
3600 | attribute. When ``COMMUNITY`` is specified, BGP routes that match that | |
3601 | community are displayed. When `exact-match` is specified, it display only | |
3602 | routes that have an exact match. | |
c3c5a71f | 3603 | |
8fcedbd2 | 3604 | .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD |
42fc5d26 | 3605 | |
8fcedbd2 | 3606 | .. clicmd:: show [ip] bgp <ipv4|ipv6> community-list WORD exact-match |
42fc5d26 | 3607 | |
8fcedbd2 QY |
3608 | These commands display BGP routes for the address family specified that |
3609 | match the specified community list. When `exact-match` is specified, it | |
3610 | displays only routes that have an exact match. | |
42fc5d26 | 3611 | |
56c07345 | 3612 | If ``wide`` option is specified, then the prefix table's width is increased |
96f3485c MK |
3613 | to fully display the prefix and the nexthop. |
3614 | ||
3615 | This is especially handy dealing with IPv6 prefixes and | |
3616 | if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. | |
3617 | ||
56c07345 | 3618 | If ``all`` option is specified, ``ip`` keyword is ignored and, |
96f3485c | 3619 | routes displayed for all AFIs and SAFIs. |
56c07345 | 3620 | if afi is specified, with ``all`` option, routes will be displayed for |
96f3485c MK |
3621 | each SAFI in the selcted AFI |
3622 | ||
56c07345 | 3623 | If ``json`` option is specified, output is displayed in JSON format. |
e3ea6503 | 3624 | |
e3ea6503 PR |
3625 | .. clicmd:: show bgp labelpool <chunks|inuse|ledger|requests|summary> [json] |
3626 | ||
3627 | These commands display information about the BGP labelpool used for | |
3628 | the association of MPLS labels with routes for L3VPN and Labeled Unicast | |
3629 | ||
3630 | If ``chunks`` option is specified, output shows the current list of label | |
3631 | chunks granted to BGP by Zebra, indicating the start and end label in | |
3632 | each chunk | |
3633 | ||
3634 | If ``inuse`` option is specified, output shows the current inuse list of | |
3635 | label to prefix mappings | |
3636 | ||
3637 | If ``ledger`` option is specified, output shows ledger list of all | |
3638 | label requests made per prefix | |
3639 | ||
3640 | If ``requests`` option is specified, output shows current list of label | |
3641 | requests which have not yet been fulfilled by the labelpool | |
3642 | ||
3643 | If ``summary`` option is specified, output is a summary of the counts for | |
3644 | the chunks, inuse, ledger and requests list along with the count of | |
3645 | outstanding chunk requests to Zebra and the nummber of zebra reconnects | |
3646 | that have happened | |
3647 | ||
3648 | If ``json`` option is specified, output is displayed in JSON format. | |
96f3485c | 3649 | |
36a206db | 3650 | .. _bgp-display-routes-by-lcommunity: |
3651 | ||
3652 | Displaying Routes by Large Community Attribute | |
3653 | ---------------------------------------------- | |
3654 | ||
ac2201bb | 3655 | The following commands allow displaying routes based on their |
36a206db | 3656 | large community attribute. |
3657 | ||
36a206db | 3658 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community |
3659 | ||
36a206db | 3660 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY |
3661 | ||
36a206db | 3662 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match |
3663 | ||
36a206db | 3664 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json |
3665 | ||
3666 | These commands display BGP routes which have the large community attribute. | |
3667 | attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that | |
ac2201bb DA |
3668 | large community are displayed. When `exact-match` is specified, it display |
3669 | only routes that have an exact match. When `json` is specified, it display | |
36a206db | 3670 | routes in json format. |
3671 | ||
36a206db | 3672 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD |
3673 | ||
36a206db | 3674 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match |
3675 | ||
36a206db | 3676 | .. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json |
3677 | ||
3678 | These commands display BGP routes for the address family specified that | |
ac2201bb DA |
3679 | match the specified large community list. When `exact-match` is specified, |
3680 | it displays only routes that have an exact match. When `json` is specified, | |
36a206db | 3681 | it display routes in json format. |
3682 | ||
8fcedbd2 | 3683 | .. _bgp-display-routes-by-as-path: |
42fc5d26 | 3684 | |
36a206db | 3685 | |
8fcedbd2 QY |
3686 | Displaying Routes by AS Path |
3687 | ---------------------------- | |
42fc5d26 | 3688 | |
8fcedbd2 | 3689 | .. clicmd:: show bgp ipv4|ipv6 regexp LINE |
76bd1499 | 3690 | |
8fcedbd2 QY |
3691 | This commands displays BGP routes that matches a regular |
3692 | expression `line` (:ref:`bgp-regular-expressions`). | |
3693 | ||
e6f59415 | 3694 | .. clicmd:: show [ip] bgp ipv4 vpn |
8fcedbd2 | 3695 | |
e6f59415 | 3696 | .. clicmd:: show [ip] bgp ipv6 vpn |
8fcedbd2 QY |
3697 | |
3698 | Print active IPV4 or IPV6 routes advertised via the VPN SAFI. | |
3699 | ||
8fcedbd2 QY |
3700 | .. clicmd:: show bgp ipv4 vpn summary |
3701 | ||
8fcedbd2 QY |
3702 | .. clicmd:: show bgp ipv6 vpn summary |
3703 | ||
3704 | Print a summary of neighbor connections for the specified AFI/SAFI combination. | |
3705 | ||
22bfb2a6 TA |
3706 | Displaying Routes by Route Distinguisher |
3707 | ---------------------------------------- | |
3708 | ||
3709 | .. clicmd:: show bgp [<ipv4|ipv6> vpn | l2vpn evpn [route]] rd <all|RD> | |
3710 | ||
3711 | For L3VPN and EVPN address-families, routes can be displayed on a per-RD | |
3712 | (Route Distinguisher) basis or for all RD's. | |
3713 | ||
3714 | .. clicmd:: show bgp l2vpn evpn rd <all|RD> [overlay | tags] | |
3715 | ||
3716 | Use the ``overlay`` or ``tags`` keywords to display the overlay/tag | |
3717 | information about the EVPN prefixes in the selected Route Distinguisher. | |
3718 | ||
3719 | .. clicmd:: show bgp l2vpn evpn route rd <all|RD> mac <MAC> [ip <MAC>] [json] | |
3720 | ||
3721 | For EVPN Type 2 (macip) routes, a MAC address (and optionally an IP address) | |
3722 | can be supplied to the command to only display matching prefixes in the | |
3723 | specified RD. | |
3724 | ||
09d78f10 DS |
3725 | Displaying Update Group Information |
3726 | ----------------------------------- | |
3727 | ||
6c5be52a | 3728 | .. clicmd:: show bgp update-groups [advertise-queue|advertised-routes|packet-queue] |
09d78f10 DS |
3729 | |
3730 | Display Information about each individual update-group being used. | |
3731 | If SUBGROUP-ID is specified only display about that particular group. If | |
3732 | advertise-queue is specified the list of routes that need to be sent | |
3733 | to the peers in the update-group is displayed, advertised-routes means | |
a64e0ee5 | 3734 | the list of routes we have sent to the peers in the update-group and |
09d78f10 DS |
3735 | packet-queue specifies the list of packets in the queue to be sent. |
3736 | ||
6c5be52a | 3737 | .. clicmd:: show bgp update-groups statistics |
09d78f10 DS |
3738 | |
3739 | Display Information about update-group events in FRR. | |
8fcedbd2 | 3740 | |
4ccd4033 HS |
3741 | Segment-Routing IPv6 |
3742 | -------------------- | |
3743 | ||
3744 | .. clicmd:: show bgp segment-routing srv6 | |
3745 | ||
3746 | This command displays information about SRv6 L3VPN in bgpd. Specifically, | |
3747 | what kind of Locator is being used, and its Locator chunk information. | |
3748 | And the SID of the SRv6 Function that is actually managed on bgpd. | |
3749 | In the following example, bgpd is using a Locator named loc1, and two SRv6 | |
3750 | Functions are managed to perform VPNv6 VRF redirect for vrf10 and vrf20. | |
3751 | ||
3752 | :: | |
3753 | ||
3754 | router# show bgp segment-routing srv6 | |
3755 | locator_name: loc1 | |
3756 | locator_chunks: | |
3757 | - 2001:db8:1:1::/64 | |
3758 | functions: | |
3759 | - sid: 2001:db8:1:1::100 | |
3760 | locator: loc1 | |
3761 | - sid: 2001:db8:1:1::200 | |
3762 | locator: loc1 | |
3763 | bgps: | |
3764 | - name: default | |
3765 | vpn_policy[AFI_IP].tovpn_sid: none | |
3766 | vpn_policy[AFI_IP6].tovpn_sid: none | |
3767 | - name: vrf10 | |
3768 | vpn_policy[AFI_IP].tovpn_sid: none | |
3769 | vpn_policy[AFI_IP6].tovpn_sid: 2001:db8:1:1::100 | |
3770 | - name: vrf20 | |
3771 | vpn_policy[AFI_IP].tovpn_sid: none | |
3772 | vpn_policy[AFI_IP6].tovpn_sid: 2001:db8:1:1::200 | |
3773 | ||
3774 | ||
8fcedbd2 QY |
3775 | .. _bgp-route-reflector: |
3776 | ||
3777 | Route Reflector | |
3778 | =============== | |
3779 | ||
749afd7d RF |
3780 | BGP routers connected inside the same AS through BGP belong to an internal |
3781 | BGP session, or IBGP. In order to prevent routing table loops, IBGP does not | |
3782 | advertise IBGP-learned routes to other routers in the same session. As such, | |
3783 | IBGP requires a full mesh of all peers. For large networks, this quickly becomes | |
3784 | unscalable. Introducing route reflectors removes the need for the full-mesh. | |
8fcedbd2 | 3785 | |
749afd7d RF |
3786 | When route reflectors are configured, these will reflect the routes announced |
3787 | by the peers configured as clients. A route reflector client is configured | |
3788 | with: | |
8fcedbd2 | 3789 | |
8fcedbd2 QY |
3790 | .. clicmd:: neighbor PEER route-reflector-client |
3791 | ||
c3c5a71f | 3792 | |
749afd7d RF |
3793 | To avoid single points of failure, multiple route reflectors can be configured. |
3794 | ||
3795 | A cluster is a collection of route reflectors and their clients, and is used | |
3796 | by route reflectors to avoid looping. | |
3797 | ||
749afd7d | 3798 | .. clicmd:: bgp cluster-id A.B.C.D |
42fc5d26 | 3799 | |
03750f1e | 3800 | .. clicmd:: bgp no-rib |
8dad2243 DS |
3801 | |
3802 | To set and unset the BGP daemon ``-n`` / ``--no_kernel`` options during runtime | |
3803 | to disable BGP route installation to the RIB (Zebra), the ``[no] bgp no-rib`` | |
3804 | commands can be used; | |
3805 | ||
3806 | Please note that setting the option during runtime will withdraw all routes in | |
3807 | the daemons RIB from Zebra and unsetting it will announce all routes in the | |
3808 | daemons RIB to Zebra. If the option is passed as a command line argument when | |
3809 | starting the daemon and the configuration gets saved, the option will persist | |
3810 | unless removed from the configuration with the negating command prior to the | |
3811 | configuration write operation. | |
3812 | ||
03750f1e | 3813 | .. clicmd:: bgp send-extra-data zebra |
9a06c157 | 3814 | |
3165cca9 | 3815 | This Command turns off the ability of BGP to send extra data to zebra. |
9a06c157 DS |
3816 | In this case it's the AS-Path being used for the path. The default behavior |
3817 | in BGP is to send this data and to turn it off enter the no form of the command. | |
3818 | If extra data was sent to zebra, and this command is turned on there is no | |
3819 | effort to clean up this data in the rib. | |
3820 | ||
1cc55938 S |
3821 | .. _bgp-suppress-fib: |
3822 | ||
3823 | Suppressing routes not installed in FIB | |
3824 | ======================================= | |
3825 | ||
3826 | The FRR implementation of BGP advertises prefixes learnt from a peer to other | |
3827 | peers even if the routes do not get installed in the FIB. There can be | |
3828 | scenarios where the hardware tables in some of the routers (along the path from | |
3829 | the source to destination) is full which will result in all routes not getting | |
3830 | installed in the FIB. If these routes are advertised to the downstream routers | |
3831 | then traffic will start flowing and will be dropped at the intermediate router. | |
3832 | ||
3833 | The solution is to provide a configurable option to check for the FIB install | |
3834 | status of the prefixes and advertise to peers if the prefixes are successfully | |
3835 | installed in the FIB. The advertisement of the prefixes are suppressed if it is | |
3836 | not installed in FIB. | |
3837 | ||
3838 | The following conditions apply will apply when checking for route installation | |
3839 | status in FIB: | |
0ea5223c | 3840 | |
1cc55938 S |
3841 | 1. The advertisement or suppression of routes based on FIB install status |
3842 | applies only for newly learnt routes from peer (routes which are not in | |
3843 | BGP local RIB). | |
3844 | 2. If the route received from peer already exists in BGP local RIB and route | |
3845 | attributes have changed (best path changed), the old path is deleted and | |
3846 | new path is installed in FIB. The FIB install status will not have any | |
3847 | effect. Therefore only when the route is received first time the checks | |
3848 | apply. | |
3849 | 3. The feature will not apply for routes learnt through other means like | |
3850 | redistribution to bgp from other protocols. This is applicable only to | |
3851 | peer learnt routes. | |
3852 | 4. If a route is installed in FIB and then gets deleted from the dataplane, | |
3853 | then routes will not be withdrawn from peers. This will be considered as | |
3854 | dataplane issue. | |
3855 | 5. The feature will slightly increase the time required to advertise the routes | |
3856 | to peers since the route install status needs to be received from the FIB | |
3857 | 6. If routes are received by the peer before the configuration is applied, then | |
3858 | the bgp sessions need to be reset for the configuration to take effect. | |
3859 | 7. If the route which is already installed in dataplane is removed for some | |
3860 | reason, sending withdraw message to peers is not currently supported. | |
3861 | ||
03750f1e | 3862 | .. clicmd:: bgp suppress-fib-pending |
8dad2243 | 3863 | |
4f4ba68c DS |
3864 | This command is applicable at the global level and at an individual |
3865 | bgp level. If applied at the global level all bgp instances will | |
3866 | wait for fib installation before announcing routes and there is no | |
3867 | way to turn it off for a particular bgp vrf. | |
3868 | ||
0efdf0fe | 3869 | .. _routing-policy: |
42fc5d26 | 3870 | |
8fcedbd2 QY |
3871 | Routing Policy |
3872 | ============== | |
42fc5d26 | 3873 | |
4da7fda3 | 3874 | You can set different routing policy for a peer. For example, you can set |
9eb95b3b QY |
3875 | different filter for a peer. |
3876 | ||
3877 | .. code-block:: frr | |
c1a54c05 | 3878 | |
c1a54c05 QY |
3879 | ! |
3880 | router bgp 1 view 1 | |
3881 | neighbor 10.0.0.1 remote-as 2 | |
3882 | address-family ipv4 unicast | |
3883 | neighbor 10.0.0.1 distribute-list 1 in | |
3884 | exit-address-family | |
3885 | ! | |
3886 | router bgp 1 view 2 | |
3887 | neighbor 10.0.0.1 remote-as 2 | |
3888 | address-family ipv4 unicast | |
3889 | neighbor 10.0.0.1 distribute-list 2 in | |
3890 | exit-address-family | |
c3c5a71f | 3891 | |
4da7fda3 QY |
3892 | This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2. |
3893 | When the update is inserted into view 1, distribute-list 1 is applied. On the | |
3894 | other hand, when the update is inserted into view 2, distribute-list 2 is | |
3895 | applied. | |
42fc5d26 | 3896 | |
42fc5d26 | 3897 | |
0efdf0fe | 3898 | .. _bgp-regular-expressions: |
42fc5d26 QY |
3899 | |
3900 | BGP Regular Expressions | |
3901 | ======================= | |
3902 | ||
8fcedbd2 QY |
3903 | BGP regular expressions are based on :t:`POSIX 1003.2` regular expressions. The |
3904 | following description is just a quick subset of the POSIX regular expressions. | |
42fc5d26 QY |
3905 | |
3906 | ||
8fcedbd2 | 3907 | .\* |
c1a54c05 | 3908 | Matches any single character. |
42fc5d26 | 3909 | |
8fcedbd2 | 3910 | \* |
c1a54c05 | 3911 | Matches 0 or more occurrences of pattern. |
42fc5d26 | 3912 | |
8fcedbd2 | 3913 | \+ |
c1a54c05 | 3914 | Matches 1 or more occurrences of pattern. |
42fc5d26 QY |
3915 | |
3916 | ? | |
c1a54c05 | 3917 | Match 0 or 1 occurrences of pattern. |
42fc5d26 QY |
3918 | |
3919 | ^ | |
c1a54c05 | 3920 | Matches the beginning of the line. |
42fc5d26 QY |
3921 | |
3922 | $ | |
c1a54c05 | 3923 | Matches the end of the line. |
42fc5d26 QY |
3924 | |
3925 | _ | |
8fcedbd2 QY |
3926 | The ``_`` character has special meanings in BGP regular expressions. It |
3927 | matches to space and comma , and AS set delimiter ``{`` and ``}`` and AS | |
3928 | confederation delimiter ``(`` and ``)``. And it also matches to the | |
3929 | beginning of the line and the end of the line. So ``_`` can be used for AS | |
3930 | value boundaries match. This character technically evaluates to | |
3931 | ``(^|[,{}()]|$)``. | |
42fc5d26 | 3932 | |
42fc5d26 | 3933 | |
c1a54c05 | 3934 | .. _bgp-configuration-examples: |
42fc5d26 | 3935 | |
8fcedbd2 QY |
3936 | Miscellaneous Configuration Examples |
3937 | ==================================== | |
42fc5d26 | 3938 | |
9eb95b3b QY |
3939 | Example of a session to an upstream, advertising only one prefix to it. |
3940 | ||
3941 | .. code-block:: frr | |
42fc5d26 | 3942 | |
c1a54c05 QY |
3943 | router bgp 64512 |
3944 | bgp router-id 10.236.87.1 | |
3945 | neighbor upstream peer-group | |
3946 | neighbor upstream remote-as 64515 | |
3947 | neighbor upstream capability dynamic | |
3948 | neighbor 10.1.1.1 peer-group upstream | |
3949 | neighbor 10.1.1.1 description ACME ISP | |
c3c5a71f | 3950 | |
c1a54c05 QY |
3951 | address-family ipv4 unicast |
3952 | network 10.236.87.0/24 | |
3953 | neighbor upstream prefix-list pl-allowed-adv out | |
3954 | exit-address-family | |
3955 | ! | |
3956 | ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25 | |
3957 | ip prefix-list pl-allowed-adv seq 10 deny any | |
42fc5d26 | 3958 | |
aa9eafa4 QY |
3959 | A more complex example including upstream, peer and customer sessions |
3960 | advertising global prefixes and NO_EXPORT prefixes and providing actions for | |
3961 | customer routes based on community values. Extensive use is made of route-maps | |
3962 | and the 'call' feature to support selective advertising of prefixes. This | |
3963 | example is intended as guidance only, it has NOT been tested and almost | |
3964 | certainly contains silly mistakes, if not serious flaws. | |
42fc5d26 | 3965 | |
9eb95b3b | 3966 | .. code-block:: frr |
42fc5d26 | 3967 | |
c1a54c05 QY |
3968 | router bgp 64512 |
3969 | bgp router-id 10.236.87.1 | |
3970 | neighbor upstream capability dynamic | |
3971 | neighbor cust capability dynamic | |
3972 | neighbor peer capability dynamic | |
3973 | neighbor 10.1.1.1 remote-as 64515 | |
3974 | neighbor 10.1.1.1 peer-group upstream | |
3975 | neighbor 10.2.1.1 remote-as 64516 | |
3976 | neighbor 10.2.1.1 peer-group upstream | |
3977 | neighbor 10.3.1.1 remote-as 64517 | |
3978 | neighbor 10.3.1.1 peer-group cust-default | |
3979 | neighbor 10.3.1.1 description customer1 | |
3980 | neighbor 10.4.1.1 remote-as 64518 | |
3981 | neighbor 10.4.1.1 peer-group cust | |
3982 | neighbor 10.4.1.1 description customer2 | |
3983 | neighbor 10.5.1.1 remote-as 64519 | |
3984 | neighbor 10.5.1.1 peer-group peer | |
3985 | neighbor 10.5.1.1 description peer AS 1 | |
3986 | neighbor 10.6.1.1 remote-as 64520 | |
3987 | neighbor 10.6.1.1 peer-group peer | |
3988 | neighbor 10.6.1.1 description peer AS 2 | |
3989 | ||
3990 | address-family ipv4 unicast | |
3991 | network 10.123.456.0/24 | |
3992 | network 10.123.456.128/25 route-map rm-no-export | |
3993 | neighbor upstream route-map rm-upstream-out out | |
3994 | neighbor cust route-map rm-cust-in in | |
3995 | neighbor cust route-map rm-cust-out out | |
3996 | neighbor cust send-community both | |
3997 | neighbor peer route-map rm-peer-in in | |
3998 | neighbor peer route-map rm-peer-out out | |
3999 | neighbor peer send-community both | |
4000 | neighbor 10.3.1.1 prefix-list pl-cust1-network in | |
4001 | neighbor 10.4.1.1 prefix-list pl-cust2-network in | |
4002 | neighbor 10.5.1.1 prefix-list pl-peer1-network in | |
4003 | neighbor 10.6.1.1 prefix-list pl-peer2-network in | |
4004 | exit-address-family | |
4005 | ! | |
4006 | ip prefix-list pl-default permit 0.0.0.0/0 | |
4007 | ! | |
4008 | ip prefix-list pl-upstream-peers permit 10.1.1.1/32 | |
4009 | ip prefix-list pl-upstream-peers permit 10.2.1.1/32 | |
4010 | ! | |
4011 | ip prefix-list pl-cust1-network permit 10.3.1.0/24 | |
4012 | ip prefix-list pl-cust1-network permit 10.3.2.0/24 | |
4013 | ! | |
4014 | ip prefix-list pl-cust2-network permit 10.4.1.0/24 | |
4015 | ! | |
4016 | ip prefix-list pl-peer1-network permit 10.5.1.0/24 | |
4017 | ip prefix-list pl-peer1-network permit 10.5.2.0/24 | |
4018 | ip prefix-list pl-peer1-network permit 192.168.0.0/24 | |
4019 | ! | |
4020 | ip prefix-list pl-peer2-network permit 10.6.1.0/24 | |
4021 | ip prefix-list pl-peer2-network permit 10.6.2.0/24 | |
4022 | ip prefix-list pl-peer2-network permit 192.168.1.0/24 | |
4023 | ip prefix-list pl-peer2-network permit 192.168.2.0/24 | |
4024 | ip prefix-list pl-peer2-network permit 172.16.1/24 | |
4025 | ! | |
e6e62ee5 CS |
4026 | bgp as-path access-list seq 5 asp-own-as permit ^$ |
4027 | bgp as-path access-list seq 10 asp-own-as permit _64512_ | |
c1a54c05 QY |
4028 | ! |
4029 | ! ################################################################# | |
4030 | ! Match communities we provide actions for, on routes receives from | |
4031 | ! customers. Communities values of <our-ASN>:X, with X, have actions: | |
4032 | ! | |
4033 | ! 100 - blackhole the prefix | |
4034 | ! 200 - set no_export | |
4035 | ! 300 - advertise only to other customers | |
4036 | ! 400 - advertise only to upstreams | |
4037 | ! 500 - set no_export when advertising to upstreams | |
4038 | ! 2X00 - set local_preference to X00 | |
4039 | ! | |
4040 | ! blackhole the prefix of the route | |
a64e0ee5 | 4041 | bgp community-list standard cm-blackhole permit 64512:100 |
c1a54c05 QY |
4042 | ! |
4043 | ! set no-export community before advertising | |
a64e0ee5 | 4044 | bgp community-list standard cm-set-no-export permit 64512:200 |
c1a54c05 QY |
4045 | ! |
4046 | ! advertise only to other customers | |
a64e0ee5 | 4047 | bgp community-list standard cm-cust-only permit 64512:300 |
c1a54c05 QY |
4048 | ! |
4049 | ! advertise only to upstreams | |
a64e0ee5 | 4050 | bgp community-list standard cm-upstream-only permit 64512:400 |
c1a54c05 QY |
4051 | ! |
4052 | ! advertise to upstreams with no-export | |
a64e0ee5 | 4053 | bgp community-list standard cm-upstream-noexport permit 64512:500 |
c1a54c05 QY |
4054 | ! |
4055 | ! set local-pref to least significant 3 digits of the community | |
a64e0ee5 DA |
4056 | bgp community-list standard cm-prefmod-100 permit 64512:2100 |
4057 | bgp community-list standard cm-prefmod-200 permit 64512:2200 | |
4058 | bgp community-list standard cm-prefmod-300 permit 64512:2300 | |
4059 | bgp community-list standard cm-prefmod-400 permit 64512:2400 | |
4060 | bgp community-list expanded cme-prefmod-range permit 64512:2... | |
c1a54c05 QY |
4061 | ! |
4062 | ! Informational communities | |
4063 | ! | |
4064 | ! 3000 - learned from upstream | |
4065 | ! 3100 - learned from customer | |
4066 | ! 3200 - learned from peer | |
4067 | ! | |
a64e0ee5 DA |
4068 | bgp community-list standard cm-learnt-upstream permit 64512:3000 |
4069 | bgp community-list standard cm-learnt-cust permit 64512:3100 | |
4070 | bgp community-list standard cm-learnt-peer permit 64512:3200 | |
c1a54c05 QY |
4071 | ! |
4072 | ! ################################################################### | |
4073 | ! Utility route-maps | |
4074 | ! | |
4075 | ! These utility route-maps generally should not used to permit/deny | |
4076 | ! routes, i.e. they do not have meaning as filters, and hence probably | |
4077 | ! should be used with 'on-match next'. These all finish with an empty | |
4078 | ! permit entry so as not interfere with processing in the caller. | |
4079 | ! | |
4080 | route-map rm-no-export permit 10 | |
4081 | set community additive no-export | |
4082 | route-map rm-no-export permit 20 | |
4083 | ! | |
4084 | route-map rm-blackhole permit 10 | |
f6aa36f5 | 4085 | description blackhole, up-pref and ensure it cannot escape this AS |
c1a54c05 QY |
4086 | set ip next-hop 127.0.0.1 |
4087 | set local-preference 10 | |
4088 | set community additive no-export | |
4089 | route-map rm-blackhole permit 20 | |
4090 | ! | |
4091 | ! Set local-pref as requested | |
4092 | route-map rm-prefmod permit 10 | |
4093 | match community cm-prefmod-100 | |
4094 | set local-preference 100 | |
4095 | route-map rm-prefmod permit 20 | |
4096 | match community cm-prefmod-200 | |
4097 | set local-preference 200 | |
4098 | route-map rm-prefmod permit 30 | |
4099 | match community cm-prefmod-300 | |
4100 | set local-preference 300 | |
4101 | route-map rm-prefmod permit 40 | |
4102 | match community cm-prefmod-400 | |
4103 | set local-preference 400 | |
4104 | route-map rm-prefmod permit 50 | |
4105 | ! | |
4106 | ! Community actions to take on receipt of route. | |
4107 | route-map rm-community-in permit 10 | |
4108 | description check for blackholing, no point continuing if it matches. | |
4109 | match community cm-blackhole | |
4110 | call rm-blackhole | |
4111 | route-map rm-community-in permit 20 | |
4112 | match community cm-set-no-export | |
4113 | call rm-no-export | |
4114 | on-match next | |
4115 | route-map rm-community-in permit 30 | |
4116 | match community cme-prefmod-range | |
4117 | call rm-prefmod | |
4118 | route-map rm-community-in permit 40 | |
4119 | ! | |
4120 | ! ##################################################################### | |
4121 | ! Community actions to take when advertising a route. | |
4122 | ! These are filtering route-maps, | |
4123 | ! | |
4124 | ! Deny customer routes to upstream with cust-only set. | |
4125 | route-map rm-community-filt-to-upstream deny 10 | |
4126 | match community cm-learnt-cust | |
4127 | match community cm-cust-only | |
4128 | route-map rm-community-filt-to-upstream permit 20 | |
4129 | ! | |
4130 | ! Deny customer routes to other customers with upstream-only set. | |
4131 | route-map rm-community-filt-to-cust deny 10 | |
4132 | match community cm-learnt-cust | |
4133 | match community cm-upstream-only | |
4134 | route-map rm-community-filt-to-cust permit 20 | |
4135 | ! | |
4136 | ! ################################################################### | |
4137 | ! The top-level route-maps applied to sessions. Further entries could | |
4138 | ! be added obviously.. | |
4139 | ! | |
4140 | ! Customers | |
4141 | route-map rm-cust-in permit 10 | |
4142 | call rm-community-in | |
4143 | on-match next | |
4144 | route-map rm-cust-in permit 20 | |
4145 | set community additive 64512:3100 | |
4146 | route-map rm-cust-in permit 30 | |
4147 | ! | |
4148 | route-map rm-cust-out permit 10 | |
4149 | call rm-community-filt-to-cust | |
4150 | on-match next | |
4151 | route-map rm-cust-out permit 20 | |
4152 | ! | |
4153 | ! Upstream transit ASes | |
4154 | route-map rm-upstream-out permit 10 | |
4155 | description filter customer prefixes which are marked cust-only | |
4156 | call rm-community-filt-to-upstream | |
4157 | on-match next | |
4158 | route-map rm-upstream-out permit 20 | |
4159 | description only customer routes are provided to upstreams/peers | |
4160 | match community cm-learnt-cust | |
4161 | ! | |
4162 | ! Peer ASes | |
4163 | ! outbound policy is same as for upstream | |
4164 | route-map rm-peer-out permit 10 | |
4165 | call rm-upstream-out | |
4166 | ! | |
4167 | route-map rm-peer-in permit 10 | |
4168 | set community additive 64512:3200 | |
c3c5a71f | 4169 | |
8fcedbd2 QY |
4170 | |
4171 | Example of how to set up a 6-Bone connection. | |
4172 | ||
4173 | .. code-block:: frr | |
4174 | ||
4175 | ! bgpd configuration | |
4176 | ! ================== | |
4177 | ! | |
4178 | ! MP-BGP configuration | |
4179 | ! | |
4180 | router bgp 7675 | |
4181 | bgp router-id 10.0.0.1 | |
4182 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number` | |
4183 | ! | |
4184 | address-family ipv6 | |
4185 | network 3ffe:506::/32 | |
4186 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate | |
4187 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out | |
4188 | neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number` | |
4189 | neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out | |
4190 | exit-address-family | |
4191 | ! | |
4192 | ipv6 access-list all permit any | |
4193 | ! | |
4194 | ! Set output nexthop address. | |
4195 | ! | |
4196 | route-map set-nexthop permit 10 | |
4197 | match ipv6 address all | |
4198 | set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225 | |
4199 | set ipv6 nexthop local fe80::2c0:4fff:fe68:a225 | |
4200 | ! | |
4201 | log file bgpd.log | |
4202 | ! | |
4203 | ||
4ab46701 AR |
4204 | .. _bgp-tcp-mss: |
4205 | ||
4206 | BGP tcp-mss support | |
4207 | =================== | |
4208 | TCP provides a mechanism for the user to specify the max segment size. | |
4209 | setsockopt API is used to set the max segment size for TCP session. We | |
4210 | can configure this as part of BGP neighbor configuration. | |
4211 | ||
4212 | This document explains how to avoid ICMP vulnerability issues by limiting | |
4213 | TCP max segment size when you are using MTU discovery. Using MTU discovery | |
4214 | on TCP paths is one method of avoiding BGP packet fragmentation. | |
4215 | ||
4216 | TCP negotiates a maximum segment size (MSS) value during session connection | |
4217 | establishment between two peers. The MSS value negotiated is primarily based | |
073b7664 DA |
4218 | on the maximum transmission unit (MTU) of the interfaces to which the |
4219 | communicating peers are directly connected. However, due to variations in | |
4220 | link MTU on the path taken by the TCP packets, some packets in the network | |
4ab46701 | 4221 | that are well within the MSS value might be fragmented when the packet size |
073b7664 | 4222 | exceeds the link's MTU. |
4ab46701 AR |
4223 | |
4224 | This feature is supported with TCP over IPv4 and TCP over IPv6. | |
4225 | ||
4226 | CLI Configuration: | |
4227 | ------------------ | |
4228 | Below configuration can be done in router bgp mode and allows the user to | |
4229 | configure the tcp-mss value per neighbor. The configuration gets applied | |
4230 | only after hard reset is performed on that neighbor. If we configure tcp-mss | |
4231 | on both the neighbors then both neighbors need to be reset. | |
4232 | ||
4233 | The configuration takes effect based on below rules, so there is a configured | |
4234 | tcp-mss and a synced tcp-mss value per TCP session. | |
4235 | ||
4236 | By default if the configuration is not done then the TCP max segment size is | |
4237 | set to the Maximum Transmission unit (MTU) – (IP/IP6 header size + TCP header | |
4238 | size + ethernet header). For IPv4 its MTU – (20 bytes IP header + 20 bytes TCP | |
4239 | header + 12 bytes ethernet header) and for IPv6 its MTU – (40 bytes IPv6 header | |
4240 | + 20 bytes TCP header + 12 bytes ethernet header). | |
4241 | ||
073b7664 | 4242 | If the config is done then it reduces 12-14 bytes for the ether header and |
4ab46701 AR |
4243 | uses it after synchronizing in TCP handshake. |
4244 | ||
4245 | .. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> tcp-mss (1-65535) | |
4246 | ||
4247 | When tcp-mss is configured kernel reduces 12-14 bytes for ethernet header. | |
4248 | E.g. if tcp-mss is configured as 150 the synced value will be 138. | |
4249 | ||
4250 | Note: configured and synced value is different since TCP module will reduce | |
4251 | 12 bytes for ethernet header. | |
4252 | ||
4253 | Running config: | |
4254 | --------------- | |
4255 | ||
4256 | .. code-block:: frr | |
4257 | ||
073b7664 | 4258 | frr# show running-config |
4ab46701 AR |
4259 | Building configuration... |
4260 | ||
4261 | Current configuration: | |
4262 | ! | |
4263 | router bgp 100 | |
4264 | bgp router-id 192.0.2.1 | |
4265 | neighbor 198.51.100.2 remote-as 100 | |
4266 | neighbor 198.51.100.2 tcp-mss 150 => new entry | |
4267 | neighbor 2001:DB8::2 remote-as 100 | |
4268 | neighbor 2001:DB8::2 tcp-mss 400 => new entry | |
4269 | ||
4270 | Show command: | |
4271 | ------------- | |
4272 | ||
4273 | .. code-block:: frr | |
4274 | ||
073b7664 | 4275 | frr# show bgp neighbors 198.51.100.2 |
4ab46701 AR |
4276 | BGP neighbor is 198.51.100.2, remote AS 100, local AS 100, internal link |
4277 | Hostname: frr | |
4278 | BGP version 4, remote router ID 192.0.2.2, local router ID 192.0.2.1 | |
4279 | BGP state = Established, up for 02:15:28 | |
4280 | Last read 00:00:28, Last write 00:00:28 | |
4281 | Hold time is 180, keepalive interval is 60 seconds | |
4282 | Configured tcp-mss is 150, synced tcp-mss is 138 => new display | |
4283 | ||
4284 | .. code-block:: frr | |
4285 | ||
073b7664 | 4286 | frr# show bgp neighbors 2001:DB8::2 |
4ab46701 AR |
4287 | BGP neighbor is 2001:DB8::2, remote AS 100, local AS 100, internal link |
4288 | Hostname: frr | |
4289 | BGP version 4, remote router ID 192.0.2.2, local router ID 192.0.2.1 | |
4290 | BGP state = Established, up for 02:16:34 | |
4291 | Last read 00:00:34, Last write 00:00:34 | |
4292 | Hold time is 180, keepalive interval is 60 seconds | |
4293 | Configured tcp-mss is 400, synced tcp-mss is 388 => new display | |
4294 | ||
4295 | Show command json output: | |
4296 | ------------------------- | |
4297 | ||
4298 | .. code-block:: frr | |
4299 | ||
073b7664 | 4300 | frr# show bgp neighbors 2001:DB8::2 json |
4ab46701 AR |
4301 | { |
4302 | "2001:DB8::2":{ | |
4303 | "remoteAs":100, | |
4304 | "localAs":100, | |
4305 | "nbrInternalLink":true, | |
4306 | "hostname":"frr", | |
4307 | "bgpVersion":4, | |
4308 | "remoteRouterId":"192.0.2.2", | |
4309 | "localRouterId":"192.0.2.1", | |
4310 | "bgpState":"Established", | |
4311 | "bgpTimerUpMsec":8349000, | |
4312 | "bgpTimerUpString":"02:19:09", | |
4313 | "bgpTimerUpEstablishedEpoch":1613054251, | |
4314 | "bgpTimerLastRead":9000, | |
4315 | "bgpTimerLastWrite":9000, | |
4316 | "bgpInUpdateElapsedTimeMsecs":8347000, | |
4317 | "bgpTimerHoldTimeMsecs":180000, | |
4318 | "bgpTimerKeepAliveIntervalMsecs":60000, | |
4319 | "bgpTcpMssConfigured":400, => new entry | |
4320 | "bgpTcpMssSynced":388, => new entry | |
4321 | ||
4322 | .. code-block:: frr | |
4323 | ||
073b7664 | 4324 | frr# show bgp neighbors 198.51.100.2 json |
4ab46701 AR |
4325 | { |
4326 | "198.51.100.2":{ | |
4327 | "remoteAs":100, | |
4328 | "localAs":100, | |
4329 | "nbrInternalLink":true, | |
4330 | "hostname":"frr", | |
4331 | "bgpVersion":4, | |
4332 | "remoteRouterId":"192.0.2.2", | |
4333 | "localRouterId":"192.0.2.1", | |
4334 | "bgpState":"Established", | |
4335 | "bgpTimerUpMsec":8370000, | |
4336 | "bgpTimerUpString":"02:19:30", | |
4337 | "bgpTimerUpEstablishedEpoch":1613054251, | |
4338 | "bgpTimerLastRead":30000, | |
4339 | "bgpTimerLastWrite":30000, | |
4340 | "bgpInUpdateElapsedTimeMsecs":8368000, | |
4341 | "bgpTimerHoldTimeMsecs":180000, | |
4342 | "bgpTimerKeepAliveIntervalMsecs":60000, | |
4343 | "bgpTcpMssConfigured":150, => new entry | |
4344 | "bgpTcpMssSynced":138, => new entry | |
8fcedbd2 | 4345 | |
9e146a81 | 4346 | .. include:: routeserver.rst |
f3817860 QY |
4347 | |
4348 | .. include:: rpki.rst | |
c1a54c05 | 4349 | |
ed647ed2 | 4350 | .. include:: wecmp_linkbw.rst |
4351 | ||
00458d01 PG |
4352 | .. include:: flowspec.rst |
4353 | ||
d1e7591e | 4354 | .. [#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 |
4355 | .. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345 |
4356 | .. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009 | |
4357 | .. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002 |