]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | @node Zebra |
718e3744 | 2 | @chapter Zebra |
3 | ||
4 | @c SYNOPSIS | |
5 | @command{zebra} is an IP routing manager. It provides kernel routing | |
6 | table updates, interface lookups, and redistribution of routes between | |
7 | different 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 | ||
21 | Besides 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 | |
27 | Runs in batch mode. @command{zebra} parses configuration file and terminates | |
28 | immediately. | |
29 | ||
30 | @item -k | |
31 | @itemx --keep_kernel | |
32 | When zebra starts up, don't delete old self inserted routes. | |
33 | ||
718e3744 | 34 | @item -r |
35 | @itemx --retain | |
36 | When 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} {} | |
48 | Up 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}} {} | |
55 | Set 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} {} | |
60 | Set the secondary flag for this address. This causes ospfd to not treat the | |
61 | address as a distinct subnet. | |
718e3744 | 62 | @end deffn |
63 | ||
64 | @deffn {Interface Command} {description @var{description} ...} {} | |
65 | Set description for the interface. | |
66 | @end deffn | |
67 | ||
68 | @deffn {Interface Command} {multicast} {} | |
69 | @deffnx {Interface Command} {no multicast} {} | |
70 | Enable 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 | 75 | Set bandwidth value of the interface in kilobits/sec. This is for |
76 | calculating OSPF cost. This command does not affect the actual device | |
77 | configuration. | |
78 | @end deffn | |
79 | ||
80 | @deffn {Interface Command} {link-detect} {} | |
81 | @deffnx {Interface Command} {no link-detect} {} | |
82 | Enable/disable link-detect on platforms which support this. Currently | |
c3eab60e PJ |
83 | only Linux and Solaris, and only where network interface drivers support reporting |
84 | link-state via the IFF_RUNNING flag. | |
718e3744 | 85 | @end deffn |
86 | ||
76b89b4a | 87 | @node Static Route Commands |
718e3744 | 88 | @section Static Route Commands |
89 | ||
90 | Static routing is a very fundamental feature of routing technology. It | |
91 | defines 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 | |
96 | A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it | |
971a4497 | 97 | is treated as an interface name. If the interface name is @var{null0} then |
98 | zebra installs a blackhole route. | |
718e3744 | 99 | |
100 | @example | |
101 | ip route 10.0.0.0/8 10.0.0.2 | |
102 | ip route 10.0.0.0/8 ppp0 | |
971a4497 | 103 | ip route 10.0.0.0/8 null0 |
718e3744 | 104 | @end example |
105 | ||
106 | First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. | |
971a4497 | 107 | Second one defines the same prefix but with gateway to interface ppp0. The |
108 | third install a blackhole route. | |
718e3744 | 109 | @end deffn |
110 | ||
111 | @deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {} | |
112 | This is alternate version of above command. When @var{network} is | |
113 | A.B.C.D format, user must define @var{netmask} value with A.B.C.D | |
114 | format. @var{gateway} is same option as above command | |
115 | ||
116 | @example | |
117 | ip route 10.0.0.0 255.255.255.0 10.0.0.2 | |
118 | ip route 10.0.0.0 255.255.255.0 ppp0 | |
971a4497 | 119 | ip route 10.0.0.0 255.255.255.0 null0 |
718e3744 | 120 | @end example |
121 | ||
971a4497 | 122 | These 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 | 126 | Installs the route with the specified distance. |
718e3744 | 127 | @end deffn |
128 | ||
129 | Multiple nexthop static route | |
130 | ||
131 | @example | |
132 | ip route 10.0.0.1/32 10.0.0.2 | |
133 | ip route 10.0.0.1/32 10.0.0.3 | |
134 | ip route 10.0.0.1/32 eth0 | |
135 | @end example | |
136 | ||
137 | If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 | |
138 | is reachable, then the last route is installed into the kernel. | |
139 | ||
971a4497 | 140 | If zebra has been compiled with multipath support, and both 10.0.0.2 and |
141 | 10.0.0.3 are reachable, zebra will install a multipath route via both | |
142 | nexthops, if the platform supports this. | |
143 | ||
718e3744 | 144 | @example |
145 | zebra> show ip route | |
146 | S> 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 |
152 | ip route 10.0.0.0/8 10.0.0.2 | |
153 | ip route 10.0.0.0/8 10.0.0.3 | |
154 | ip route 10.0.0.0/8 null0 255 | |
155 | @end example | |
718e3744 | 156 | |
971a4497 | 157 | This will install a multihop route via the specified next-hops if they are |
158 | reachable, as well as a high-metric blackhole route, which can be useful to | |
159 | prevent traffic destined for a prefix to match less-specific routes (eg | |
160 | default) should the specified gateways not be reachable. Eg: | |
718e3744 | 161 | |
971a4497 | 162 | @example |
163 | zebra> show ip route 10.0.0.0/8 | |
164 | Routing 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 | ||
169 | Routing 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}} {} | |
176 | These behave similarly to their ipv4 counterparts. | |
718e3744 | 177 | @end deffn |
178 | ||
179 | ||
180 | @deffn Command {table @var{tableno}} {} | |
181 | Select the primary kernel routing table to be used. This only works | |
182 | for kernels supporting multiple routing tables (like GNU/Linux 2.2.x | |
183 | and later). After setting @var{tableno} with this command, | |
184 | static 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 | |
189 | Zebra supports @command{prefix-list} and @command{route-map} to match | |
190 | routes received from other quagga components. The | |
191 | @command{permit}/@command{deny} facilities provided by these commands | |
192 | can be used to filter which routes zebra will install in the kernel. | |
193 | ||
194 | @deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {} | |
195 | Apply a route-map filter to routes for the specified protocol. @var{protocol} | |
196 | can 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}} | |
211 | Within a route-map, set the preferred source address for matching routes | |
212 | when installing in the kernel. | |
213 | @end deffn | |
214 | ||
215 | @example | |
216 | The following creates a prefix-list that matches all addresses, a route-map | |
217 | that sets the preferred source address, and applies the route-map to all | |
218 | @command{rip} routes. | |
219 | ||
220 | @group | |
221 | ip prefix-list ANY permit 0.0.0.0/0 le 32 | |
222 | route-map RM1 permit 10 | |
223 | match ip address prefix-list ANY | |
224 | set src 10.0.0.1 | |
225 | ||
226 | ip 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} {} | |
234 | Display current routes which zebra holds in its database. | |
235 | ||
236 | @example | |
237 | @group | |
238 | Router# show ip route | |
239 | Codes: K - kernel route, C - connected, S - static, R - RIP, | |
240 | B - BGP * - FIB route. | |
241 | ||
242 | K* 0.0.0.0/0 203.181.89.241 | |
243 | S 0.0.0.0/0 203.181.89.1 | |
244 | C* 127.0.0.0/8 lo | |
245 | C* 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} {} |
266 | Display whether the host's IP forwarding function is enabled or not. | |
267 | Almost any UNIX kernel can be configured with IP forwarding disabled. | |
268 | If so, the box can't work as a router. | |
269 | @end deffn | |
270 | ||
271 | @deffn Command {show ipv6forward} {} | |
272 | Display whether the host's IP v6 forwarding is enabled or not. | |
273 | @end deffn |