blob: a6bf0d1c93902d89e6591bbe9ab8ace3fe725218 [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
Paul Jakma7514fb72007-05-02 16:05:35 +000013* zebra Route Filtering:: Commands for zebra route filtering
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +000014* zebra FIB push interface:: Interface to optional FPM component
paul718e3742002-12-13 20:15:29 +000015* zebra Terminal Mode Commands:: Commands for zebra's VTY
16@end menu
17
18
paul76b89b42004-11-06 17:13:09 +000019@node Invoking zebra
paul718e3742002-12-13 20:15:29 +000020@section Invoking zebra
21
22Besides the common invocation options (@pxref{Common Invocation Options}), the
23@command{zebra} specific invocation options are listed below.
24
25@table @samp
26@item -b
27@itemx --batch
28Runs in batch mode. @command{zebra} parses configuration file and terminates
29immediately.
30
31@item -k
32@itemx --keep_kernel
33When zebra starts up, don't delete old self inserted routes.
34
paul718e3742002-12-13 20:15:29 +000035@item -r
36@itemx --retain
37When program terminates, retain routes added by zebra.
38
39@end table
40
paul76b89b42004-11-06 17:13:09 +000041@node Interface Commands
paul718e3742002-12-13 20:15:29 +000042@section Interface Commands
43
44@deffn Command {interface @var{ifname}} {}
45@end deffn
46
47@deffn {Interface Command} {shutdown} {}
48@deffnx {Interface Command} {no shutdown} {}
49Up or down the current interface.
50@end deffn
51
paul971a4492003-06-20 01:18:07 +000052@deffn {Interface Command} {ip address @var{address/prefix}} {}
Denis Ovsienkoe6844aa2011-03-18 20:20:53 +030053@deffnx {Interface Command} {ipv6 address @var{address/prefix}} {}
paul971a4492003-06-20 01:18:07 +000054@deffnx {Interface Command} {no ip address @var{address/prefix}} {}
Denis Ovsienkoe6844aa2011-03-18 20:20:53 +030055@deffnx {Interface Command} {no ipv6 address @var{address/prefix}} {}
paul971a4492003-06-20 01:18:07 +000056Set the IPv4 or IPv6 address/prefix for the interface.
57@end deffn
58
59@deffn {Interface Command} {ip address @var{address/prefix} secondary} {}
60@deffnx {Interface Command} {no ip address @var{address/prefix} secondary} {}
61Set the secondary flag for this address. This causes ospfd to not treat the
62address as a distinct subnet.
paul718e3742002-12-13 20:15:29 +000063@end deffn
64
65@deffn {Interface Command} {description @var{description} ...} {}
66Set description for the interface.
67@end deffn
68
69@deffn {Interface Command} {multicast} {}
70@deffnx {Interface Command} {no multicast} {}
71Enable or disables multicast flag for the interface.
72@end deffn
73
74@deffn {Interface Command} {bandwidth <1-10000000>} {}
75@deffnx {Interface Command} {no bandwidth <1-10000000>} {}
paul971a4492003-06-20 01:18:07 +000076Set bandwidth value of the interface in kilobits/sec. This is for
77calculating OSPF cost. This command does not affect the actual device
78configuration.
79@end deffn
80
81@deffn {Interface Command} {link-detect} {}
82@deffnx {Interface Command} {no link-detect} {}
83Enable/disable link-detect on platforms which support this. Currently
Paul Jakmac3eab602006-07-28 04:42:39 +000084only Linux and Solaris, and only where network interface drivers support reporting
85link-state via the IFF_RUNNING flag.
paul718e3742002-12-13 20:15:29 +000086@end deffn
87
paul76b89b42004-11-06 17:13:09 +000088@node Static Route Commands
paul718e3742002-12-13 20:15:29 +000089@section Static Route Commands
90
91Static routing is a very fundamental feature of routing technology. It
92defines static prefix and gateway.
93
94@deffn Command {ip route @var{network} @var{gateway}} {}
95@var{network} is destination prefix with format of A.B.C.D/M.
96@var{gateway} is gateway for the prefix. When @var{gateway} is
97A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it
paul971a4492003-06-20 01:18:07 +000098is treated as an interface name. If the interface name is @var{null0} then
99zebra installs a blackhole route.
paul718e3742002-12-13 20:15:29 +0000100
101@example
102ip route 10.0.0.0/8 10.0.0.2
103ip route 10.0.0.0/8 ppp0
paul971a4492003-06-20 01:18:07 +0000104ip route 10.0.0.0/8 null0
paul718e3742002-12-13 20:15:29 +0000105@end example
106
107First example defines 10.0.0.0/8 static route with gateway 10.0.0.2.
paul971a4492003-06-20 01:18:07 +0000108Second one defines the same prefix but with gateway to interface ppp0. The
109third install a blackhole route.
paul718e3742002-12-13 20:15:29 +0000110@end deffn
111
112@deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {}
113This is alternate version of above command. When @var{network} is
114A.B.C.D format, user must define @var{netmask} value with A.B.C.D
115format. @var{gateway} is same option as above command
116
117@example
118ip route 10.0.0.0 255.255.255.0 10.0.0.2
119ip route 10.0.0.0 255.255.255.0 ppp0
paul971a4492003-06-20 01:18:07 +0000120ip route 10.0.0.0 255.255.255.0 null0
paul718e3742002-12-13 20:15:29 +0000121@end example
122
paul971a4492003-06-20 01:18:07 +0000123These statements are equivalent to those in the previous example.
paul718e3742002-12-13 20:15:29 +0000124@end deffn
125
126@deffn Command {ip route @var{network} @var{gateway} @var{distance}} {}
paul971a4492003-06-20 01:18:07 +0000127Installs the route with the specified distance.
paul718e3742002-12-13 20:15:29 +0000128@end deffn
129
130Multiple nexthop static route
131
132@example
133ip route 10.0.0.1/32 10.0.0.2
134ip route 10.0.0.1/32 10.0.0.3
135ip route 10.0.0.1/32 eth0
136@end example
137
138If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
139is reachable, then the last route is installed into the kernel.
140
paul971a4492003-06-20 01:18:07 +0000141If zebra has been compiled with multipath support, and both 10.0.0.2 and
14210.0.0.3 are reachable, zebra will install a multipath route via both
143nexthops, if the platform supports this.
144
paul718e3742002-12-13 20:15:29 +0000145@example
146zebra> show ip route
147S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive
148 via 10.0.0.3 inactive
149 * is directly connected, eth0
150@end example
151
paul971a4492003-06-20 01:18:07 +0000152@example
153ip route 10.0.0.0/8 10.0.0.2
154ip route 10.0.0.0/8 10.0.0.3
155ip route 10.0.0.0/8 null0 255
156@end example
157
158This will install a multihop route via the specified next-hops if they are
159reachable, as well as a high-metric blackhole route, which can be useful to
160prevent traffic destined for a prefix to match less-specific routes (eg
161default) should the specified gateways not be reachable. Eg:
162
163@example
164zebra> show ip route 10.0.0.0/8
165Routing entry for 10.0.0.0/8
166 Known via "static", distance 1, metric 0
167 10.0.0.2 inactive
168 10.0.0.3 inactive
169
170Routing entry for 10.0.0.0/8
171 Known via "static", distance 255, metric 0
172 directly connected, Null0
173@end example
paul718e3742002-12-13 20:15:29 +0000174
175@deffn Command {ipv6 route @var{network} @var{gateway}} {}
paul971a4492003-06-20 01:18:07 +0000176@deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {}
177These behave similarly to their ipv4 counterparts.
paul718e3742002-12-13 20:15:29 +0000178@end deffn
179
180
181@deffn Command {table @var{tableno}} {}
182Select the primary kernel routing table to be used. This only works
183for kernels supporting multiple routing tables (like GNU/Linux 2.2.x
184and later). After setting @var{tableno} with this command,
185static routes defined after this are added to the specified table.
186@end deffn
187
Paul Jakma7514fb72007-05-02 16:05:35 +0000188@node zebra Route Filtering
189@section zebra Route Filtering
190Zebra supports @command{prefix-list} and @command{route-map} to match
191routes received from other quagga components. The
192@command{permit}/@command{deny} facilities provided by these commands
193can be used to filter which routes zebra will install in the kernel.
194
195@deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {}
196Apply a route-map filter to routes for the specified protocol. @var{protocol}
197can be @b{any} or one of
198@b{system},
199@b{kernel},
200@b{connected},
201@b{static},
202@b{rip},
203@b{ripng},
204@b{ospf},
205@b{ospf6},
206@b{isis},
207@b{bgp},
208@b{hsls}.
209@end deffn
210
211@deffn {Route Map} {set src @var{address}}
212Within a route-map, set the preferred source address for matching routes
213when installing in the kernel.
214@end deffn
215
216@example
217The following creates a prefix-list that matches all addresses, a route-map
218that sets the preferred source address, and applies the route-map to all
219@command{rip} routes.
220
221@group
222ip prefix-list ANY permit 0.0.0.0/0 le 32
223route-map RM1 permit 10
224 match ip address prefix-list ANY
225 set src 10.0.0.1
226
227ip protocol rip route-map RM1
228@end group
229@end example
230
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +0000231@node zebra FIB push interface
232@section zebra FIB push interface
233
234Zebra supports a 'FIB push' interface that allows an external
235component to learn the forwarding information computed by the Quagga
236routing suite.
237
238In Quagga, the Routing Information Base (RIB) resides inside
239zebra. Routing protocols communicate their best routes to zebra, and
240zebra computes the best route across protocols for each prefix. This
241latter information makes up the Forwarding Information Base
242(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in
243the kernel to forward packets according to the routes computed by
244Quagga. The kernel FIB is updated in an OS-specific way. For example,
245the @code{netlink} interface is used on Linux, and route sockets are
246used on FreeBSD.
247
248The FIB push interface aims to provide a cross-platform mechanism to
249support scenarios where the router has a forwarding path that is
250distinct from the kernel, commonly a hardware-based fast path. In
251these cases, the FIB needs to be maintained reliably in the fast path
252as well. We refer to the component that programs the forwarding plane
253(directly or indirectly) as the Forwarding Plane Manager or FPM.
254
255The FIB push interface comprises of a TCP connection between zebra and
256the FPM. The connection is initiated by zebra -- that is, the FPM acts
257as the TCP server.
258
259The relevant zebra code kicks in when zebra is configured with the
260@code{--enable-fpm} flag. Zebra periodically attempts to connect to
261the well-known FPM port. Once the connection is up, zebra starts
262sending messages containing routes over the socket to the FPM. Zebra
263sends a complete copy of the forwarding table to the FPM, including
264routes that it may have picked up from the kernel. The existing
265interaction of zebra with the kernel remains unchanged -- that is, the
266kernel continues to receive FIB updates as before.
267
268The format of the messages exchanged with the FPM is defined by the
269file @file{fpm/fpm.h} in the quagga tree.
270
271The zebra FPM interface uses replace semantics. That is, if a 'route
272add' message for a prefix is followed by another 'route add' message,
273the information in the second message is complete by itself, and
274replaces the information sent in the first message.
275
276If the connection to the FPM goes down for some reason, zebra sends
277the FPM a complete copy of the forwarding table(s) when it reconnects.
278
paul76b89b42004-11-06 17:13:09 +0000279@node zebra Terminal Mode Commands
paul718e3742002-12-13 20:15:29 +0000280@section zebra Terminal Mode Commands
281
282@deffn Command {show ip route} {}
283Display current routes which zebra holds in its database.
284
285@example
286@group
287Router# show ip route
288Codes: K - kernel route, C - connected, S - static, R - RIP,
289 B - BGP * - FIB route.
290
291K* 0.0.0.0/0 203.181.89.241
292S 0.0.0.0/0 203.181.89.1
293C* 127.0.0.0/8 lo
294C* 203.181.89.240/28 eth0
295@end group
296@end example
297@end deffn
298
299@deffn Command {show ipv6 route} {}
300@end deffn
301
302@deffn Command {show interface} {}
303@end deffn
304
Paul Jakma7514fb72007-05-02 16:05:35 +0000305@deffn Command {show ip prefix-list [@var{name}]} {}
306@end deffn
307
308@deffn Command {show route-map [@var{name}]} {}
309@end deffn
310
311@deffn Command {show ip protocol} {}
312@end deffn
313
paul718e3742002-12-13 20:15:29 +0000314@deffn Command {show ipforward} {}
315Display whether the host's IP forwarding function is enabled or not.
316Almost any UNIX kernel can be configured with IP forwarding disabled.
317If so, the box can't work as a router.
318@end deffn
319
320@deffn Command {show ipv6forward} {}
321Display whether the host's IP v6 forwarding is enabled or not.
322@end deffn
Avneesh Sachdevb9c24cd2012-11-13 22:49:00 +0000323
324@deffn Command {show zebra fpm stats} {}
325Display statistics related to the zebra code that interacts with the
326optional Forwarding Plane Manager (FPM) component.
327@end deffn
328
329@deffn Command {clear zebra fpm stats} {}
330Reset statistics related to the zebra code that interacts with the
331optional Forwarding Plane Manager (FPM) component.
332@end deffn