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