]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/zebra.rst
Merge pull request #8528 from opensourcerouting/build-cleanup-20210421
[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.
32
c9365894 33.. option:: -r, --retain
42fc5d26 34
da7e1a92
QY
35 When program terminates, do not flush routes installed by *zebra* from the
36 kernel.
42fc5d26 37
0d8df934
DS
38.. option:: -e X, --ecmp X
39
40 Run zebra with a limited ecmp ability compared to what it is compiled to.
41 If you are running zebra on hardware limited functionality you can
42 force zebra to limit the maximum ecmp allowed to X. This number
43 is bounded by what you compiled FRR with as the maximum number.
44
204ed384
PG
45.. option:: -n, --vrfwnetns
46
47 When *Zebra* starts with this option, the VRF backend is based on Linux
48 network namespaces. That implies that all network namespaces discovered by
49 ZEBRA will create an associated VRF. The other daemons will operate on the VRF
80ca5b6d 50 VRF defined by *Zebra*, as usual.
204ed384 51
f90115c5 52 .. seealso:: :ref:`zebra-vrf`
013f9762 53
cc6743c2
PG
54.. option:: -o, --vrfdefaultname
55
56 When *Zebra* starts with this option, the default VRF name is changed to the
57 parameter.
58
59 .. seealso:: :ref:`zebra-vrf`
60
6ed85950
DS
61.. option:: -z <path_to_socket>, --socket <path_to_socket>
62
63 If this option is supplied on the cli, the path to the zebra
64 control socket(zapi), is used. This option overrides a -N <namespace>
65 option if handed to it on the cli.
66
4354d381
DS
67.. option:: --v6-rr-semantics
68
69 The linux kernel is receiving the ability to use the same route
70 replacement semantics for v6 that v4 uses. If you are using a
71 kernel that supports this functionality then run *Zebra* with this
72 option and we will use Route Replace Semantics instead of delete
73 than add.
74
e4876266
DS
75.. option:: --asic-offload [notify_on_offload|notify_on_ack]
76
77 The linux kernel has the ability to use asic-offload ( see switchdev
78 development ). When the operator knows that FRR will be working in
79 this way, allow them to specify this with FRR. At this point this
80 code only supports asynchronous notification of the offload state.
81 In other words the initial ACK received for linux kernel installation
82 does not give zebra any data about what the state of the offload
83 is. This option takes the optional paramegers notify_on_offload
84 or notify_on_ack. This signals to zebra to notify upper level
85 protocols about route installation/update on ack received from
86 the linux kernel or from offload notification.
87
0efdf0fe 88.. _interface-commands:
42fc5d26 89
4d25da4f
PG
90Configuration Addresses behaviour
91=================================
92
93At startup, *Zebra* will first discover the underlying networking objects
94from the operating system. This includes interfaces, addresses of
95interfaces, static routes, etc. Then, it will read the configuration
96file, including its own interface addresses, static routes, etc. All this
97information comprises the operational context from *Zebra*. But
98configuration context from *Zebra* will remain the same as the one from
99:file:`zebra.conf` config file. As an example, executing the following
100:clicmd:`show running-config` will reflect what was in :file:`zebra.conf`.
101In a similar way, networking objects that are configured outside of the
102*Zebra* like *iproute2* will not impact the configuration context from
103*Zebra*. This behaviour permits you to continue saving your own config
104file, and decide what is really to be pushed on the config file, and what
105is dependent on the underlying system.
106Note that inversely, from *Zebra*, you will not be able to delete networking
107objects that were previously configured outside of *Zebra*.
108
109
42fc5d26
QY
110Interface Commands
111==================
112
0efdf0fe 113.. _standard-commands:
42fc5d26
QY
114
115Standard Commands
116-----------------
117
d1a242fd
QY
118
119.. clicmd:: interface IFNAME
120
204ed384
PG
121
122.. clicmd:: interface IFNAME vrf VRF
123
42fc5d26 124
d1a242fd 125.. clicmd:: shutdown
42fc5d26 126
42fc5d26 127
d1a242fd 128 Up or down the current interface.
42fc5d26 129
42fc5d26 130
d1a242fd 131.. clicmd:: ip address ADDRESS/PREFIX
42fc5d26 132
d1a242fd 133.. clicmd:: ipv6 address ADDRESS/PREFIX
42fc5d26 134
42fc5d26 135
42fc5d26 136
d1a242fd 137 Set the IPv4 or IPv6 address/prefix for the interface.
42fc5d26 138
42fc5d26 139
d1a242fd 140.. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
42fc5d26 141
42fc5d26 142
d1e7591e
QY
143 Configure an IPv4 Point-to-Point address on the interface. (The concept of
144 PtP addressing does not exist for IPv6.)
42fc5d26 145
d1a242fd
QY
146 `local-addr` has no subnet mask since the local side in PtP addressing is
147 always a single (/32) address. `peer-addr/prefix` can be an arbitrary subnet
148 behind the other end of the link (or even on the link in Point-to-Multipoint
149 setups), though generally /32s are used.
42fc5d26 150
42fc5d26 151
d1a242fd 152.. clicmd:: description DESCRIPTION ...
42fc5d26 153
d1a242fd 154 Set description for the interface.
42fc5d26 155
42fc5d26 156
d1a242fd 157.. clicmd:: multicast
42fc5d26 158
42fc5d26 159
d1a242fd 160 Enable or disables multicast flag for the interface.
42fc5d26 161
42fc5d26 162
d1a242fd 163.. clicmd:: bandwidth (1-10000000)
d1a242fd 164
d1a242fd
QY
165
166 Set bandwidth value of the interface in kilobits/sec. This is for
167 calculating OSPF cost. This command does not affect the actual device
168 configuration.
169
d1a242fd
QY
170
171.. clicmd:: link-detect
d1a242fd 172
d1a242fd
QY
173
174 Enable/disable link-detect on platforms which support this. Currently only
32d9e333
DS
175 Linux, and only where network interface drivers support reporting
176 link-state via the ``IFF_RUNNING`` flag.
4c97fd1a 177
30980e0a 178 In FRR, link-detect is on by default.
42fc5d26 179
0efdf0fe 180.. _link-parameters-commands:
42fc5d26
QY
181
182Link Parameters Commands
183------------------------
184
85400b29
MS
185.. note::
186
187 At this time, FRR offers partial support for some of the routing
188 protocol extensions that can be used with MPLS-TE. FRR does not
189 support a complete RSVP-TE solution currently.
190
d1a242fd 191.. clicmd:: link-params
42fc5d26 192
42fc5d26 193
85400b29
MS
194 Enter into the link parameters sub node. At least 'enable' must be
195 set to activate the link parameters, and consequently routing
196 information that could be used as part of Traffic Engineering on
197 this interface. MPLS-TE must be enable at the OSPF
198 (:ref:`ospf-traffic-engineering`) or ISIS
199 (:ref:`isis-traffic-engineering`) router level in complement to
200 this. Disable link parameters for this interface.
42fc5d26 201
d1a242fd 202 Under link parameter statement, the following commands set the different TE values:
42fc5d26 203
d1a242fd 204.. clicmd:: link-params [enable]
42fc5d26 205
d1a242fd 206 Enable link parameters for this interface.
42fc5d26 207
d1a242fd 208.. clicmd:: link-params [metric (0-4294967295)]
42fc5d26 209
d1a242fd 210.. clicmd:: link-params max-bw BANDWIDTH
42fc5d26 211
d1a242fd 212.. clicmd:: link-params max-rsv-bw BANDWIDTH
42fc5d26 213
d1a242fd 214.. clicmd:: link-params unrsv-bw (0-7) BANDWIDTH
42fc5d26 215
d1a242fd 216.. clicmd:: link-params admin-grp BANDWIDTH
42fc5d26 217
d1a242fd
QY
218 These commands specifies the Traffic Engineering parameters of the interface
219 in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively
220 the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth
221 (interface speed by default), Maximum Reservable Bandwidth, Unreserved
222 Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource
223 Class/Color (OSPF).
42fc5d26 224
d1a242fd
QY
225 Note that BANDIWDTH is specified in IEEE floating point format and express
226 in Bytes/second.
42fc5d26 227
d1a242fd 228.. clicmd:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)]
42fc5d26 229
d1a242fd 230.. clicmd:: link-param delay-variation (0-16777215)
42fc5d26 231
d1a242fd 232.. clicmd:: link-param packet-loss PERCENTAGE
42fc5d26 233
d1a242fd 234.. clicmd:: link-param res-bw BANDWIDTH
42fc5d26 235
d1a242fd 236.. clicmd:: link-param ava-bw BANDWIDTH
42fc5d26 237
d1a242fd 238.. clicmd:: link-param use-bw BANDWIDTH
42fc5d26 239
d1e7591e 240 These command specifies additional Traffic Engineering parameters of the
d1a242fd
QY
241 interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and
242 draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the
243 delay, jitter, loss, available bandwidth, reservable bandwidth and utilized
244 bandwidth.
42fc5d26 245
d1a242fd
QY
246 Note that BANDWIDTH is specified in IEEE floating point format and express
247 in Bytes/second. Delays and delay variation are express in micro-second
248 (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step
249 of 0.000003.
42fc5d26 250
d1a242fd 251.. clicmd:: link-param neighbor <A.B.C.D> as (0-65535)
42fc5d26 252
d1a242fd 253.. clicmd:: link-param no neighbor
42fc5d26 254
d1a242fd
QY
255 Specifies the remote ASBR IP address and Autonomous System (AS) number
256 for InterASv2 link in OSPF (RFC5392). Note that this option is not yet
257 supported for ISIS (RFC5316).
42fc5d26 258
43b8e264
QY
259.. clicmd:: ip nht resolve-via-default
260
261 Allows nexthop tracking to resolve via the default route. This is useful
262 when e.g. you want to allow BGP to peer across the default route.
263
f90115c5 264.. _zebra-vrf:
80ca5b6d 265
9187f11a
DS
266Administrative Distance
267=======================
268
269Administrative distance allows FRR to make decisions about what routes
270should be installed in the rib based upon the originating protocol.
271The lowest Admin Distance is the route selected. This is purely a
272subjective decision about ordering and care has been taken to choose
273the same distances that other routing suites have choosen.
274
275+------------+-----------+
276| Protocol | Distance |
277+------------+-----------+
278| System | 0 |
279+------------+-----------+
280| Kernel | 0 |
281+------------+-----------+
282| Connect | 0 |
283+------------+-----------+
284| Static | 1 |
285+------------+-----------+
286| NHRP | 10 |
287+------------+-----------+
288| EBGP | 20 |
289+------------+-----------+
290| EIGRP | 90 |
291+------------+-----------+
292| BABEL | 100 |
293+------------+-----------+
294| OSPF | 110 |
295+------------+-----------+
296| ISIS | 115 |
297+------------+-----------+
298| OPENFABRIC | 115 |
299+------------+-----------+
300| RIP | 120 |
301+------------+-----------+
302| Table | 150 |
303+------------+-----------+
304| SHARP | 150 |
305+------------+-----------+
306| IBGP | 200 |
307+------------+-----------+
308| PBR | 200 |
309+------------+-----------+
310
311An admin distance of 255 indicates to Zebra that the route should not be
312installed into the Data Plane. Additionally routes with an admin distance
313of 255 will not be redistributed.
314
315Zebra does treat Kernel routes as special case for the purposes of Admin
316Distance. Upon learning about a route that is not originated by FRR
317we read the metric value as a uint32_t. The top byte of the value
318is interpreted as the Administrative Distance and the low three bytes
319are read in as the metric. This special case is to facilitate VRF
320default routes.
321
ba5e7ae2
DS
322Route Replace Semantics
323=======================
324
325When using the Linux Kernel as a forwarding plane, routes are installed
326with a metric of 20 to the kernel. Please note that the kernel's metric
327value bears no resemblence to FRR's RIB metric or admin distance. It
328merely is a way for the Linux Kernel to decide which route to use if it
329has multiple routes for the same prefix from multiple sources. An example
330here would be if someone else was running another routing suite besides
331FRR at the same time, the kernel must choose what route to use to forward
332on. FRR choose the value of 20 because of two reasons. FRR wanted a
333value small enough to be choosen but large enough that the operator could
334allow route prioritization by the kernel when multiple routing suites are
335being run and FRR wanted to take advantage of Route Replace semantics that
336the linux kernel offers. In order for Route Replacement semantics to
337work FRR must use the same metric when issuing the replace command.
338Currently FRR only supports Route Replace semantics using the Linux
339Kernel.
340
80ca5b6d
QY
341Virtual Routing and Forwarding
342==============================
42fc5d26 343
80ca5b6d
QY
344FRR supports :abbr:`VRF (Virtual Routing and Forwarding)`. VRF is a way to
345separate networking contexts on the same machine. Those networking contexts are
346associated with separate interfaces, thus making it possible to associate one
347interface with a specific VRF.
204ed384 348
204ed384 349VRF can be used, for example, when instantiating per enterprise networking
80ca5b6d
QY
350services, without having to instantiate the physical host machine or the
351routing management daemons for each enterprise. As a result, interfaces are
352separate for each set of VRF, and routing daemons can have their own context
353for each VRF.
204ed384
PG
354
355This conceptual view introduces the *Default VRF* case. If the user does not
80ca5b6d
QY
356configure any specific VRF, then by default, FRR uses the *Default VRF*.
357
204ed384 358Configuring VRF networking contexts can be done in various ways on FRR. The VRF
80ca5b6d 359interfaces can be configured by entering in interface configuration mode
614aa5c1 360:clicmd:`interface IFNAME vrf VRF`.
204ed384
PG
361
362A VRF backend mode is chosen when running *Zebra*.
363
364If no option is chosen, then the *Linux VRF* implementation as references in
80ca5b6d 365https://www.kernel.org/doc/Documentation/networking/vrf.txt will be mapped over
204ed384
PG
366the *Zebra* VRF. The routing table associated to that VRF is a Linux table
367identifier located in the same *Linux network namespace* where *Zebra* started.
eff8e8a2
DS
368Please note when using the *Linux VRF* routing table it is expected that a
369default Kernel route will be installed that has a metric as outlined in the
370www.kernel.org doc above. The Linux Kernel does table lookup via a combination
371of rule application of the rule table and then route lookup of the specified
372table. If no route match is found then the next applicable rule is applied
373to find the next route table to use to look for a route match. As such if
374your VRF table does not have a default blackhole route with a high metric
375VRF route lookup will leave the table specified by the VRF, which is undesirable.
204ed384 376
80ca5b6d
QY
377If the :option:`-n` option is chosen, then the *Linux network namespace* will
378be mapped over the *Zebra* VRF. That implies that *Zebra* is able to configure
379several *Linux network namespaces*. The routing table associated to that VRF
380is the whole routing tables located in that namespace. For instance, this mode
381matches OpenStack Network Namespaces. It matches also OpenFastPath. The default
382behavior remains Linux VRF which is supported by the Linux kernel community,
383see https://www.kernel.org/doc/Documentation/networking/vrf.txt.
204ed384
PG
384
385Because of that difference, there are some subtle differences when running some
386commands in relationship to VRF. Here is an extract of some of those commands:
387
204ed384
PG
388.. clicmd:: vrf VRF
389
390 This command is available on configuration mode. By default, above command
52119114 391 permits accessing the VRF configuration mode. This mode is available for
d66a93dd
PG
392 both VRFs. It is to be noted that *Zebra* does not create Linux VRF.
393 The network administrator can however decide to provision this command in
394 configuration file to provide more clarity about the intended configuration.
204ed384 395
204ed384
PG
396.. clicmd:: netns NAMESPACE
397
80ca5b6d
QY
398 This command is based on VRF configuration mode. This command is available
399 when *Zebra* is run in :option:`-n` mode. This command reflects which *Linux
400 network namespace* is to be mapped with *Zebra* VRF. It is to be noted that
401 *Zebra* creates and detects added/suppressed VRFs from the Linux environment
d66a93dd
PG
402 (in fact, those managed with iproute2). The network administrator can however
403 decide to provision this command in configuration file to provide more clarity
404 about the intended configuration.
204ed384 405
204ed384
PG
406.. clicmd:: show ip route vrf VRF
407
408 The show command permits dumping the routing table associated to the VRF. If
80ca5b6d
QY
409 *Zebra* is launched with default settings, this will be the ``TABLENO`` of
410 the VRF configured on the kernel, thanks to information provided in
411 https://www.kernel.org/doc/Documentation/networking/vrf.txt. If *Zebra* is
412 launched with :option:`-n` option, this will be the default routing table of
413 the *Linux network namespace* ``VRF``.
204ed384 414
204ed384
PG
415.. clicmd:: show ip route vrf VRF table TABLENO
416
80ca5b6d
QY
417 The show command is only available with :option:`-n` option. This command
418 will dump the routing table ``TABLENO`` of the *Linux network namespace*
419 ``VRF``.
420
5a81528c
PG
421.. clicmd:: show ip route vrf VRF tables
422
423 This command will dump the routing tables within the vrf scope. If `vrf all`
424 is executed, all routing tables will be dumped.
425
a3fd74f7
DS
426.. clicmd:: show <ip|ipv6> route summary [vrf VRF] [table TABLENO] [prefix]
427
428 This command will dump a summary output of the specified VRF and TABLENO
429 combination. If neither VRF or TABLENO is specified FRR defaults to
430 the default vrf and default table. If prefix is specified dump the
431 number of prefix routes.
432
c94e6725
PG
433By using the :option:`-n` option, the *Linux network namespace* will be mapped
434over the *Zebra* VRF. One nice feature that is possible by handling *Linux
435network namespace* is the ability to name default VRF. At startup, *Zebra*
436discovers the available *Linux network namespace* by parsing folder
437`/var/run/netns`. Each file stands for a *Linux network namespace*, but not all
438*Linux network namespaces* are available under that folder. This is the case for
439default VRF. It is possible to name the default VRF, by creating a file, by
440executing following commands.
441
442.. code-block:: shell
443
444 touch /var/run/netns/vrf0
445 mount --bind /proc/self/ns/net /var/run/netns/vrf0
446
447Above command illustrates what happens when the default VRF is visible under
448`var/run/netns/`. Here, the default VRF file is `vrf0`.
449At startup, FRR detects the presence of that file. It detects that the file
450statistics information matches the same file statistics information as
451`/proc/self/ns/net` ( through stat() function). As statistics information
452matches, then `vrf0` stands for the new default namespace name.
56f0bea7 453Consequently, the VRF naming `Default` will be overridden by the new discovered
c94e6725
PG
454namespace name `vrf0`.
455
456For those who don't use VRF backend with *Linux network namespace*, it is
457possible to statically configure and recompile FRR. It is possible to choose an
458alternate name for default VRF. Then, the default VRF naming will automatically
459be updated with the new name. To illustrate, if you want to recompile with
460`global` value, use the following command:
461
cc4345d4 462.. code-block:: shell
c94e6725
PG
463
464 ./configure --with-defaultvrfname=global
465
b03d3432
PG
466.. _zebra-mpls:
467
468MPLS Commands
469=============
470
471You can configure static mpls entries in zebra. Basically, handling MPLS
472consists of popping, swapping or pushing labels to IP packets.
473
474MPLS Acronyms
475-------------
476
477:abbr:`LSR (Labeled Switch Router)`
478 Networking devices handling labels used to forward traffic between and through
479 them.
480
481:abbr:`LER (Labeled Edge Router)`
482 A Labeled edge router is located at the edge of an MPLS network, generally
483 between an IP network and an MPLS network.
484
485MPLS Push Action
486----------------
487
488The push action is generally used for LER devices, which want to encapsulate
489all traffic for a wished destination into an MPLS label. This action is stored
490in routing entry, and can be configured like a route:
491
03750f1e 492.. clicmd:: ip route NETWORK MASK GATEWAY|INTERFACE label LABEL
b03d3432 493
56f0bea7 494 NETWORK and MASK stand for the IP prefix entry to be added as static
b03d3432
PG
495 route entry.
496 GATEWAY is the gateway IP address to reach, in order to reach the prefix.
497 INTERFACE is the interface behind which the prefix is located.
498 LABEL is the MPLS label to use to reach the prefix abovementioned.
499
500 You can check that the static entry is stored in the zebra RIB database, by
501 looking at the presence of the entry.
502
503 ::
504
505 zebra(configure)# ip route 1.1.1.1/32 10.0.1.1 label 777
506 zebra# show ip route
507 Codes: K - kernel route, C - connected, S - static, R - RIP,
508 O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
509 T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
510 F - PBR,
511 > - selected route, * - FIB route
512
513 S>* 1.1.1.1/32 [1/0] via 10.0.1.1, r2-eth0, label 777, 00:39:42
514
515MPLS Swap and Pop Action
516------------------------
517
518The swap action is generally used for LSR devices, which swap a packet with a
519label, with an other label. The Pop action is used on LER devices, at the
520termination of the MPLS traffic; this is used to remove MPLS header.
521
03750f1e 522.. clicmd:: mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null
b03d3432
PG
523
524 INCOMING_LABEL and OUTGOING_LABEL are MPLS labels with values ranging from 16
525 to 1048575.
526 GATEWAY is the gateway IP address where to send MPLS packet.
527 The outgoing label can either be a value or have an explicit-null label header. This
528 specific header can be read by IP devices. The incoming label can also be removed; in
529 that case the implicit-null keyword is used, and the outgoing packet emitted is an IP
530 packet without MPLS header.
531
532You can check that the MPLS actions are stored in the zebra MPLS table, by looking at the
533presence of the entry.
534
b03d3432
PG
535.. clicmd:: show mpls table
536
537::
538
539 zebra(configure)# mpls lsp 18 10.125.0.2 implicit-null
540 zebra(configure)# mpls lsp 19 10.125.0.2 20
541 zebra(configure)# mpls lsp 21 10.125.0.2 explicit-null
542 zebra# show mpls table
543 Inbound Outbound
544 Label Type Nexthop Label
545 -------- ------- --------------- --------
546 18 Static 10.125.0.2 implicit-null
547 19 Static 10.125.0.2 20
548 21 Static 10.125.0.2 IPv4 Explicit Null
549
550
80ca5b6d
QY
551.. _multicast-rib-commands:
552
42fc5d26
QY
553Multicast RIB Commands
554======================
555
556The Multicast RIB provides a separate table of unicast destinations which
d1a242fd 557is used for Multicast Reverse Path Forwarding decisions. It is used with
42fc5d26
QY
558a multicast source's IP address, hence contains not multicast group
559addresses but unicast addresses.
560
d1a242fd 561This table is fully separate from the default unicast table. However,
42fc5d26
QY
562RPF lookup can include the unicast table.
563
dc1046f7 564WARNING: RPF lookup results are non-responsive in this version of FRR,
42fc5d26
QY
565i.e. multicast routing does not actively react to changes in underlying
566unicast topology!
567
d1a242fd 568.. clicmd:: ip multicast rpf-lookup-mode MODE
42fc5d26 569
42fc5d26 570
d1a242fd 571 MODE sets the method used to perform RPF lookups. Supported modes:
42fc5d26 572
9eb95b3b
QY
573 urib-only
574 Performs the lookup on the Unicast RIB. The Multicast RIB is never used.
42fc5d26 575
9eb95b3b
QY
576 mrib-only
577 Performs the lookup on the Multicast RIB. The Unicast RIB is never used.
42fc5d26 578
9eb95b3b
QY
579 mrib-then-urib
580 Tries to perform the lookup on the Multicast RIB. If any route is found,
581 that route is used. Otherwise, the Unicast RIB is tried.
42fc5d26 582
9eb95b3b
QY
583 lower-distance
584 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
585 with the lower administrative distance is used; if they're equal, the
586 Multicast RIB takes precedence.
42fc5d26 587
9eb95b3b
QY
588 longer-prefix
589 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
590 with the longer prefix length is used; if they're equal, the
591 Multicast RIB takes precedence.
42fc5d26 592
9eb95b3b
QY
593 The `mrib-then-urib` setting is the default behavior if nothing is
594 configured. If this is the desired behavior, it should be explicitly
595 configured to make the configuration immune against possible changes in
596 what the default behavior is.
42fc5d26 597
d1a242fd 598.. warning::
1e31580f 599
d1a242fd
QY
600 Unreachable routes do not receive special treatment and do not cause
601 fallback to a second lookup.
42fc5d26 602
d1a242fd 603.. clicmd:: show ip rpf ADDR
42fc5d26 604
d1a242fd
QY
605 Performs a Multicast RPF lookup, as configured with ``ip multicast
606 rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look
607 up.
42fc5d26 608
d1a242fd 609 ::
42fc5d26
QY
610
611 > show ip rpf 192.0.2.1
612 Routing entry for 192.0.2.0/24 using Unicast RIB
d1a242fd
QY
613
614 Known via "kernel", distance 0, metric 0, best
615 * 198.51.100.1, via eth0
a8c90e15 616
42fc5d26 617
d1a242fd
QY
618 Indicates that a multicast source lookup for 192.0.2.1 would use an
619 Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1.
42fc5d26 620
d1a242fd 621.. clicmd:: show ip rpf
42fc5d26 622
d1a242fd
QY
623 Prints the entire Multicast RIB. Note that this is independent of the
624 configured RPF lookup mode, the Multicast RIB may be printed yet not
625 used at all.
42fc5d26 626
d1a242fd 627.. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE]
42fc5d26 628
42fc5d26 629
d1a242fd
QY
630 Adds a static route entry to the Multicast RIB. This performs exactly as the
631 ``ip route`` command, except that it inserts the route in the Multicast RIB
632 instead of the Unicast RIB.
42fc5d26 633
0efdf0fe 634.. _zebra-route-filtering:
42fc5d26
QY
635
636zebra Route Filtering
637=====================
638
0efdf0fe 639Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes
013f9762 640received from other FRR components. The permit/deny facilities provided by
d1a242fd
QY
641these commands can be used to filter which routes zebra will install in the
642kernel.
42fc5d26 643
d1a242fd 644.. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP
42fc5d26 645
013f9762 646 Apply a route-map filter to routes for the specified protocol. PROTOCOL can
431dd37e 647 be:
013f9762 648
563018b9
DS
649 - any,
650 - babel,
651 - bgp,
013f9762 652 - connected,
563018b9
DS
653 - eigrp,
654 - isis,
655 - kernel,
656 - nhrp,
657 - openfabric,
013f9762
QY
658 - ospf,
659 - ospf6,
563018b9
DS
660 - rip,
661 - sharp,
662 - static,
663 - ripng,
664 - table,
665 - vnc.
666
667 If you choose any as the option that will cause all protocols that are sending
668 routes to zebra. You can specify a :dfn:`ip protocol PROTOCOL route-map ROUTEMAP`
669 on a per vrf basis, by entering this command under vrf mode for the vrf you
670 want to apply the route-map against.
d1a242fd 671
d1a242fd
QY
672.. clicmd:: set src ADDRESS
673
674 Within a route-map, set the preferred source address for matching routes
675 when installing in the kernel.
676
677
678The following creates a prefix-list that matches all addresses, a route-map
679that sets the preferred source address, and applies the route-map to all
680*rip* routes.
681
9eb95b3b 682.. code-block:: frr
42fc5d26 683
d1a242fd
QY
684 ip prefix-list ANY permit 0.0.0.0/0 le 32
685 route-map RM1 permit 10
686 match ip address prefix-list ANY
687 set src 10.0.0.1
42fc5d26 688
d1a242fd 689 ip protocol rip route-map RM1
a8c90e15 690
1d0372dd
TB
691IPv6 example for OSPFv3.
692
693.. code-block:: frr
694
695 ipv6 prefix-list ANY seq 10 permit any
696 route-map RM6 permit 10
697 match ipv6 address prefix-list ANY
698 set src 2001:db8:425:1000::3
699
700 ipv6 protocol ospf6 route-map RM6
701
702
703.. note::
704
705 For both IPv4 and IPv6, the IP address has to exist at the point the
706 route-map is created. Be wary of race conditions if the interface is
707 not created at startup. On Debian, FRR might start before ifupdown
708 completes. Consider a reboot test.
42fc5d26 709
03750f1e 710.. clicmd:: zebra route-map delay-timer (0-600)
3d34678f
DS
711
712 Set the delay before any route-maps are processed in zebra. The
713 default time for this is 5 seconds.
714
0efdf0fe 715.. _zebra-fib-push-interface:
42fc5d26
QY
716
717zebra FIB push interface
718========================
719
720Zebra supports a 'FIB push' interface that allows an external
dc1046f7 721component to learn the forwarding information computed by the FRR
d1a242fd 722routing suite. This is a loadable module that needs to be enabled
0efdf0fe 723at startup as described in :ref:`loadable-module-support`.
42fc5d26 724
dc1046f7 725In FRR, the Routing Information Base (RIB) resides inside
42fc5d26
QY
726zebra. Routing protocols communicate their best routes to zebra, and
727zebra computes the best route across protocols for each prefix. This
728latter information makes up the Forwarding Information Base
729(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
730the kernel to forward packets according to the routes computed by
dc1046f7 731FRR. The kernel FIB is updated in an OS-specific way. For example,
d1e7591e 732the `Netlink` interface is used on Linux, and route sockets are
42fc5d26
QY
733used on FreeBSD.
734
735The FIB push interface aims to provide a cross-platform mechanism to
736support scenarios where the router has a forwarding path that is
737distinct from the kernel, commonly a hardware-based fast path. In
738these cases, the FIB needs to be maintained reliably in the fast path
739as well. We refer to the component that programs the forwarding plane
740(directly or indirectly) as the Forwarding Plane Manager or FPM.
741
80ca5b6d
QY
742.. program:: configure
743
42fc5d26 744The relevant zebra code kicks in when zebra is configured with the
9d736133
RZ
745:option:`--enable-fpm` flag and started with the module (``-M fpm``
746or ``-M dplane_fpm_nl``).
747
748.. note::
749
750 The ``fpm`` implementation attempts to connect to ``127.0.0.1`` port ``2620``
751 by default without configurations. The ``dplane_fpm_nl`` only attempts to
752 connect to a server if configured.
753
754Zebra periodically attempts to connect to the well-known FPM port (``2620``).
755Once the connection is up, zebra starts sending messages containing routes
756over the socket to the FPM. Zebra sends a complete copy of the forwarding
757table to the FPM, including routes that it may have picked up from the kernel.
758The existing interaction of zebra with the kernel remains unchanged -- that
759is, the kernel continues to receive FIB updates as before.
760
761The default FPM message format is netlink, however it can be controlled
762with the module load-time option. The modules accept the following options:
763
764- ``fpm``: ``netlink`` and ``protobuf``.
765- ``dplane_fpm_nl``: none, it only implements netlink.
42fc5d26
QY
766
767The zebra FPM interface uses replace semantics. That is, if a 'route
768add' message for a prefix is followed by another 'route add' message,
769the information in the second message is complete by itself, and
770replaces the information sent in the first message.
771
772If the connection to the FPM goes down for some reason, zebra sends
773the FPM a complete copy of the forwarding table(s) when it reconnects.
774
9d736133
RZ
775For more details on the implementation, please read the developer's manual FPM
776section.
777
778FPM Commands
779============
780
781``fpm`` implementation
782----------------------
783
9d736133
RZ
784.. clicmd:: fpm connection ip A.B.C.D port (1-65535)
785
03750f1e
QY
786 Configure ``zebra`` to connect to a different FPM server than the default of
787 ``127.0.0.1:2060``
9d736133 788
9d736133
RZ
789.. clicmd:: show zebra fpm stats
790
791 Shows the FPM statistics.
792
793 Sample output:
794
795 ::
796
797 Counter Total Last 10 secs
798
799 connect_calls 3 2
800 connect_no_sock 0 0
801 read_cb_calls 2 2
802 write_cb_calls 2 0
803 write_calls 1 0
804 partial_writes 0 0
805 max_writes_hit 0 0
806 t_write_yields 0 0
807 nop_deletes_skipped 6 0
808 route_adds 5 0
809 route_dels 0 0
810 updates_triggered 11 0
811 redundant_triggers 0 0
812 dests_del_after_update 0 0
813 t_conn_down_starts 0 0
814 t_conn_down_dests_processed 0 0
815 t_conn_down_yields 0 0
816 t_conn_down_finishes 0 0
817 t_conn_up_starts 1 0
818 t_conn_up_dests_processed 11 0
819 t_conn_up_yields 0 0
820 t_conn_up_aborts 0 0
821 t_conn_up_finishes 1 0
822
823
9d736133
RZ
824.. clicmd:: clear zebra fpm stats
825
6d8589da
RZ
826 Reset statistics related to the zebra code that interacts with the
827 optional Forwarding Plane Manager (FPM) component.
9d736133
RZ
828
829
830``dplane_fpm_nl`` implementation
831--------------------------------
832
9d736133
RZ
833.. clicmd:: fpm address <A.B.C.D|X:X::X:X> [port (1-65535)]
834
835 Configures the FPM server address. Once configured ``zebra`` will attempt
836 to connect to it immediately.
837
03750f1e
QY
838 The ``no`` form disables FPM entirely. ``zebra`` will close any current
839 connections and will not attempt to connect to it anymore.
9d736133 840
5f66e9a0
RZ
841.. clicmd:: fpm use-next-hop-groups
842
843 Use the new netlink messages ``RTM_NEWNEXTHOP`` / ``RTM_DELNEXTHOP`` to
844 group repeated route next hop information.
845
f41ddc27 846 The ``no`` form uses the old known FPM behavior of including next hop
03750f1e 847 information in the route (e.g. ``RTM_NEWROUTE``) messages.
5f66e9a0 848
9d736133
RZ
849.. clicmd:: show fpm counters [json]
850
851 Show the FPM statistics (plain text or JSON formatted).
852
853 Sample output:
854
855 ::
856
857 FPM counters
858 ============
859 Input bytes: 0
860 Output bytes: 308
861 Output buffer current size: 0
862 Output buffer peak size: 308
863 Connection closes: 0
864 Connection errors: 0
865 Data plane items processed: 0
866 Data plane items enqueued: 0
867 Data plane items queue peak: 0
868 Buffer full hits: 0
869 User FPM configurations: 1
870 User FPM disable requests: 0
871
872
9d736133
RZ
873.. clicmd:: clear fpm counters
874
6d8589da
RZ
875 Reset statistics related to the zebra code that interacts with the
876 optional Forwarding Plane Manager (FPM) component.
9d736133
RZ
877
878
3fdcb303
MS
879.. _zebra-dplane:
880
881Dataplane Commands
882==================
883
884The zebra dataplane subsystem provides a framework for FIB
885programming. Zebra uses the dataplane to program the local kernel as
886it makes changes to objects such as IP routes, MPLS LSPs, and
887interface IP addresses. The dataplane runs in its own pthread, in
888order to off-load work from the main zebra pthread.
889
890
3fdcb303
MS
891.. clicmd:: show zebra dplane [detailed]
892
893 Display statistics about the updates and events passing through the
894 dataplane subsystem.
895
896
3fdcb303
MS
897.. clicmd:: show zebra dplane providers
898
899 Display information about the running dataplane plugins that are
900 providing updates to a FIB. By default, the local kernel plugin is
901 present.
902
903
3fdcb303
MS
904.. clicmd:: zebra dplane limit [NUMBER]
905
906 Configure the limit on the number of pending updates that are
907 waiting to be processed by the dataplane pthread.
908
909
42fc5d26
QY
910zebra Terminal Mode Commands
911============================
912
d1a242fd 913.. clicmd:: show ip route
42fc5d26 914
d1a242fd 915 Display current routes which zebra holds in its database.
42fc5d26
QY
916
917::
918
42fc5d26
QY
919 Router# show ip route
920 Codes: K - kernel route, C - connected, S - static, R - RIP,
d1a242fd 921 B - BGP * - FIB route.
42fc5d26 922
d1a242fd
QY
923 K* 0.0.0.0/0 203.181.89.241
924 S 0.0.0.0/0 203.181.89.1
925 C* 127.0.0.0/8 lo
42fc5d26 926 C* 203.181.89.240/28 eth0
a8c90e15 927
42fc5d26 928
d1a242fd 929.. clicmd:: show ipv6 route
42fc5d26 930
da3ef85b 931.. clicmd:: show [ip|ipv6] route [PREFIX] [nexthop-group]
fbe49edb 932
da3ef85b
SW
933 Display detailed information about a route. If [nexthop-group] is
934 included, it will display the nexthop group ID the route is using as well.
935
da3ef85b
SW
936.. clicmd:: show interface [NAME] [{vrf VRF|brief}] [nexthop-group]
937
da3ef85b
SW
938.. clicmd:: show interface [NAME] [{vrf all|brief}] [nexthop-group]
939
940 Display interface information. If no extra information is added, it will
941 dump information on all interfaces. If [NAME] is specified, it will display
942 detailed information about that single interface. If [nexthop-group] is
943 specified, it will display nexthop groups pointing out that interface.
42fc5d26 944
d1a242fd 945.. clicmd:: show ip prefix-list [NAME]
42fc5d26 946
d1a242fd 947.. clicmd:: show route-map [NAME]
42fc5d26 948
d1a242fd 949.. clicmd:: show ip protocol
42fc5d26 950
854cdf7c 951.. clicmd:: show ip forward
42fc5d26 952
d1a242fd
QY
953 Display whether the host's IP forwarding function is enabled or not.
954 Almost any UNIX kernel can be configured with IP forwarding disabled.
955 If so, the box can't work as a router.
42fc5d26 956
854cdf7c 957.. clicmd:: show ipv6 forward
42fc5d26 958
d1a242fd 959 Display whether the host's IP v6 forwarding is enabled or not.
42fc5d26 960
d1a242fd 961.. clicmd:: show zebra
42fc5d26 962
d1a242fd
QY
963 Display various statistics related to the installation and deletion
964 of routes, neighbor updates, and LSP's into the kernel.
42fc5d26 965
46677ed2
DS
966.. clicmd:: show zebra client [summary]
967
968 Display statistics about clients that are connected to zebra. This is
969 useful for debugging and seeing how much data is being passed between
970 zebra and it's clients. If the summary form of the command is choosen
971 a table is displayed with shortened information.
972
46677ed2
DS
973.. clicmd:: show zebra router table summary
974
975 Display summarized data about tables created, their afi/safi/tableid
976 and how many routes each table contains. Please note this is the
977 total number of route nodes in the table. Which will be higher than
978 the actual number of routes that are held.
979
a8ad9a89 980.. clicmd:: show nexthop-group rib [ID] [vrf NAME] [singleton [ip|ip6]] [type]
083954e9
DS
981
982 Display nexthop groups created by zebra. The [vrf NAME] option
983 is only meaningful if you have started zebra with the --vrfwnetns
984 option as that nexthop groups are per namespace in linux.
985 If you specify singleton you would like to see the singleton
a8ad9a89
SW
986 nexthop groups that do have an afi. [type] allows you to filter those
987 only coming from a specific NHG type (protocol).
da3ef85b 988
13b01f2f
JAG
989
990Router-id
991=========
992
993Many routing protocols require a router-id to be configured. To have a
994consistent router-id across all daemons, the following commands are available
995to configure and display the router-id:
996
03750f1e 997.. clicmd:: [ip] router-id A.B.C.D
13b01f2f 998
17d1eafa 999 Allow entering of the router-id. This command also works under the
98a3fb0a 1000 vrf subnode, to allow router-id's per vrf.
13b01f2f 1001
03750f1e 1002.. clicmd:: [ip] router-id A.B.C.D vrf NAME
17d1eafa
DS
1003
1004 Configure the router-id of this router from the configure NODE.
1005 A show run of this command will display the router-id command
1006 under the vrf sub node. This command is deprecated and will
1007 be removed at some point in time in the future.
98a3fb0a 1008
98a3fb0a 1009.. clicmd:: show [ip] router-id [vrf NAME]
13b01f2f
JAG
1010
1011 Display the user configured router-id.
1012
98a3fb0a
SM
1013For protocols requiring an IPv6 router-id, the following commands are available:
1014
03750f1e 1015.. clicmd:: ipv6 router-id X:X::X:X
98a3fb0a
SM
1016
1017 Configure the IPv6 router-id of this router. Like its IPv4 counterpart,
1018 this command works under the vrf subnode, to allow router-id's per vrf.
1019
98a3fb0a 1020.. clicmd:: show ipv6 router-id [vrf NAME]
13b01f2f 1021
98a3fb0a 1022 Display the user configured IPv6 router-id.
8d150f52
MS
1023
1024
1025Debugging
1026=========
1027
1028.. clicmd:: debug zebra mpls [detailed]
1029
1030 MPLS-related events and information.
1031
1032.. clicmd:: debug zebra events
1033
1034 Zebra events
1035
1036.. clicmd:: debug zebra nht [detailed]
1037
1038 Nexthop-tracking / reachability information
1039
1040.. clicmd:: debug zebra vxlan
1041
1042 VxLAN (EVPN) events
1043
1044.. clicmd:: debug zebra pseudowires
1045
1046 Pseudowire events.
1047
1048.. clicmd:: debug zebra packet [<recv|send>] [detail]
1049
1050 ZAPI message and packet details
1051
1052.. clicmd:: debug zebra kernel
1053
1054 Kernel / OS events.
1055
1056.. clicmd:: debug zebra kernel msgdump [<recv|send>]
1057
1058 Raw OS (netlink) message details.
1059
1060.. clicmd:: debug zebra rib [detailed]
1061
1062 RIB events.
1063
1064.. clicmd:: debug zebra fpm
1065
1066 FPM (forwarding-plane manager) events.
1067
1068.. clicmd:: debug zebra dplane [detailed]
1069
1070 Dataplane / FIB events.
1071
1072.. clicmd:: debug zebra pbr
1073
1074 PBR (policy-based routing) events.
1075
1076.. clicmd:: debug zebra mlag
1077
1078 MLAG events.
1079
1080.. clicmd:: debug zebra evpn mh <es|mac|neigh|nh>
1081
1082 EVPN multi-hop events.
1083
1084.. clicmd:: debug zebra nexthop [detail]
1085
1086 Nexthop and nexthop-group events.
1087