7 *zebra* is an IP routing manager. It provides kernel routing
8 table updates, interface lookups, and redistribution of routes between
9 different routing protocols.
16 Besides the common invocation options (:ref:`common-invocation-options`), the
17 *zebra* specific invocation options are listed below.
21 .. option:: -b, --batch
23 Runs in batch mode. *zebra* parses configuration file and terminates
26 .. option:: -k, --keep_kernel
28 When zebra starts up, don't delete old self inserted routes.
30 .. option:: -r, --retain
32 When program terminates, retain routes added by zebra.
34 .. program:: configure
36 .. _interface-commands:
41 .. _standard-commands:
46 .. index:: interface IFNAME
48 .. clicmd:: interface IFNAME
53 .. index:: no shutdown
55 .. clicmd:: no shutdown
57 Up or down the current interface.
59 .. index:: ip address ADDRESS/PREFIX
61 .. clicmd:: ip address ADDRESS/PREFIX
62 .. index:: ipv6 address ADDRESS/PREFIX
64 .. clicmd:: ipv6 address ADDRESS/PREFIX
65 .. index:: no ip address ADDRESS/PREFIX
67 .. clicmd:: no ip address ADDRESS/PREFIX
68 .. index:: no ipv6 address ADDRESS/PREFIX
70 .. clicmd:: no ipv6 address ADDRESS/PREFIX
72 Set the IPv4 or IPv6 address/prefix for the interface.
74 .. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
76 .. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
77 .. index:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
79 .. clicmd:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX
81 Configure an IPv4 Pointopoint address on the interface. (The concept of PtP
82 addressing does not exist for IPv6.)
84 `local-addr` has no subnet mask since the local side in PtP addressing is
85 always a single (/32) address. `peer-addr/prefix` can be an arbitrary subnet
86 behind the other end of the link (or even on the link in Point-to-Multipoint
87 setups), though generally /32s are used.
89 .. index:: ip address ADDRESS/PREFIX secondary
91 .. clicmd:: ip address ADDRESS/PREFIX secondary
92 .. index:: no ip address ADDRESS/PREFIX secondary
94 .. clicmd:: no ip address ADDRESS/PREFIX secondary
96 Set the secondary flag for this address. This causes ospfd to not treat the
97 address as a distinct subnet.
99 .. index:: description DESCRIPTION ...
101 .. clicmd:: description DESCRIPTION ...
103 Set description for the interface.
107 .. clicmd:: multicast
108 .. index:: no multicast
110 .. clicmd:: no multicast
112 Enable or disables multicast flag for the interface.
114 .. index:: bandwidth (1-10000000)
116 .. clicmd:: bandwidth (1-10000000)
117 .. index:: no bandwidth (1-10000000)
119 .. clicmd:: no bandwidth (1-10000000)
121 Set bandwidth value of the interface in kilobits/sec. This is for
122 calculating OSPF cost. This command does not affect the actual device
125 .. index:: link-detect
127 .. clicmd:: link-detect
128 .. index:: no link-detect
130 .. clicmd:: no link-detect
132 Enable/disable link-detect on platforms which support this. Currently only
133 Linux and Solaris, and only where network interface drivers support
134 reporting link-state via the ``IFF_RUNNING`` flag.
136 .. _link-parameters-commands:
138 Link Parameters Commands
139 ------------------------
141 .. index:: link-params
142 .. clicmd:: link-params
144 .. index:: no link-param
145 .. clicmd:: no link-param
147 Enter into the link parameters sub node. At least 'enable' must be set to
148 activate the link parameters, and consequently Traffic Engineering on this
149 interface. MPLS-TE must be enable at the OSPF
150 (:ref:`ospf-traffic-engineering`) or ISIS (:ref:`isis-traffic-engineering`)
151 router level in complement to this. Disable link parameters for this
154 Under link parameter statement, the following commands set the different TE values:
156 .. index:: link-params [enable]
157 .. clicmd:: link-params [enable]
159 Enable link parameters for this interface.
161 .. index:: link-params [metric (0-4294967295)]
162 .. clicmd:: link-params [metric (0-4294967295)]
164 .. index:: link-params max-bw BANDWIDTH
165 .. clicmd:: link-params max-bw BANDWIDTH
167 .. index:: link-params max-rsv-bw BANDWIDTH
168 .. clicmd:: link-params max-rsv-bw BANDWIDTH
170 .. index:: link-params unrsv-bw (0-7) BANDWIDTH
171 .. clicmd:: link-params unrsv-bw (0-7) BANDWIDTH
173 .. index:: link-params admin-grp BANDWIDTH
174 .. clicmd:: link-params admin-grp BANDWIDTH
176 These commands specifies the Traffic Engineering parameters of the interface
177 in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively
178 the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth
179 (interface speed by default), Maximum Reservable Bandwidth, Unreserved
180 Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource
183 Note that BANDIWDTH is specified in IEEE floating point format and express
186 .. index:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)]
187 .. clicmd:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)]
189 .. index:: link-param delay-variation (0-16777215)
190 .. clicmd:: link-param delay-variation (0-16777215)
192 .. index:: link-param packet-loss PERCENTAGE
193 .. clicmd:: link-param packet-loss PERCENTAGE
195 .. index:: link-param res-bw BANDWIDTH
196 .. clicmd:: link-param res-bw BANDWIDTH
198 .. index:: link-param ava-bw BANDWIDTH
199 .. clicmd:: link-param ava-bw BANDWIDTH
201 .. index:: link-param use-bw BANDWIDTH
202 .. clicmd:: link-param use-bw BANDWIDTH
204 These command specifies additionnal Traffic Engineering parameters of the
205 interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and
206 draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the
207 delay, jitter, loss, available bandwidth, reservable bandwidth and utilized
210 Note that BANDWIDTH is specified in IEEE floating point format and express
211 in Bytes/second. Delays and delay variation are express in micro-second
212 (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step
215 .. index:: link-param neighbor <A.B.C.D> as (0-65535)
216 .. clicmd:: link-param neighbor <A.B.C.D> as (0-65535)
218 .. index:: link-param no neighbor
219 .. clicmd:: link-param no neighbor
221 Specifies the remote ASBR IP address and Autonomous System (AS) number
222 for InterASv2 link in OSPF (RFC5392). Note that this option is not yet
223 supported for ISIS (RFC5316).
225 .. _static-route-commands:
227 Static Route Commands
228 =====================
230 Static routing is a very fundamental feature of routing technology. It
231 defines static prefix and gateway.
233 .. index:: ip route NETWORK GATEWAY
234 .. clicmd:: ip route NETWORK GATEWAY
236 NETWORK is destination prefix with format of A.B.C.D/M. GATEWAY is gateway
237 for the prefix. When GATEWAY is A.B.C.D format. It is taken as a IPv4
238 address gateway. Otherwise it is treated as an interface name. If the
239 interface name is ``null0`` then zebra installs a blackhole route.
241 Some example configuration:
245 ip route 10.0.0.0/8 10.0.0.2
246 ip route 10.0.0.0/8 ppp0
247 ip route 10.0.0.0/8 null0
249 First example defines 10.0.0.0/8 static route with gateway 10.0.0.2.
250 Second one defines the same prefix but with gateway to interface ppp0. The
251 third install a blackhole route.
253 .. index:: ip route NETWORK NETMASK GATEWAY
254 .. clicmd:: ip route NETWORK NETMASK GATEWAY
256 This is alternate version of above command. When NETWORK is
257 A.B.C.D format, user must define NETMASK value with A.B.C.D
258 format. GATEWAY is same option as above command.
262 ip route 10.0.0.0 255.255.255.0 10.0.0.2
263 ip route 10.0.0.0 255.255.255.0 ppp0
264 ip route 10.0.0.0 255.255.255.0 null0
267 These statements are equivalent to those in the previous example.
269 .. index:: ip route NETWORK GATEWAY DISTANCE
270 .. clicmd:: ip route NETWORK GATEWAY DISTANCE
272 Installs the route with the specified distance.
274 Multiple nexthop static route:
278 ip route 10.0.0.1/32 10.0.0.2
279 ip route 10.0.0.1/32 10.0.0.3
280 ip route 10.0.0.1/32 eth0
283 If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
284 is reachable, then the last route is installed into the kernel.
286 If zebra has been compiled with multipath support, and both 10.0.0.2 and
287 10.0.0.3 are reachable, zebra will install a multipath route via both
288 nexthops, if the platform supports this.
293 S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive
294 via 10.0.0.3 inactive
295 * is directly connected, eth0
300 ip route 10.0.0.0/8 10.0.0.2
301 ip route 10.0.0.0/8 10.0.0.3
302 ip route 10.0.0.0/8 null0 255
305 This will install a multihop route via the specified next-hops if they are
306 reachable, as well as a high-metric blackhole route, which can be useful to
307 prevent traffic destined for a prefix to match less-specific routes (eg
308 default) should the specified gateways not be reachable. Eg:
312 zebra> show ip route 10.0.0.0/8
313 Routing entry for 10.0.0.0/8
314 Known via "static", distance 1, metric 0
318 Routing entry for 10.0.0.0/8
319 Known via "static", distance 255, metric 0
320 directly connected, Null0
323 .. index:: ipv6 route NETWORK GATEWAY
324 .. clicmd:: ipv6 route NETWORK GATEWAY
326 .. index:: ipv6 route NETWORK GATEWAY DISTANCE
327 .. clicmd:: ipv6 route NETWORK GATEWAY DISTANCE
329 These behave similarly to their ipv4 counterparts.
331 .. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY
332 .. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY
334 .. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY DISTANCE
335 .. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY DISTANCE
337 Install a static source-specific route. These routes are currently supported
338 on Linux operating systems only, and perform AND matching on packet's
339 destination and source addresses in the kernel's forwarding path. Note that
340 destination longest-prefix match is "more important" than source LPM, e.g.
341 *"2001:db8:1::/64 from 2001:db8::/48"* will win over
342 *"2001:db8::/48 from 2001:db8:1::/64"* if both match.
344 .. index:: table TABLENO
345 .. clicmd:: table TABLENO
347 Select the primary kernel routing table to be used. This only works
348 for kernels supporting multiple routing tables (like GNU/Linux 2.2.x
349 and later). After setting TABLENO with this command,
350 static routes defined after this are added to the specified table.
352 .. _multicast-rib-commands:
354 Multicast RIB Commands
355 ======================
357 The Multicast RIB provides a separate table of unicast destinations which
358 is used for Multicast Reverse Path Forwarding decisions. It is used with
359 a multicast source's IP address, hence contains not multicast group
360 addresses but unicast addresses.
362 This table is fully separate from the default unicast table. However,
363 RPF lookup can include the unicast table.
365 WARNING: RPF lookup results are non-responsive in this version of FRR,
366 i.e. multicast routing does not actively react to changes in underlying
369 .. index:: ip multicast rpf-lookup-mode MODE
370 .. clicmd:: ip multicast rpf-lookup-mode MODE
372 .. index:: no ip multicast rpf-lookup-mode [MODE]
373 .. clicmd:: no ip multicast rpf-lookup-mode [MODE]
375 MODE sets the method used to perform RPF lookups. Supported modes:
378 Performs the lookup on the Unicast RIB. The Multicast RIB is never used.
381 Performs the lookup on the Multicast RIB. The Unicast RIB is never used.
384 Tries to perform the lookup on the Multicast RIB. If any route is found,
385 that route is used. Otherwise, the Unicast RIB is tried.
388 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
389 with the lower administrative distance is used; if they're equal, the
390 Multicast RIB takes precedence.
393 Performs a lookup on the Multicast RIB and Unicast RIB each. The result
394 with the longer prefix length is used; if they're equal, the
395 Multicast RIB takes precedence.
397 The `mrib-then-urib` setting is the default behavior if nothing is
398 configured. If this is the desired behavior, it should be explicitly
399 configured to make the configuration immune against possible changes in
400 what the default behavior is.
403 Unreachable routes do not receive special treatment and do not cause
404 fallback to a second lookup.
406 .. index:: show ip rpf ADDR
407 .. clicmd:: show ip rpf ADDR
409 Performs a Multicast RPF lookup, as configured with ``ip multicast
410 rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look
415 > show ip rpf 192.0.2.1
416 Routing entry for 192.0.2.0/24 using Unicast RIB
418 Known via "kernel", distance 0, metric 0, best
419 * 198.51.100.1, via eth0
422 Indicates that a multicast source lookup for 192.0.2.1 would use an
423 Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1.
425 .. index:: show ip rpf
426 .. clicmd:: show ip rpf
428 Prints the entire Multicast RIB. Note that this is independent of the
429 configured RPF lookup mode, the Multicast RIB may be printed yet not
432 .. index:: ip mroute PREFIX NEXTHOP [DISTANCE]
433 .. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE]
435 .. index:: no ip mroute PREFIX NEXTHOP [DISTANCE]
436 .. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE]
438 Adds a static route entry to the Multicast RIB. This performs exactly as the
439 ``ip route`` command, except that it inserts the route in the Multicast RIB
440 instead of the Unicast RIB.
442 .. _zebra-route-filtering:
444 zebra Route Filtering
445 =====================
447 Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes
448 received from other FRR components. The permit/deny facilities provided by
449 these commands can be used to filter which routes zebra will install in the
452 .. index:: ip protocol PROTOCOL route-map ROUTEMAP
453 .. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP
455 Apply a route-map filter to routes for the specified protocol. PROTOCOL can
470 .. index:: set src ADDRESS
471 .. clicmd:: set src ADDRESS
473 Within a route-map, set the preferred source address for matching routes
474 when installing in the kernel.
477 The following creates a prefix-list that matches all addresses, a route-map
478 that sets the preferred source address, and applies the route-map to all
483 ip prefix-list ANY permit 0.0.0.0/0 le 32
484 route-map RM1 permit 10
485 match ip address prefix-list ANY
488 ip protocol rip route-map RM1
491 .. _zebra-fib-push-interface:
493 zebra FIB push interface
494 ========================
496 Zebra supports a 'FIB push' interface that allows an external
497 component to learn the forwarding information computed by the FRR
498 routing suite. This is a loadable module that needs to be enabled
499 at startup as described in :ref:`loadable-module-support`.
501 In FRR, the Routing Information Base (RIB) resides inside
502 zebra. Routing protocols communicate their best routes to zebra, and
503 zebra computes the best route across protocols for each prefix. This
504 latter information makes up the Forwarding Information Base
505 (FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
506 the kernel to forward packets according to the routes computed by
507 FRR. The kernel FIB is updated in an OS-specific way. For example,
508 the `netlink` interface is used on Linux, and route sockets are
511 The FIB push interface aims to provide a cross-platform mechanism to
512 support scenarios where the router has a forwarding path that is
513 distinct from the kernel, commonly a hardware-based fast path. In
514 these cases, the FIB needs to be maintained reliably in the fast path
515 as well. We refer to the component that programs the forwarding plane
516 (directly or indirectly) as the Forwarding Plane Manager or FPM.
518 The FIB push interface comprises of a TCP connection between zebra and
519 the FPM. The connection is initiated by zebra -- that is, the FPM acts
522 The relevant zebra code kicks in when zebra is configured with the
523 :option:`--enable-fpm` flag. Zebra periodically attempts to connect to
524 the well-known FPM port. Once the connection is up, zebra starts
525 sending messages containing routes over the socket to the FPM. Zebra
526 sends a complete copy of the forwarding table to the FPM, including
527 routes that it may have picked up from the kernel. The existing
528 interaction of zebra with the kernel remains unchanged -- that is, the
529 kernel continues to receive FIB updates as before.
531 The encapsulation header for the messages exchanged with the FPM is
532 defined by the file :file:`fpm/fpm.h` in the frr tree. The routes
533 themselves are encoded in netlink or protobuf format, with netlink
536 Protobuf is one of a number of new serialization formats wherein the
537 message schema is expressed in a purpose-built language. Code for
538 encoding/decoding to/from the wire format is generated from the
539 schema. Protobuf messages can be extended easily while maintaining
540 backward-compatibility with older code. Protobuf has the following
541 advantages over netlink:
543 - Code for serialization/deserialization is generated automatically. This
544 reduces the likelihood of bugs, allows third-party programs to be integrated
545 quickly, and makes it easy to add fields.
546 - The message format is not tied to an OS (Linux), and can be evolved
549 As mentioned before, zebra encodes routes sent to the FPM in netlink
550 format by default. The format can be controlled via the FPM module's
551 load-time option to zebra, which currently takes the values `netlink`
554 The zebra FPM interface uses replace semantics. That is, if a 'route
555 add' message for a prefix is followed by another 'route add' message,
556 the information in the second message is complete by itself, and
557 replaces the information sent in the first message.
559 If the connection to the FPM goes down for some reason, zebra sends
560 the FPM a complete copy of the forwarding table(s) when it reconnects.
562 zebra Terminal Mode Commands
563 ============================
565 .. index:: show ip route
566 .. clicmd:: show ip route
568 Display current routes which zebra holds in its database.
572 Router# show ip route
573 Codes: K - kernel route, C - connected, S - static, R - RIP,
574 B - BGP * - FIB route.
576 K* 0.0.0.0/0 203.181.89.241
577 S 0.0.0.0/0 203.181.89.1
579 C* 203.181.89.240/28 eth0
582 .. index:: show ipv6 route
583 .. clicmd:: show ipv6 route
585 .. index:: show interface
586 .. clicmd:: show interface
588 .. index:: show ip prefix-list [NAME]
589 .. clicmd:: show ip prefix-list [NAME]
591 .. index:: show route-map [NAME]
592 .. clicmd:: show route-map [NAME]
594 .. index:: show ip protocol
595 .. clicmd:: show ip protocol
597 .. index:: show ipforward
598 .. clicmd:: show ipforward
600 Display whether the host's IP forwarding function is enabled or not.
601 Almost any UNIX kernel can be configured with IP forwarding disabled.
602 If so, the box can't work as a router.
604 .. index:: show ipv6forward
605 .. clicmd:: show ipv6forward
607 Display whether the host's IP v6 forwarding is enabled or not.
609 .. index:: show zebra
610 .. clicmd:: show zebra
612 Display various statistics related to the installation and deletion
613 of routes, neighbor updates, and LSP's into the kernel.
615 .. index:: show zebra fpm stats
616 .. clicmd:: show zebra fpm stats
618 Display statistics related to the zebra code that interacts with the
619 optional Forwarding Plane Manager (FPM) component.
621 .. index:: clear zebra fpm stats
622 .. clicmd:: clear zebra fpm stats
624 Reset statistics related to the zebra code that interacts with the
625 optional Forwarding Plane Manager (FPM) component.