]>
Commit | Line | Data |
---|---|---|
0efdf0fe | 1 | .. _zebra: |
42fc5d26 QY |
2 | |
3 | ***** | |
4 | Zebra | |
5 | ***** | |
6 | ||
d1a242fd | 7 | *zebra* is an IP routing manager. It provides kernel routing |
42fc5d26 QY |
8 | table updates, interface lookups, and redistribution of routes between |
9 | different routing protocols. | |
10 | ||
0efdf0fe | 11 | .. _invoking-zebra: |
42fc5d26 QY |
12 | |
13 | Invoking zebra | |
14 | ============== | |
15 | ||
0efdf0fe | 16 | Besides the common invocation options (:ref:`common-invocation-options`), the |
42fc5d26 QY |
17 | *zebra* specific invocation options are listed below. |
18 | ||
d1a242fd | 19 | .. program:: zebra |
42fc5d26 | 20 | |
c9365894 | 21 | .. option:: -b, --batch |
42fc5d26 | 22 | |
d1a242fd QY |
23 | Runs in batch mode. *zebra* parses configuration file and terminates |
24 | immediately. | |
42fc5d26 | 25 | |
c9365894 | 26 | .. option:: -k, --keep_kernel |
42fc5d26 | 27 | |
d1a242fd | 28 | When zebra starts up, don't delete old self inserted routes. |
42fc5d26 | 29 | |
c9365894 | 30 | .. option:: -r, --retain |
42fc5d26 | 31 | |
d1a242fd | 32 | When program terminates, retain routes added by zebra. |
42fc5d26 | 33 | |
013f9762 QY |
34 | .. program:: configure |
35 | ||
0efdf0fe | 36 | .. _interface-commands: |
42fc5d26 QY |
37 | |
38 | Interface Commands | |
39 | ================== | |
40 | ||
0efdf0fe | 41 | .. _standard-commands: |
42fc5d26 QY |
42 | |
43 | Standard Commands | |
44 | ----------------- | |
45 | ||
d1a242fd QY |
46 | .. index:: interface IFNAME |
47 | ||
48 | .. clicmd:: interface IFNAME | |
49 | ||
50 | .. index:: shutdown | |
42fc5d26 | 51 | |
d1a242fd QY |
52 | .. clicmd:: shutdown |
53 | .. index:: no shutdown | |
42fc5d26 | 54 | |
d1a242fd | 55 | .. clicmd:: no shutdown |
42fc5d26 | 56 | |
d1a242fd | 57 | Up or down the current interface. |
42fc5d26 | 58 | |
d1a242fd | 59 | .. index:: ip address ADDRESS/PREFIX |
42fc5d26 | 60 | |
d1a242fd QY |
61 | .. clicmd:: ip address ADDRESS/PREFIX |
62 | .. index:: ipv6 address ADDRESS/PREFIX | |
42fc5d26 | 63 | |
d1a242fd QY |
64 | .. clicmd:: ipv6 address ADDRESS/PREFIX |
65 | .. index:: no ip address ADDRESS/PREFIX | |
42fc5d26 | 66 | |
d1a242fd QY |
67 | .. clicmd:: no ip address ADDRESS/PREFIX |
68 | .. index:: no ipv6 address ADDRESS/PREFIX | |
42fc5d26 | 69 | |
d1a242fd | 70 | .. clicmd:: no ipv6 address ADDRESS/PREFIX |
42fc5d26 | 71 | |
d1a242fd | 72 | Set the IPv4 or IPv6 address/prefix for the interface. |
42fc5d26 | 73 | |
d1a242fd | 74 | .. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX |
42fc5d26 | 75 | |
d1a242fd QY |
76 | .. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX |
77 | .. index:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX | |
42fc5d26 | 78 | |
d1a242fd | 79 | .. clicmd:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX |
42fc5d26 | 80 | |
d1e7591e QY |
81 | Configure an IPv4 Point-to-Point address on the interface. (The concept of |
82 | PtP addressing does not exist for IPv6.) | |
42fc5d26 | 83 | |
d1a242fd QY |
84 | `local-addr` has no subnet mask since the local side in PtP addressing is |
85 | always a single (/32) address. `peer-addr/prefix` can be an arbitrary subnet | |
86 | behind the other end of the link (or even on the link in Point-to-Multipoint | |
87 | setups), though generally /32s are used. | |
42fc5d26 | 88 | |
d1a242fd | 89 | .. index:: ip address ADDRESS/PREFIX secondary |
42fc5d26 | 90 | |
d1a242fd QY |
91 | .. clicmd:: ip address ADDRESS/PREFIX secondary |
92 | .. index:: no ip address ADDRESS/PREFIX secondary | |
42fc5d26 | 93 | |
d1a242fd | 94 | .. clicmd:: no ip address ADDRESS/PREFIX secondary |
42fc5d26 | 95 | |
d1a242fd QY |
96 | Set the secondary flag for this address. This causes ospfd to not treat the |
97 | address as a distinct subnet. | |
42fc5d26 | 98 | |
d1a242fd | 99 | .. index:: description DESCRIPTION ... |
42fc5d26 | 100 | |
d1a242fd | 101 | .. clicmd:: description DESCRIPTION ... |
42fc5d26 | 102 | |
d1a242fd | 103 | Set description for the interface. |
42fc5d26 | 104 | |
d1a242fd | 105 | .. index:: multicast |
42fc5d26 | 106 | |
d1a242fd QY |
107 | .. clicmd:: multicast |
108 | .. index:: no multicast | |
42fc5d26 | 109 | |
d1a242fd | 110 | .. clicmd:: no multicast |
42fc5d26 | 111 | |
d1a242fd | 112 | Enable or disables multicast flag for the interface. |
42fc5d26 | 113 | |
d1a242fd | 114 | .. index:: bandwidth (1-10000000) |
42fc5d26 | 115 | |
d1a242fd QY |
116 | .. clicmd:: bandwidth (1-10000000) |
117 | .. index:: no bandwidth (1-10000000) | |
118 | ||
119 | .. clicmd:: no bandwidth (1-10000000) | |
120 | ||
121 | Set bandwidth value of the interface in kilobits/sec. This is for | |
122 | calculating OSPF cost. This command does not affect the actual device | |
123 | configuration. | |
124 | ||
125 | .. index:: link-detect | |
126 | ||
127 | .. clicmd:: link-detect | |
128 | .. index:: no link-detect | |
129 | ||
130 | .. clicmd:: no link-detect | |
131 | ||
132 | Enable/disable link-detect on platforms which support this. Currently only | |
133 | Linux and Solaris, and only where network interface drivers support | |
134 | reporting link-state via the ``IFF_RUNNING`` flag. | |
42fc5d26 | 135 | |
0efdf0fe | 136 | .. _link-parameters-commands: |
42fc5d26 QY |
137 | |
138 | Link Parameters Commands | |
139 | ------------------------ | |
140 | ||
d1a242fd QY |
141 | .. index:: link-params |
142 | .. clicmd:: link-params | |
42fc5d26 | 143 | |
d1a242fd QY |
144 | .. index:: no link-param |
145 | .. clicmd:: no link-param | |
42fc5d26 | 146 | |
d1a242fd QY |
147 | Enter into the link parameters sub node. At least 'enable' must be set to |
148 | activate the link parameters, and consequently Traffic Engineering on this | |
149 | interface. MPLS-TE must be enable at the OSPF | |
0efdf0fe | 150 | (:ref:`ospf-traffic-engineering`) or ISIS (:ref:`isis-traffic-engineering`) |
d1a242fd QY |
151 | router level in complement to this. Disable link parameters for this |
152 | interface. | |
42fc5d26 | 153 | |
d1a242fd | 154 | Under link parameter statement, the following commands set the different TE values: |
42fc5d26 | 155 | |
d1a242fd QY |
156 | .. index:: link-params [enable] |
157 | .. clicmd:: link-params [enable] | |
42fc5d26 | 158 | |
d1a242fd | 159 | Enable link parameters for this interface. |
42fc5d26 | 160 | |
d1a242fd QY |
161 | .. index:: link-params [metric (0-4294967295)] |
162 | .. clicmd:: link-params [metric (0-4294967295)] | |
42fc5d26 | 163 | |
d1a242fd QY |
164 | .. index:: link-params max-bw BANDWIDTH |
165 | .. clicmd:: link-params max-bw BANDWIDTH | |
42fc5d26 | 166 | |
d1a242fd QY |
167 | .. index:: link-params max-rsv-bw BANDWIDTH |
168 | .. clicmd:: link-params max-rsv-bw BANDWIDTH | |
42fc5d26 | 169 | |
d1a242fd QY |
170 | .. index:: link-params unrsv-bw (0-7) BANDWIDTH |
171 | .. clicmd:: link-params unrsv-bw (0-7) BANDWIDTH | |
42fc5d26 | 172 | |
d1a242fd QY |
173 | .. index:: link-params admin-grp BANDWIDTH |
174 | .. clicmd:: link-params admin-grp BANDWIDTH | |
42fc5d26 | 175 | |
d1a242fd QY |
176 | These commands specifies the Traffic Engineering parameters of the interface |
177 | in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively | |
178 | the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth | |
179 | (interface speed by default), Maximum Reservable Bandwidth, Unreserved | |
180 | Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource | |
181 | Class/Color (OSPF). | |
42fc5d26 | 182 | |
d1a242fd QY |
183 | Note that BANDIWDTH is specified in IEEE floating point format and express |
184 | in Bytes/second. | |
42fc5d26 | 185 | |
d1a242fd QY |
186 | .. index:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)] |
187 | .. clicmd:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)] | |
42fc5d26 | 188 | |
d1a242fd QY |
189 | .. index:: link-param delay-variation (0-16777215) |
190 | .. clicmd:: link-param delay-variation (0-16777215) | |
42fc5d26 | 191 | |
d1a242fd QY |
192 | .. index:: link-param packet-loss PERCENTAGE |
193 | .. clicmd:: link-param packet-loss PERCENTAGE | |
42fc5d26 | 194 | |
d1a242fd QY |
195 | .. index:: link-param res-bw BANDWIDTH |
196 | .. clicmd:: link-param res-bw BANDWIDTH | |
42fc5d26 | 197 | |
d1a242fd QY |
198 | .. index:: link-param ava-bw BANDWIDTH |
199 | .. clicmd:: link-param ava-bw BANDWIDTH | |
42fc5d26 | 200 | |
d1a242fd QY |
201 | .. index:: link-param use-bw BANDWIDTH |
202 | .. clicmd:: link-param use-bw BANDWIDTH | |
42fc5d26 | 203 | |
d1e7591e | 204 | These command specifies additional Traffic Engineering parameters of the |
d1a242fd QY |
205 | interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and |
206 | draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the | |
207 | delay, jitter, loss, available bandwidth, reservable bandwidth and utilized | |
208 | bandwidth. | |
42fc5d26 | 209 | |
d1a242fd QY |
210 | Note that BANDWIDTH is specified in IEEE floating point format and express |
211 | in Bytes/second. Delays and delay variation are express in micro-second | |
212 | (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step | |
213 | of 0.000003. | |
42fc5d26 | 214 | |
d1a242fd QY |
215 | .. index:: link-param neighbor <A.B.C.D> as (0-65535) |
216 | .. clicmd:: link-param neighbor <A.B.C.D> as (0-65535) | |
42fc5d26 | 217 | |
d1a242fd QY |
218 | .. index:: link-param no neighbor |
219 | .. clicmd:: link-param no neighbor | |
42fc5d26 | 220 | |
d1a242fd QY |
221 | Specifies the remote ASBR IP address and Autonomous System (AS) number |
222 | for InterASv2 link in OSPF (RFC5392). Note that this option is not yet | |
223 | supported for ISIS (RFC5316). | |
42fc5d26 | 224 | |
0efdf0fe | 225 | .. _static-route-commands: |
42fc5d26 QY |
226 | |
227 | Static Route Commands | |
228 | ===================== | |
229 | ||
d1a242fd | 230 | Static routing is a very fundamental feature of routing technology. It |
42fc5d26 QY |
231 | defines static prefix and gateway. |
232 | ||
d1a242fd QY |
233 | .. index:: ip route NETWORK GATEWAY |
234 | .. clicmd:: ip route NETWORK GATEWAY | |
42fc5d26 | 235 | |
d1a242fd QY |
236 | NETWORK is destination prefix with format of A.B.C.D/M. GATEWAY is gateway |
237 | for the prefix. When GATEWAY is A.B.C.D format. It is taken as a IPv4 | |
238 | address gateway. Otherwise it is treated as an interface name. If the | |
239 | interface name is ``null0`` then zebra installs a blackhole route. | |
42fc5d26 | 240 | |
d1a242fd | 241 | Some example configuration: |
a8c90e15 | 242 | |
9eb95b3b QY |
243 | .. code-block:: frr |
244 | ||
d1a242fd QY |
245 | ip route 10.0.0.0/8 10.0.0.2 |
246 | ip route 10.0.0.0/8 ppp0 | |
247 | ip route 10.0.0.0/8 null0 | |
42fc5d26 | 248 | |
d1a242fd QY |
249 | First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. |
250 | Second one defines the same prefix but with gateway to interface ppp0. The | |
251 | third install a blackhole route. | |
42fc5d26 | 252 | |
d1a242fd QY |
253 | .. index:: ip route NETWORK NETMASK GATEWAY |
254 | .. clicmd:: ip route NETWORK NETMASK GATEWAY | |
42fc5d26 | 255 | |
d1a242fd QY |
256 | This is alternate version of above command. When NETWORK is |
257 | A.B.C.D format, user must define NETMASK value with A.B.C.D | |
258 | format. GATEWAY is same option as above command. | |
42fc5d26 | 259 | |
9eb95b3b | 260 | .. code-block:: frr |
42fc5d26 | 261 | |
d1a242fd QY |
262 | ip route 10.0.0.0 255.255.255.0 10.0.0.2 |
263 | ip route 10.0.0.0 255.255.255.0 ppp0 | |
264 | ip route 10.0.0.0 255.255.255.0 null0 | |
a8c90e15 | 265 | |
42fc5d26 | 266 | |
d1a242fd | 267 | These statements are equivalent to those in the previous example. |
42fc5d26 | 268 | |
d1a242fd QY |
269 | .. index:: ip route NETWORK GATEWAY DISTANCE |
270 | .. clicmd:: ip route NETWORK GATEWAY DISTANCE | |
42fc5d26 | 271 | |
d1a242fd | 272 | Installs the route with the specified distance. |
42fc5d26 | 273 | |
9eb95b3b | 274 | Multiple nexthop static route: |
42fc5d26 | 275 | |
9eb95b3b | 276 | .. code-block:: frr |
42fc5d26 | 277 | |
d1a242fd QY |
278 | ip route 10.0.0.1/32 10.0.0.2 |
279 | ip route 10.0.0.1/32 10.0.0.3 | |
280 | ip route 10.0.0.1/32 eth0 | |
a8c90e15 | 281 | |
42fc5d26 QY |
282 | |
283 | If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 | |
284 | is reachable, then the last route is installed into the kernel. | |
285 | ||
286 | If zebra has been compiled with multipath support, and both 10.0.0.2 and | |
287 | 10.0.0.3 are reachable, zebra will install a multipath route via both | |
288 | nexthops, if the platform supports this. | |
289 | ||
290 | :: | |
291 | ||
d1a242fd QY |
292 | zebra> show ip route |
293 | S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive | |
294 | via 10.0.0.3 inactive | |
295 | * is directly connected, eth0 | |
a8c90e15 | 296 | |
42fc5d26 | 297 | |
9eb95b3b | 298 | .. code-block:: frr |
42fc5d26 | 299 | |
d1a242fd QY |
300 | ip route 10.0.0.0/8 10.0.0.2 |
301 | ip route 10.0.0.0/8 10.0.0.3 | |
302 | ip route 10.0.0.0/8 null0 255 | |
a8c90e15 | 303 | |
42fc5d26 QY |
304 | |
305 | This will install a multihop route via the specified next-hops if they are | |
306 | reachable, as well as a high-metric blackhole route, which can be useful to | |
d1e7591e QY |
307 | prevent traffic destined for a prefix to match less-specific routes (e.g. |
308 | default) should the specified gateways not be reachable. E.g.: | |
42fc5d26 QY |
309 | |
310 | :: | |
311 | ||
d1a242fd QY |
312 | zebra> show ip route 10.0.0.0/8 |
313 | Routing entry for 10.0.0.0/8 | |
314 | Known via "static", distance 1, metric 0 | |
315 | 10.0.0.2 inactive | |
316 | 10.0.0.3 inactive | |
42fc5d26 | 317 | |
d1a242fd QY |
318 | Routing entry for 10.0.0.0/8 |
319 | Known via "static", distance 255, metric 0 | |
320 | directly connected, Null0 | |
a8c90e15 | 321 | |
42fc5d26 | 322 | |
d1a242fd QY |
323 | .. index:: ipv6 route NETWORK GATEWAY |
324 | .. clicmd:: ipv6 route NETWORK GATEWAY | |
42fc5d26 | 325 | |
d1a242fd QY |
326 | .. index:: ipv6 route NETWORK GATEWAY DISTANCE |
327 | .. clicmd:: ipv6 route NETWORK GATEWAY DISTANCE | |
42fc5d26 | 328 | |
d1a242fd | 329 | These behave similarly to their ipv4 counterparts. |
42fc5d26 | 330 | |
d1a242fd QY |
331 | .. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY |
332 | .. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY | |
42fc5d26 | 333 | |
d1a242fd QY |
334 | .. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY DISTANCE |
335 | .. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY DISTANCE | |
42fc5d26 | 336 | |
d1a242fd QY |
337 | Install a static source-specific route. These routes are currently supported |
338 | on Linux operating systems only, and perform AND matching on packet's | |
339 | destination and source addresses in the kernel's forwarding path. Note that | |
340 | destination longest-prefix match is "more important" than source LPM, e.g. | |
341 | *"2001:db8:1::/64 from 2001:db8::/48"* will win over | |
342 | *"2001:db8::/48 from 2001:db8:1::/64"* if both match. | |
42fc5d26 | 343 | |
d1a242fd QY |
344 | .. index:: table TABLENO |
345 | .. clicmd:: table TABLENO | |
42fc5d26 | 346 | |
d1a242fd QY |
347 | Select the primary kernel routing table to be used. This only works |
348 | for kernels supporting multiple routing tables (like GNU/Linux 2.2.x | |
349 | and later). After setting TABLENO with this command, | |
350 | static routes defined after this are added to the specified table. | |
42fc5d26 | 351 | |
0efdf0fe | 352 | .. _multicast-rib-commands: |
42fc5d26 QY |
353 | |
354 | Multicast RIB Commands | |
355 | ====================== | |
356 | ||
357 | The Multicast RIB provides a separate table of unicast destinations which | |
d1a242fd | 358 | is used for Multicast Reverse Path Forwarding decisions. It is used with |
42fc5d26 QY |
359 | a multicast source's IP address, hence contains not multicast group |
360 | addresses but unicast addresses. | |
361 | ||
d1a242fd | 362 | This table is fully separate from the default unicast table. However, |
42fc5d26 QY |
363 | RPF lookup can include the unicast table. |
364 | ||
dc1046f7 | 365 | WARNING: RPF lookup results are non-responsive in this version of FRR, |
42fc5d26 QY |
366 | i.e. multicast routing does not actively react to changes in underlying |
367 | unicast topology! | |
368 | ||
d1a242fd QY |
369 | .. index:: ip multicast rpf-lookup-mode MODE |
370 | .. clicmd:: ip multicast rpf-lookup-mode MODE | |
42fc5d26 | 371 | |
d1a242fd QY |
372 | .. index:: no ip multicast rpf-lookup-mode [MODE] |
373 | .. clicmd:: no ip multicast rpf-lookup-mode [MODE] | |
42fc5d26 | 374 | |
d1a242fd | 375 | MODE sets the method used to perform RPF lookups. Supported modes: |
42fc5d26 | 376 | |
9eb95b3b QY |
377 | urib-only |
378 | Performs the lookup on the Unicast RIB. The Multicast RIB is never used. | |
42fc5d26 | 379 | |
9eb95b3b QY |
380 | mrib-only |
381 | Performs the lookup on the Multicast RIB. The Unicast RIB is never used. | |
42fc5d26 | 382 | |
9eb95b3b QY |
383 | mrib-then-urib |
384 | Tries to perform the lookup on the Multicast RIB. If any route is found, | |
385 | that route is used. Otherwise, the Unicast RIB is tried. | |
42fc5d26 | 386 | |
9eb95b3b QY |
387 | lower-distance |
388 | Performs a lookup on the Multicast RIB and Unicast RIB each. The result | |
389 | with the lower administrative distance is used; if they're equal, the | |
390 | Multicast RIB takes precedence. | |
42fc5d26 | 391 | |
9eb95b3b QY |
392 | longer-prefix |
393 | Performs a lookup on the Multicast RIB and Unicast RIB each. The result | |
394 | with the longer prefix length is used; if they're equal, the | |
395 | Multicast RIB takes precedence. | |
42fc5d26 | 396 | |
9eb95b3b QY |
397 | The `mrib-then-urib` setting is the default behavior if nothing is |
398 | configured. If this is the desired behavior, it should be explicitly | |
399 | configured to make the configuration immune against possible changes in | |
400 | what the default behavior is. | |
42fc5d26 | 401 | |
d1a242fd QY |
402 | .. warning:: |
403 | Unreachable routes do not receive special treatment and do not cause | |
404 | fallback to a second lookup. | |
42fc5d26 | 405 | |
d1a242fd QY |
406 | .. index:: show ip rpf ADDR |
407 | .. clicmd:: show ip rpf ADDR | |
42fc5d26 | 408 | |
d1a242fd QY |
409 | Performs a Multicast RPF lookup, as configured with ``ip multicast |
410 | rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look | |
411 | up. | |
42fc5d26 | 412 | |
d1a242fd | 413 | :: |
42fc5d26 QY |
414 | |
415 | > show ip rpf 192.0.2.1 | |
416 | Routing entry for 192.0.2.0/24 using Unicast RIB | |
d1a242fd QY |
417 | |
418 | Known via "kernel", distance 0, metric 0, best | |
419 | * 198.51.100.1, via eth0 | |
a8c90e15 | 420 | |
42fc5d26 | 421 | |
d1a242fd QY |
422 | Indicates that a multicast source lookup for 192.0.2.1 would use an |
423 | Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1. | |
42fc5d26 | 424 | |
d1a242fd QY |
425 | .. index:: show ip rpf |
426 | .. clicmd:: show ip rpf | |
42fc5d26 | 427 | |
d1a242fd QY |
428 | Prints the entire Multicast RIB. Note that this is independent of the |
429 | configured RPF lookup mode, the Multicast RIB may be printed yet not | |
430 | used at all. | |
42fc5d26 | 431 | |
d1a242fd QY |
432 | .. index:: ip mroute PREFIX NEXTHOP [DISTANCE] |
433 | .. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE] | |
42fc5d26 | 434 | |
d1a242fd QY |
435 | .. index:: no ip mroute PREFIX NEXTHOP [DISTANCE] |
436 | .. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE] | |
42fc5d26 | 437 | |
d1a242fd QY |
438 | Adds a static route entry to the Multicast RIB. This performs exactly as the |
439 | ``ip route`` command, except that it inserts the route in the Multicast RIB | |
440 | instead of the Unicast RIB. | |
42fc5d26 | 441 | |
0efdf0fe | 442 | .. _zebra-route-filtering: |
42fc5d26 QY |
443 | |
444 | zebra Route Filtering | |
445 | ===================== | |
446 | ||
0efdf0fe | 447 | Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes |
013f9762 | 448 | received from other FRR components. The permit/deny facilities provided by |
d1a242fd QY |
449 | these commands can be used to filter which routes zebra will install in the |
450 | kernel. | |
42fc5d26 | 451 | |
d1a242fd QY |
452 | .. index:: ip protocol PROTOCOL route-map ROUTEMAP |
453 | .. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP | |
42fc5d26 | 454 | |
013f9762 QY |
455 | Apply a route-map filter to routes for the specified protocol. PROTOCOL can |
456 | be **any** or one of | |
457 | ||
458 | - system, | |
459 | - kernel, | |
460 | - connected, | |
461 | - static, | |
462 | - rip, | |
463 | - ripng, | |
464 | - ospf, | |
465 | - ospf6, | |
466 | - isis, | |
467 | - bgp, | |
468 | - hsls. | |
d1a242fd QY |
469 | |
470 | .. index:: set src ADDRESS | |
471 | .. clicmd:: set src ADDRESS | |
472 | ||
473 | Within a route-map, set the preferred source address for matching routes | |
474 | when installing in the kernel. | |
475 | ||
476 | ||
477 | The following creates a prefix-list that matches all addresses, a route-map | |
478 | that sets the preferred source address, and applies the route-map to all | |
479 | *rip* routes. | |
480 | ||
9eb95b3b | 481 | .. code-block:: frr |
42fc5d26 | 482 | |
d1a242fd QY |
483 | ip prefix-list ANY permit 0.0.0.0/0 le 32 |
484 | route-map RM1 permit 10 | |
485 | match ip address prefix-list ANY | |
486 | set src 10.0.0.1 | |
42fc5d26 | 487 | |
d1a242fd | 488 | ip protocol rip route-map RM1 |
a8c90e15 | 489 | |
42fc5d26 | 490 | |
0efdf0fe | 491 | .. _zebra-fib-push-interface: |
42fc5d26 QY |
492 | |
493 | zebra FIB push interface | |
494 | ======================== | |
495 | ||
496 | Zebra supports a 'FIB push' interface that allows an external | |
dc1046f7 | 497 | component to learn the forwarding information computed by the FRR |
d1a242fd | 498 | routing suite. This is a loadable module that needs to be enabled |
0efdf0fe | 499 | at startup as described in :ref:`loadable-module-support`. |
42fc5d26 | 500 | |
dc1046f7 | 501 | In FRR, the Routing Information Base (RIB) resides inside |
42fc5d26 QY |
502 | zebra. Routing protocols communicate their best routes to zebra, and |
503 | zebra computes the best route across protocols for each prefix. This | |
504 | latter information makes up the Forwarding Information Base | |
505 | (FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in | |
506 | the kernel to forward packets according to the routes computed by | |
dc1046f7 | 507 | FRR. The kernel FIB is updated in an OS-specific way. For example, |
d1e7591e | 508 | the `Netlink` interface is used on Linux, and route sockets are |
42fc5d26 QY |
509 | used on FreeBSD. |
510 | ||
511 | The FIB push interface aims to provide a cross-platform mechanism to | |
512 | support scenarios where the router has a forwarding path that is | |
513 | distinct from the kernel, commonly a hardware-based fast path. In | |
514 | these cases, the FIB needs to be maintained reliably in the fast path | |
515 | as well. We refer to the component that programs the forwarding plane | |
516 | (directly or indirectly) as the Forwarding Plane Manager or FPM. | |
517 | ||
518 | The FIB push interface comprises of a TCP connection between zebra and | |
519 | the FPM. The connection is initiated by zebra -- that is, the FPM acts | |
520 | as the TCP server. | |
521 | ||
522 | The relevant zebra code kicks in when zebra is configured with the | |
d1a242fd | 523 | :option:`--enable-fpm` flag. Zebra periodically attempts to connect to |
42fc5d26 QY |
524 | the well-known FPM port. Once the connection is up, zebra starts |
525 | sending messages containing routes over the socket to the FPM. Zebra | |
526 | sends a complete copy of the forwarding table to the FPM, including | |
527 | routes that it may have picked up from the kernel. The existing | |
528 | interaction of zebra with the kernel remains unchanged -- that is, the | |
529 | kernel continues to receive FIB updates as before. | |
530 | ||
531 | The encapsulation header for the messages exchanged with the FPM is | |
532 | defined by the file :file:`fpm/fpm.h` in the frr tree. The routes | |
d1e7591e | 533 | themselves are encoded in Netlink or protobuf format, with Netlink |
42fc5d26 QY |
534 | being the default. |
535 | ||
536 | Protobuf is one of a number of new serialization formats wherein the | |
537 | message schema is expressed in a purpose-built language. Code for | |
538 | encoding/decoding to/from the wire format is generated from the | |
539 | schema. Protobuf messages can be extended easily while maintaining | |
540 | backward-compatibility with older code. Protobuf has the following | |
d1e7591e | 541 | advantages over Netlink: |
42fc5d26 | 542 | |
d1a242fd QY |
543 | - Code for serialization/deserialization is generated automatically. This |
544 | reduces the likelihood of bugs, allows third-party programs to be integrated | |
545 | quickly, and makes it easy to add fields. | |
546 | - The message format is not tied to an OS (Linux), and can be evolved | |
42fc5d26 QY |
547 | independently. |
548 | ||
d1e7591e | 549 | As mentioned before, zebra encodes routes sent to the FPM in Netlink |
42fc5d26 | 550 | format by default. The format can be controlled via the FPM module's |
d1e7591e | 551 | load-time option to zebra, which currently takes the values `Netlink` |
42fc5d26 QY |
552 | and `protobuf`. |
553 | ||
554 | The zebra FPM interface uses replace semantics. That is, if a 'route | |
555 | add' message for a prefix is followed by another 'route add' message, | |
556 | the information in the second message is complete by itself, and | |
557 | replaces the information sent in the first message. | |
558 | ||
559 | If the connection to the FPM goes down for some reason, zebra sends | |
560 | the FPM a complete copy of the forwarding table(s) when it reconnects. | |
561 | ||
562 | zebra Terminal Mode Commands | |
563 | ============================ | |
564 | ||
d1a242fd QY |
565 | .. index:: show ip route |
566 | .. clicmd:: show ip route | |
42fc5d26 | 567 | |
d1a242fd | 568 | Display current routes which zebra holds in its database. |
42fc5d26 QY |
569 | |
570 | :: | |
571 | ||
42fc5d26 QY |
572 | Router# show ip route |
573 | Codes: K - kernel route, C - connected, S - static, R - RIP, | |
d1a242fd | 574 | B - BGP * - FIB route. |
42fc5d26 | 575 | |
d1a242fd QY |
576 | K* 0.0.0.0/0 203.181.89.241 |
577 | S 0.0.0.0/0 203.181.89.1 | |
578 | C* 127.0.0.0/8 lo | |
42fc5d26 | 579 | C* 203.181.89.240/28 eth0 |
a8c90e15 | 580 | |
42fc5d26 | 581 | |
d1a242fd QY |
582 | .. index:: show ipv6 route |
583 | .. clicmd:: show ipv6 route | |
42fc5d26 | 584 | |
d1a242fd QY |
585 | .. index:: show interface |
586 | .. clicmd:: show interface | |
42fc5d26 | 587 | |
d1a242fd QY |
588 | .. index:: show ip prefix-list [NAME] |
589 | .. clicmd:: show ip prefix-list [NAME] | |
42fc5d26 | 590 | |
d1a242fd QY |
591 | .. index:: show route-map [NAME] |
592 | .. clicmd:: show route-map [NAME] | |
42fc5d26 | 593 | |
d1a242fd QY |
594 | .. index:: show ip protocol |
595 | .. clicmd:: show ip protocol | |
42fc5d26 | 596 | |
d1a242fd QY |
597 | .. index:: show ipforward |
598 | .. clicmd:: show ipforward | |
42fc5d26 | 599 | |
d1a242fd QY |
600 | Display whether the host's IP forwarding function is enabled or not. |
601 | Almost any UNIX kernel can be configured with IP forwarding disabled. | |
602 | If so, the box can't work as a router. | |
42fc5d26 | 603 | |
d1a242fd QY |
604 | .. index:: show ipv6forward |
605 | .. clicmd:: show ipv6forward | |
42fc5d26 | 606 | |
d1a242fd | 607 | Display whether the host's IP v6 forwarding is enabled or not. |
42fc5d26 | 608 | |
d1a242fd QY |
609 | .. index:: show zebra |
610 | .. clicmd:: show zebra | |
42fc5d26 | 611 | |
d1a242fd QY |
612 | Display various statistics related to the installation and deletion |
613 | of routes, neighbor updates, and LSP's into the kernel. | |
42fc5d26 | 614 | |
d1a242fd QY |
615 | .. index:: show zebra fpm stats |
616 | .. clicmd:: show zebra fpm stats | |
42fc5d26 | 617 | |
d1a242fd QY |
618 | Display statistics related to the zebra code that interacts with the |
619 | optional Forwarding Plane Manager (FPM) component. | |
42fc5d26 | 620 | |
d1a242fd QY |
621 | .. index:: clear zebra fpm stats |
622 | .. clicmd:: clear zebra fpm stats | |
42fc5d26 | 623 | |
d1a242fd QY |
624 | Reset statistics related to the zebra code that interacts with the |
625 | optional Forwarding Plane Manager (FPM) component. | |
42fc5d26 | 626 |