paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | @node Zebra |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2 | @chapter Zebra |
| 3 | |
| 4 | @c SYNOPSIS |
| 5 | @command{zebra} is an IP routing manager. It provides kernel routing |
| 6 | table updates, interface lookups, and redistribution of routes between |
| 7 | different routing protocols. |
| 8 | |
| 9 | @menu |
| 10 | * Invoking zebra:: Running the program |
| 11 | * Interface Commands:: Commands for zebra interfaces |
| 12 | * Static Route Commands:: Commands for adding static routes |
David Lamparter | a4e830c | 2015-01-30 01:44:25 +0100 | [diff] [blame] | 13 | * Multicast RIB Commands:: Commands for controlling MRIB behavior |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 14 | * zebra Route Filtering:: Commands for zebra route filtering |
Avneesh Sachdev | b9c24cd | 2012-11-13 22:49:00 +0000 | [diff] [blame] | 15 | * zebra FIB push interface:: Interface to optional FPM component |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 16 | * zebra Terminal Mode Commands:: Commands for zebra's VTY |
| 17 | @end menu |
| 18 | |
| 19 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 20 | @node Invoking zebra |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 21 | @section Invoking zebra |
| 22 | |
| 23 | Besides the common invocation options (@pxref{Common Invocation Options}), the |
| 24 | @command{zebra} specific invocation options are listed below. |
| 25 | |
| 26 | @table @samp |
| 27 | @item -b |
| 28 | @itemx --batch |
| 29 | Runs in batch mode. @command{zebra} parses configuration file and terminates |
| 30 | immediately. |
| 31 | |
| 32 | @item -k |
| 33 | @itemx --keep_kernel |
| 34 | When zebra starts up, don't delete old self inserted routes. |
| 35 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 36 | @item -r |
| 37 | @itemx --retain |
| 38 | When program terminates, retain routes added by zebra. |
| 39 | |
| 40 | @end table |
| 41 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 42 | @node Interface Commands |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | @section Interface Commands |
| 44 | |
| 45 | @deffn Command {interface @var{ifname}} {} |
| 46 | @end deffn |
| 47 | |
| 48 | @deffn {Interface Command} {shutdown} {} |
| 49 | @deffnx {Interface Command} {no shutdown} {} |
| 50 | Up or down the current interface. |
| 51 | @end deffn |
| 52 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 53 | @deffn {Interface Command} {ip address @var{address/prefix}} {} |
Denis Ovsienko | e6844aa | 2011-03-18 20:20:53 +0300 | [diff] [blame] | 54 | @deffnx {Interface Command} {ipv6 address @var{address/prefix}} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 55 | @deffnx {Interface Command} {no ip address @var{address/prefix}} {} |
Denis Ovsienko | e6844aa | 2011-03-18 20:20:53 +0300 | [diff] [blame] | 56 | @deffnx {Interface Command} {no ipv6 address @var{address/prefix}} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 57 | Set the IPv4 or IPv6 address/prefix for the interface. |
| 58 | @end deffn |
| 59 | |
| 60 | @deffn {Interface Command} {ip address @var{address/prefix} secondary} {} |
| 61 | @deffnx {Interface Command} {no ip address @var{address/prefix} secondary} {} |
| 62 | Set the secondary flag for this address. This causes ospfd to not treat the |
| 63 | address as a distinct subnet. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 64 | @end deffn |
| 65 | |
| 66 | @deffn {Interface Command} {description @var{description} ...} {} |
| 67 | Set description for the interface. |
| 68 | @end deffn |
| 69 | |
| 70 | @deffn {Interface Command} {multicast} {} |
| 71 | @deffnx {Interface Command} {no multicast} {} |
| 72 | Enable or disables multicast flag for the interface. |
| 73 | @end deffn |
| 74 | |
| 75 | @deffn {Interface Command} {bandwidth <1-10000000>} {} |
| 76 | @deffnx {Interface Command} {no bandwidth <1-10000000>} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 77 | Set bandwidth value of the interface in kilobits/sec. This is for |
| 78 | calculating OSPF cost. This command does not affect the actual device |
| 79 | configuration. |
| 80 | @end deffn |
| 81 | |
| 82 | @deffn {Interface Command} {link-detect} {} |
| 83 | @deffnx {Interface Command} {no link-detect} {} |
| 84 | Enable/disable link-detect on platforms which support this. Currently |
Paul Jakma | c3eab60 | 2006-07-28 04:42:39 +0000 | [diff] [blame] | 85 | only Linux and Solaris, and only where network interface drivers support reporting |
| 86 | link-state via the IFF_RUNNING flag. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 87 | @end deffn |
| 88 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 89 | @node Static Route Commands |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 90 | @section Static Route Commands |
| 91 | |
| 92 | Static routing is a very fundamental feature of routing technology. It |
| 93 | defines static prefix and gateway. |
| 94 | |
| 95 | @deffn Command {ip route @var{network} @var{gateway}} {} |
| 96 | @var{network} is destination prefix with format of A.B.C.D/M. |
| 97 | @var{gateway} is gateway for the prefix. When @var{gateway} is |
| 98 | A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 99 | is treated as an interface name. If the interface name is @var{null0} then |
| 100 | zebra installs a blackhole route. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 101 | |
| 102 | @example |
| 103 | ip route 10.0.0.0/8 10.0.0.2 |
| 104 | ip route 10.0.0.0/8 ppp0 |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 105 | ip route 10.0.0.0/8 null0 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 106 | @end example |
| 107 | |
| 108 | First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 109 | Second one defines the same prefix but with gateway to interface ppp0. The |
| 110 | third install a blackhole route. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 111 | @end deffn |
| 112 | |
| 113 | @deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {} |
| 114 | This is alternate version of above command. When @var{network} is |
| 115 | A.B.C.D format, user must define @var{netmask} value with A.B.C.D |
| 116 | format. @var{gateway} is same option as above command |
| 117 | |
| 118 | @example |
| 119 | ip route 10.0.0.0 255.255.255.0 10.0.0.2 |
| 120 | ip route 10.0.0.0 255.255.255.0 ppp0 |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 121 | ip route 10.0.0.0 255.255.255.0 null0 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 122 | @end example |
| 123 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 124 | These statements are equivalent to those in the previous example. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 125 | @end deffn |
| 126 | |
| 127 | @deffn Command {ip route @var{network} @var{gateway} @var{distance}} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 128 | Installs the route with the specified distance. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 129 | @end deffn |
| 130 | |
| 131 | Multiple nexthop static route |
| 132 | |
| 133 | @example |
| 134 | ip route 10.0.0.1/32 10.0.0.2 |
| 135 | ip route 10.0.0.1/32 10.0.0.3 |
| 136 | ip route 10.0.0.1/32 eth0 |
| 137 | @end example |
| 138 | |
| 139 | If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 |
| 140 | is reachable, then the last route is installed into the kernel. |
| 141 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 142 | If zebra has been compiled with multipath support, and both 10.0.0.2 and |
| 143 | 10.0.0.3 are reachable, zebra will install a multipath route via both |
| 144 | nexthops, if the platform supports this. |
| 145 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 146 | @example |
| 147 | zebra> show ip route |
| 148 | S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive |
| 149 | via 10.0.0.3 inactive |
| 150 | * is directly connected, eth0 |
| 151 | @end example |
| 152 | |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 153 | @example |
| 154 | ip route 10.0.0.0/8 10.0.0.2 |
| 155 | ip route 10.0.0.0/8 10.0.0.3 |
| 156 | ip route 10.0.0.0/8 null0 255 |
| 157 | @end example |
| 158 | |
| 159 | This will install a multihop route via the specified next-hops if they are |
| 160 | reachable, as well as a high-metric blackhole route, which can be useful to |
| 161 | prevent traffic destined for a prefix to match less-specific routes (eg |
| 162 | default) should the specified gateways not be reachable. Eg: |
| 163 | |
| 164 | @example |
| 165 | zebra> show ip route 10.0.0.0/8 |
| 166 | Routing entry for 10.0.0.0/8 |
| 167 | Known via "static", distance 1, metric 0 |
| 168 | 10.0.0.2 inactive |
| 169 | 10.0.0.3 inactive |
| 170 | |
| 171 | Routing entry for 10.0.0.0/8 |
| 172 | Known via "static", distance 255, metric 0 |
| 173 | directly connected, Null0 |
| 174 | @end example |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 175 | |
| 176 | @deffn Command {ipv6 route @var{network} @var{gateway}} {} |
paul | 971a449 | 2003-06-20 01:18:07 +0000 | [diff] [blame] | 177 | @deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {} |
| 178 | These behave similarly to their ipv4 counterparts. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 179 | @end deffn |
| 180 | |
| 181 | |
| 182 | @deffn Command {table @var{tableno}} {} |
| 183 | Select the primary kernel routing table to be used. This only works |
| 184 | for kernels supporting multiple routing tables (like GNU/Linux 2.2.x |
| 185 | and later). After setting @var{tableno} with this command, |
| 186 | static routes defined after this are added to the specified table. |
| 187 | @end deffn |
| 188 | |
David Lamparter | a4e830c | 2015-01-30 01:44:25 +0100 | [diff] [blame] | 189 | @node Multicast RIB Commands |
| 190 | @section Multicast RIB Commands |
| 191 | |
| 192 | The Multicast RIB provides a separate table of unicast destinations which |
| 193 | is used for Multicast Reverse Path Forwarding decisions. It is used with |
| 194 | a multicast source's IP address, hence contains not multicast group |
| 195 | addresses but unicast addresses. |
| 196 | |
| 197 | This table is fully separate from the default unicast table. However, |
| 198 | RPF lookup can include the unicast table. |
| 199 | |
| 200 | WARNING: RPF lookup results are non-responsive in this version of Quagga, |
| 201 | i.e. multicast routing does not actively react to changes in underlying |
| 202 | unicast topology! |
| 203 | |
| 204 | @deffn Command {ip multicast rpf-lookup-mode @var{mode}} {} |
| 205 | @deffnx Command {no ip multicast rpf-lookup-mode [@var{mode}]} {} |
| 206 | |
| 207 | @var{mode} sets the method used to perform RPF lookups. Supported modes: |
| 208 | |
| 209 | @table @samp |
| 210 | @item urib-only |
| 211 | Performs the lookup on the Unicast RIB. The Multicast RIB is never used. |
| 212 | @item mrib-only |
| 213 | Performs the lookup on the Multicast RIB. The Unicast RIB is never used. |
| 214 | @item mrib-then-urib |
| 215 | Tries to perform the lookup on the Multicast RIB. If any route is found, |
| 216 | that route is used. Otherwise, the Unicast RIB is tried. |
| 217 | @item lower-distance |
| 218 | Performs a lookup on the Multicast RIB and Unicast RIB each. The result |
| 219 | with the lower administrative distance is used; if they're equal, the |
| 220 | Multicast RIB takes precedence. |
| 221 | @item longer-prefix |
| 222 | Performs a lookup on the Multicast RIB and Unicast RIB each. The result |
| 223 | with the longer prefix length is used; if they're equal, the |
| 224 | Multicast RIB takes precedence. |
| 225 | @end table |
| 226 | |
David Lamparter | b162ab7 | 2015-02-02 03:00:22 +0100 | [diff] [blame] | 227 | The @code{mrib-then-urib} setting is the default behavior if nothing is |
| 228 | configured. If this is the desired behavior, it should be explicitly |
| 229 | configured to make the configuration immune against possible changes in |
| 230 | what the default behavior is. |
| 231 | |
David Lamparter | a4e830c | 2015-01-30 01:44:25 +0100 | [diff] [blame] | 232 | WARNING: Unreachable routes do not receive special treatment and do not |
| 233 | cause fallback to a second lookup. |
| 234 | @end deffn |
| 235 | |
| 236 | @deffn Command {show ip rpf @var{addr}} {} |
| 237 | |
| 238 | Performs a Multicast RPF lookup, as configured with |
| 239 | @command{ip multicast rpf-lookup-mode @var{mode}}. @var{addr} specifies |
| 240 | the multicast source address to look up. |
| 241 | |
| 242 | @example |
| 243 | > show ip rpf 192.0.2.1 |
| 244 | Routing entry for 192.0.2.0/24 using Unicast RIB |
| 245 | Known via "kernel", distance 0, metric 0, best |
| 246 | * 198.51.100.1, via eth0 |
| 247 | @end example |
| 248 | |
| 249 | Indicates that a multicast source lookup for 192.0.2.1 would use an |
| 250 | Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1. |
| 251 | @end deffn |
| 252 | |
| 253 | @deffn Command {show ip rpf} {} |
| 254 | |
| 255 | Prints the entire Multicast RIB. Note that this is independent of the |
| 256 | configured RPF lookup mode, the Multicast RIB may be printed yet not |
| 257 | used at all. |
| 258 | @end deffn |
| 259 | |
| 260 | @deffn Command {ip mroute @var{prefix} @var{nexthop} [@var{distance}]} {} |
| 261 | @deffnx Command {no ip mroute @var{prefix} @var{nexthop} [@var{distance}]} {} |
| 262 | |
| 263 | Adds a static route entry to the Multicast RIB. This performs exactly as |
| 264 | the @command{ip route} command, except that it inserts the route in the |
| 265 | Multicast RIB instead of the Unicast RIB. |
| 266 | @end deffn |
| 267 | |
| 268 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 269 | @node zebra Route Filtering |
| 270 | @section zebra Route Filtering |
| 271 | Zebra supports @command{prefix-list} and @command{route-map} to match |
| 272 | routes received from other quagga components. The |
| 273 | @command{permit}/@command{deny} facilities provided by these commands |
| 274 | can be used to filter which routes zebra will install in the kernel. |
| 275 | |
| 276 | @deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {} |
| 277 | Apply a route-map filter to routes for the specified protocol. @var{protocol} |
| 278 | can be @b{any} or one of |
| 279 | @b{system}, |
| 280 | @b{kernel}, |
| 281 | @b{connected}, |
| 282 | @b{static}, |
| 283 | @b{rip}, |
| 284 | @b{ripng}, |
| 285 | @b{ospf}, |
| 286 | @b{ospf6}, |
| 287 | @b{isis}, |
| 288 | @b{bgp}, |
| 289 | @b{hsls}. |
| 290 | @end deffn |
| 291 | |
| 292 | @deffn {Route Map} {set src @var{address}} |
| 293 | Within a route-map, set the preferred source address for matching routes |
| 294 | when installing in the kernel. |
| 295 | @end deffn |
| 296 | |
| 297 | @example |
| 298 | The following creates a prefix-list that matches all addresses, a route-map |
| 299 | that sets the preferred source address, and applies the route-map to all |
| 300 | @command{rip} routes. |
| 301 | |
| 302 | @group |
| 303 | ip prefix-list ANY permit 0.0.0.0/0 le 32 |
| 304 | route-map RM1 permit 10 |
| 305 | match ip address prefix-list ANY |
| 306 | set src 10.0.0.1 |
| 307 | |
| 308 | ip protocol rip route-map RM1 |
| 309 | @end group |
| 310 | @end example |
| 311 | |
Avneesh Sachdev | b9c24cd | 2012-11-13 22:49:00 +0000 | [diff] [blame] | 312 | @node zebra FIB push interface |
| 313 | @section zebra FIB push interface |
| 314 | |
| 315 | Zebra supports a 'FIB push' interface that allows an external |
| 316 | component to learn the forwarding information computed by the Quagga |
| 317 | routing suite. |
| 318 | |
| 319 | In Quagga, the Routing Information Base (RIB) resides inside |
| 320 | zebra. Routing protocols communicate their best routes to zebra, and |
| 321 | zebra computes the best route across protocols for each prefix. This |
| 322 | latter information makes up the Forwarding Information Base |
| 323 | (FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in |
| 324 | the kernel to forward packets according to the routes computed by |
| 325 | Quagga. The kernel FIB is updated in an OS-specific way. For example, |
| 326 | the @code{netlink} interface is used on Linux, and route sockets are |
| 327 | used on FreeBSD. |
| 328 | |
| 329 | The FIB push interface aims to provide a cross-platform mechanism to |
| 330 | support scenarios where the router has a forwarding path that is |
| 331 | distinct from the kernel, commonly a hardware-based fast path. In |
| 332 | these cases, the FIB needs to be maintained reliably in the fast path |
| 333 | as well. We refer to the component that programs the forwarding plane |
| 334 | (directly or indirectly) as the Forwarding Plane Manager or FPM. |
| 335 | |
| 336 | The FIB push interface comprises of a TCP connection between zebra and |
| 337 | the FPM. The connection is initiated by zebra -- that is, the FPM acts |
| 338 | as the TCP server. |
| 339 | |
| 340 | The relevant zebra code kicks in when zebra is configured with the |
| 341 | @code{--enable-fpm} flag. Zebra periodically attempts to connect to |
| 342 | the well-known FPM port. Once the connection is up, zebra starts |
| 343 | sending messages containing routes over the socket to the FPM. Zebra |
| 344 | sends a complete copy of the forwarding table to the FPM, including |
| 345 | routes that it may have picked up from the kernel. The existing |
| 346 | interaction of zebra with the kernel remains unchanged -- that is, the |
| 347 | kernel continues to receive FIB updates as before. |
| 348 | |
| 349 | The format of the messages exchanged with the FPM is defined by the |
| 350 | file @file{fpm/fpm.h} in the quagga tree. |
| 351 | |
| 352 | The zebra FPM interface uses replace semantics. That is, if a 'route |
| 353 | add' message for a prefix is followed by another 'route add' message, |
| 354 | the information in the second message is complete by itself, and |
| 355 | replaces the information sent in the first message. |
| 356 | |
| 357 | If the connection to the FPM goes down for some reason, zebra sends |
| 358 | the FPM a complete copy of the forwarding table(s) when it reconnects. |
| 359 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 360 | @node zebra Terminal Mode Commands |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 361 | @section zebra Terminal Mode Commands |
| 362 | |
| 363 | @deffn Command {show ip route} {} |
| 364 | Display current routes which zebra holds in its database. |
| 365 | |
| 366 | @example |
| 367 | @group |
| 368 | Router# show ip route |
| 369 | Codes: K - kernel route, C - connected, S - static, R - RIP, |
| 370 | B - BGP * - FIB route. |
| 371 | |
| 372 | K* 0.0.0.0/0 203.181.89.241 |
| 373 | S 0.0.0.0/0 203.181.89.1 |
| 374 | C* 127.0.0.0/8 lo |
| 375 | C* 203.181.89.240/28 eth0 |
| 376 | @end group |
| 377 | @end example |
| 378 | @end deffn |
| 379 | |
| 380 | @deffn Command {show ipv6 route} {} |
| 381 | @end deffn |
| 382 | |
| 383 | @deffn Command {show interface} {} |
| 384 | @end deffn |
| 385 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 386 | @deffn Command {show ip prefix-list [@var{name}]} {} |
| 387 | @end deffn |
| 388 | |
| 389 | @deffn Command {show route-map [@var{name}]} {} |
| 390 | @end deffn |
| 391 | |
| 392 | @deffn Command {show ip protocol} {} |
| 393 | @end deffn |
| 394 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 395 | @deffn Command {show ipforward} {} |
| 396 | Display whether the host's IP forwarding function is enabled or not. |
| 397 | Almost any UNIX kernel can be configured with IP forwarding disabled. |
| 398 | If so, the box can't work as a router. |
| 399 | @end deffn |
| 400 | |
| 401 | @deffn Command {show ipv6forward} {} |
| 402 | Display whether the host's IP v6 forwarding is enabled or not. |
| 403 | @end deffn |
Avneesh Sachdev | b9c24cd | 2012-11-13 22:49:00 +0000 | [diff] [blame] | 404 | |
| 405 | @deffn Command {show zebra fpm stats} {} |
| 406 | Display statistics related to the zebra code that interacts with the |
| 407 | optional Forwarding Plane Manager (FPM) component. |
| 408 | @end deffn |
| 409 | |
| 410 | @deffn Command {clear zebra fpm stats} {} |
| 411 | Reset statistics related to the zebra code that interacts with the |
| 412 | optional Forwarding Plane Manager (FPM) component. |
| 413 | @end deffn |