]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/zebra.rst
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
[mirror_frr.git] / doc / user / zebra.rst
CommitLineData
0efdf0fe 1.. _zebra:
42fc5d26
QY
2
3*****
4Zebra
5*****
6
d1a242fd 7*zebra* is an IP routing manager. It provides kernel routing
42fc5d26
QY
8table updates, interface lookups, and redistribution of routes between
9different routing protocols.
10
0efdf0fe 11.. _invoking-zebra:
42fc5d26
QY
12
13Invoking zebra
14==============
15
0efdf0fe 16Besides the common invocation options (:ref:`common-invocation-options`), the
42fc5d26
QY
17*zebra* specific invocation options are listed below.
18
d1a242fd 19.. program:: zebra
42fc5d26 20
c9365894 21.. option:: -b, --batch
42fc5d26 22
d1a242fd
QY
23 Runs in batch mode. *zebra* parses configuration file and terminates
24 immediately.
42fc5d26 25
d4644d41
DS
26.. option:: -K TIME, --graceful_restart TIME
27
28 If this option is specified, the graceful restart time is TIME seconds.
29 Zebra, when started, will read in routes. Those routes that Zebra
30 identifies that it was the originator of will be swept in TIME seconds.
31 If no time is specified then we will sweep those routes immediately.
bdbdd2a7 32 Under the \*BSD's, there is no way to properly store the originating
fd149fe6
DS
33 route and the route types in this case will show up as a static route
34 with an admin distance of 255.
d4644d41 35
c9365894 36.. option:: -r, --retain
42fc5d26 37
da7e1a92
QY
38 When program terminates, do not flush routes installed by *zebra* from the
39 kernel.
42fc5d26 40
0d8df934
DS
41.. option:: -e X, --ecmp X
42
43 Run zebra with a limited ecmp ability compared to what it is compiled to.
44 If you are running zebra on hardware limited functionality you can
45 force zebra to limit the maximum ecmp allowed to X. This number
46 is bounded by what you compiled FRR with as the maximum number.
47
204ed384
PG
48.. option:: -n, --vrfwnetns
49
50 When *Zebra* starts with this option, the VRF backend is based on Linux
51 network namespaces. That implies that all network namespaces discovered by
52 ZEBRA will create an associated VRF. The other daemons will operate on the VRF
80ca5b6d 53 VRF defined by *Zebra*, as usual.
204ed384 54
f90115c5 55 .. seealso:: :ref:`zebra-vrf`
013f9762 56
6ed85950
DS
57.. option:: -z <path_to_socket>, --socket <path_to_socket>
58
59 If this option is supplied on the cli, the path to the zebra
60 control socket(zapi), is used. This option overrides a -N <namespace>
61 option if handed to it on the cli.
62
4354d381
DS
63.. option:: --v6-rr-semantics
64
65 The linux kernel is receiving the ability to use the same route
66 replacement semantics for v6 that v4 uses. If you are using a
67 kernel that supports this functionality then run *Zebra* with this
68 option and we will use Route Replace Semantics instead of delete
69 than add.
70
e4876266
DS
71.. option:: --asic-offload [notify_on_offload|notify_on_ack]
72
73 The linux kernel has the ability to use asic-offload ( see switchdev
74 development ). When the operator knows that FRR will be working in
75 this way, allow them to specify this with FRR. At this point this
76 code only supports asynchronous notification of the offload state.
77 In other words the initial ACK received for linux kernel installation
78 does not give zebra any data about what the state of the offload
79 is. This option takes the optional paramegers notify_on_offload
80 or notify_on_ack. This signals to zebra to notify upper level
81 protocols about route installation/update on ack received from
82 the linux kernel or from offload notification.
83
4dca0c10
DS
84.. option:: -s <SIZE>, --nl-bufsize <SIZE>
85
86 Allow zebra to modify the default receive buffer size to SIZE
2f5997dc 87 in bytes. Under \*BSD only the -s option is available.
4dca0c10 88
0efdf0fe 89.. _interface-commands:
42fc5d26 90
4d25da4f
PG
91Configuration Addresses behaviour
92=================================
93
94At startup, *Zebra* will first discover the underlying networking objects
95from the operating system. This includes interfaces, addresses of
96interfaces, static routes, etc. Then, it will read the configuration
97file, including its own interface addresses, static routes, etc. All this
98information comprises the operational context from *Zebra*. But
99configuration context from *Zebra* will remain the same as the one from
100:file:`zebra.conf` config file. As an example, executing the following
101:clicmd:`show running-config` will reflect what was in :file:`zebra.conf`.
102In a similar way, networking objects that are configured outside of the
103*Zebra* like *iproute2* will not impact the configuration context from
104*Zebra*. This behaviour permits you to continue saving your own config
105file, and decide what is really to be pushed on the config file, and what
106is dependent on the underlying system.
107Note that inversely, from *Zebra*, you will not be able to delete networking
108objects that were previously configured outside of *Zebra*.
109
110
42fc5d26
QY
111Interface Commands
112==================
113
0efdf0fe 114.. _standard-commands:
42fc5d26
QY
115
116Standard Commands
117-----------------
118
d1a242fd
QY
119
120.. clicmd:: interface IFNAME
121
204ed384
PG
122
123.. clicmd:: interface IFNAME vrf VRF
124
42fc5d26 125
d1a242fd 126.. clicmd:: shutdown
42fc5d26 127
42fc5d26 128
d1a242fd 129 Up or down the current interface.
42fc5d26 130
42fc5d26 131
d1a242fd 132.. clicmd:: ip address ADDRESS/PREFIX
42fc5d26 133
d1a242fd 134.. clicmd:: ipv6 address ADDRESS/PREFIX
42fc5d26 135
42fc5d26 136
42fc5d26 137
d1a242fd 138 Set the IPv4 or IPv6 address/prefix for the interface.
42fc5d26 139
42fc5d26 140
d1a242fd 141.. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
42fc5d26 142
42fc5d26 143
d1e7591e
QY
144 Configure an IPv4 Point-to-Point address on the interface. (The concept of
145 PtP addressing does not exist for IPv6.)
42fc5d26 146
23c5949f
DA
147 ``local-addr`` has no subnet mask since the local side in PtP addressing is
148 always a single (/32) address. ``peer-addr/prefix`` can be an arbitrary subnet
d1a242fd
QY
149 behind the other end of the link (or even on the link in Point-to-Multipoint
150 setups), though generally /32s are used.
42fc5d26 151
42fc5d26 152
d1a242fd 153.. clicmd:: description DESCRIPTION ...
42fc5d26 154
d1a242fd 155 Set description for the interface.
42fc5d26 156
42fc5d26 157
d1a242fd 158.. clicmd:: multicast
42fc5d26 159
42fc5d26 160
23c5949f 161 Enable or disable multicast flag for the interface.
42fc5d26 162
42fc5d26 163
d1a242fd 164.. clicmd:: bandwidth (1-10000000)
d1a242fd 165
d1a242fd
QY
166
167 Set bandwidth value of the interface in kilobits/sec. This is for
168 calculating OSPF cost. This command does not affect the actual device
169 configuration.
170
d1a242fd
QY
171
172.. clicmd:: link-detect
d1a242fd 173
d1a242fd 174
23c5949f 175 Enable or disable link-detect on platforms which support this. Currently only
32d9e333
DS
176 Linux, and only where network interface drivers support reporting
177 link-state via the ``IFF_RUNNING`` flag.
4c97fd1a 178
30980e0a 179 In FRR, link-detect is on by default.
42fc5d26 180
0efdf0fe 181.. _link-parameters-commands:
42fc5d26
QY
182
183Link Parameters Commands
184------------------------
185
85400b29
MS
186.. note::
187
188 At this time, FRR offers partial support for some of the routing
189 protocol extensions that can be used with MPLS-TE. FRR does not
190 support a complete RSVP-TE solution currently.
191
d1a242fd 192.. clicmd:: link-params
42fc5d26 193
42fc5d26 194
85400b29
MS
195 Enter into the link parameters sub node. At least 'enable' must be
196 set to activate the link parameters, and consequently routing
197 information that could be used as part of Traffic Engineering on
198 this interface. MPLS-TE must be enable at the OSPF
199 (:ref:`ospf-traffic-engineering`) or ISIS
200 (:ref:`isis-traffic-engineering`) router level in complement to
e33dbe08 201 this.
42fc5d26 202
d1a242fd 203 Under link parameter statement, the following commands set the different TE values:
42fc5d26 204
e33dbe08 205.. clicmd:: enable
42fc5d26 206
d1a242fd 207 Enable link parameters for this interface.
42fc5d26 208
e33dbe08 209.. clicmd:: metric (0-4294967295)
42fc5d26 210
e33dbe08 211.. clicmd:: max-bw BANDWIDTH
42fc5d26 212
e33dbe08 213.. clicmd:: max-rsv-bw BANDWIDTH
42fc5d26 214
e33dbe08 215.. clicmd:: unrsv-bw (0-7) BANDWIDTH
42fc5d26 216
e33dbe08 217.. clicmd:: admin-grp BANDWIDTH
42fc5d26 218
d1a242fd
QY
219 These commands specifies the Traffic Engineering parameters of the interface
220 in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively
221 the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth
222 (interface speed by default), Maximum Reservable Bandwidth, Unreserved
223 Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource
224 Class/Color (OSPF).
42fc5d26 225
c5e0101c 226 Note that BANDWIDTH is specified in IEEE floating point format and express
d1a242fd 227 in Bytes/second.
42fc5d26 228
e33dbe08 229.. clicmd:: delay (0-16777215) [min (0-16777215) | max (0-16777215)]
42fc5d26 230
e33dbe08 231.. clicmd:: delay-variation (0-16777215)
42fc5d26 232
e33dbe08 233.. clicmd:: packet-loss PERCENTAGE
42fc5d26 234
e33dbe08 235.. clicmd:: res-bw BANDWIDTH
42fc5d26 236
e33dbe08 237.. clicmd:: ava-bw BANDWIDTH
42fc5d26 238
e33dbe08 239.. clicmd:: use-bw BANDWIDTH
42fc5d26 240
d1e7591e 241 These command specifies additional Traffic Engineering parameters of the
d1a242fd
QY
242 interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and
243 draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the
244 delay, jitter, loss, available bandwidth, reservable bandwidth and utilized
245 bandwidth.
42fc5d26 246
d1a242fd
QY
247 Note that BANDWIDTH is specified in IEEE floating point format and express
248 in Bytes/second. Delays and delay variation are express in micro-second
249 (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step
250 of 0.000003.
42fc5d26 251
e33dbe08 252.. clicmd:: neighbor <A.B.C.D> as (0-65535)
42fc5d26 253
d1a242fd
QY
254 Specifies the remote ASBR IP address and Autonomous System (AS) number
255 for InterASv2 link in OSPF (RFC5392). Note that this option is not yet
256 supported for ISIS (RFC5316).
42fc5d26 257
a090c2da
IR
258Nexthop Tracking
259================
260
261Nexthop tracking doesn't resolve nexthops via the default route by default.
262Allowing this might be useful when e.g. you want to allow BGP to peer across
263the default route.
264
43b8e264
QY
265.. clicmd:: ip nht resolve-via-default
266
a090c2da
IR
267 Allow IPv4 nexthop tracking to resolve via the default route. This parameter
268 is configured per-VRF, so the command is also available in the VRF subnode.
269
270.. clicmd:: ipv6 nht resolve-via-default
271
272 Allow IPv6 nexthop tracking to resolve via the default route. This parameter
273 is configured per-VRF, so the command is also available in the VRF subnode.
43b8e264 274
9187f11a
DS
275Administrative Distance
276=======================
277
278Administrative distance allows FRR to make decisions about what routes
279should be installed in the rib based upon the originating protocol.
280The lowest Admin Distance is the route selected. This is purely a
281subjective decision about ordering and care has been taken to choose
282the same distances that other routing suites have choosen.
283
284+------------+-----------+
285| Protocol | Distance |
286+------------+-----------+
287| System | 0 |
288+------------+-----------+
289| Kernel | 0 |
290+------------+-----------+
291| Connect | 0 |
292+------------+-----------+
293| Static | 1 |
294+------------+-----------+
295| NHRP | 10 |
296+------------+-----------+
297| EBGP | 20 |
298+------------+-----------+
299| EIGRP | 90 |
300+------------+-----------+
301| BABEL | 100 |
302+------------+-----------+
303| OSPF | 110 |
304+------------+-----------+
305| ISIS | 115 |
306+------------+-----------+
307| OPENFABRIC | 115 |
308+------------+-----------+
309| RIP | 120 |
310+------------+-----------+
311| Table | 150 |
312+------------+-----------+
313| SHARP | 150 |
314+------------+-----------+
315| IBGP | 200 |
316+------------+-----------+
317| PBR | 200 |
318+------------+-----------+
319
320An admin distance of 255 indicates to Zebra that the route should not be
321installed into the Data Plane. Additionally routes with an admin distance
322of 255 will not be redistributed.
323
324Zebra does treat Kernel routes as special case for the purposes of Admin
325Distance. Upon learning about a route that is not originated by FRR
326we read the metric value as a uint32_t. The top byte of the value
327is interpreted as the Administrative Distance and the low three bytes
328are read in as the metric. This special case is to facilitate VRF
329default routes.
330
ba5e7ae2
DS
331Route Replace Semantics
332=======================
333
334When using the Linux Kernel as a forwarding plane, routes are installed
335with a metric of 20 to the kernel. Please note that the kernel's metric
336value bears no resemblence to FRR's RIB metric or admin distance. It
337merely is a way for the Linux Kernel to decide which route to use if it
338has multiple routes for the same prefix from multiple sources. An example
339here would be if someone else was running another routing suite besides
340FRR at the same time, the kernel must choose what route to use to forward
341on. FRR choose the value of 20 because of two reasons. FRR wanted a
342value small enough to be choosen but large enough that the operator could
343allow route prioritization by the kernel when multiple routing suites are
344being run and FRR wanted to take advantage of Route Replace semantics that
345the linux kernel offers. In order for Route Replacement semantics to
346work FRR must use the same metric when issuing the replace command.
347Currently FRR only supports Route Replace semantics using the Linux
348Kernel.
349
75b8d482
IR
350.. _zebra-vrf:
351
80ca5b6d
QY
352Virtual Routing and Forwarding
353==============================
42fc5d26 354
80ca5b6d
QY
355FRR supports :abbr:`VRF (Virtual Routing and Forwarding)`. VRF is a way to
356separate networking contexts on the same machine. Those networking contexts are
357associated with separate interfaces, thus making it possible to associate one
358interface with a specific VRF.
204ed384 359
204ed384 360VRF can be used, for example, when instantiating per enterprise networking
80ca5b6d
QY
361services, without having to instantiate the physical host machine or the
362routing management daemons for each enterprise. As a result, interfaces are
363separate for each set of VRF, and routing daemons can have their own context
364for each VRF.
204ed384
PG
365
366This conceptual view introduces the *Default VRF* case. If the user does not
ac2cb9bf
IR
367configure any specific VRF, then by default, FRR uses the *Default VRF*. The
368name "default" is used to refer to this VRF in various CLI commands and YANG
369models. It is possible to change that name by passing the ``-o`` option to all
370daemons, for example, one can use ``-o vrf0`` to change the name to "vrf0".
371The easiest way to pass the same option to all daemons is to use the
372``frr_global_options`` variable in the
373:ref:`Daemons Configuration File <daemons-configuration-file>`.
80ca5b6d 374
204ed384 375Configuring VRF networking contexts can be done in various ways on FRR. The VRF
80ca5b6d 376interfaces can be configured by entering in interface configuration mode
614aa5c1 377:clicmd:`interface IFNAME vrf VRF`.
204ed384
PG
378
379A VRF backend mode is chosen when running *Zebra*.
380
381If no option is chosen, then the *Linux VRF* implementation as references in
80ca5b6d 382https://www.kernel.org/doc/Documentation/networking/vrf.txt will be mapped over
204ed384
PG
383the *Zebra* VRF. The routing table associated to that VRF is a Linux table
384identifier located in the same *Linux network namespace* where *Zebra* started.
eff8e8a2
DS
385Please note when using the *Linux VRF* routing table it is expected that a
386default Kernel route will be installed that has a metric as outlined in the
387www.kernel.org doc above. The Linux Kernel does table lookup via a combination
388of rule application of the rule table and then route lookup of the specified
389table. If no route match is found then the next applicable rule is applied
390to find the next route table to use to look for a route match. As such if
391your VRF table does not have a default blackhole route with a high metric
392VRF route lookup will leave the table specified by the VRF, which is undesirable.
204ed384 393
80ca5b6d
QY
394If the :option:`-n` option is chosen, then the *Linux network namespace* will
395be mapped over the *Zebra* VRF. That implies that *Zebra* is able to configure
396several *Linux network namespaces*. The routing table associated to that VRF
397is the whole routing tables located in that namespace. For instance, this mode
398matches OpenStack Network Namespaces. It matches also OpenFastPath. The default
399behavior remains Linux VRF which is supported by the Linux kernel community,
400see https://www.kernel.org/doc/Documentation/networking/vrf.txt.
204ed384
PG
401
402Because of that difference, there are some subtle differences when running some
403commands in relationship to VRF. Here is an extract of some of those commands:
404
204ed384
PG
405.. clicmd:: vrf VRF
406
407 This command is available on configuration mode. By default, above command
52119114 408 permits accessing the VRF configuration mode. This mode is available for
d66a93dd
PG
409 both VRFs. It is to be noted that *Zebra* does not create Linux VRF.
410 The network administrator can however decide to provision this command in
411 configuration file to provide more clarity about the intended configuration.
204ed384 412
204ed384
PG
413.. clicmd:: netns NAMESPACE
414
80ca5b6d
QY
415 This command is based on VRF configuration mode. This command is available
416 when *Zebra* is run in :option:`-n` mode. This command reflects which *Linux
417 network namespace* is to be mapped with *Zebra* VRF. It is to be noted that
418 *Zebra* creates and detects added/suppressed VRFs from the Linux environment
d66a93dd
PG
419 (in fact, those managed with iproute2). The network administrator can however
420 decide to provision this command in configuration file to provide more clarity
421 about the intended configuration.
204ed384 422
204ed384
PG
423.. clicmd:: show ip route vrf VRF
424
425 The show command permits dumping the routing table associated to the VRF. If
80ca5b6d
QY
426 *Zebra* is launched with default settings, this will be the ``TABLENO`` of
427 the VRF configured on the kernel, thanks to information provided in
428 https://www.kernel.org/doc/Documentation/networking/vrf.txt. If *Zebra* is
429 launched with :option:`-n` option, this will be the default routing table of
430 the *Linux network namespace* ``VRF``.
204ed384 431
204ed384
PG
432.. clicmd:: show ip route vrf VRF table TABLENO
433
80ca5b6d
QY
434 The show command is only available with :option:`-n` option. This command
435 will dump the routing table ``TABLENO`` of the *Linux network namespace*
436 ``VRF``.
437
5a81528c
PG
438.. clicmd:: show ip route vrf VRF tables
439
23c5949f 440 This command will dump the routing tables within the vrf scope. If ``vrf all``
5a81528c
PG
441 is executed, all routing tables will be dumped.
442
a3fd74f7
DS
443.. clicmd:: show <ip|ipv6> route summary [vrf VRF] [table TABLENO] [prefix]
444
445 This command will dump a summary output of the specified VRF and TABLENO
446 combination. If neither VRF or TABLENO is specified FRR defaults to
447 the default vrf and default table. If prefix is specified dump the
448 number of prefix routes.
449
42d4b30e
PG
450.. _zebra-table-allocation:
451
452Table Allocation
453================
454
455Some services like BGP flowspec allocate routing tables to perform policy
456routing based on netfilter criteria and IP rules. In order to avoid
457conflicts between VRF allocated routing tables and those services, Zebra
458proposes to define a chunk of routing tables to use by other services.
459
460Allocation configuration can be done like below, with the range of the
461chunk of routing tables to be used by the given service.
462
463.. clicmd:: ip table range <STARTTABLENO> <ENDTABLENO>
464
df55b448
DS
465.. _zebra-ecmp:
466
467ECMP
468====
469
470FRR supports ECMP as part of normal operations and is generally compiled
471with a limit of 64 way ECMP. This of course can be modified via configure
472options on compilation if the end operator desires to do so. Individual
473protocols each have their own way of dictating ECMP policy and their
474respective documentation should be read.
475
23c5949f 476ECMP can be inspected in zebra by doing a ``show ip route X`` command.
df55b448
DS
477
478.. code-block:: shell
479
480 eva# show ip route 4.4.4.4/32
481 Codes: K - kernel route, C - connected, S - static, R - RIP,
482 O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
483 T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
484 F - PBR, f - OpenFabric,
485 > - selected route, * - FIB route, q - queued, r - rejected, b - backup
486 t - trapped, o - offload failure
487
488 D>* 4.4.4.4/32 [150/0] via 192.168.161.1, enp39s0, weight 1, 00:00:02
489 * via 192.168.161.2, enp39s0, weight 1, 00:00:02
490 * via 192.168.161.3, enp39s0, weight 1, 00:00:02
491 * via 192.168.161.4, enp39s0, weight 1, 00:00:02
492 * via 192.168.161.5, enp39s0, weight 1, 00:00:02
493 * via 192.168.161.6, enp39s0, weight 1, 00:00:02
494 * via 192.168.161.7, enp39s0, weight 1, 00:00:02
495 * via 192.168.161.8, enp39s0, weight 1, 00:00:02
496 * via 192.168.161.9, enp39s0, weight 1, 00:00:02
497 * via 192.168.161.10, enp39s0, weight 1, 00:00:02
498 * via 192.168.161.11, enp39s0, weight 1, 00:00:02
499 * via 192.168.161.12, enp39s0, weight 1, 00:00:02
500 * via 192.168.161.13, enp39s0, weight 1, 00:00:02
501 * via 192.168.161.14, enp39s0, weight 1, 00:00:02
502 * via 192.168.161.15, enp39s0, weight 1, 00:00:02
503 * via 192.168.161.16, enp39s0, weight 1, 00:00:02
504
23c5949f 505In this example we have 16 way ecmp for the 4.4.4.4/32 route. The ``*`` character
df55b448
DS
506tells us that the route is installed in the Data Plane, or FIB.
507
508If you are using the Linux kernel as a Data Plane, this can be inspected
23c5949f 509via a ``ip route show X`` command:
df55b448
DS
510
511.. code-block:: shell
512
513 sharpd@eva ~/f/doc(ecmp_doc_change)> ip route show 4.4.4.4/32
514 4.4.4.4 nhid 185483868 proto sharp metric 20
515 nexthop via 192.168.161.1 dev enp39s0 weight 1
516 nexthop via 192.168.161.10 dev enp39s0 weight 1
517 nexthop via 192.168.161.11 dev enp39s0 weight 1
518 nexthop via 192.168.161.12 dev enp39s0 weight 1
519 nexthop via 192.168.161.13 dev enp39s0 weight 1
520 nexthop via 192.168.161.14 dev enp39s0 weight 1
521 nexthop via 192.168.161.15 dev enp39s0 weight 1
522 nexthop via 192.168.161.16 dev enp39s0 weight 1
523 nexthop via 192.168.161.2 dev enp39s0 weight 1
524 nexthop via 192.168.161.3 dev enp39s0 weight 1
525 nexthop via 192.168.161.4 dev enp39s0 weight 1
526 nexthop via 192.168.161.5 dev enp39s0 weight 1
527 nexthop via 192.168.161.6 dev enp39s0 weight 1
528 nexthop via 192.168.161.7 dev enp39s0 weight 1
529 nexthop via 192.168.161.8 dev enp39s0 weight 1
530 nexthop via 192.168.161.9 dev enp39s0 weight 1
531
532Once installed into the FIB, FRR currently has little control over what
533nexthops are choosen to forward packets on. Currently the Linux kernel
23c5949f 534has a ``fib_multipath_hash_policy`` sysctl which dictates how the hashing
df55b448
DS
535algorithm is used to forward packets.
536
b03d3432
PG
537.. _zebra-mpls:
538
539MPLS Commands
540=============
541
542You can configure static mpls entries in zebra. Basically, handling MPLS
543consists of popping, swapping or pushing labels to IP packets.
544
545MPLS Acronyms
546-------------
547
548:abbr:`LSR (Labeled Switch Router)`
549 Networking devices handling labels used to forward traffic between and through
550 them.
551
552:abbr:`LER (Labeled Edge Router)`
553 A Labeled edge router is located at the edge of an MPLS network, generally
554 between an IP network and an MPLS network.
555
556MPLS Push Action
557----------------
558
559The push action is generally used for LER devices, which want to encapsulate
560all traffic for a wished destination into an MPLS label. This action is stored
561in routing entry, and can be configured like a route:
562
03750f1e 563.. clicmd:: ip route NETWORK MASK GATEWAY|INTERFACE label LABEL
b03d3432 564
56f0bea7 565 NETWORK and MASK stand for the IP prefix entry to be added as static
b03d3432
PG
566 route entry.
567 GATEWAY is the gateway IP address to reach, in order to reach the prefix.
568 INTERFACE is the interface behind which the prefix is located.
569 LABEL is the MPLS label to use to reach the prefix abovementioned.
570
571 You can check that the static entry is stored in the zebra RIB database, by
572 looking at the presence of the entry.
573
574 ::
575
576 zebra(configure)# ip route 1.1.1.1/32 10.0.1.1 label 777
577 zebra# show ip route
578 Codes: K - kernel route, C - connected, S - static, R - RIP,
579 O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
580 T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
581 F - PBR,
582 > - selected route, * - FIB route
583
584 S>* 1.1.1.1/32 [1/0] via 10.0.1.1, r2-eth0, label 777, 00:39:42
585
586MPLS Swap and Pop Action
587------------------------
588
589The swap action is generally used for LSR devices, which swap a packet with a
590label, with an other label. The Pop action is used on LER devices, at the
591termination of the MPLS traffic; this is used to remove MPLS header.
592
03750f1e 593.. clicmd:: mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null
b03d3432
PG
594
595 INCOMING_LABEL and OUTGOING_LABEL are MPLS labels with values ranging from 16
596 to 1048575.
597 GATEWAY is the gateway IP address where to send MPLS packet.
598 The outgoing label can either be a value or have an explicit-null label header. This
599 specific header can be read by IP devices. The incoming label can also be removed; in
600 that case the implicit-null keyword is used, and the outgoing packet emitted is an IP
601 packet without MPLS header.
602
603You can check that the MPLS actions are stored in the zebra MPLS table, by looking at the
604presence of the entry.
605
b03d3432
PG
606.. clicmd:: show mpls table
607
608::
609
610 zebra(configure)# mpls lsp 18 10.125.0.2 implicit-null
611 zebra(configure)# mpls lsp 19 10.125.0.2 20
612 zebra(configure)# mpls lsp 21 10.125.0.2 explicit-null
613 zebra# show mpls table
614 Inbound Outbound
615 Label Type Nexthop Label
616 -------- ------- --------------- --------
617 18 Static 10.125.0.2 implicit-null
618 19 Static 10.125.0.2 20
619 21 Static 10.125.0.2 IPv4 Explicit Null
620
621
4c6f9934
HS
622.. _zebra-srv6:
623
4ccd4033 624Segment-Routing IPv6
4c6f9934
HS
625====================
626
627Segment-Routing is source routing paradigm that allows
628network operator to encode network intent into the packets.
629SRv6 is an implementation of Segment-Routing
630with application of IPv6 and segment-routing-header.
631
632All routing daemon can use the Segment-Routing base
633framework implemented on zebra to use SRv6 routing mechanism.
634In that case, user must configure initial srv6 setting on
635FRR's cli or frr.conf or zebra.conf. This section shows how
636to configure SRv6 on FRR. Of course SRv6 can be used as standalone,
637and this section also helps that case.
638
4c6f9934
HS
639.. clicmd:: show segment-routing srv6 locator [json]
640
4ccd4033
HS
641 This command dump SRv6-locator configured on zebra. SRv6-locator is used
642 to route to the node before performing the SRv6-function. and that works as
643 aggregation of SRv6-function's IDs. Following console log shows two
644 SRv6-locators loc1 and loc2. All locators are identified by unique IPv6
645 prefix. User can get that information as JSON string when ``json`` key word
646 at the end of cli is presented.
4c6f9934
HS
647
648::
649
650 router# sh segment-routing srv6 locator
651 Locator:
652 Name ID Prefix Status
653 -------------------- ------- ------------------------ -------
4ccd4033
HS
654 loc1 1 2001:db8:1:1::/64 Up
655 loc2 2 2001:db8:2:2::/64 Up
656
4ccd4033
HS
657.. clicmd:: show segment-routing srv6 locator NAME detail [json]
658
659 As shown in the example, by specifying the name of the locator, you
660 can see the detailed information for each locator. Locator can be
661 represented by a single IPv6 prefix, but SRv6 is designed to share this
662 Locator among multiple Routing Protocols. For this purpose, zebra divides
663 the IPv6 prefix block that makes the Locator unique into multiple chunks,
664 and manages the ownership of each chunk.
665
666 For example, loc1 has system as its owner. For example, loc1 is owned by
667 system, which means that it is not yet proprietary to any routing protocol.
668 For example, loc2 has sharp as its owner. This means that the shaprd for
669 function development holds the owner of the chunk of this locator, and no
670 other routing protocol will use this area.
671
672::
673
674 router# show segment-routing srv6 locator loc1 detail
675 Name: loc1
676 Prefix: 2001:db8:1:1::/64
677 Chunks:
678 - prefix: 2001:db8:1:1::/64, owner: system
679
680 router# show segment-routing srv6 locator loc2 detail
681 Name: loc2
682 Prefix: 2001:db8:2:2::/64
683 Chunks:
684 - prefix: 2001:db8:2:2::/64, owner: sharp
4c6f9934 685
4c6f9934 686.. clicmd:: segment-routing
4ccd4033
HS
687
688 Move from configure mode to segment-routing node.
689
4c6f9934 690.. clicmd:: srv6
4ccd4033
HS
691
692 Move from segment-routing node to srv6 node.
693
4c6f9934
HS
694.. clicmd:: locators
695
4ccd4033
HS
696 Move from srv6 node to locator node. In this locator node, user can
697 configure detailed settings such as the actual srv6 locator.
4c6f9934 698
4c6f9934 699.. clicmd:: locator NAME
4c6f9934 700
4ccd4033
HS
701 Create a new locator. If the name of an existing locator is specified,
702 move to specified locator's configuration node to change the settings it.
4c6f9934 703
4ccd4033 704.. clicmd:: prefix X:X::X:X/M [function-bits-length 32]
4c6f9934 705
4ccd4033
HS
706 Set the ipv6 prefix block of the locator. SRv6 locator is defined by
707 RFC8986. The actual routing protocol specifies the locator and allocates a
708 SID to be used by each routing protocol. This SID is included in the locator
709 as an IPv6 prefix.
710
711 Following example console log shows the typical configuration of SRv6
712 data-plane. After a new SRv6 locator, named loc1, is created, loc1's prefix
713 is configured as ``2001:db8:1:1::/64``. If user or some routing daemon
714 allocates new SID on this locator, new SID will allocated in range of this
715 prefix. For example, if some routing daemon creates new SID on locator
716 (``2001:db8:1:1::/64``), Then new SID will be ``2001:db8:1:1:7::/80``,
717 ``2001:db8:1:1:8::/80``, and so on. Each locator has default SID that is
718 SRv6 local function "End". Usually default SID is allocated as
719 ``PREFIX:1::``. (``PREFIX`` is locator's prefix) For example, if user
720 configure the locator's prefix as ``2001:db8:1:1::/64``, then default SID
721 will be ``2001:db8:1:1:1::``)
722
723 The function bits range is 16bits by default. If operator want to change
724 function bits range, they can configure with ``function-bits-length``
725 option.
4c6f9934
HS
726
727::
728
729 router# configure terminal
730 router(config)# segment-routinig
731 router(config-sr)# srv6
732 router(config-srv6)# locators
4ccd4033
HS
733 router(config-srv6-locs)# locator loc1
734 router(config-srv6-loc)# prefix 2001:db8:1:1::/64
4c6f9934
HS
735
736 router(config-srv6-loc)# show run
737 ...
738 segment-routing
739 srv6
740 locators
4ccd4033
HS
741 locator loc1
742 prefix 2001:db8:1:1::/64
4c6f9934
HS
743 !
744 ...
745
80ca5b6d
QY
746.. _multicast-rib-commands:
747
42fc5d26
QY
748Multicast RIB Commands
749======================
750
751The Multicast RIB provides a separate table of unicast destinations which
d1a242fd 752is used for Multicast Reverse Path Forwarding decisions. It is used with
42fc5d26
QY
753a multicast source's IP address, hence contains not multicast group
754addresses but unicast addresses.
755
d1a242fd 756This table is fully separate from the default unicast table. However,
42fc5d26
QY
757RPF lookup can include the unicast table.
758
dc1046f7 759WARNING: RPF lookup results are non-responsive in this version of FRR,
42fc5d26
QY
760i.e. multicast routing does not actively react to changes in underlying
761unicast topology!
762
d1a242fd 763.. clicmd:: ip multicast rpf-lookup-mode MODE
42fc5d26 764
42fc5d26 765
d1a242fd 766 MODE sets the method used to perform RPF lookups. Supported modes:
42fc5d26 767
9eb95b3b
QY
768 urib-only
769 Performs the lookup on the Unicast RIB. The Multicast RIB is never used.
42fc5d26 770
9eb95b3b
QY
771 mrib-only
772 Performs the lookup on the Multicast RIB. The Unicast RIB is never used.
42fc5d26 773
9eb95b3b
QY
774 mrib-then-urib
775 Tries to perform the lookup on the Multicast RIB. If any route is found,
776 that route is used. Otherwise, the Unicast RIB is tried.
42fc5d26 777
9eb95b3b
QY
778 lower-distance
779 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
780 with the lower administrative distance is used; if they're equal, the
781 Multicast RIB takes precedence.
42fc5d26 782
9eb95b3b
QY
783 longer-prefix
784 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
785 with the longer prefix length is used; if they're equal, the
786 Multicast RIB takes precedence.
42fc5d26 787
23c5949f 788 The ``mrib-then-urib`` setting is the default behavior if nothing is
9eb95b3b
QY
789 configured. If this is the desired behavior, it should be explicitly
790 configured to make the configuration immune against possible changes in
791 what the default behavior is.
42fc5d26 792
d1a242fd 793.. warning::
1e31580f 794
d1a242fd
QY
795 Unreachable routes do not receive special treatment and do not cause
796 fallback to a second lookup.
42fc5d26 797
d1a242fd 798.. clicmd:: show ip rpf ADDR
42fc5d26 799
d1a242fd
QY
800 Performs a Multicast RPF lookup, as configured with ``ip multicast
801 rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look
802 up.
42fc5d26 803
d1a242fd 804 ::
42fc5d26
QY
805
806 > show ip rpf 192.0.2.1
807 Routing entry for 192.0.2.0/24 using Unicast RIB
d1a242fd
QY
808
809 Known via "kernel", distance 0, metric 0, best
810 * 198.51.100.1, via eth0
a8c90e15 811
42fc5d26 812
d1a242fd
QY
813 Indicates that a multicast source lookup for 192.0.2.1 would use an
814 Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1.
42fc5d26 815
d1a242fd 816.. clicmd:: show ip rpf
42fc5d26 817
d1a242fd
QY
818 Prints the entire Multicast RIB. Note that this is independent of the
819 configured RPF lookup mode, the Multicast RIB may be printed yet not
820 used at all.
42fc5d26 821
d1a242fd 822.. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE]
42fc5d26 823
42fc5d26 824
d1a242fd
QY
825 Adds a static route entry to the Multicast RIB. This performs exactly as the
826 ``ip route`` command, except that it inserts the route in the Multicast RIB
827 instead of the Unicast RIB.
42fc5d26 828
0efdf0fe 829.. _zebra-route-filtering:
42fc5d26
QY
830
831zebra Route Filtering
832=====================
833
0efdf0fe 834Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes
013f9762 835received from other FRR components. The permit/deny facilities provided by
d1a242fd
QY
836these commands can be used to filter which routes zebra will install in the
837kernel.
42fc5d26 838
d1a242fd 839.. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP
42fc5d26 840
013f9762 841 Apply a route-map filter to routes for the specified protocol. PROTOCOL can
431dd37e 842 be:
013f9762 843
563018b9
DS
844 - any,
845 - babel,
846 - bgp,
013f9762 847 - connected,
563018b9
DS
848 - eigrp,
849 - isis,
850 - kernel,
851 - nhrp,
852 - openfabric,
013f9762
QY
853 - ospf,
854 - ospf6,
563018b9
DS
855 - rip,
856 - sharp,
857 - static,
858 - ripng,
859 - table,
860 - vnc.
861
862 If you choose any as the option that will cause all protocols that are sending
863 routes to zebra. You can specify a :dfn:`ip protocol PROTOCOL route-map ROUTEMAP`
864 on a per vrf basis, by entering this command under vrf mode for the vrf you
865 want to apply the route-map against.
d1a242fd 866
d1a242fd
QY
867.. clicmd:: set src ADDRESS
868
869 Within a route-map, set the preferred source address for matching routes
870 when installing in the kernel.
871
872
873The following creates a prefix-list that matches all addresses, a route-map
874that sets the preferred source address, and applies the route-map to all
875*rip* routes.
876
9eb95b3b 877.. code-block:: frr
42fc5d26 878
d1a242fd
QY
879 ip prefix-list ANY permit 0.0.0.0/0 le 32
880 route-map RM1 permit 10
23c5949f
DA
881 match ip address prefix-list ANY
882 set src 10.0.0.1
42fc5d26 883
d1a242fd 884 ip protocol rip route-map RM1
a8c90e15 885
1d0372dd
TB
886IPv6 example for OSPFv3.
887
888.. code-block:: frr
889
890 ipv6 prefix-list ANY seq 10 permit any
891 route-map RM6 permit 10
23c5949f
DA
892 match ipv6 address prefix-list ANY
893 set src 2001:db8:425:1000::3
1d0372dd
TB
894
895 ipv6 protocol ospf6 route-map RM6
896
897
898.. note::
899
1f74d96c
IR
900 For both IPv4 and IPv6, the IP address has to exist on some interface when
901 the route is getting installed into the system. Otherwise, kernel rejects
902 the route. To solve the problem of disappearing IPv6 addresses when the
903 interface goes down, use ``net.ipv6.conf.all.keep_addr_on_down``
904 :ref:`sysctl option <zebra-sysctl>`.
42fc5d26 905
03750f1e 906.. clicmd:: zebra route-map delay-timer (0-600)
3d34678f
DS
907
908 Set the delay before any route-maps are processed in zebra. The
909 default time for this is 5 seconds.
910
0efdf0fe 911.. _zebra-fib-push-interface:
42fc5d26
QY
912
913zebra FIB push interface
914========================
915
916Zebra supports a 'FIB push' interface that allows an external
dc1046f7 917component to learn the forwarding information computed by the FRR
d1a242fd 918routing suite. This is a loadable module that needs to be enabled
0efdf0fe 919at startup as described in :ref:`loadable-module-support`.
42fc5d26 920
dc1046f7 921In FRR, the Routing Information Base (RIB) resides inside
42fc5d26
QY
922zebra. Routing protocols communicate their best routes to zebra, and
923zebra computes the best route across protocols for each prefix. This
924latter information makes up the Forwarding Information Base
925(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
926the kernel to forward packets according to the routes computed by
dc1046f7 927FRR. The kernel FIB is updated in an OS-specific way. For example,
23c5949f 928the ``Netlink`` interface is used on Linux, and route sockets are
42fc5d26
QY
929used on FreeBSD.
930
931The FIB push interface aims to provide a cross-platform mechanism to
932support scenarios where the router has a forwarding path that is
933distinct from the kernel, commonly a hardware-based fast path. In
934these cases, the FIB needs to be maintained reliably in the fast path
935as well. We refer to the component that programs the forwarding plane
936(directly or indirectly) as the Forwarding Plane Manager or FPM.
937
80ca5b6d
QY
938.. program:: configure
939
42fc5d26 940The relevant zebra code kicks in when zebra is configured with the
9d736133
RZ
941:option:`--enable-fpm` flag and started with the module (``-M fpm``
942or ``-M dplane_fpm_nl``).
943
944.. note::
945
946 The ``fpm`` implementation attempts to connect to ``127.0.0.1`` port ``2620``
947 by default without configurations. The ``dplane_fpm_nl`` only attempts to
948 connect to a server if configured.
949
950Zebra periodically attempts to connect to the well-known FPM port (``2620``).
951Once the connection is up, zebra starts sending messages containing routes
952over the socket to the FPM. Zebra sends a complete copy of the forwarding
953table to the FPM, including routes that it may have picked up from the kernel.
954The existing interaction of zebra with the kernel remains unchanged -- that
955is, the kernel continues to receive FIB updates as before.
956
957The default FPM message format is netlink, however it can be controlled
958with the module load-time option. The modules accept the following options:
959
960- ``fpm``: ``netlink`` and ``protobuf``.
961- ``dplane_fpm_nl``: none, it only implements netlink.
42fc5d26
QY
962
963The zebra FPM interface uses replace semantics. That is, if a 'route
964add' message for a prefix is followed by another 'route add' message,
965the information in the second message is complete by itself, and
966replaces the information sent in the first message.
967
968If the connection to the FPM goes down for some reason, zebra sends
969the FPM a complete copy of the forwarding table(s) when it reconnects.
970
9d736133
RZ
971For more details on the implementation, please read the developer's manual FPM
972section.
973
974FPM Commands
975============
976
977``fpm`` implementation
978----------------------
979
9d736133
RZ
980.. clicmd:: fpm connection ip A.B.C.D port (1-65535)
981
03750f1e
QY
982 Configure ``zebra`` to connect to a different FPM server than the default of
983 ``127.0.0.1:2060``
9d736133 984
9d736133
RZ
985.. clicmd:: show zebra fpm stats
986
987 Shows the FPM statistics.
988
989 Sample output:
990
991 ::
992
993 Counter Total Last 10 secs
994
995 connect_calls 3 2
996 connect_no_sock 0 0
997 read_cb_calls 2 2
998 write_cb_calls 2 0
999 write_calls 1 0
1000 partial_writes 0 0
1001 max_writes_hit 0 0
1002 t_write_yields 0 0
1003 nop_deletes_skipped 6 0
1004 route_adds 5 0
1005 route_dels 0 0
1006 updates_triggered 11 0
1007 redundant_triggers 0 0
1008 dests_del_after_update 0 0
1009 t_conn_down_starts 0 0
1010 t_conn_down_dests_processed 0 0
1011 t_conn_down_yields 0 0
1012 t_conn_down_finishes 0 0
1013 t_conn_up_starts 1 0
1014 t_conn_up_dests_processed 11 0
1015 t_conn_up_yields 0 0
1016 t_conn_up_aborts 0 0
1017 t_conn_up_finishes 1 0
1018
1019
9d736133
RZ
1020.. clicmd:: clear zebra fpm stats
1021
6d8589da
RZ
1022 Reset statistics related to the zebra code that interacts with the
1023 optional Forwarding Plane Manager (FPM) component.
9d736133
RZ
1024
1025
1026``dplane_fpm_nl`` implementation
1027--------------------------------
1028
9d736133
RZ
1029.. clicmd:: fpm address <A.B.C.D|X:X::X:X> [port (1-65535)]
1030
1031 Configures the FPM server address. Once configured ``zebra`` will attempt
1032 to connect to it immediately.
1033
03750f1e
QY
1034 The ``no`` form disables FPM entirely. ``zebra`` will close any current
1035 connections and will not attempt to connect to it anymore.
9d736133 1036
5f66e9a0
RZ
1037.. clicmd:: fpm use-next-hop-groups
1038
1039 Use the new netlink messages ``RTM_NEWNEXTHOP`` / ``RTM_DELNEXTHOP`` to
1040 group repeated route next hop information.
1041
f41ddc27 1042 The ``no`` form uses the old known FPM behavior of including next hop
03750f1e 1043 information in the route (e.g. ``RTM_NEWROUTE``) messages.
5f66e9a0 1044
9d736133
RZ
1045.. clicmd:: show fpm counters [json]
1046
1047 Show the FPM statistics (plain text or JSON formatted).
1048
1049 Sample output:
1050
1051 ::
1052
1053 FPM counters
1054 ============
1055 Input bytes: 0
1056 Output bytes: 308
1057 Output buffer current size: 0
1058 Output buffer peak size: 308
1059 Connection closes: 0
1060 Connection errors: 0
1061 Data plane items processed: 0
1062 Data plane items enqueued: 0
1063 Data plane items queue peak: 0
1064 Buffer full hits: 0
1065 User FPM configurations: 1
1066 User FPM disable requests: 0
1067
1068
9d736133
RZ
1069.. clicmd:: clear fpm counters
1070
6d8589da
RZ
1071 Reset statistics related to the zebra code that interacts with the
1072 optional Forwarding Plane Manager (FPM) component.
9d736133
RZ
1073
1074
3fdcb303
MS
1075.. _zebra-dplane:
1076
1077Dataplane Commands
1078==================
1079
1080The zebra dataplane subsystem provides a framework for FIB
1081programming. Zebra uses the dataplane to program the local kernel as
1082it makes changes to objects such as IP routes, MPLS LSPs, and
1083interface IP addresses. The dataplane runs in its own pthread, in
1084order to off-load work from the main zebra pthread.
1085
1086
3fdcb303
MS
1087.. clicmd:: show zebra dplane [detailed]
1088
1089 Display statistics about the updates and events passing through the
1090 dataplane subsystem.
1091
1092
3fdcb303
MS
1093.. clicmd:: show zebra dplane providers
1094
1095 Display information about the running dataplane plugins that are
1096 providing updates to a FIB. By default, the local kernel plugin is
1097 present.
1098
1099
3fdcb303
MS
1100.. clicmd:: zebra dplane limit [NUMBER]
1101
1102 Configure the limit on the number of pending updates that are
1103 waiting to be processed by the dataplane pthread.
1104
1105
42fc5d26
QY
1106zebra Terminal Mode Commands
1107============================
1108
d1a242fd 1109.. clicmd:: show ip route
42fc5d26 1110
d1a242fd 1111 Display current routes which zebra holds in its database.
42fc5d26
QY
1112
1113::
1114
42fc5d26
QY
1115 Router# show ip route
1116 Codes: K - kernel route, C - connected, S - static, R - RIP,
d1a242fd 1117 B - BGP * - FIB route.
42fc5d26 1118
d1a242fd
QY
1119 K* 0.0.0.0/0 203.181.89.241
1120 S 0.0.0.0/0 203.181.89.1
1121 C* 127.0.0.0/8 lo
42fc5d26 1122 C* 203.181.89.240/28 eth0
a8c90e15 1123
42fc5d26 1124
d1a242fd 1125.. clicmd:: show ipv6 route
42fc5d26 1126
da3ef85b 1127.. clicmd:: show [ip|ipv6] route [PREFIX] [nexthop-group]
fbe49edb 1128
da3ef85b
SW
1129 Display detailed information about a route. If [nexthop-group] is
1130 included, it will display the nexthop group ID the route is using as well.
1131
c15dc24f
RW
1132.. clicmd:: show interface [NAME] [{vrf VRF|brief}] [json]
1133
1134.. clicmd:: show interface [NAME] [{vrf all|brief}] [json]
1135
da3ef85b
SW
1136.. clicmd:: show interface [NAME] [{vrf VRF|brief}] [nexthop-group]
1137
da3ef85b
SW
1138.. clicmd:: show interface [NAME] [{vrf all|brief}] [nexthop-group]
1139
1140 Display interface information. If no extra information is added, it will
1141 dump information on all interfaces. If [NAME] is specified, it will display
1142 detailed information about that single interface. If [nexthop-group] is
1143 specified, it will display nexthop groups pointing out that interface.
42fc5d26 1144
c15dc24f
RW
1145 If the ``json`` option is specified, output is displayed in JSON format.
1146
d1a242fd 1147.. clicmd:: show ip prefix-list [NAME]
42fc5d26 1148
d1a242fd 1149.. clicmd:: show route-map [NAME]
42fc5d26 1150
d1a242fd 1151.. clicmd:: show ip protocol
42fc5d26 1152
854cdf7c 1153.. clicmd:: show ip forward
42fc5d26 1154
d1a242fd
QY
1155 Display whether the host's IP forwarding function is enabled or not.
1156 Almost any UNIX kernel can be configured with IP forwarding disabled.
1157 If so, the box can't work as a router.
42fc5d26 1158
854cdf7c 1159.. clicmd:: show ipv6 forward
42fc5d26 1160
d1a242fd 1161 Display whether the host's IP v6 forwarding is enabled or not.
42fc5d26 1162
d1a242fd 1163.. clicmd:: show zebra
42fc5d26 1164
d1a242fd 1165 Display various statistics related to the installation and deletion
446f6ec5
DS
1166 of routes, neighbor updates, and LSP's into the kernel. In addition
1167 show various zebra state that is useful when debugging an operator's
1168 setup.
42fc5d26 1169
46677ed2
DS
1170.. clicmd:: show zebra client [summary]
1171
1172 Display statistics about clients that are connected to zebra. This is
1173 useful for debugging and seeing how much data is being passed between
1174 zebra and it's clients. If the summary form of the command is choosen
1175 a table is displayed with shortened information.
1176
46677ed2
DS
1177.. clicmd:: show zebra router table summary
1178
1179 Display summarized data about tables created, their afi/safi/tableid
1180 and how many routes each table contains. Please note this is the
1181 total number of route nodes in the table. Which will be higher than
1182 the actual number of routes that are held.
1183
a8ad9a89 1184.. clicmd:: show nexthop-group rib [ID] [vrf NAME] [singleton [ip|ip6]] [type]
083954e9
DS
1185
1186 Display nexthop groups created by zebra. The [vrf NAME] option
1187 is only meaningful if you have started zebra with the --vrfwnetns
1188 option as that nexthop groups are per namespace in linux.
1189 If you specify singleton you would like to see the singleton
a8ad9a89
SW
1190 nexthop groups that do have an afi. [type] allows you to filter those
1191 only coming from a specific NHG type (protocol).
da3ef85b 1192
d29fd1b7 1193.. clicmd:: show <ip|ipv6> zebra route dump [<vrf> VRFNAME]
1194
1195 It dumps all the routes from RIB with detailed information including
1196 internal flags, status etc. This is defined as a hidden command.
1197
13b01f2f
JAG
1198
1199Router-id
1200=========
1201
1202Many routing protocols require a router-id to be configured. To have a
1203consistent router-id across all daemons, the following commands are available
1204to configure and display the router-id:
1205
03750f1e 1206.. clicmd:: [ip] router-id A.B.C.D
13b01f2f 1207
17d1eafa 1208 Allow entering of the router-id. This command also works under the
98a3fb0a 1209 vrf subnode, to allow router-id's per vrf.
13b01f2f 1210
03750f1e 1211.. clicmd:: [ip] router-id A.B.C.D vrf NAME
17d1eafa
DS
1212
1213 Configure the router-id of this router from the configure NODE.
1214 A show run of this command will display the router-id command
1215 under the vrf sub node. This command is deprecated and will
1216 be removed at some point in time in the future.
98a3fb0a 1217
98a3fb0a 1218.. clicmd:: show [ip] router-id [vrf NAME]
13b01f2f
JAG
1219
1220 Display the user configured router-id.
1221
98a3fb0a
SM
1222For protocols requiring an IPv6 router-id, the following commands are available:
1223
03750f1e 1224.. clicmd:: ipv6 router-id X:X::X:X
98a3fb0a
SM
1225
1226 Configure the IPv6 router-id of this router. Like its IPv4 counterpart,
1227 this command works under the vrf subnode, to allow router-id's per vrf.
1228
98a3fb0a 1229.. clicmd:: show ipv6 router-id [vrf NAME]
13b01f2f 1230
98a3fb0a 1231 Display the user configured IPv6 router-id.
8d150f52 1232
1f74d96c
IR
1233.. _zebra-sysctl:
1234
229f842b
TA
1235sysctl settings
1236===============
cbacd05b
DS
1237
1238The linux kernel has a variety of sysctl's that affect it's operation as a router. This
1239section is meant to act as a starting point for those sysctl's that must be used in
1240order to provide FRR with smooth operation as a router. This section is not meant
1241as the full documentation for sysctl's. The operator must use the sysctl documentation
229f842b
TA
1242with the linux kernel for that. The following link has helpful references to many relevant
1243sysctl values: https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
1244
1245Expected sysctl settings
4c9cf198 1246------------------------
cbacd05b
DS
1247
1248.. option:: net.ipv4.ip_forward = 1
1249
229f842b
TA
1250 This global option allows the linux kernel to forward (route) ipv4 packets incoming from one
1251 interface to an outgoing interface. If this is set to 0, the system will not route transit
1252 ipv4 packets, i.e. packets that are not sent to/from a process running on the local system.
cbacd05b 1253
229f842b 1254.. option:: net.ipv4.conf.{all,default,<interface>}.forwarding = 1
cbacd05b 1255
229f842b
TA
1256 The linux kernel can selectively enable forwarding (routing) of ipv4 packets on a per
1257 interface basis. The forwarding check in the kernel dataplane occurs against the ingress
1258 Layer 3 interface, i.e. if the ingress L3 interface has forwarding set to 0, packets will not
1259 be routed.
cbacd05b 1260
229f842b
TA
1261.. option:: net.ipv6.conf.{all,default,<interface>}.forwarding = 1
1262
1263 This per interface option allows the linux kernel to forward (route) transit ipv6 packets
1264 i.e. incoming from one Layer 3 interface to an outgoing Layer 3 interface.
1265 The forwarding check in the kernel dataplane occurs against the ingress Layer 3 interface,
1266 i.e. if the ingress L3 interface has forwarding set to 0, packets will not be routed.
1267
1268.. option:: net.ipv6.conf.all.keep_addr_on_down = 1
cbacd05b
DS
1269
1270 When an interface is taken down, do not remove the v6 addresses associated with the interface.
1271 This option is recommended because this is the default behavior for v4 as well.
1272
229f842b 1273.. option:: net.ipv6.route.skip_notify_on_dev_down = 1
cbacd05b
DS
1274
1275 When an interface is taken down, the linux kernel will not notify, via netlink, about routes
1276 that used that interface being removed from the FIB. This option is recommended because this
1277 is the default behavior for v4 as well.
8d150f52 1278
229f842b 1279Optional sysctl settings
4c9cf198 1280------------------------
229f842b
TA
1281
1282.. option:: net.ipv4.conf.{all,default,<interface>}.bc_forwarding = 0
1283
1284 This per interface option allows the linux kernel to optionally allow Directed Broadcast
1285 (i.e. Routed Broadcast or Subnet Broadcast) packets to be routed onto the connected network
1286 segment where the subnet exists.
1287 If the local router receives a routed packet destined for a broadcast address of a connected
1288 subnet, setting bc_forwarding to 1 on the interface with the target subnet assigned to it will
1289 allow non locally-generated packets to be routed via the broadcast route.
1290 If bc_forwarding is set to 0, routed packets destined for a broadcast route will be dropped.
1291 e.g.
1292 Host1 (SIP:192.0.2.10, DIP:10.0.0.255) -> (eth0:192.0.2.1/24) Router1 (eth1:10.0.0.1/24) -> BC
1293 If net.ipv4.conf.{all,default,<interface>}.bc_forwarding=1, then Router1 will forward each
1294 packet destined to 10.0.0.255 onto the eth1 interface with a broadcast DMAC (ff:ff:ff:ff:ff:ff).
1295
1296.. option:: net.ipv4.conf.{all,default,<interface>}.arp_accept = 1
1297
1298 This per interface option allows the linux kernel to optionally skip the creation of ARP
1299 entries upon the receipt of a Gratuitous ARP (GARP) frame carrying an IP that is not already
1300 present in the ARP cache. Setting arp_accept to 0 on an interface will ensure NEW ARP entries
1301 are not created due to the arrival of a GARP frame.
1302 Note: This does not impact how the kernel reacts to GARP frames that carry a "known" IP
1303 (that is already in the ARP cache) -- an existing ARP entry will always be updated
1304 when a GARP for that IP is received.
1305
1306.. option:: net.ipv4.conf.{all,default,<interface>}.arp_ignore = 0
1307
1308 This per interface option allows the linux kernel to control what conditions must be met in
1309 order for an ARP reply to be sent in response to an ARP request targeting a local IP address.
1310 When arp_ignore is set to 0, the kernel will send ARP replies in response to any ARP Request
1311 with a Target-IP matching a local address.
1312 When arp_ignore is set to 1, the kernel will send ARP replies if the Target-IP in the ARP
1313 Request matches an IP address on the interface the Request arrived at.
1314 When arp_ignore is set to 2, the kernel will send ARP replies only if the Target-IP matches an
1315 IP address on the interface where the Request arrived AND the Sender-IP falls within the subnet
1316 assigned to the local IP/interface.
1317
1318.. option:: net.ipv4.conf.{all,default,<interface>}.arp_notify = 1
1319
1320 This per interface option allows the linux kernel to decide whether to send a Gratuitious ARP
1321 (GARP) frame when the Layer 3 interface comes UP.
1322 When arp_notify is set to 0, no GARP is sent.
1323 When arp_notify is set to 1, a GARP is sent when the interface comes UP.
1324
1325.. option:: net.ipv6.conf.{all,default,<interface>}.ndisc_notify = 1
1326
1327 This per interface option allows the linux kernel to decide whether to send an Unsolicited
1328 Neighbor Advertisement (U-NA) frame when the Layer 3 interface comes UP.
1329 When ndisc_notify is set to 0, no U-NA is sent.
1330 When ndisc_notify is set to 1, a U-NA is sent when the interface comes UP.
1331
48dbe48a
DS
1332Useful sysctl settings
1333----------------------
1334
23c5949f 1335.. option:: net.ipv6.conf.all.use_oif_addrs_only = 1
48dbe48a
DS
1336
1337 When enabled, the candidate source addresses for destinations routed via this interface are
1338 restricted to the set of addresses configured on this interface (RFC 6724 section 4). If
1339 an operator has hundreds of IP addresses per interface this solves the latency problem.
1340
8d150f52
MS
1341Debugging
1342=========
1343
1344.. clicmd:: debug zebra mpls [detailed]
1345
1346 MPLS-related events and information.
1347
1348.. clicmd:: debug zebra events
1349
1350 Zebra events
1351
1352.. clicmd:: debug zebra nht [detailed]
1353
1354 Nexthop-tracking / reachability information
1355
1356.. clicmd:: debug zebra vxlan
1357
1358 VxLAN (EVPN) events
1359
1360.. clicmd:: debug zebra pseudowires
1361
1362 Pseudowire events.
1363
1364.. clicmd:: debug zebra packet [<recv|send>] [detail]
1365
1366 ZAPI message and packet details
1367
1368.. clicmd:: debug zebra kernel
1369
1370 Kernel / OS events.
1371
1372.. clicmd:: debug zebra kernel msgdump [<recv|send>]
1373
1374 Raw OS (netlink) message details.
1375
1376.. clicmd:: debug zebra rib [detailed]
1377
1378 RIB events.
1379
1380.. clicmd:: debug zebra fpm
1381
1382 FPM (forwarding-plane manager) events.
1383
1384.. clicmd:: debug zebra dplane [detailed]
1385
1386 Dataplane / FIB events.
1387
1388.. clicmd:: debug zebra pbr
1389
1390 PBR (policy-based routing) events.
1391
1392.. clicmd:: debug zebra mlag
1393
1394 MLAG events.
1395
1396.. clicmd:: debug zebra evpn mh <es|mac|neigh|nh>
1397
1398 EVPN multi-hop events.
1399
1400.. clicmd:: debug zebra nexthop [detail]
1401
1402 Nexthop and nexthop-group events.
1403
30085ba5
DL
1404Scripting
1405=========
1406
1407.. clicmd:: zebra on-rib-process script SCRIPT
1408
1409 Set a Lua script for :ref:`on-rib-process-dplane-results` hook call.
23c5949f 1410 SCRIPT is the basename of the script, without ``.lua``.
30085ba5
DL
1411
1412Data structures
1413---------------
1414
1415.. _const-struct-zebra-dplane-ctx:
1416
1417const struct zebra_dplane_ctx
1418^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1419
1420.. code-block:: console
1421
1422 * integer zd_op
1423 * integer zd_status
1424 * integer zd_provider
1425 * integer zd_vrf_id
1426 * integer zd_table_id
1427 * integer zd_ifname
1428 * integer zd_ifindex
1429 * table rinfo (if zd_op is DPLANE_OP_ROUTE*, DPLANE_NH_*)
1430
1431 * prefix zd_dest
1432 * prefix zd_src
1433 * integer zd_afi
1434 * integer zd_safi
1435 * integer zd_type
1436 * integer zd_old_type
1437 * integer zd_tag
1438 * integer zd_old_tag
1439 * integer zd_metric
1440 * integer zd_old_metric
1441 * integer zd_instance
1442 * integer zd_old_instance
1443 * integer zd_distance
1444 * integer zd_old_distance
1445 * integer zd_mtu
1446 * integer zd_nexthop_mtu
1447 * table nhe
1448
1449 * integer id
1450 * integer old_id
1451 * integer afi
1452 * integer vrf_id
1453 * integer type
1454 * nexthop_group ng
1455 * nh_grp
1456 * integer nh_grp_count
1457
1458 * integer zd_nhg_id
1459 * nexthop_group zd_ng
1460 * nexthop_group backup_ng
1461 * nexthop_group zd_old_ng
1462 * nexthop_group old_backup_ng
1463
1464 * integer label (if zd_op is DPLANE_OP_LSP_*)
1465 * table pw (if zd_op is DPLANE_OP_PW_*)
1466
1467 * integer type
1468 * integer af
1469 * integer status
1470 * integer flags
1471 * integer local_label
1472 * integer remote_label
1473
1474 * table macinfo (if zd_op is DPLANE_OP_MAC_*)
1475
1476 * integer vid
1477 * integer br_ifindex
1478 * ethaddr mac
1479 * integer vtep_ip
1480 * integer is_sticky
1481 * integer nhg_id
1482 * integer update_flags
1483
1484 * table rule (if zd_op is DPLANE_OP_RULE_*)
1485
1486 * integer sock
1487 * integer unique
1488 * integer seq
1489 * string ifname
1490 * integer priority
1491 * integer old_priority
1492 * integer table
1493 * integer old_table
1494 * integer filter_bm
1495 * integer old_filter_bm
1496 * integer fwmark
1497 * integer old_fwmark
1498 * integer dsfield
1499 * integer old_dsfield
1500 * integer ip_proto
1501 * integer old_ip_proto
1502 * prefix src_ip
1503 * prefix old_src_ip
1504 * prefix dst_ip
1505 * prefix old_dst_ip
1506
1507 * table iptable (if zd_op is DPLANE_OP_IPTABLE_*)
1508
1509 * integer sock
1510 * integer vrf_id
1511 * integer unique
1512 * integer type
1513 * integer filter_bm
1514 * integer fwmark
1515 * integer action
1516 * integer pkt_len_min
1517 * integer pkt_len_max
1518 * integer tcp_flags
1519 * integer dscp_value
1520 * integer fragment
1521 * integer protocol
1522 * integer nb_interface
1523 * integer flow_label
1524 * integer family
1525 * string ipset_name
1526
1527 * table ipset (if zd_op is DPLANE_OP_IPSET_*)
1528 * integer sock
1529 * integer vrf_id
1530 * integer unique
1531 * integer type
1532 * integer family
1533 * string ipset_name
1534
1535 * table neigh (if zd_op is DPLANE_OP_NEIGH_*)
1536
1537 * ipaddr ip_addr
1538 * table link
1539
1540 * ethaddr mac
1541 * ipaddr ip_addr
1542
1543 * integer flags
1544 * integer state
1545 * integer update_flags
1546
1547 * table br_port (if zd_op is DPLANE_OP_BR_PORT_UPDATE)
1548
1549 * integer sph_filter_cnt
1550 * integer flags
1551 * integer backup_nhg_id
1552
1553 * table neightable (if zd_op is DPLANE_OP_NEIGH_TABLE_UPDATE)
1554
1555 * integer family
1556 * integer app_probes
1557 * integer ucast_probes
1558 * integer mcast_probes
1559
1560 * table gre (if zd_op is DPLANE_OP_GRE_SET)**
1561
1562 * integer link_ifindex
1563 * integer mtu
1564
1565
1566.. _const-struct-nh-grp:
1567
1568const struct nh_grp
1569^^^^^^^^^^^^^^^^^^^
1570
1571.. code-block:: console
1572
1573 * integer id
1574 * integer weight
1575
1576
1577.. _zebra-hook-calls:
1578
1579Zebra Hook calls
1580----------------
1581
1582.. _on-rib-process-dplane-results:
1583
1584on_rib_process_dplane_results
1585^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1586
1587Called when RIB processes dataplane events.
1588Set script location with the ``zebra on-rib-process script SCRIPT`` command.
1589
1590**Arguments**
1591
1592* :ref:`const struct zebra_dplane_ctx<const-struct-zebra-dplane-ctx>` ctx
1593
1594
1595.. code-block:: lua
1596
1597 function on_rib_process_dplane_results(ctx)
1598 log.info(ctx.rinfo.zd_dest.network)
1599 return {}