blob: a57591377af8096bc5f951b401f98e035a0c1512 [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
paul718e3742002-12-13 20:15:29 +000014* zebra Terminal Mode Commands:: Commands for zebra's VTY
15@end menu
16
17
paul76b89b42004-11-06 17:13:09 +000018@node Invoking zebra
paul718e3742002-12-13 20:15:29 +000019@section Invoking zebra
20
21Besides the common invocation options (@pxref{Common Invocation Options}), the
22@command{zebra} specific invocation options are listed below.
23
24@table @samp
25@item -b
26@itemx --batch
27Runs in batch mode. @command{zebra} parses configuration file and terminates
28immediately.
29
30@item -k
31@itemx --keep_kernel
32When zebra starts up, don't delete old self inserted routes.
33
paul718e3742002-12-13 20:15:29 +000034@item -r
35@itemx --retain
36When program terminates, retain routes added by zebra.
37
38@end table
39
paul76b89b42004-11-06 17:13:09 +000040@node Interface Commands
paul718e3742002-12-13 20:15:29 +000041@section Interface Commands
42
43@deffn Command {interface @var{ifname}} {}
44@end deffn
45
46@deffn {Interface Command} {shutdown} {}
47@deffnx {Interface Command} {no shutdown} {}
48Up or down the current interface.
49@end deffn
50
paul971a4492003-06-20 01:18:07 +000051@deffn {Interface Command} {ip address @var{address/prefix}} {}
Denis Ovsienkof6680532011-03-18 20:20:53 +030052@deffnx {Interface Command} {ipv6 address @var{address/prefix}} {}
paul971a4492003-06-20 01:18:07 +000053@deffnx {Interface Command} {no ip address @var{address/prefix}} {}
Denis Ovsienkof6680532011-03-18 20:20:53 +030054@deffnx {Interface Command} {no ipv6 address @var{address/prefix}} {}
paul971a4492003-06-20 01:18:07 +000055Set the IPv4 or IPv6 address/prefix for the interface.
56@end deffn
57
58@deffn {Interface Command} {ip address @var{address/prefix} secondary} {}
59@deffnx {Interface Command} {no ip address @var{address/prefix} secondary} {}
60Set the secondary flag for this address. This causes ospfd to not treat the
61address as a distinct subnet.
paul718e3742002-12-13 20:15:29 +000062@end deffn
63
64@deffn {Interface Command} {description @var{description} ...} {}
65Set description for the interface.
66@end deffn
67
68@deffn {Interface Command} {multicast} {}
69@deffnx {Interface Command} {no multicast} {}
70Enable or disables multicast flag for the interface.
71@end deffn
72
73@deffn {Interface Command} {bandwidth <1-10000000>} {}
74@deffnx {Interface Command} {no bandwidth <1-10000000>} {}
paul971a4492003-06-20 01:18:07 +000075Set bandwidth value of the interface in kilobits/sec. This is for
76calculating OSPF cost. This command does not affect the actual device
77configuration.
78@end deffn
79
80@deffn {Interface Command} {link-detect} {}
81@deffnx {Interface Command} {no link-detect} {}
82Enable/disable link-detect on platforms which support this. Currently
Paul Jakmac3eab602006-07-28 04:42:39 +000083only Linux and Solaris, and only where network interface drivers support reporting
84link-state via the IFF_RUNNING flag.
paul718e3742002-12-13 20:15:29 +000085@end deffn
86
paul76b89b42004-11-06 17:13:09 +000087@node Static Route Commands
paul718e3742002-12-13 20:15:29 +000088@section Static Route Commands
89
90Static routing is a very fundamental feature of routing technology. It
91defines static prefix and gateway.
92
93@deffn Command {ip route @var{network} @var{gateway}} {}
94@var{network} is destination prefix with format of A.B.C.D/M.
95@var{gateway} is gateway for the prefix. When @var{gateway} is
96A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it
paul971a4492003-06-20 01:18:07 +000097is treated as an interface name. If the interface name is @var{null0} then
98zebra installs a blackhole route.
paul718e3742002-12-13 20:15:29 +000099
100@example
101ip route 10.0.0.0/8 10.0.0.2
102ip route 10.0.0.0/8 ppp0
paul971a4492003-06-20 01:18:07 +0000103ip route 10.0.0.0/8 null0
paul718e3742002-12-13 20:15:29 +0000104@end example
105
106First example defines 10.0.0.0/8 static route with gateway 10.0.0.2.
paul971a4492003-06-20 01:18:07 +0000107Second one defines the same prefix but with gateway to interface ppp0. The
108third install a blackhole route.
paul718e3742002-12-13 20:15:29 +0000109@end deffn
110
111@deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {}
112This is alternate version of above command. When @var{network} is
113A.B.C.D format, user must define @var{netmask} value with A.B.C.D
114format. @var{gateway} is same option as above command
115
116@example
117ip route 10.0.0.0 255.255.255.0 10.0.0.2
118ip route 10.0.0.0 255.255.255.0 ppp0
paul971a4492003-06-20 01:18:07 +0000119ip route 10.0.0.0 255.255.255.0 null0
paul718e3742002-12-13 20:15:29 +0000120@end example
121
paul971a4492003-06-20 01:18:07 +0000122These statements are equivalent to those in the previous example.
paul718e3742002-12-13 20:15:29 +0000123@end deffn
124
125@deffn Command {ip route @var{network} @var{gateway} @var{distance}} {}
paul971a4492003-06-20 01:18:07 +0000126Installs the route with the specified distance.
paul718e3742002-12-13 20:15:29 +0000127@end deffn
128
129Multiple nexthop static route
130
131@example
132ip route 10.0.0.1/32 10.0.0.2
133ip route 10.0.0.1/32 10.0.0.3
134ip route 10.0.0.1/32 eth0
135@end example
136
137If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0
138is reachable, then the last route is installed into the kernel.
139
paul971a4492003-06-20 01:18:07 +0000140If zebra has been compiled with multipath support, and both 10.0.0.2 and
14110.0.0.3 are reachable, zebra will install a multipath route via both
142nexthops, if the platform supports this.
143
paul718e3742002-12-13 20:15:29 +0000144@example
145zebra> show ip route
146S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive
147 via 10.0.0.3 inactive
148 * is directly connected, eth0
149@end example
150
paul971a4492003-06-20 01:18:07 +0000151@example
152ip route 10.0.0.0/8 10.0.0.2
153ip route 10.0.0.0/8 10.0.0.3
154ip route 10.0.0.0/8 null0 255
155@end example
156
157This will install a multihop route via the specified next-hops if they are
158reachable, as well as a high-metric blackhole route, which can be useful to
159prevent traffic destined for a prefix to match less-specific routes (eg
160default) should the specified gateways not be reachable. Eg:
161
162@example
163zebra> show ip route 10.0.0.0/8
164Routing entry for 10.0.0.0/8
165 Known via "static", distance 1, metric 0
166 10.0.0.2 inactive
167 10.0.0.3 inactive
168
169Routing entry for 10.0.0.0/8
170 Known via "static", distance 255, metric 0
171 directly connected, Null0
172@end example
paul718e3742002-12-13 20:15:29 +0000173
174@deffn Command {ipv6 route @var{network} @var{gateway}} {}
paul971a4492003-06-20 01:18:07 +0000175@deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {}
176These behave similarly to their ipv4 counterparts.
paul718e3742002-12-13 20:15:29 +0000177@end deffn
178
179
180@deffn Command {table @var{tableno}} {}
181Select the primary kernel routing table to be used. This only works
182for kernels supporting multiple routing tables (like GNU/Linux 2.2.x
183and later). After setting @var{tableno} with this command,
184static routes defined after this are added to the specified table.
185@end deffn
186
Paul Jakma7514fb72007-05-02 16:05:35 +0000187@node zebra Route Filtering
188@section zebra Route Filtering
189Zebra supports @command{prefix-list} and @command{route-map} to match
190routes received from other quagga components. The
191@command{permit}/@command{deny} facilities provided by these commands
192can be used to filter which routes zebra will install in the kernel.
193
194@deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {}
195Apply a route-map filter to routes for the specified protocol. @var{protocol}
196can be @b{any} or one of
197@b{system},
198@b{kernel},
199@b{connected},
200@b{static},
201@b{rip},
202@b{ripng},
203@b{ospf},
204@b{ospf6},
205@b{isis},
206@b{bgp},
207@b{hsls}.
208@end deffn
209
210@deffn {Route Map} {set src @var{address}}
211Within a route-map, set the preferred source address for matching routes
212when installing in the kernel.
213@end deffn
214
215@example
216The following creates a prefix-list that matches all addresses, a route-map
217that sets the preferred source address, and applies the route-map to all
218@command{rip} routes.
219
220@group
221ip prefix-list ANY permit 0.0.0.0/0 le 32
222route-map RM1 permit 10
223 match ip address prefix-list ANY
224 set src 10.0.0.1
225
226ip protocol rip route-map RM1
227@end group
228@end example
229
paul76b89b42004-11-06 17:13:09 +0000230@node zebra Terminal Mode Commands
paul718e3742002-12-13 20:15:29 +0000231@section zebra Terminal Mode Commands
232
233@deffn Command {show ip route} {}
234Display current routes which zebra holds in its database.
235
236@example
237@group
238Router# show ip route
239Codes: K - kernel route, C - connected, S - static, R - RIP,
240 B - BGP * - FIB route.
241
242K* 0.0.0.0/0 203.181.89.241
243S 0.0.0.0/0 203.181.89.1
244C* 127.0.0.0/8 lo
245C* 203.181.89.240/28 eth0
246@end group
247@end example
248@end deffn
249
250@deffn Command {show ipv6 route} {}
251@end deffn
252
253@deffn Command {show interface} {}
254@end deffn
255
Paul Jakma7514fb72007-05-02 16:05:35 +0000256@deffn Command {show ip prefix-list [@var{name}]} {}
257@end deffn
258
259@deffn Command {show route-map [@var{name}]} {}
260@end deffn
261
262@deffn Command {show ip protocol} {}
263@end deffn
264
paul718e3742002-12-13 20:15:29 +0000265@deffn Command {show ipforward} {}
266Display whether the host's IP forwarding function is enabled or not.
267Almost any UNIX kernel can be configured with IP forwarding disabled.
268If so, the box can't work as a router.
269@end deffn
270
271@deffn Command {show ipv6forward} {}
272Display whether the host's IP v6 forwarding is enabled or not.
273@end deffn