blob: 4c11d2440d5614187b31331e51543fe2d89e37e9 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001@node Zebra
paul718e3742002-12-13 20:15:29 +00002@chapter Zebra
3
4@c SYNOPSIS
5@command{zebra} is an IP routing manager. It provides kernel routing
6table updates, interface lookups, and redistribution of routes between
7different 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 Lampartera4e830c2015-01-30 01:44:25 +010013* Multicast RIB Commands:: Commands for controlling MRIB behavior
Paul Jakma7514fb72007-05-02 16:05:35 +000014* zebra Route Filtering:: Commands for zebra route filtering
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +000015* zebra FIB push interface:: Interface to optional FPM component
paul718e3742002-12-13 20:15:29 +000016* zebra Terminal Mode Commands:: Commands for zebra's VTY
17@end menu
18
19
paul76b89b42004-11-06 17:13:09 +000020@node Invoking zebra
paul718e3742002-12-13 20:15:29 +000021@section Invoking zebra
22
23Besides 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
29Runs in batch mode. @command{zebra} parses configuration file and terminates
30immediately.
31
32@item -k
33@itemx --keep_kernel
34When zebra starts up, don't delete old self inserted routes.
35
paul718e3742002-12-13 20:15:29 +000036@item -r
37@itemx --retain
38When program terminates, retain routes added by zebra.
39
40@end table
41
paul76b89b42004-11-06 17:13:09 +000042@node Interface Commands
paul718e3742002-12-13 20:15:29 +000043@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} {}
50Up or down the current interface.
51@end deffn
52
paul971a4492003-06-20 01:18:07 +000053@deffn {Interface Command} {ip address @var{address/prefix}} {}
Denis Ovsienkoe6844aa2011-03-18 20:20:53 +030054@deffnx {Interface Command} {ipv6 address @var{address/prefix}} {}
paul971a4492003-06-20 01:18:07 +000055@deffnx {Interface Command} {no ip address @var{address/prefix}} {}
Denis Ovsienkoe6844aa2011-03-18 20:20:53 +030056@deffnx {Interface Command} {no ipv6 address @var{address/prefix}} {}
paul971a4492003-06-20 01:18:07 +000057Set 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} {}
62Set the secondary flag for this address. This causes ospfd to not treat the
63address as a distinct subnet.
paul718e3742002-12-13 20:15:29 +000064@end deffn
65
66@deffn {Interface Command} {description @var{description} ...} {}
67Set description for the interface.
68@end deffn
69
70@deffn {Interface Command} {multicast} {}
71@deffnx {Interface Command} {no multicast} {}
72Enable 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>} {}
paul971a4492003-06-20 01:18:07 +000077Set bandwidth value of the interface in kilobits/sec. This is for
78calculating OSPF cost. This command does not affect the actual device
79configuration.
80@end deffn
81
82@deffn {Interface Command} {link-detect} {}
83@deffnx {Interface Command} {no link-detect} {}
84Enable/disable link-detect on platforms which support this. Currently
Paul Jakmac3eab602006-07-28 04:42:39 +000085only Linux and Solaris, and only where network interface drivers support reporting
86link-state via the IFF_RUNNING flag.
paul718e3742002-12-13 20:15:29 +000087@end deffn
88
paul76b89b42004-11-06 17:13:09 +000089@node Static Route Commands
paul718e3742002-12-13 20:15:29 +000090@section Static Route Commands
91
92Static routing is a very fundamental feature of routing technology. It
93defines 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
98A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it
paul971a4492003-06-20 01:18:07 +000099is treated as an interface name. If the interface name is @var{null0} then
100zebra installs a blackhole route.
paul718e3742002-12-13 20:15:29 +0000101
102@example
103ip route 10.0.0.0/8 10.0.0.2
104ip route 10.0.0.0/8 ppp0
paul971a4492003-06-20 01:18:07 +0000105ip route 10.0.0.0/8 null0
paul718e3742002-12-13 20:15:29 +0000106@end example
107
108First example defines 10.0.0.0/8 static route with gateway 10.0.0.2.
paul971a4492003-06-20 01:18:07 +0000109Second one defines the same prefix but with gateway to interface ppp0. The
110third install a blackhole route.
paul718e3742002-12-13 20:15:29 +0000111@end deffn
112
113@deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {}
114This is alternate version of above command. When @var{network} is
115A.B.C.D format, user must define @var{netmask} value with A.B.C.D
116format. @var{gateway} is same option as above command
117
118@example
119ip route 10.0.0.0 255.255.255.0 10.0.0.2
120ip route 10.0.0.0 255.255.255.0 ppp0
paul971a4492003-06-20 01:18:07 +0000121ip route 10.0.0.0 255.255.255.0 null0
paul718e3742002-12-13 20:15:29 +0000122@end example
123
paul971a4492003-06-20 01:18:07 +0000124These statements are equivalent to those in the previous example.
paul718e3742002-12-13 20:15:29 +0000125@end deffn
126
127@deffn Command {ip route @var{network} @var{gateway} @var{distance}} {}
paul971a4492003-06-20 01:18:07 +0000128Installs the route with the specified distance.
paul718e3742002-12-13 20:15:29 +0000129@end deffn
130
131Multiple nexthop static route
132
133@example
134ip route 10.0.0.1/32 10.0.0.2
135ip route 10.0.0.1/32 10.0.0.3
136ip route 10.0.0.1/32 eth0
137@end example
138
139If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
140is reachable, then the last route is installed into the kernel.
141
paul971a4492003-06-20 01:18:07 +0000142If zebra has been compiled with multipath support, and both 10.0.0.2 and
14310.0.0.3 are reachable, zebra will install a multipath route via both
144nexthops, if the platform supports this.
145
paul718e3742002-12-13 20:15:29 +0000146@example
147zebra> show ip route
148S> 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
paul971a4492003-06-20 01:18:07 +0000153@example
154ip route 10.0.0.0/8 10.0.0.2
155ip route 10.0.0.0/8 10.0.0.3
156ip route 10.0.0.0/8 null0 255
157@end example
158
159This will install a multihop route via the specified next-hops if they are
160reachable, as well as a high-metric blackhole route, which can be useful to
161prevent traffic destined for a prefix to match less-specific routes (eg
162default) should the specified gateways not be reachable. Eg:
163
164@example
165zebra> show ip route 10.0.0.0/8
166Routing 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
171Routing entry for 10.0.0.0/8
172 Known via "static", distance 255, metric 0
173 directly connected, Null0
174@end example
paul718e3742002-12-13 20:15:29 +0000175
176@deffn Command {ipv6 route @var{network} @var{gateway}} {}
paul971a4492003-06-20 01:18:07 +0000177@deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {}
178These behave similarly to their ipv4 counterparts.
paul718e3742002-12-13 20:15:29 +0000179@end deffn
180
181
182@deffn Command {table @var{tableno}} {}
183Select the primary kernel routing table to be used. This only works
184for kernels supporting multiple routing tables (like GNU/Linux 2.2.x
185and later). After setting @var{tableno} with this command,
186static routes defined after this are added to the specified table.
187@end deffn
188
David Lampartera4e830c2015-01-30 01:44:25 +0100189@node Multicast RIB Commands
190@section Multicast RIB Commands
191
192The Multicast RIB provides a separate table of unicast destinations which
193is used for Multicast Reverse Path Forwarding decisions. It is used with
194a multicast source's IP address, hence contains not multicast group
195addresses but unicast addresses.
196
197This table is fully separate from the default unicast table. However,
198RPF lookup can include the unicast table.
199
200WARNING: RPF lookup results are non-responsive in this version of Quagga,
201i.e. multicast routing does not actively react to changes in underlying
202unicast 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
211Performs the lookup on the Unicast RIB. The Multicast RIB is never used.
212@item mrib-only
213Performs the lookup on the Multicast RIB. The Unicast RIB is never used.
214@item mrib-then-urib
215Tries to perform the lookup on the Multicast RIB. If any route is found,
216that route is used. Otherwise, the Unicast RIB is tried.
217@item lower-distance
218Performs a lookup on the Multicast RIB and Unicast RIB each. The result
219with the lower administrative distance is used; if they're equal, the
220Multicast RIB takes precedence.
221@item longer-prefix
222Performs a lookup on the Multicast RIB and Unicast RIB each. The result
223with the longer prefix length is used; if they're equal, the
224Multicast RIB takes precedence.
225@end table
226
David Lamparterb162ab72015-02-02 03:00:22 +0100227The @code{mrib-then-urib} setting is the default behavior if nothing is
228configured. If this is the desired behavior, it should be explicitly
229configured to make the configuration immune against possible changes in
230what the default behavior is.
231
David Lampartera4e830c2015-01-30 01:44:25 +0100232WARNING: Unreachable routes do not receive special treatment and do not
233cause fallback to a second lookup.
234@end deffn
235
236@deffn Command {show ip rpf @var{addr}} {}
237
238Performs a Multicast RPF lookup, as configured with
239@command{ip multicast rpf-lookup-mode @var{mode}}. @var{addr} specifies
240the multicast source address to look up.
241
242@example
243> show ip rpf 192.0.2.1
244Routing 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
249Indicates that a multicast source lookup for 192.0.2.1 would use an
250Unicast 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
255Prints the entire Multicast RIB. Note that this is independent of the
256configured RPF lookup mode, the Multicast RIB may be printed yet not
257used 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
263Adds a static route entry to the Multicast RIB. This performs exactly as
264the @command{ip route} command, except that it inserts the route in the
265Multicast RIB instead of the Unicast RIB.
266@end deffn
267
268
Paul Jakma7514fb72007-05-02 16:05:35 +0000269@node zebra Route Filtering
270@section zebra Route Filtering
271Zebra supports @command{prefix-list} and @command{route-map} to match
272routes received from other quagga components. The
273@command{permit}/@command{deny} facilities provided by these commands
274can be used to filter which routes zebra will install in the kernel.
275
276@deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {}
277Apply a route-map filter to routes for the specified protocol. @var{protocol}
278can 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}}
293Within a route-map, set the preferred source address for matching routes
294when installing in the kernel.
295@end deffn
296
297@example
298The following creates a prefix-list that matches all addresses, a route-map
299that sets the preferred source address, and applies the route-map to all
300@command{rip} routes.
301
302@group
303ip prefix-list ANY permit 0.0.0.0/0 le 32
304route-map RM1 permit 10
305 match ip address prefix-list ANY
306 set src 10.0.0.1
307
308ip protocol rip route-map RM1
309@end group
310@end example
311
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +0000312@node zebra FIB push interface
313@section zebra FIB push interface
314
315Zebra supports a 'FIB push' interface that allows an external
316component to learn the forwarding information computed by the Quagga
317routing suite.
318
319In Quagga, the Routing Information Base (RIB) resides inside
320zebra. Routing protocols communicate their best routes to zebra, and
321zebra computes the best route across protocols for each prefix. This
322latter information makes up the Forwarding Information Base
323(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
324the kernel to forward packets according to the routes computed by
325Quagga. The kernel FIB is updated in an OS-specific way. For example,
326the @code{netlink} interface is used on Linux, and route sockets are
327used on FreeBSD.
328
329The FIB push interface aims to provide a cross-platform mechanism to
330support scenarios where the router has a forwarding path that is
331distinct from the kernel, commonly a hardware-based fast path. In
332these cases, the FIB needs to be maintained reliably in the fast path
333as well. We refer to the component that programs the forwarding plane
334(directly or indirectly) as the Forwarding Plane Manager or FPM.
335
336The FIB push interface comprises of a TCP connection between zebra and
337the FPM. The connection is initiated by zebra -- that is, the FPM acts
338as the TCP server.
339
340The relevant zebra code kicks in when zebra is configured with the
341@code{--enable-fpm} flag. Zebra periodically attempts to connect to
342the well-known FPM port. Once the connection is up, zebra starts
343sending messages containing routes over the socket to the FPM. Zebra
344sends a complete copy of the forwarding table to the FPM, including
345routes that it may have picked up from the kernel. The existing
346interaction of zebra with the kernel remains unchanged -- that is, the
347kernel continues to receive FIB updates as before.
348
349The format of the messages exchanged with the FPM is defined by the
350file @file{fpm/fpm.h} in the quagga tree.
351
352The zebra FPM interface uses replace semantics. That is, if a 'route
353add' message for a prefix is followed by another 'route add' message,
354the information in the second message is complete by itself, and
355replaces the information sent in the first message.
356
357If the connection to the FPM goes down for some reason, zebra sends
358the FPM a complete copy of the forwarding table(s) when it reconnects.
359
paul76b89b42004-11-06 17:13:09 +0000360@node zebra Terminal Mode Commands
paul718e3742002-12-13 20:15:29 +0000361@section zebra Terminal Mode Commands
362
363@deffn Command {show ip route} {}
364Display current routes which zebra holds in its database.
365
366@example
367@group
368Router# show ip route
369Codes: K - kernel route, C - connected, S - static, R - RIP,
370 B - BGP * - FIB route.
371
372K* 0.0.0.0/0 203.181.89.241
373S 0.0.0.0/0 203.181.89.1
374C* 127.0.0.0/8 lo
375C* 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 Jakma7514fb72007-05-02 16:05:35 +0000386@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
paul718e3742002-12-13 20:15:29 +0000395@deffn Command {show ipforward} {}
396Display whether the host's IP forwarding function is enabled or not.
397Almost any UNIX kernel can be configured with IP forwarding disabled.
398If so, the box can't work as a router.
399@end deffn
400
401@deffn Command {show ipv6forward} {}
402Display whether the host's IP v6 forwarding is enabled or not.
403@end deffn
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +0000404
405@deffn Command {show zebra fpm stats} {}
406Display statistics related to the zebra code that interacts with the
407optional Forwarding Plane Manager (FPM) component.
408@end deffn
409
410@deffn Command {clear zebra fpm stats} {}
411Reset statistics related to the zebra code that interacts with the
412optional Forwarding Plane Manager (FPM) component.
413@end deffn