]> git.proxmox.com Git - mirror_frr.git/blame - doc/main.texi
[zebra] Routemap support on received routes, with 'set src' command (linux)
[mirror_frr.git] / doc / main.texi
CommitLineData
718e3744 1@node Zebra
718e3744 2@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
7514fb77 13* zebra Route Filtering:: Commands for zebra route filtering
718e3744 14* zebra Terminal Mode Commands:: Commands for zebra's VTY
15@end menu
16
17
76b89b4a 18@node Invoking zebra
718e3744 19@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
718e3744 34@item -r
35@itemx --retain
36When program terminates, retain routes added by zebra.
37
38@end table
39
76b89b4a 40@node Interface Commands
718e3744 41@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
971a4497 51@deffn {Interface Command} {ip address @var{address/prefix}} {}
52@deffnx {Interface Command} {ip6 address @var{address/prefix}} {}
53@deffnx {Interface Command} {no ip address @var{address/prefix}} {}
54@deffnx {Interface Command} {no ip6 address @var{address/prefix}} {}
55Set 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.
718e3744 62@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>} {}
971a4497 75Set 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
c3eab60e
PJ
83only Linux and Solaris, and only where network interface drivers support reporting
84link-state via the IFF_RUNNING flag.
718e3744 85@end deffn
86
76b89b4a 87@node Static Route Commands
718e3744 88@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
971a4497 97is treated as an interface name. If the interface name is @var{null0} then
98zebra installs a blackhole route.
718e3744 99
100@example
101ip route 10.0.0.0/8 10.0.0.2
102ip route 10.0.0.0/8 ppp0
971a4497 103ip route 10.0.0.0/8 null0
718e3744 104@end example
105
106First example defines 10.0.0.0/8 static route with gateway 10.0.0.2.
971a4497 107Second one defines the same prefix but with gateway to interface ppp0. The
108third install a blackhole route.
718e3744 109@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
971a4497 119ip route 10.0.0.0 255.255.255.0 null0
718e3744 120@end example
121
971a4497 122These statements are equivalent to those in the previous example.
718e3744 123@end deffn
124
125@deffn Command {ip route @var{network} @var{gateway} @var{distance}} {}
971a4497 126Installs the route with the specified distance.
718e3744 127@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
971a4497 140If 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
718e3744 144@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
971a4497 151@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
718e3744 156
971a4497 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:
718e3744 161
971a4497 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
718e3744 173
971a4497 174@deffn Command {ipv6 route @var{network} @var{gateway}} {}
175@deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {}
176These behave similarly to their ipv4 counterparts.
718e3744 177@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
7514fb77
PJ
187@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
76b89b4a 230@node zebra Terminal Mode Commands
718e3744 231@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
7514fb77
PJ
256@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
718e3744 265@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