]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/zebra.rst
doc: add doc for zebra dplane cli
[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
c9365894 26.. option:: -k, --keep_kernel
42fc5d26 27
d1a242fd 28 When zebra starts up, don't delete old self inserted routes.
42fc5d26 29
c9365894 30.. option:: -r, --retain
42fc5d26 31
da7e1a92
QY
32 When program terminates, do not flush routes installed by *zebra* from the
33 kernel.
42fc5d26 34
0d8df934
DS
35.. option:: -e X, --ecmp X
36
37 Run zebra with a limited ecmp ability compared to what it is compiled to.
38 If you are running zebra on hardware limited functionality you can
39 force zebra to limit the maximum ecmp allowed to X. This number
40 is bounded by what you compiled FRR with as the maximum number.
41
204ed384
PG
42.. option:: -n, --vrfwnetns
43
44 When *Zebra* starts with this option, the VRF backend is based on Linux
45 network namespaces. That implies that all network namespaces discovered by
46 ZEBRA will create an associated VRF. The other daemons will operate on the VRF
80ca5b6d 47 VRF defined by *Zebra*, as usual.
204ed384 48
f90115c5 49 .. seealso:: :ref:`zebra-vrf`
013f9762 50
cc6743c2
PG
51.. option:: -o, --vrfdefaultname
52
53 When *Zebra* starts with this option, the default VRF name is changed to the
54 parameter.
55
56 .. seealso:: :ref:`zebra-vrf`
57
4354d381
DS
58.. option:: --v6-rr-semantics
59
60 The linux kernel is receiving the ability to use the same route
61 replacement semantics for v6 that v4 uses. If you are using a
62 kernel that supports this functionality then run *Zebra* with this
63 option and we will use Route Replace Semantics instead of delete
64 than add.
65
0efdf0fe 66.. _interface-commands:
42fc5d26 67
4d25da4f
PG
68Configuration Addresses behaviour
69=================================
70
71At startup, *Zebra* will first discover the underlying networking objects
72from the operating system. This includes interfaces, addresses of
73interfaces, static routes, etc. Then, it will read the configuration
74file, including its own interface addresses, static routes, etc. All this
75information comprises the operational context from *Zebra*. But
76configuration context from *Zebra* will remain the same as the one from
77:file:`zebra.conf` config file. As an example, executing the following
78:clicmd:`show running-config` will reflect what was in :file:`zebra.conf`.
79In a similar way, networking objects that are configured outside of the
80*Zebra* like *iproute2* will not impact the configuration context from
81*Zebra*. This behaviour permits you to continue saving your own config
82file, and decide what is really to be pushed on the config file, and what
83is dependent on the underlying system.
84Note that inversely, from *Zebra*, you will not be able to delete networking
85objects that were previously configured outside of *Zebra*.
86
87
42fc5d26
QY
88Interface Commands
89==================
90
0efdf0fe 91.. _standard-commands:
42fc5d26
QY
92
93Standard Commands
94-----------------
95
d1a242fd
QY
96.. index:: interface IFNAME
97
98.. clicmd:: interface IFNAME
99
204ed384
PG
100.. index:: interface IFNAME vrf VRF
101
102.. clicmd:: interface IFNAME vrf VRF
103
d1a242fd 104.. index:: shutdown
42fc5d26 105
d1a242fd
QY
106.. clicmd:: shutdown
107.. index:: no shutdown
42fc5d26 108
d1a242fd 109.. clicmd:: no shutdown
42fc5d26 110
d1a242fd 111 Up or down the current interface.
42fc5d26 112
d1a242fd 113.. index:: ip address ADDRESS/PREFIX
42fc5d26 114
d1a242fd
QY
115.. clicmd:: ip address ADDRESS/PREFIX
116.. index:: ipv6 address ADDRESS/PREFIX
42fc5d26 117
d1a242fd
QY
118.. clicmd:: ipv6 address ADDRESS/PREFIX
119.. index:: no ip address ADDRESS/PREFIX
42fc5d26 120
d1a242fd
QY
121.. clicmd:: no ip address ADDRESS/PREFIX
122.. index:: no ipv6 address ADDRESS/PREFIX
42fc5d26 123
d1a242fd 124.. clicmd:: no ipv6 address ADDRESS/PREFIX
42fc5d26 125
d1a242fd 126 Set the IPv4 or IPv6 address/prefix for the interface.
42fc5d26 127
d1a242fd 128.. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
42fc5d26 129
d1a242fd
QY
130.. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
131.. index:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
42fc5d26 132
d1a242fd 133.. clicmd:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
42fc5d26 134
d1e7591e
QY
135 Configure an IPv4 Point-to-Point address on the interface. (The concept of
136 PtP addressing does not exist for IPv6.)
42fc5d26 137
d1a242fd
QY
138 `local-addr` has no subnet mask since the local side in PtP addressing is
139 always a single (/32) address. `peer-addr/prefix` can be an arbitrary subnet
140 behind the other end of the link (or even on the link in Point-to-Multipoint
141 setups), though generally /32s are used.
42fc5d26 142
d1a242fd 143.. index:: description DESCRIPTION ...
42fc5d26 144
d1a242fd 145.. clicmd:: description DESCRIPTION ...
42fc5d26 146
d1a242fd 147 Set description for the interface.
42fc5d26 148
d1a242fd 149.. index:: multicast
42fc5d26 150
d1a242fd
QY
151.. clicmd:: multicast
152.. index:: no multicast
42fc5d26 153
d1a242fd 154.. clicmd:: no multicast
42fc5d26 155
d1a242fd 156 Enable or disables multicast flag for the interface.
42fc5d26 157
d1a242fd 158.. index:: bandwidth (1-10000000)
42fc5d26 159
d1a242fd
QY
160.. clicmd:: bandwidth (1-10000000)
161.. index:: no bandwidth (1-10000000)
162
163.. clicmd:: no bandwidth (1-10000000)
164
165 Set bandwidth value of the interface in kilobits/sec. This is for
166 calculating OSPF cost. This command does not affect the actual device
167 configuration.
168
169.. index:: link-detect
170
171.. clicmd:: link-detect
172.. index:: no link-detect
173
174.. clicmd:: no link-detect
175
176 Enable/disable link-detect on platforms which support this. Currently only
177 Linux and Solaris, and only where network interface drivers support
178 reporting link-state via the ``IFF_RUNNING`` flag.
4c97fd1a 179
30980e0a 180 In FRR, link-detect is on by default.
42fc5d26 181
0efdf0fe 182.. _link-parameters-commands:
42fc5d26
QY
183
184Link Parameters Commands
185------------------------
186
d1a242fd
QY
187.. index:: link-params
188.. clicmd:: link-params
42fc5d26 189
d1a242fd
QY
190.. index:: no link-param
191.. clicmd:: no link-param
42fc5d26 192
d1a242fd
QY
193 Enter into the link parameters sub node. At least 'enable' must be set to
194 activate the link parameters, and consequently Traffic Engineering on this
195 interface. MPLS-TE must be enable at the OSPF
0efdf0fe 196 (:ref:`ospf-traffic-engineering`) or ISIS (:ref:`isis-traffic-engineering`)
d1a242fd
QY
197 router level in complement to this. Disable link parameters for this
198 interface.
42fc5d26 199
d1a242fd 200 Under link parameter statement, the following commands set the different TE values:
42fc5d26 201
d1a242fd
QY
202.. index:: link-params [enable]
203.. clicmd:: link-params [enable]
42fc5d26 204
d1a242fd 205 Enable link parameters for this interface.
42fc5d26 206
d1a242fd
QY
207.. index:: link-params [metric (0-4294967295)]
208.. clicmd:: link-params [metric (0-4294967295)]
42fc5d26 209
d1a242fd
QY
210.. index:: link-params max-bw BANDWIDTH
211.. clicmd:: link-params max-bw BANDWIDTH
42fc5d26 212
d1a242fd
QY
213.. index:: link-params max-rsv-bw BANDWIDTH
214.. clicmd:: link-params max-rsv-bw BANDWIDTH
42fc5d26 215
d1a242fd
QY
216.. index:: link-params unrsv-bw (0-7) BANDWIDTH
217.. clicmd:: link-params unrsv-bw (0-7) BANDWIDTH
42fc5d26 218
d1a242fd
QY
219.. index:: link-params admin-grp BANDWIDTH
220.. clicmd:: link-params admin-grp BANDWIDTH
42fc5d26 221
d1a242fd
QY
222 These commands specifies the Traffic Engineering parameters of the interface
223 in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively
224 the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth
225 (interface speed by default), Maximum Reservable Bandwidth, Unreserved
226 Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource
227 Class/Color (OSPF).
42fc5d26 228
d1a242fd
QY
229 Note that BANDIWDTH is specified in IEEE floating point format and express
230 in Bytes/second.
42fc5d26 231
d1a242fd
QY
232.. index:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)]
233.. clicmd:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)]
42fc5d26 234
d1a242fd
QY
235.. index:: link-param delay-variation (0-16777215)
236.. clicmd:: link-param delay-variation (0-16777215)
42fc5d26 237
d1a242fd
QY
238.. index:: link-param packet-loss PERCENTAGE
239.. clicmd:: link-param packet-loss PERCENTAGE
42fc5d26 240
d1a242fd
QY
241.. index:: link-param res-bw BANDWIDTH
242.. clicmd:: link-param res-bw BANDWIDTH
42fc5d26 243
d1a242fd
QY
244.. index:: link-param ava-bw BANDWIDTH
245.. clicmd:: link-param ava-bw BANDWIDTH
42fc5d26 246
d1a242fd
QY
247.. index:: link-param use-bw BANDWIDTH
248.. clicmd:: link-param use-bw BANDWIDTH
42fc5d26 249
d1e7591e 250 These command specifies additional Traffic Engineering parameters of the
d1a242fd
QY
251 interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and
252 draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the
253 delay, jitter, loss, available bandwidth, reservable bandwidth and utilized
254 bandwidth.
42fc5d26 255
d1a242fd
QY
256 Note that BANDWIDTH is specified in IEEE floating point format and express
257 in Bytes/second. Delays and delay variation are express in micro-second
258 (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step
259 of 0.000003.
42fc5d26 260
d1a242fd
QY
261.. index:: link-param neighbor <A.B.C.D> as (0-65535)
262.. clicmd:: link-param neighbor <A.B.C.D> as (0-65535)
42fc5d26 263
d1a242fd
QY
264.. index:: link-param no neighbor
265.. clicmd:: link-param no neighbor
42fc5d26 266
d1a242fd
QY
267 Specifies the remote ASBR IP address and Autonomous System (AS) number
268 for InterASv2 link in OSPF (RFC5392). Note that this option is not yet
269 supported for ISIS (RFC5316).
42fc5d26 270
43b8e264
QY
271.. index:: ip nht resolve-via-default
272.. clicmd:: ip nht resolve-via-default
273
274 Allows nexthop tracking to resolve via the default route. This is useful
275 when e.g. you want to allow BGP to peer across the default route.
276
f90115c5 277.. _zebra-vrf:
80ca5b6d
QY
278
279Virtual Routing and Forwarding
280==============================
42fc5d26 281
80ca5b6d
QY
282FRR supports :abbr:`VRF (Virtual Routing and Forwarding)`. VRF is a way to
283separate networking contexts on the same machine. Those networking contexts are
284associated with separate interfaces, thus making it possible to associate one
285interface with a specific VRF.
204ed384 286
204ed384 287VRF can be used, for example, when instantiating per enterprise networking
80ca5b6d
QY
288services, without having to instantiate the physical host machine or the
289routing management daemons for each enterprise. As a result, interfaces are
290separate for each set of VRF, and routing daemons can have their own context
291for each VRF.
204ed384
PG
292
293This conceptual view introduces the *Default VRF* case. If the user does not
80ca5b6d
QY
294configure any specific VRF, then by default, FRR uses the *Default VRF*.
295
204ed384 296Configuring VRF networking contexts can be done in various ways on FRR. The VRF
80ca5b6d 297interfaces can be configured by entering in interface configuration mode
614aa5c1 298:clicmd:`interface IFNAME vrf VRF`.
204ed384
PG
299
300A VRF backend mode is chosen when running *Zebra*.
301
302If no option is chosen, then the *Linux VRF* implementation as references in
80ca5b6d 303https://www.kernel.org/doc/Documentation/networking/vrf.txt will be mapped over
204ed384
PG
304the *Zebra* VRF. The routing table associated to that VRF is a Linux table
305identifier located in the same *Linux network namespace* where *Zebra* started.
306
80ca5b6d
QY
307If the :option:`-n` option is chosen, then the *Linux network namespace* will
308be mapped over the *Zebra* VRF. That implies that *Zebra* is able to configure
309several *Linux network namespaces*. The routing table associated to that VRF
310is the whole routing tables located in that namespace. For instance, this mode
311matches OpenStack Network Namespaces. It matches also OpenFastPath. The default
312behavior remains Linux VRF which is supported by the Linux kernel community,
313see https://www.kernel.org/doc/Documentation/networking/vrf.txt.
204ed384
PG
314
315Because of that difference, there are some subtle differences when running some
316commands in relationship to VRF. Here is an extract of some of those commands:
317
318.. index:: vrf VRF
319.. clicmd:: vrf VRF
320
321 This command is available on configuration mode. By default, above command
52119114 322 permits accessing the VRF configuration mode. This mode is available for
d66a93dd
PG
323 both VRFs. It is to be noted that *Zebra* does not create Linux VRF.
324 The network administrator can however decide to provision this command in
325 configuration file to provide more clarity about the intended configuration.
204ed384
PG
326
327.. index:: netns NAMESPACE
328.. clicmd:: netns NAMESPACE
329
80ca5b6d
QY
330 This command is based on VRF configuration mode. This command is available
331 when *Zebra* is run in :option:`-n` mode. This command reflects which *Linux
332 network namespace* is to be mapped with *Zebra* VRF. It is to be noted that
333 *Zebra* creates and detects added/suppressed VRFs from the Linux environment
d66a93dd
PG
334 (in fact, those managed with iproute2). The network administrator can however
335 decide to provision this command in configuration file to provide more clarity
336 about the intended configuration.
204ed384 337
204ed384
PG
338.. index:: show ip route vrf VRF
339.. clicmd:: show ip route vrf VRF
340
341 The show command permits dumping the routing table associated to the VRF. If
80ca5b6d
QY
342 *Zebra* is launched with default settings, this will be the ``TABLENO`` of
343 the VRF configured on the kernel, thanks to information provided in
344 https://www.kernel.org/doc/Documentation/networking/vrf.txt. If *Zebra* is
345 launched with :option:`-n` option, this will be the default routing table of
346 the *Linux network namespace* ``VRF``.
204ed384
PG
347
348.. index:: show ip route vrf VRF table TABLENO
349.. clicmd:: show ip route vrf VRF table TABLENO
350
80ca5b6d
QY
351 The show command is only available with :option:`-n` option. This command
352 will dump the routing table ``TABLENO`` of the *Linux network namespace*
353 ``VRF``.
354
c94e6725
PG
355By using the :option:`-n` option, the *Linux network namespace* will be mapped
356over the *Zebra* VRF. One nice feature that is possible by handling *Linux
357network namespace* is the ability to name default VRF. At startup, *Zebra*
358discovers the available *Linux network namespace* by parsing folder
359`/var/run/netns`. Each file stands for a *Linux network namespace*, but not all
360*Linux network namespaces* are available under that folder. This is the case for
361default VRF. It is possible to name the default VRF, by creating a file, by
362executing following commands.
363
364.. code-block:: shell
365
366 touch /var/run/netns/vrf0
367 mount --bind /proc/self/ns/net /var/run/netns/vrf0
368
369Above command illustrates what happens when the default VRF is visible under
370`var/run/netns/`. Here, the default VRF file is `vrf0`.
371At startup, FRR detects the presence of that file. It detects that the file
372statistics information matches the same file statistics information as
373`/proc/self/ns/net` ( through stat() function). As statistics information
374matches, then `vrf0` stands for the new default namespace name.
56f0bea7 375Consequently, the VRF naming `Default` will be overridden by the new discovered
c94e6725
PG
376namespace name `vrf0`.
377
378For those who don't use VRF backend with *Linux network namespace*, it is
379possible to statically configure and recompile FRR. It is possible to choose an
380alternate name for default VRF. Then, the default VRF naming will automatically
381be updated with the new name. To illustrate, if you want to recompile with
382`global` value, use the following command:
383
cc4345d4 384.. code-block:: shell
c94e6725
PG
385
386 ./configure --with-defaultvrfname=global
387
b03d3432
PG
388.. _zebra-mpls:
389
390MPLS Commands
391=============
392
393You can configure static mpls entries in zebra. Basically, handling MPLS
394consists of popping, swapping or pushing labels to IP packets.
395
396MPLS Acronyms
397-------------
398
399:abbr:`LSR (Labeled Switch Router)`
400 Networking devices handling labels used to forward traffic between and through
401 them.
402
403:abbr:`LER (Labeled Edge Router)`
404 A Labeled edge router is located at the edge of an MPLS network, generally
405 between an IP network and an MPLS network.
406
407MPLS Push Action
408----------------
409
410The push action is generally used for LER devices, which want to encapsulate
411all traffic for a wished destination into an MPLS label. This action is stored
412in routing entry, and can be configured like a route:
413
414.. index:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL
415.. clicmd:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL
416
56f0bea7 417 NETWORK and MASK stand for the IP prefix entry to be added as static
b03d3432
PG
418 route entry.
419 GATEWAY is the gateway IP address to reach, in order to reach the prefix.
420 INTERFACE is the interface behind which the prefix is located.
421 LABEL is the MPLS label to use to reach the prefix abovementioned.
422
423 You can check that the static entry is stored in the zebra RIB database, by
424 looking at the presence of the entry.
425
426 ::
427
428 zebra(configure)# ip route 1.1.1.1/32 10.0.1.1 label 777
429 zebra# show ip route
430 Codes: K - kernel route, C - connected, S - static, R - RIP,
431 O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
432 T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
433 F - PBR,
434 > - selected route, * - FIB route
435
436 S>* 1.1.1.1/32 [1/0] via 10.0.1.1, r2-eth0, label 777, 00:39:42
437
438MPLS Swap and Pop Action
439------------------------
440
441The swap action is generally used for LSR devices, which swap a packet with a
442label, with an other label. The Pop action is used on LER devices, at the
443termination of the MPLS traffic; this is used to remove MPLS header.
444
445.. index:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null
446.. clicmd:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null
447
448 INCOMING_LABEL and OUTGOING_LABEL are MPLS labels with values ranging from 16
449 to 1048575.
450 GATEWAY is the gateway IP address where to send MPLS packet.
451 The outgoing label can either be a value or have an explicit-null label header. This
452 specific header can be read by IP devices. The incoming label can also be removed; in
453 that case the implicit-null keyword is used, and the outgoing packet emitted is an IP
454 packet without MPLS header.
455
456You can check that the MPLS actions are stored in the zebra MPLS table, by looking at the
457presence of the entry.
458
459.. index:: show mpls table
460.. clicmd:: show mpls table
461
462::
463
464 zebra(configure)# mpls lsp 18 10.125.0.2 implicit-null
465 zebra(configure)# mpls lsp 19 10.125.0.2 20
466 zebra(configure)# mpls lsp 21 10.125.0.2 explicit-null
467 zebra# show mpls table
468 Inbound Outbound
469 Label Type Nexthop Label
470 -------- ------- --------------- --------
471 18 Static 10.125.0.2 implicit-null
472 19 Static 10.125.0.2 20
473 21 Static 10.125.0.2 IPv4 Explicit Null
474
475
80ca5b6d
QY
476.. _multicast-rib-commands:
477
42fc5d26
QY
478Multicast RIB Commands
479======================
480
481The Multicast RIB provides a separate table of unicast destinations which
d1a242fd 482is used for Multicast Reverse Path Forwarding decisions. It is used with
42fc5d26
QY
483a multicast source's IP address, hence contains not multicast group
484addresses but unicast addresses.
485
d1a242fd 486This table is fully separate from the default unicast table. However,
42fc5d26
QY
487RPF lookup can include the unicast table.
488
dc1046f7 489WARNING: RPF lookup results are non-responsive in this version of FRR,
42fc5d26
QY
490i.e. multicast routing does not actively react to changes in underlying
491unicast topology!
492
d1a242fd
QY
493.. index:: ip multicast rpf-lookup-mode MODE
494.. clicmd:: ip multicast rpf-lookup-mode MODE
42fc5d26 495
d1a242fd
QY
496.. index:: no ip multicast rpf-lookup-mode [MODE]
497.. clicmd:: no ip multicast rpf-lookup-mode [MODE]
42fc5d26 498
d1a242fd 499 MODE sets the method used to perform RPF lookups. Supported modes:
42fc5d26 500
9eb95b3b
QY
501 urib-only
502 Performs the lookup on the Unicast RIB. The Multicast RIB is never used.
42fc5d26 503
9eb95b3b
QY
504 mrib-only
505 Performs the lookup on the Multicast RIB. The Unicast RIB is never used.
42fc5d26 506
9eb95b3b
QY
507 mrib-then-urib
508 Tries to perform the lookup on the Multicast RIB. If any route is found,
509 that route is used. Otherwise, the Unicast RIB is tried.
42fc5d26 510
9eb95b3b
QY
511 lower-distance
512 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
513 with the lower administrative distance is used; if they're equal, the
514 Multicast RIB takes precedence.
42fc5d26 515
9eb95b3b
QY
516 longer-prefix
517 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
518 with the longer prefix length is used; if they're equal, the
519 Multicast RIB takes precedence.
42fc5d26 520
9eb95b3b
QY
521 The `mrib-then-urib` setting is the default behavior if nothing is
522 configured. If this is the desired behavior, it should be explicitly
523 configured to make the configuration immune against possible changes in
524 what the default behavior is.
42fc5d26 525
d1a242fd
QY
526.. warning::
527 Unreachable routes do not receive special treatment and do not cause
528 fallback to a second lookup.
42fc5d26 529
d1a242fd
QY
530.. index:: show ip rpf ADDR
531.. clicmd:: show ip rpf ADDR
42fc5d26 532
d1a242fd
QY
533 Performs a Multicast RPF lookup, as configured with ``ip multicast
534 rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look
535 up.
42fc5d26 536
d1a242fd 537 ::
42fc5d26
QY
538
539 > show ip rpf 192.0.2.1
540 Routing entry for 192.0.2.0/24 using Unicast RIB
d1a242fd
QY
541
542 Known via "kernel", distance 0, metric 0, best
543 * 198.51.100.1, via eth0
a8c90e15 544
42fc5d26 545
d1a242fd
QY
546 Indicates that a multicast source lookup for 192.0.2.1 would use an
547 Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1.
42fc5d26 548
d1a242fd
QY
549.. index:: show ip rpf
550.. clicmd:: show ip rpf
42fc5d26 551
d1a242fd
QY
552 Prints the entire Multicast RIB. Note that this is independent of the
553 configured RPF lookup mode, the Multicast RIB may be printed yet not
554 used at all.
42fc5d26 555
d1a242fd
QY
556.. index:: ip mroute PREFIX NEXTHOP [DISTANCE]
557.. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE]
42fc5d26 558
d1a242fd
QY
559.. index:: no ip mroute PREFIX NEXTHOP [DISTANCE]
560.. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE]
42fc5d26 561
d1a242fd
QY
562 Adds a static route entry to the Multicast RIB. This performs exactly as the
563 ``ip route`` command, except that it inserts the route in the Multicast RIB
564 instead of the Unicast RIB.
42fc5d26 565
0efdf0fe 566.. _zebra-route-filtering:
42fc5d26
QY
567
568zebra Route Filtering
569=====================
570
0efdf0fe 571Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes
013f9762 572received from other FRR components. The permit/deny facilities provided by
d1a242fd
QY
573these commands can be used to filter which routes zebra will install in the
574kernel.
42fc5d26 575
d1a242fd
QY
576.. index:: ip protocol PROTOCOL route-map ROUTEMAP
577.. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP
42fc5d26 578
013f9762
QY
579 Apply a route-map filter to routes for the specified protocol. PROTOCOL can
580 be **any** or one of
581
582 - system,
583 - kernel,
584 - connected,
585 - static,
586 - rip,
587 - ripng,
588 - ospf,
589 - ospf6,
590 - isis,
591 - bgp,
592 - hsls.
d1a242fd
QY
593
594.. index:: set src ADDRESS
595.. clicmd:: set src ADDRESS
596
597 Within a route-map, set the preferred source address for matching routes
598 when installing in the kernel.
599
600
601The following creates a prefix-list that matches all addresses, a route-map
602that sets the preferred source address, and applies the route-map to all
603*rip* routes.
604
9eb95b3b 605.. code-block:: frr
42fc5d26 606
d1a242fd
QY
607 ip prefix-list ANY permit 0.0.0.0/0 le 32
608 route-map RM1 permit 10
609 match ip address prefix-list ANY
610 set src 10.0.0.1
42fc5d26 611
d1a242fd 612 ip protocol rip route-map RM1
a8c90e15 613
42fc5d26 614
0efdf0fe 615.. _zebra-fib-push-interface:
42fc5d26
QY
616
617zebra FIB push interface
618========================
619
620Zebra supports a 'FIB push' interface that allows an external
dc1046f7 621component to learn the forwarding information computed by the FRR
d1a242fd 622routing suite. This is a loadable module that needs to be enabled
0efdf0fe 623at startup as described in :ref:`loadable-module-support`.
42fc5d26 624
dc1046f7 625In FRR, the Routing Information Base (RIB) resides inside
42fc5d26
QY
626zebra. Routing protocols communicate their best routes to zebra, and
627zebra computes the best route across protocols for each prefix. This
628latter information makes up the Forwarding Information Base
629(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
630the kernel to forward packets according to the routes computed by
dc1046f7 631FRR. The kernel FIB is updated in an OS-specific way. For example,
d1e7591e 632the `Netlink` interface is used on Linux, and route sockets are
42fc5d26
QY
633used on FreeBSD.
634
635The FIB push interface aims to provide a cross-platform mechanism to
636support scenarios where the router has a forwarding path that is
637distinct from the kernel, commonly a hardware-based fast path. In
638these cases, the FIB needs to be maintained reliably in the fast path
639as well. We refer to the component that programs the forwarding plane
640(directly or indirectly) as the Forwarding Plane Manager or FPM.
641
642The FIB push interface comprises of a TCP connection between zebra and
643the FPM. The connection is initiated by zebra -- that is, the FPM acts
644as the TCP server.
645
80ca5b6d
QY
646.. program:: configure
647
42fc5d26 648The relevant zebra code kicks in when zebra is configured with the
d1a242fd 649:option:`--enable-fpm` flag. Zebra periodically attempts to connect to
42fc5d26
QY
650the well-known FPM port. Once the connection is up, zebra starts
651sending messages containing routes over the socket to the FPM. Zebra
652sends a complete copy of the forwarding table to the FPM, including
653routes that it may have picked up from the kernel. The existing
654interaction of zebra with the kernel remains unchanged -- that is, the
655kernel continues to receive FIB updates as before.
656
657The encapsulation header for the messages exchanged with the FPM is
658defined by the file :file:`fpm/fpm.h` in the frr tree. The routes
d1e7591e 659themselves are encoded in Netlink or protobuf format, with Netlink
42fc5d26
QY
660being the default.
661
662Protobuf is one of a number of new serialization formats wherein the
663message schema is expressed in a purpose-built language. Code for
664encoding/decoding to/from the wire format is generated from the
665schema. Protobuf messages can be extended easily while maintaining
666backward-compatibility with older code. Protobuf has the following
d1e7591e 667advantages over Netlink:
42fc5d26 668
d1a242fd
QY
669- Code for serialization/deserialization is generated automatically. This
670 reduces the likelihood of bugs, allows third-party programs to be integrated
671 quickly, and makes it easy to add fields.
672- The message format is not tied to an OS (Linux), and can be evolved
42fc5d26
QY
673 independently.
674
d1e7591e 675As mentioned before, zebra encodes routes sent to the FPM in Netlink
42fc5d26 676format by default. The format can be controlled via the FPM module's
d1e7591e 677load-time option to zebra, which currently takes the values `Netlink`
42fc5d26
QY
678and `protobuf`.
679
680The zebra FPM interface uses replace semantics. That is, if a 'route
681add' message for a prefix is followed by another 'route add' message,
682the information in the second message is complete by itself, and
683replaces the information sent in the first message.
684
685If the connection to the FPM goes down for some reason, zebra sends
686the FPM a complete copy of the forwarding table(s) when it reconnects.
687
0e4c75d6
MS
688.. _zebra-dplane:
689
690Dataplane Commands
691==================
692
693The zebra dataplane subsystem provides a framework for FIB
694programming. Zebra uses the dataplane to program the local kernel as
695it makes changes to objects such as IP routes, MPLS LSPs, and
696interface IP addresses. The dataplane runs in its own pthread, in
697order to off-load work from the main zebra pthread.
698
699
700.. index:: show zebra dplane [detailed]
701.. clicmd:: show zebra dplane [detailed]
702
703 Display statistics about the updates and events passing through the
704 dataplane subsystem.
705
706
707.. index:: show zebra dplane providers
708.. clicmd:: show zebra dplane providers
709
710 Display information about the running dataplane plugins that are
711 providing updates to a FIB. By default, the local kernel plugin is
712 present.
713
714
715.. index:: zebra dplane limit [NUMBER]
716.. clicmd:: zebra dplane limit [NUMBER]
717
718 Configure the limit on the number of pending updates that are
719 waiting to be processed by the dataplane pthread.
720
721
42fc5d26
QY
722zebra Terminal Mode Commands
723============================
724
d1a242fd
QY
725.. index:: show ip route
726.. clicmd:: show ip route
42fc5d26 727
d1a242fd 728 Display current routes which zebra holds in its database.
42fc5d26
QY
729
730::
731
42fc5d26
QY
732 Router# show ip route
733 Codes: K - kernel route, C - connected, S - static, R - RIP,
d1a242fd 734 B - BGP * - FIB route.
42fc5d26 735
d1a242fd
QY
736 K* 0.0.0.0/0 203.181.89.241
737 S 0.0.0.0/0 203.181.89.1
738 C* 127.0.0.0/8 lo
42fc5d26 739 C* 203.181.89.240/28 eth0
a8c90e15 740
42fc5d26 741
d1a242fd
QY
742.. index:: show ipv6 route
743.. clicmd:: show ipv6 route
42fc5d26 744
d1a242fd
QY
745.. index:: show interface
746.. clicmd:: show interface
42fc5d26 747
d1a242fd
QY
748.. index:: show ip prefix-list [NAME]
749.. clicmd:: show ip prefix-list [NAME]
42fc5d26 750
d1a242fd
QY
751.. index:: show route-map [NAME]
752.. clicmd:: show route-map [NAME]
42fc5d26 753
d1a242fd
QY
754.. index:: show ip protocol
755.. clicmd:: show ip protocol
42fc5d26 756
d1a242fd
QY
757.. index:: show ipforward
758.. clicmd:: show ipforward
42fc5d26 759
d1a242fd
QY
760 Display whether the host's IP forwarding function is enabled or not.
761 Almost any UNIX kernel can be configured with IP forwarding disabled.
762 If so, the box can't work as a router.
42fc5d26 763
d1a242fd
QY
764.. index:: show ipv6forward
765.. clicmd:: show ipv6forward
42fc5d26 766
d1a242fd 767 Display whether the host's IP v6 forwarding is enabled or not.
42fc5d26 768
d1a242fd
QY
769.. index:: show zebra
770.. clicmd:: show zebra
42fc5d26 771
d1a242fd
QY
772 Display various statistics related to the installation and deletion
773 of routes, neighbor updates, and LSP's into the kernel.
42fc5d26 774
46677ed2
DS
775.. index:: show zebra client [summary]
776.. clicmd:: show zebra client [summary]
777
778 Display statistics about clients that are connected to zebra. This is
779 useful for debugging and seeing how much data is being passed between
780 zebra and it's clients. If the summary form of the command is choosen
781 a table is displayed with shortened information.
782
783.. index:: show zebra router table summary
784.. clicmd:: show zebra router table summary
785
786 Display summarized data about tables created, their afi/safi/tableid
787 and how many routes each table contains. Please note this is the
788 total number of route nodes in the table. Which will be higher than
789 the actual number of routes that are held.
790
d1a242fd
QY
791.. index:: show zebra fpm stats
792.. clicmd:: show zebra fpm stats
42fc5d26 793
d1a242fd
QY
794 Display statistics related to the zebra code that interacts with the
795 optional Forwarding Plane Manager (FPM) component.
42fc5d26 796
d1a242fd
QY
797.. index:: clear zebra fpm stats
798.. clicmd:: clear zebra fpm stats
42fc5d26 799
d1a242fd
QY
800 Reset statistics related to the zebra code that interacts with the
801 optional Forwarding Plane Manager (FPM) component.
42fc5d26 802