blob: 810866aa16b66a49ca2b66e83a6d48ce6d0fac00 [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
227WARNING: Unreachable routes do not receive special treatment and do not
228cause fallback to a second lookup.
229@end deffn
230
231@deffn Command {show ip rpf @var{addr}} {}
232
233Performs a Multicast RPF lookup, as configured with
234@command{ip multicast rpf-lookup-mode @var{mode}}. @var{addr} specifies
235the multicast source address to look up.
236
237@example
238> show ip rpf 192.0.2.1
239Routing entry for 192.0.2.0/24 using Unicast RIB
240 Known via "kernel", distance 0, metric 0, best
241 * 198.51.100.1, via eth0
242@end example
243
244Indicates that a multicast source lookup for 192.0.2.1 would use an
245Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1.
246@end deffn
247
248@deffn Command {show ip rpf} {}
249
250Prints the entire Multicast RIB. Note that this is independent of the
251configured RPF lookup mode, the Multicast RIB may be printed yet not
252used at all.
253@end deffn
254
255@deffn Command {ip mroute @var{prefix} @var{nexthop} [@var{distance}]} {}
256@deffnx Command {no ip mroute @var{prefix} @var{nexthop} [@var{distance}]} {}
257
258Adds a static route entry to the Multicast RIB. This performs exactly as
259the @command{ip route} command, except that it inserts the route in the
260Multicast RIB instead of the Unicast RIB.
261@end deffn
262
263
Paul Jakma7514fb72007-05-02 16:05:35 +0000264@node zebra Route Filtering
265@section zebra Route Filtering
266Zebra supports @command{prefix-list} and @command{route-map} to match
267routes received from other quagga components. The
268@command{permit}/@command{deny} facilities provided by these commands
269can be used to filter which routes zebra will install in the kernel.
270
271@deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {}
272Apply a route-map filter to routes for the specified protocol. @var{protocol}
273can be @b{any} or one of
274@b{system},
275@b{kernel},
276@b{connected},
277@b{static},
278@b{rip},
279@b{ripng},
280@b{ospf},
281@b{ospf6},
282@b{isis},
283@b{bgp},
284@b{hsls}.
285@end deffn
286
287@deffn {Route Map} {set src @var{address}}
288Within a route-map, set the preferred source address for matching routes
289when installing in the kernel.
290@end deffn
291
292@example
293The following creates a prefix-list that matches all addresses, a route-map
294that sets the preferred source address, and applies the route-map to all
295@command{rip} routes.
296
297@group
298ip prefix-list ANY permit 0.0.0.0/0 le 32
299route-map RM1 permit 10
300 match ip address prefix-list ANY
301 set src 10.0.0.1
302
303ip protocol rip route-map RM1
304@end group
305@end example
306
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +0000307@node zebra FIB push interface
308@section zebra FIB push interface
309
310Zebra supports a 'FIB push' interface that allows an external
311component to learn the forwarding information computed by the Quagga
312routing suite.
313
314In Quagga, the Routing Information Base (RIB) resides inside
315zebra. Routing protocols communicate their best routes to zebra, and
316zebra computes the best route across protocols for each prefix. This
317latter information makes up the Forwarding Information Base
318(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
319the kernel to forward packets according to the routes computed by
320Quagga. The kernel FIB is updated in an OS-specific way. For example,
321the @code{netlink} interface is used on Linux, and route sockets are
322used on FreeBSD.
323
324The FIB push interface aims to provide a cross-platform mechanism to
325support scenarios where the router has a forwarding path that is
326distinct from the kernel, commonly a hardware-based fast path. In
327these cases, the FIB needs to be maintained reliably in the fast path
328as well. We refer to the component that programs the forwarding plane
329(directly or indirectly) as the Forwarding Plane Manager or FPM.
330
331The FIB push interface comprises of a TCP connection between zebra and
332the FPM. The connection is initiated by zebra -- that is, the FPM acts
333as the TCP server.
334
335The relevant zebra code kicks in when zebra is configured with the
336@code{--enable-fpm} flag. Zebra periodically attempts to connect to
337the well-known FPM port. Once the connection is up, zebra starts
338sending messages containing routes over the socket to the FPM. Zebra
339sends a complete copy of the forwarding table to the FPM, including
340routes that it may have picked up from the kernel. The existing
341interaction of zebra with the kernel remains unchanged -- that is, the
342kernel continues to receive FIB updates as before.
343
344The format of the messages exchanged with the FPM is defined by the
345file @file{fpm/fpm.h} in the quagga tree.
346
347The zebra FPM interface uses replace semantics. That is, if a 'route
348add' message for a prefix is followed by another 'route add' message,
349the information in the second message is complete by itself, and
350replaces the information sent in the first message.
351
352If the connection to the FPM goes down for some reason, zebra sends
353the FPM a complete copy of the forwarding table(s) when it reconnects.
354
paul76b89b42004-11-06 17:13:09 +0000355@node zebra Terminal Mode Commands
paul718e3742002-12-13 20:15:29 +0000356@section zebra Terminal Mode Commands
357
358@deffn Command {show ip route} {}
359Display current routes which zebra holds in its database.
360
361@example
362@group
363Router# show ip route
364Codes: K - kernel route, C - connected, S - static, R - RIP,
365 B - BGP * - FIB route.
366
367K* 0.0.0.0/0 203.181.89.241
368S 0.0.0.0/0 203.181.89.1
369C* 127.0.0.0/8 lo
370C* 203.181.89.240/28 eth0
371@end group
372@end example
373@end deffn
374
375@deffn Command {show ipv6 route} {}
376@end deffn
377
378@deffn Command {show interface} {}
379@end deffn
380
Paul Jakma7514fb72007-05-02 16:05:35 +0000381@deffn Command {show ip prefix-list [@var{name}]} {}
382@end deffn
383
384@deffn Command {show route-map [@var{name}]} {}
385@end deffn
386
387@deffn Command {show ip protocol} {}
388@end deffn
389
paul718e3742002-12-13 20:15:29 +0000390@deffn Command {show ipforward} {}
391Display whether the host's IP forwarding function is enabled or not.
392Almost any UNIX kernel can be configured with IP forwarding disabled.
393If so, the box can't work as a router.
394@end deffn
395
396@deffn Command {show ipv6forward} {}
397Display whether the host's IP v6 forwarding is enabled or not.
398@end deffn
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +0000399
400@deffn Command {show zebra fpm stats} {}
401Display statistics related to the zebra code that interacts with the
402optional Forwarding Plane Manager (FPM) component.
403@end deffn
404
405@deffn Command {clear zebra fpm stats} {}
406Reset statistics related to the zebra code that interacts with the
407optional Forwarding Plane Manager (FPM) component.
408@end deffn