]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/zebra.rst
Merge pull request #3372 from nitinsoniism/show_evpn_mac_vni_all_detail
[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
d1a242fd
QY
271.. index:: table TABLENO
272.. clicmd:: table TABLENO
42fc5d26 273
80ca5b6d
QY
274 Select the primary kernel routing table to be used. This only works for
275 kernels supporting multiple routing tables (like GNU/Linux 2.2.x and later).
276 After setting TABLENO with this command, static routes defined after this
277 are added to the specified table.
42fc5d26 278
f90115c5 279.. _zebra-vrf:
80ca5b6d
QY
280
281Virtual Routing and Forwarding
282==============================
42fc5d26 283
80ca5b6d
QY
284FRR supports :abbr:`VRF (Virtual Routing and Forwarding)`. VRF is a way to
285separate networking contexts on the same machine. Those networking contexts are
286associated with separate interfaces, thus making it possible to associate one
287interface with a specific VRF.
204ed384 288
204ed384 289VRF can be used, for example, when instantiating per enterprise networking
80ca5b6d
QY
290services, without having to instantiate the physical host machine or the
291routing management daemons for each enterprise. As a result, interfaces are
292separate for each set of VRF, and routing daemons can have their own context
293for each VRF.
204ed384
PG
294
295This conceptual view introduces the *Default VRF* case. If the user does not
80ca5b6d
QY
296configure any specific VRF, then by default, FRR uses the *Default VRF*.
297
204ed384 298Configuring VRF networking contexts can be done in various ways on FRR. The VRF
80ca5b6d 299interfaces can be configured by entering in interface configuration mode
614aa5c1 300:clicmd:`interface IFNAME vrf VRF`.
204ed384
PG
301
302A VRF backend mode is chosen when running *Zebra*.
303
304If no option is chosen, then the *Linux VRF* implementation as references in
80ca5b6d 305https://www.kernel.org/doc/Documentation/networking/vrf.txt will be mapped over
204ed384
PG
306the *Zebra* VRF. The routing table associated to that VRF is a Linux table
307identifier located in the same *Linux network namespace* where *Zebra* started.
308
80ca5b6d
QY
309If the :option:`-n` option is chosen, then the *Linux network namespace* will
310be mapped over the *Zebra* VRF. That implies that *Zebra* is able to configure
311several *Linux network namespaces*. The routing table associated to that VRF
312is the whole routing tables located in that namespace. For instance, this mode
313matches OpenStack Network Namespaces. It matches also OpenFastPath. The default
314behavior remains Linux VRF which is supported by the Linux kernel community,
315see https://www.kernel.org/doc/Documentation/networking/vrf.txt.
204ed384
PG
316
317Because of that difference, there are some subtle differences when running some
318commands in relationship to VRF. Here is an extract of some of those commands:
319
320.. index:: vrf VRF
321.. clicmd:: vrf VRF
322
323 This command is available on configuration mode. By default, above command
52119114 324 permits accessing the VRF configuration mode. This mode is available for
d66a93dd
PG
325 both VRFs. It is to be noted that *Zebra* does not create Linux VRF.
326 The network administrator can however decide to provision this command in
327 configuration file to provide more clarity about the intended configuration.
204ed384
PG
328
329.. index:: netns NAMESPACE
330.. clicmd:: netns NAMESPACE
331
80ca5b6d
QY
332 This command is based on VRF configuration mode. This command is available
333 when *Zebra* is run in :option:`-n` mode. This command reflects which *Linux
334 network namespace* is to be mapped with *Zebra* VRF. It is to be noted that
335 *Zebra* creates and detects added/suppressed VRFs from the Linux environment
d66a93dd
PG
336 (in fact, those managed with iproute2). The network administrator can however
337 decide to provision this command in configuration file to provide more clarity
338 about the intended configuration.
204ed384 339
204ed384
PG
340.. index:: show ip route vrf VRF
341.. clicmd:: show ip route vrf VRF
342
343 The show command permits dumping the routing table associated to the VRF. If
80ca5b6d
QY
344 *Zebra* is launched with default settings, this will be the ``TABLENO`` of
345 the VRF configured on the kernel, thanks to information provided in
346 https://www.kernel.org/doc/Documentation/networking/vrf.txt. If *Zebra* is
347 launched with :option:`-n` option, this will be the default routing table of
348 the *Linux network namespace* ``VRF``.
204ed384
PG
349
350.. index:: show ip route vrf VRF table TABLENO
351.. clicmd:: show ip route vrf VRF table TABLENO
352
80ca5b6d
QY
353 The show command is only available with :option:`-n` option. This command
354 will dump the routing table ``TABLENO`` of the *Linux network namespace*
355 ``VRF``.
356
c94e6725
PG
357By using the :option:`-n` option, the *Linux network namespace* will be mapped
358over the *Zebra* VRF. One nice feature that is possible by handling *Linux
359network namespace* is the ability to name default VRF. At startup, *Zebra*
360discovers the available *Linux network namespace* by parsing folder
361`/var/run/netns`. Each file stands for a *Linux network namespace*, but not all
362*Linux network namespaces* are available under that folder. This is the case for
363default VRF. It is possible to name the default VRF, by creating a file, by
364executing following commands.
365
366.. code-block:: shell
367
368 touch /var/run/netns/vrf0
369 mount --bind /proc/self/ns/net /var/run/netns/vrf0
370
371Above command illustrates what happens when the default VRF is visible under
372`var/run/netns/`. Here, the default VRF file is `vrf0`.
373At startup, FRR detects the presence of that file. It detects that the file
374statistics information matches the same file statistics information as
375`/proc/self/ns/net` ( through stat() function). As statistics information
376matches, then `vrf0` stands for the new default namespace name.
377Consequently, the VRF naming `Default` will be overriden by the new discovered
378namespace name `vrf0`.
379
380For those who don't use VRF backend with *Linux network namespace*, it is
381possible to statically configure and recompile FRR. It is possible to choose an
382alternate name for default VRF. Then, the default VRF naming will automatically
383be updated with the new name. To illustrate, if you want to recompile with
384`global` value, use the following command:
385
cc4345d4 386.. code-block:: shell
c94e6725
PG
387
388 ./configure --with-defaultvrfname=global
389
b03d3432
PG
390.. _zebra-mpls:
391
392MPLS Commands
393=============
394
395You can configure static mpls entries in zebra. Basically, handling MPLS
396consists of popping, swapping or pushing labels to IP packets.
397
398MPLS Acronyms
399-------------
400
401:abbr:`LSR (Labeled Switch Router)`
402 Networking devices handling labels used to forward traffic between and through
403 them.
404
405:abbr:`LER (Labeled Edge Router)`
406 A Labeled edge router is located at the edge of an MPLS network, generally
407 between an IP network and an MPLS network.
408
409MPLS Push Action
410----------------
411
412The push action is generally used for LER devices, which want to encapsulate
413all traffic for a wished destination into an MPLS label. This action is stored
414in routing entry, and can be configured like a route:
415
416.. index:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL
417.. clicmd:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL
418
419 NETWORK ans MASK stand for the IP prefix entry to be added as static
420 route entry.
421 GATEWAY is the gateway IP address to reach, in order to reach the prefix.
422 INTERFACE is the interface behind which the prefix is located.
423 LABEL is the MPLS label to use to reach the prefix abovementioned.
424
425 You can check that the static entry is stored in the zebra RIB database, by
426 looking at the presence of the entry.
427
428 ::
429
430 zebra(configure)# ip route 1.1.1.1/32 10.0.1.1 label 777
431 zebra# show ip route
432 Codes: K - kernel route, C - connected, S - static, R - RIP,
433 O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
434 T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
435 F - PBR,
436 > - selected route, * - FIB route
437
438 S>* 1.1.1.1/32 [1/0] via 10.0.1.1, r2-eth0, label 777, 00:39:42
439
440MPLS Swap and Pop Action
441------------------------
442
443The swap action is generally used for LSR devices, which swap a packet with a
444label, with an other label. The Pop action is used on LER devices, at the
445termination of the MPLS traffic; this is used to remove MPLS header.
446
447.. index:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null
448.. clicmd:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null
449
450 INCOMING_LABEL and OUTGOING_LABEL are MPLS labels with values ranging from 16
451 to 1048575.
452 GATEWAY is the gateway IP address where to send MPLS packet.
453 The outgoing label can either be a value or have an explicit-null label header. This
454 specific header can be read by IP devices. The incoming label can also be removed; in
455 that case the implicit-null keyword is used, and the outgoing packet emitted is an IP
456 packet without MPLS header.
457
458You can check that the MPLS actions are stored in the zebra MPLS table, by looking at the
459presence of the entry.
460
461.. index:: show mpls table
462.. clicmd:: show mpls table
463
464::
465
466 zebra(configure)# mpls lsp 18 10.125.0.2 implicit-null
467 zebra(configure)# mpls lsp 19 10.125.0.2 20
468 zebra(configure)# mpls lsp 21 10.125.0.2 explicit-null
469 zebra# show mpls table
470 Inbound Outbound
471 Label Type Nexthop Label
472 -------- ------- --------------- --------
473 18 Static 10.125.0.2 implicit-null
474 19 Static 10.125.0.2 20
475 21 Static 10.125.0.2 IPv4 Explicit Null
476
477
80ca5b6d
QY
478.. _multicast-rib-commands:
479
42fc5d26
QY
480Multicast RIB Commands
481======================
482
483The Multicast RIB provides a separate table of unicast destinations which
d1a242fd 484is used for Multicast Reverse Path Forwarding decisions. It is used with
42fc5d26
QY
485a multicast source's IP address, hence contains not multicast group
486addresses but unicast addresses.
487
d1a242fd 488This table is fully separate from the default unicast table. However,
42fc5d26
QY
489RPF lookup can include the unicast table.
490
dc1046f7 491WARNING: RPF lookup results are non-responsive in this version of FRR,
42fc5d26
QY
492i.e. multicast routing does not actively react to changes in underlying
493unicast topology!
494
d1a242fd
QY
495.. index:: ip multicast rpf-lookup-mode MODE
496.. clicmd:: ip multicast rpf-lookup-mode MODE
42fc5d26 497
d1a242fd
QY
498.. index:: no ip multicast rpf-lookup-mode [MODE]
499.. clicmd:: no ip multicast rpf-lookup-mode [MODE]
42fc5d26 500
d1a242fd 501 MODE sets the method used to perform RPF lookups. Supported modes:
42fc5d26 502
9eb95b3b
QY
503 urib-only
504 Performs the lookup on the Unicast RIB. The Multicast RIB is never used.
42fc5d26 505
9eb95b3b
QY
506 mrib-only
507 Performs the lookup on the Multicast RIB. The Unicast RIB is never used.
42fc5d26 508
9eb95b3b
QY
509 mrib-then-urib
510 Tries to perform the lookup on the Multicast RIB. If any route is found,
511 that route is used. Otherwise, the Unicast RIB is tried.
42fc5d26 512
9eb95b3b
QY
513 lower-distance
514 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
515 with the lower administrative distance is used; if they're equal, the
516 Multicast RIB takes precedence.
42fc5d26 517
9eb95b3b
QY
518 longer-prefix
519 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
520 with the longer prefix length is used; if they're equal, the
521 Multicast RIB takes precedence.
42fc5d26 522
9eb95b3b
QY
523 The `mrib-then-urib` setting is the default behavior if nothing is
524 configured. If this is the desired behavior, it should be explicitly
525 configured to make the configuration immune against possible changes in
526 what the default behavior is.
42fc5d26 527
d1a242fd
QY
528.. warning::
529 Unreachable routes do not receive special treatment and do not cause
530 fallback to a second lookup.
42fc5d26 531
d1a242fd
QY
532.. index:: show ip rpf ADDR
533.. clicmd:: show ip rpf ADDR
42fc5d26 534
d1a242fd
QY
535 Performs a Multicast RPF lookup, as configured with ``ip multicast
536 rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look
537 up.
42fc5d26 538
d1a242fd 539 ::
42fc5d26
QY
540
541 > show ip rpf 192.0.2.1
542 Routing entry for 192.0.2.0/24 using Unicast RIB
d1a242fd
QY
543
544 Known via "kernel", distance 0, metric 0, best
545 * 198.51.100.1, via eth0
a8c90e15 546
42fc5d26 547
d1a242fd
QY
548 Indicates that a multicast source lookup for 192.0.2.1 would use an
549 Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1.
42fc5d26 550
d1a242fd
QY
551.. index:: show ip rpf
552.. clicmd:: show ip rpf
42fc5d26 553
d1a242fd
QY
554 Prints the entire Multicast RIB. Note that this is independent of the
555 configured RPF lookup mode, the Multicast RIB may be printed yet not
556 used at all.
42fc5d26 557
d1a242fd
QY
558.. index:: ip mroute PREFIX NEXTHOP [DISTANCE]
559.. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE]
42fc5d26 560
d1a242fd
QY
561.. index:: no ip mroute PREFIX NEXTHOP [DISTANCE]
562.. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE]
42fc5d26 563
d1a242fd
QY
564 Adds a static route entry to the Multicast RIB. This performs exactly as the
565 ``ip route`` command, except that it inserts the route in the Multicast RIB
566 instead of the Unicast RIB.
42fc5d26 567
0efdf0fe 568.. _zebra-route-filtering:
42fc5d26
QY
569
570zebra Route Filtering
571=====================
572
0efdf0fe 573Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes
013f9762 574received from other FRR components. The permit/deny facilities provided by
d1a242fd
QY
575these commands can be used to filter which routes zebra will install in the
576kernel.
42fc5d26 577
d1a242fd
QY
578.. index:: ip protocol PROTOCOL route-map ROUTEMAP
579.. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP
42fc5d26 580
013f9762
QY
581 Apply a route-map filter to routes for the specified protocol. PROTOCOL can
582 be **any** or one of
583
584 - system,
585 - kernel,
586 - connected,
587 - static,
588 - rip,
589 - ripng,
590 - ospf,
591 - ospf6,
592 - isis,
593 - bgp,
594 - hsls.
d1a242fd
QY
595
596.. index:: set src ADDRESS
597.. clicmd:: set src ADDRESS
598
599 Within a route-map, set the preferred source address for matching routes
600 when installing in the kernel.
601
602
603The following creates a prefix-list that matches all addresses, a route-map
604that sets the preferred source address, and applies the route-map to all
605*rip* routes.
606
9eb95b3b 607.. code-block:: frr
42fc5d26 608
d1a242fd
QY
609 ip prefix-list ANY permit 0.0.0.0/0 le 32
610 route-map RM1 permit 10
611 match ip address prefix-list ANY
612 set src 10.0.0.1
42fc5d26 613
d1a242fd 614 ip protocol rip route-map RM1
a8c90e15 615
42fc5d26 616
0efdf0fe 617.. _zebra-fib-push-interface:
42fc5d26
QY
618
619zebra FIB push interface
620========================
621
622Zebra supports a 'FIB push' interface that allows an external
dc1046f7 623component to learn the forwarding information computed by the FRR
d1a242fd 624routing suite. This is a loadable module that needs to be enabled
0efdf0fe 625at startup as described in :ref:`loadable-module-support`.
42fc5d26 626
dc1046f7 627In FRR, the Routing Information Base (RIB) resides inside
42fc5d26
QY
628zebra. Routing protocols communicate their best routes to zebra, and
629zebra computes the best route across protocols for each prefix. This
630latter information makes up the Forwarding Information Base
631(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
632the kernel to forward packets according to the routes computed by
dc1046f7 633FRR. The kernel FIB is updated in an OS-specific way. For example,
d1e7591e 634the `Netlink` interface is used on Linux, and route sockets are
42fc5d26
QY
635used on FreeBSD.
636
637The FIB push interface aims to provide a cross-platform mechanism to
638support scenarios where the router has a forwarding path that is
639distinct from the kernel, commonly a hardware-based fast path. In
640these cases, the FIB needs to be maintained reliably in the fast path
641as well. We refer to the component that programs the forwarding plane
642(directly or indirectly) as the Forwarding Plane Manager or FPM.
643
644The FIB push interface comprises of a TCP connection between zebra and
645the FPM. The connection is initiated by zebra -- that is, the FPM acts
646as the TCP server.
647
80ca5b6d
QY
648.. program:: configure
649
42fc5d26 650The relevant zebra code kicks in when zebra is configured with the
d1a242fd 651:option:`--enable-fpm` flag. Zebra periodically attempts to connect to
42fc5d26
QY
652the well-known FPM port. Once the connection is up, zebra starts
653sending messages containing routes over the socket to the FPM. Zebra
654sends a complete copy of the forwarding table to the FPM, including
655routes that it may have picked up from the kernel. The existing
656interaction of zebra with the kernel remains unchanged -- that is, the
657kernel continues to receive FIB updates as before.
658
659The encapsulation header for the messages exchanged with the FPM is
660defined by the file :file:`fpm/fpm.h` in the frr tree. The routes
d1e7591e 661themselves are encoded in Netlink or protobuf format, with Netlink
42fc5d26
QY
662being the default.
663
664Protobuf is one of a number of new serialization formats wherein the
665message schema is expressed in a purpose-built language. Code for
666encoding/decoding to/from the wire format is generated from the
667schema. Protobuf messages can be extended easily while maintaining
668backward-compatibility with older code. Protobuf has the following
d1e7591e 669advantages over Netlink:
42fc5d26 670
d1a242fd
QY
671- Code for serialization/deserialization is generated automatically. This
672 reduces the likelihood of bugs, allows third-party programs to be integrated
673 quickly, and makes it easy to add fields.
674- The message format is not tied to an OS (Linux), and can be evolved
42fc5d26
QY
675 independently.
676
d1e7591e 677As mentioned before, zebra encodes routes sent to the FPM in Netlink
42fc5d26 678format by default. The format can be controlled via the FPM module's
d1e7591e 679load-time option to zebra, which currently takes the values `Netlink`
42fc5d26
QY
680and `protobuf`.
681
682The zebra FPM interface uses replace semantics. That is, if a 'route
683add' message for a prefix is followed by another 'route add' message,
684the information in the second message is complete by itself, and
685replaces the information sent in the first message.
686
687If the connection to the FPM goes down for some reason, zebra sends
688the FPM a complete copy of the forwarding table(s) when it reconnects.
689
690zebra Terminal Mode Commands
691============================
692
d1a242fd
QY
693.. index:: show ip route
694.. clicmd:: show ip route
42fc5d26 695
d1a242fd 696 Display current routes which zebra holds in its database.
42fc5d26
QY
697
698::
699
42fc5d26
QY
700 Router# show ip route
701 Codes: K - kernel route, C - connected, S - static, R - RIP,
d1a242fd 702 B - BGP * - FIB route.
42fc5d26 703
d1a242fd
QY
704 K* 0.0.0.0/0 203.181.89.241
705 S 0.0.0.0/0 203.181.89.1
706 C* 127.0.0.0/8 lo
42fc5d26 707 C* 203.181.89.240/28 eth0
a8c90e15 708
42fc5d26 709
d1a242fd
QY
710.. index:: show ipv6 route
711.. clicmd:: show ipv6 route
42fc5d26 712
d1a242fd
QY
713.. index:: show interface
714.. clicmd:: show interface
42fc5d26 715
d1a242fd
QY
716.. index:: show ip prefix-list [NAME]
717.. clicmd:: show ip prefix-list [NAME]
42fc5d26 718
d1a242fd
QY
719.. index:: show route-map [NAME]
720.. clicmd:: show route-map [NAME]
42fc5d26 721
d1a242fd
QY
722.. index:: show ip protocol
723.. clicmd:: show ip protocol
42fc5d26 724
d1a242fd
QY
725.. index:: show ipforward
726.. clicmd:: show ipforward
42fc5d26 727
d1a242fd
QY
728 Display whether the host's IP forwarding function is enabled or not.
729 Almost any UNIX kernel can be configured with IP forwarding disabled.
730 If so, the box can't work as a router.
42fc5d26 731
d1a242fd
QY
732.. index:: show ipv6forward
733.. clicmd:: show ipv6forward
42fc5d26 734
d1a242fd 735 Display whether the host's IP v6 forwarding is enabled or not.
42fc5d26 736
d1a242fd
QY
737.. index:: show zebra
738.. clicmd:: show zebra
42fc5d26 739
d1a242fd
QY
740 Display various statistics related to the installation and deletion
741 of routes, neighbor updates, and LSP's into the kernel.
42fc5d26 742
d1a242fd
QY
743.. index:: show zebra fpm stats
744.. clicmd:: show zebra fpm stats
42fc5d26 745
d1a242fd
QY
746 Display statistics related to the zebra code that interacts with the
747 optional Forwarding Plane Manager (FPM) component.
42fc5d26 748
d1a242fd
QY
749.. index:: clear zebra fpm stats
750.. clicmd:: clear zebra fpm stats
42fc5d26 751
d1a242fd
QY
752 Reset statistics related to the zebra code that interacts with the
753 optional Forwarding Plane Manager (FPM) component.
42fc5d26 754