Zebra
*****

zebra is an IP routing manager.  It provides kernel routing table updates, interface lookups, and redistribution of routes between different routing protocols.

Invoking zebra
==============

Besides the common invocation options (see Common Invocation Options), the zebra specific invocation options are listed below.

-b
--batch
     Runs in batch mode.  zebra parses configuration file and terminates immediately.

-k
--keep_kernel
     When zebra starts up, don't delete old self inserted routes.

-r
--retain
     When program terminates, retain routes added by zebra.

Interface Commands
==================

 -- Command: interface IFNAME

 -- Interface Command: shutdown
 -- Interface Command: no shutdown
     Up or down the current interface.

 -- Interface Command: ip address ADDRESS/PREFIX
 -- Interface Command: ip6 address ADDRESS/PREFIX
 -- Interface Command: no ip address ADDRESS/PREFIX
 -- Interface Command: no ip6 address ADDRESS/PREFIX
     Set the IPv4 or IPv6 address/prefix for the interface.

 -- Interface Command: ip address ADDRESS/PREFIX secondary
 -- Interface Command: no ip address ADDRESS/PREFIX secondary
     Set the secondary flag for this address. This causes ospfd to not treat the address as a distinct subnet.

 -- Interface Command: description DESCRIPTION ...
     Set description for the interface.

 -- Interface Command: multicast
 -- Interface Command: no multicast
     Enable or disables multicast flag for the interface.

 -- Interface Command: bandwidth <1-10000000>
 -- Interface Command: no bandwidth <1-10000000>
     Set bandwidth value of the interface in kilobits/sec.  This is for calculating OSPF cost. This command does not affect the actual device configuration.

 -- Interface Command: link-detect
 -- Interface Command: no link-detect
     Enable/disable link-detect on platforms which support this. Currently only Linux and Solaris, and only where network interface drivers support reporting link-state via the IFF_RUNNING flag.

Static Route Commands
=====================

Static routing is a very fundamental feature of routing technology.  It defines static prefix and gateway.

 -- Command: ip route NETWORK GATEWAY
     NETWORK is destination prefix with format of A.B.C.D/M. GATEWAY is gateway for the prefix.  When GATEWAY is A.B.C.D format.  It is taken as a IPv4 address gateway.  Otherwise it is treated as an interface name. If the interface name is NULL0 then zebra installs a blackhole route.

          ip route 10.0.0.0/8 10.0.0.2
          ip route 10.0.0.0/8 ppp0
          ip route 10.0.0.0/8 null0

     First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. Second one defines the same prefix but with gateway to interface ppp0. The third install a blackhole route.

 -- Command: ip route NETWORK NETMASK GATEWAY
     This is alternate version of above command.  When NETWORK is A.B.C.D format, user must define NETMASK value with A.B.C.D format.  GATEWAY is same option as above command

          ip route 10.0.0.0 255.255.255.0 10.0.0.2
          ip route 10.0.0.0 255.255.255.0 ppp0
          ip route 10.0.0.0 255.255.255.0 null0

     These statements are equivalent to those in the previous example.

 -- Command: ip route NETWORK GATEWAY DISTANCE
     Installs the route with the specified distance.

Multiple nexthop static route

     ip route 10.0.0.1/32 10.0.0.2
     ip route 10.0.0.1/32 10.0.0.3
     ip route 10.0.0.1/32 eth0

If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 is reachable, then the last route is installed into the kernel.

If zebra has been compiled with multipath support, and both 10.0.0.2 and 10.0.0.3 are reachable, zebra will install a multipath route via both nexthops, if the platform supports this.

     zebra> show ip route
     S>  10.0.0.1/32 [1/0] via 10.0.0.2 inactive
                           via 10.0.0.3 inactive
       *                   is directly connected, eth0

     ip route 10.0.0.0/8 10.0.0.2
     ip route 10.0.0.0/8 10.0.0.3
     ip route 10.0.0.0/8 null0 255

This will install a multihop route via the specified next-hops if they are reachable, as well as a high-metric blackhole route, which can be useful to prevent traffic destined for a prefix to match less-specific routes (eg default) should the specified gateways not be reachable. Eg:

     zebra> show ip route 10.0.0.0/8
     Routing entry for 10.0.0.0/8
       Known via "static", distance 1, metric 0
         10.0.0.2 inactive
         10.0.0.3 inactive

     Routing entry for 10.0.0.0/8
       Known via "static", distance 255, metric 0
         directly connected, Null0

 -- Command: ipv6 route NETWORK GATEWAY
 -- Command: ipv6 route NETWORK GATEWAY DISTANCE
     These behave similarly to their ipv4 counterparts.

 -- Command: table TABLENO
     Select the primary kernel routing table to be used.  This only works for kernels supporting multiple routing tables (like GNU/Linux 2.2.x and later).  After setting TABLENO with this command, static routes defined after this are added to the specified table.

zebra Route Filtering
=====================

Zebra supports prefix-list and route-map to match routes received from other quagga components.  The permit/deny facilities provided by these commands can be used to filter which routes zebra will install in the kernel.

 -- Command: ip protocol PROTOCOL route-map ROUTEMAP
     Apply a route-map filter to routes for the specified protocol. PROTOCOL can be any or one of system, kernel, connected, static, rip, ripng, ospf, ospf6, isis, bgp, hsls.

 -- Route Map: set src ADDRESS
     Within a route-map, set the preferred source address for matching routes when installing in the kernel.

     The following creates a prefix-list that matches all addresses, a route-map
     that sets the preferred source address, and applies the route-map to all
     rip routes.

     ip prefix-list ANY permit 0.0.0.0/0 le 32
     route-map RM1 permit 10
          match ip address prefix-list ANY
          set src 10.0.0.1

     ip protocol rip route-map RM1

zebra Terminal Mode Commands
============================

 -- Command: show ip route
     Display current routes which zebra holds in its database.

          Router# show ip route
          Codes: K - kernel route, C - connected, S - static, R - RIP,
                 B - BGP * - FIB route.

          K* 0.0.0.0/0              203.181.89.241
          S  0.0.0.0/0              203.181.89.1
          C* 127.0.0.0/8            lo
          C* 203.181.89.240/28      eth0

 -- Command: show ipv6 route

 -- Command: show interface

 -- Command: show ip prefix-list [NAME]

 -- Command: show route-map [NAME]

 -- Command: show ip protocol

 -- Command: show ipforward
     Display whether the host's IP forwarding function is enabled or not. Almost any UNIX kernel can be configured with IP forwarding disabled. If so, the box can't work as a router.

 -- Command: show ipv6forward
     Display whether the host's IP v6 forwarding is enabled or not.