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