]>
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 | |
da7e1a92 QY |
32 | When program terminates, do not flush routes installed by *zebra* from the |
33 | kernel. | |
42fc5d26 | 34 | |
0d8df934 DS |
35 | .. option:: -e X, --ecmp X |
36 | ||
37 | Run zebra with a limited ecmp ability compared to what it is compiled to. | |
38 | If you are running zebra on hardware limited functionality you can | |
39 | force zebra to limit the maximum ecmp allowed to X. This number | |
40 | is bounded by what you compiled FRR with as the maximum number. | |
41 | ||
204ed384 PG |
42 | .. option:: -n, --vrfwnetns |
43 | ||
44 | When *Zebra* starts with this option, the VRF backend is based on Linux | |
45 | network namespaces. That implies that all network namespaces discovered by | |
46 | ZEBRA will create an associated VRF. The other daemons will operate on the VRF | |
80ca5b6d | 47 | VRF defined by *Zebra*, as usual. |
204ed384 | 48 | |
f90115c5 | 49 | .. seealso:: :ref:`zebra-vrf` |
013f9762 | 50 | |
cc6743c2 PG |
51 | .. option:: -o, --vrfdefaultname |
52 | ||
53 | When *Zebra* starts with this option, the default VRF name is changed to the | |
54 | parameter. | |
55 | ||
56 | .. seealso:: :ref:`zebra-vrf` | |
57 | ||
4354d381 DS |
58 | .. option:: --v6-rr-semantics |
59 | ||
60 | The linux kernel is receiving the ability to use the same route | |
61 | replacement semantics for v6 that v4 uses. If you are using a | |
62 | kernel that supports this functionality then run *Zebra* with this | |
63 | option and we will use Route Replace Semantics instead of delete | |
64 | than add. | |
65 | ||
0efdf0fe | 66 | .. _interface-commands: |
42fc5d26 | 67 | |
4d25da4f PG |
68 | Configuration Addresses behaviour |
69 | ================================= | |
70 | ||
71 | At startup, *Zebra* will first discover the underlying networking objects | |
72 | from the operating system. This includes interfaces, addresses of | |
73 | interfaces, static routes, etc. Then, it will read the configuration | |
74 | file, including its own interface addresses, static routes, etc. All this | |
75 | information comprises the operational context from *Zebra*. But | |
76 | configuration context from *Zebra* will remain the same as the one from | |
77 | :file:`zebra.conf` config file. As an example, executing the following | |
78 | :clicmd:`show running-config` will reflect what was in :file:`zebra.conf`. | |
79 | In a similar way, networking objects that are configured outside of the | |
80 | *Zebra* like *iproute2* will not impact the configuration context from | |
81 | *Zebra*. This behaviour permits you to continue saving your own config | |
82 | file, and decide what is really to be pushed on the config file, and what | |
83 | is dependent on the underlying system. | |
84 | Note that inversely, from *Zebra*, you will not be able to delete networking | |
85 | objects that were previously configured outside of *Zebra*. | |
86 | ||
87 | ||
42fc5d26 QY |
88 | Interface Commands |
89 | ================== | |
90 | ||
0efdf0fe | 91 | .. _standard-commands: |
42fc5d26 QY |
92 | |
93 | Standard Commands | |
94 | ----------------- | |
95 | ||
d1a242fd QY |
96 | .. index:: interface IFNAME |
97 | ||
98 | .. clicmd:: interface IFNAME | |
99 | ||
204ed384 PG |
100 | .. index:: interface IFNAME vrf VRF |
101 | ||
102 | .. clicmd:: interface IFNAME vrf VRF | |
103 | ||
d1a242fd | 104 | .. index:: shutdown |
42fc5d26 | 105 | |
d1a242fd QY |
106 | .. clicmd:: shutdown |
107 | .. index:: no shutdown | |
42fc5d26 | 108 | |
d1a242fd | 109 | .. clicmd:: no shutdown |
42fc5d26 | 110 | |
d1a242fd | 111 | Up or down the current interface. |
42fc5d26 | 112 | |
d1a242fd | 113 | .. index:: ip address ADDRESS/PREFIX |
42fc5d26 | 114 | |
d1a242fd QY |
115 | .. clicmd:: ip address ADDRESS/PREFIX |
116 | .. index:: ipv6 address ADDRESS/PREFIX | |
42fc5d26 | 117 | |
d1a242fd QY |
118 | .. clicmd:: ipv6 address ADDRESS/PREFIX |
119 | .. index:: no ip address ADDRESS/PREFIX | |
42fc5d26 | 120 | |
d1a242fd QY |
121 | .. clicmd:: no ip address ADDRESS/PREFIX |
122 | .. index:: no ipv6 address ADDRESS/PREFIX | |
42fc5d26 | 123 | |
d1a242fd | 124 | .. clicmd:: no ipv6 address ADDRESS/PREFIX |
42fc5d26 | 125 | |
d1a242fd | 126 | Set the IPv4 or IPv6 address/prefix for the interface. |
42fc5d26 | 127 | |
d1a242fd | 128 | .. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX |
42fc5d26 | 129 | |
d1a242fd QY |
130 | .. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX |
131 | .. index:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX | |
42fc5d26 | 132 | |
d1a242fd | 133 | .. clicmd:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX |
42fc5d26 | 134 | |
d1e7591e QY |
135 | Configure an IPv4 Point-to-Point address on the interface. (The concept of |
136 | PtP addressing does not exist for IPv6.) | |
42fc5d26 | 137 | |
d1a242fd QY |
138 | `local-addr` has no subnet mask since the local side in PtP addressing is |
139 | always a single (/32) address. `peer-addr/prefix` can be an arbitrary subnet | |
140 | behind the other end of the link (or even on the link in Point-to-Multipoint | |
141 | setups), though generally /32s are used. | |
42fc5d26 | 142 | |
d1a242fd | 143 | .. index:: ip address ADDRESS/PREFIX secondary |
42fc5d26 | 144 | |
d1a242fd QY |
145 | .. clicmd:: ip address ADDRESS/PREFIX secondary |
146 | .. index:: no ip address ADDRESS/PREFIX secondary | |
42fc5d26 | 147 | |
d1a242fd | 148 | .. clicmd:: no ip address ADDRESS/PREFIX secondary |
42fc5d26 | 149 | |
d1a242fd QY |
150 | Set the secondary flag for this address. This causes ospfd to not treat the |
151 | address as a distinct subnet. | |
42fc5d26 | 152 | |
d1a242fd | 153 | .. index:: description DESCRIPTION ... |
42fc5d26 | 154 | |
d1a242fd | 155 | .. clicmd:: description DESCRIPTION ... |
42fc5d26 | 156 | |
d1a242fd | 157 | Set description for the interface. |
42fc5d26 | 158 | |
d1a242fd | 159 | .. index:: multicast |
42fc5d26 | 160 | |
d1a242fd QY |
161 | .. clicmd:: multicast |
162 | .. index:: no multicast | |
42fc5d26 | 163 | |
d1a242fd | 164 | .. clicmd:: no multicast |
42fc5d26 | 165 | |
d1a242fd | 166 | Enable or disables multicast flag for the interface. |
42fc5d26 | 167 | |
d1a242fd | 168 | .. index:: bandwidth (1-10000000) |
42fc5d26 | 169 | |
d1a242fd QY |
170 | .. clicmd:: bandwidth (1-10000000) |
171 | .. index:: no bandwidth (1-10000000) | |
172 | ||
173 | .. clicmd:: no bandwidth (1-10000000) | |
174 | ||
175 | Set bandwidth value of the interface in kilobits/sec. This is for | |
176 | calculating OSPF cost. This command does not affect the actual device | |
177 | configuration. | |
178 | ||
179 | .. index:: link-detect | |
180 | ||
181 | .. clicmd:: link-detect | |
182 | .. index:: no link-detect | |
183 | ||
184 | .. clicmd:: no link-detect | |
185 | ||
186 | Enable/disable link-detect on platforms which support this. Currently only | |
187 | Linux and Solaris, and only where network interface drivers support | |
188 | reporting link-state via the ``IFF_RUNNING`` flag. | |
42fc5d26 | 189 | |
0efdf0fe | 190 | .. _link-parameters-commands: |
42fc5d26 QY |
191 | |
192 | Link Parameters Commands | |
193 | ------------------------ | |
194 | ||
d1a242fd QY |
195 | .. index:: link-params |
196 | .. clicmd:: link-params | |
42fc5d26 | 197 | |
d1a242fd QY |
198 | .. index:: no link-param |
199 | .. clicmd:: no link-param | |
42fc5d26 | 200 | |
d1a242fd QY |
201 | Enter into the link parameters sub node. At least 'enable' must be set to |
202 | activate the link parameters, and consequently Traffic Engineering on this | |
203 | interface. MPLS-TE must be enable at the OSPF | |
0efdf0fe | 204 | (:ref:`ospf-traffic-engineering`) or ISIS (:ref:`isis-traffic-engineering`) |
d1a242fd QY |
205 | router level in complement to this. Disable link parameters for this |
206 | interface. | |
42fc5d26 | 207 | |
d1a242fd | 208 | Under link parameter statement, the following commands set the different TE values: |
42fc5d26 | 209 | |
d1a242fd QY |
210 | .. index:: link-params [enable] |
211 | .. clicmd:: link-params [enable] | |
42fc5d26 | 212 | |
d1a242fd | 213 | Enable link parameters for this interface. |
42fc5d26 | 214 | |
d1a242fd QY |
215 | .. index:: link-params [metric (0-4294967295)] |
216 | .. clicmd:: link-params [metric (0-4294967295)] | |
42fc5d26 | 217 | |
d1a242fd QY |
218 | .. index:: link-params max-bw BANDWIDTH |
219 | .. clicmd:: link-params max-bw BANDWIDTH | |
42fc5d26 | 220 | |
d1a242fd QY |
221 | .. index:: link-params max-rsv-bw BANDWIDTH |
222 | .. clicmd:: link-params max-rsv-bw BANDWIDTH | |
42fc5d26 | 223 | |
d1a242fd QY |
224 | .. index:: link-params unrsv-bw (0-7) BANDWIDTH |
225 | .. clicmd:: link-params unrsv-bw (0-7) BANDWIDTH | |
42fc5d26 | 226 | |
d1a242fd QY |
227 | .. index:: link-params admin-grp BANDWIDTH |
228 | .. clicmd:: link-params admin-grp BANDWIDTH | |
42fc5d26 | 229 | |
d1a242fd QY |
230 | These commands specifies the Traffic Engineering parameters of the interface |
231 | in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively | |
232 | the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth | |
233 | (interface speed by default), Maximum Reservable Bandwidth, Unreserved | |
234 | Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource | |
235 | Class/Color (OSPF). | |
42fc5d26 | 236 | |
d1a242fd QY |
237 | Note that BANDIWDTH is specified in IEEE floating point format and express |
238 | in Bytes/second. | |
42fc5d26 | 239 | |
d1a242fd QY |
240 | .. index:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)] |
241 | .. clicmd:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)] | |
42fc5d26 | 242 | |
d1a242fd QY |
243 | .. index:: link-param delay-variation (0-16777215) |
244 | .. clicmd:: link-param delay-variation (0-16777215) | |
42fc5d26 | 245 | |
d1a242fd QY |
246 | .. index:: link-param packet-loss PERCENTAGE |
247 | .. clicmd:: link-param packet-loss PERCENTAGE | |
42fc5d26 | 248 | |
d1a242fd QY |
249 | .. index:: link-param res-bw BANDWIDTH |
250 | .. clicmd:: link-param res-bw BANDWIDTH | |
42fc5d26 | 251 | |
d1a242fd QY |
252 | .. index:: link-param ava-bw BANDWIDTH |
253 | .. clicmd:: link-param ava-bw BANDWIDTH | |
42fc5d26 | 254 | |
d1a242fd QY |
255 | .. index:: link-param use-bw BANDWIDTH |
256 | .. clicmd:: link-param use-bw BANDWIDTH | |
42fc5d26 | 257 | |
d1e7591e | 258 | These command specifies additional Traffic Engineering parameters of the |
d1a242fd QY |
259 | interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and |
260 | draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the | |
261 | delay, jitter, loss, available bandwidth, reservable bandwidth and utilized | |
262 | bandwidth. | |
42fc5d26 | 263 | |
d1a242fd QY |
264 | Note that BANDWIDTH is specified in IEEE floating point format and express |
265 | in Bytes/second. Delays and delay variation are express in micro-second | |
266 | (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step | |
267 | of 0.000003. | |
42fc5d26 | 268 | |
d1a242fd QY |
269 | .. index:: link-param neighbor <A.B.C.D> as (0-65535) |
270 | .. clicmd:: link-param neighbor <A.B.C.D> as (0-65535) | |
42fc5d26 | 271 | |
d1a242fd QY |
272 | .. index:: link-param no neighbor |
273 | .. clicmd:: link-param no neighbor | |
42fc5d26 | 274 | |
d1a242fd QY |
275 | Specifies the remote ASBR IP address and Autonomous System (AS) number |
276 | for InterASv2 link in OSPF (RFC5392). Note that this option is not yet | |
277 | supported for ISIS (RFC5316). | |
42fc5d26 | 278 | |
d1a242fd QY |
279 | .. index:: table TABLENO |
280 | .. clicmd:: table TABLENO | |
42fc5d26 | 281 | |
80ca5b6d QY |
282 | Select the primary kernel routing table to be used. This only works for |
283 | kernels supporting multiple routing tables (like GNU/Linux 2.2.x and later). | |
284 | After setting TABLENO with this command, static routes defined after this | |
285 | are added to the specified table. | |
42fc5d26 | 286 | |
f90115c5 | 287 | .. _zebra-vrf: |
80ca5b6d QY |
288 | |
289 | Virtual Routing and Forwarding | |
290 | ============================== | |
42fc5d26 | 291 | |
80ca5b6d QY |
292 | FRR supports :abbr:`VRF (Virtual Routing and Forwarding)`. VRF is a way to |
293 | separate networking contexts on the same machine. Those networking contexts are | |
294 | associated with separate interfaces, thus making it possible to associate one | |
295 | interface with a specific VRF. | |
204ed384 | 296 | |
204ed384 | 297 | VRF can be used, for example, when instantiating per enterprise networking |
80ca5b6d QY |
298 | services, without having to instantiate the physical host machine or the |
299 | routing management daemons for each enterprise. As a result, interfaces are | |
300 | separate for each set of VRF, and routing daemons can have their own context | |
301 | for each VRF. | |
204ed384 PG |
302 | |
303 | This conceptual view introduces the *Default VRF* case. If the user does not | |
80ca5b6d QY |
304 | configure any specific VRF, then by default, FRR uses the *Default VRF*. |
305 | ||
204ed384 | 306 | Configuring VRF networking contexts can be done in various ways on FRR. The VRF |
80ca5b6d | 307 | interfaces can be configured by entering in interface configuration mode |
614aa5c1 | 308 | :clicmd:`interface IFNAME vrf VRF`. |
204ed384 PG |
309 | |
310 | A VRF backend mode is chosen when running *Zebra*. | |
311 | ||
312 | If no option is chosen, then the *Linux VRF* implementation as references in | |
80ca5b6d | 313 | https://www.kernel.org/doc/Documentation/networking/vrf.txt will be mapped over |
204ed384 PG |
314 | the *Zebra* VRF. The routing table associated to that VRF is a Linux table |
315 | identifier located in the same *Linux network namespace* where *Zebra* started. | |
316 | ||
80ca5b6d QY |
317 | If the :option:`-n` option is chosen, then the *Linux network namespace* will |
318 | be mapped over the *Zebra* VRF. That implies that *Zebra* is able to configure | |
319 | several *Linux network namespaces*. The routing table associated to that VRF | |
320 | is the whole routing tables located in that namespace. For instance, this mode | |
321 | matches OpenStack Network Namespaces. It matches also OpenFastPath. The default | |
322 | behavior remains Linux VRF which is supported by the Linux kernel community, | |
323 | see https://www.kernel.org/doc/Documentation/networking/vrf.txt. | |
204ed384 PG |
324 | |
325 | Because of that difference, there are some subtle differences when running some | |
326 | commands in relationship to VRF. Here is an extract of some of those commands: | |
327 | ||
328 | .. index:: vrf VRF | |
329 | .. clicmd:: vrf VRF | |
330 | ||
331 | This command is available on configuration mode. By default, above command | |
52119114 | 332 | permits accessing the VRF configuration mode. This mode is available for |
d66a93dd PG |
333 | both VRFs. It is to be noted that *Zebra* does not create Linux VRF. |
334 | The network administrator can however decide to provision this command in | |
335 | configuration file to provide more clarity about the intended configuration. | |
204ed384 PG |
336 | |
337 | .. index:: netns NAMESPACE | |
338 | .. clicmd:: netns NAMESPACE | |
339 | ||
80ca5b6d QY |
340 | This command is based on VRF configuration mode. This command is available |
341 | when *Zebra* is run in :option:`-n` mode. This command reflects which *Linux | |
342 | network namespace* is to be mapped with *Zebra* VRF. It is to be noted that | |
343 | *Zebra* creates and detects added/suppressed VRFs from the Linux environment | |
d66a93dd PG |
344 | (in fact, those managed with iproute2). The network administrator can however |
345 | decide to provision this command in configuration file to provide more clarity | |
346 | about the intended configuration. | |
204ed384 | 347 | |
204ed384 PG |
348 | .. index:: show ip route vrf VRF |
349 | .. clicmd:: show ip route vrf VRF | |
350 | ||
351 | The show command permits dumping the routing table associated to the VRF. If | |
80ca5b6d QY |
352 | *Zebra* is launched with default settings, this will be the ``TABLENO`` of |
353 | the VRF configured on the kernel, thanks to information provided in | |
354 | https://www.kernel.org/doc/Documentation/networking/vrf.txt. If *Zebra* is | |
355 | launched with :option:`-n` option, this will be the default routing table of | |
356 | the *Linux network namespace* ``VRF``. | |
204ed384 PG |
357 | |
358 | .. index:: show ip route vrf VRF table TABLENO | |
359 | .. clicmd:: show ip route vrf VRF table TABLENO | |
360 | ||
80ca5b6d QY |
361 | The show command is only available with :option:`-n` option. This command |
362 | will dump the routing table ``TABLENO`` of the *Linux network namespace* | |
363 | ``VRF``. | |
364 | ||
c94e6725 PG |
365 | By using the :option:`-n` option, the *Linux network namespace* will be mapped |
366 | over the *Zebra* VRF. One nice feature that is possible by handling *Linux | |
367 | network namespace* is the ability to name default VRF. At startup, *Zebra* | |
368 | discovers the available *Linux network namespace* by parsing folder | |
369 | `/var/run/netns`. Each file stands for a *Linux network namespace*, but not all | |
370 | *Linux network namespaces* are available under that folder. This is the case for | |
371 | default VRF. It is possible to name the default VRF, by creating a file, by | |
372 | executing following commands. | |
373 | ||
374 | .. code-block:: shell | |
375 | ||
376 | touch /var/run/netns/vrf0 | |
377 | mount --bind /proc/self/ns/net /var/run/netns/vrf0 | |
378 | ||
379 | Above command illustrates what happens when the default VRF is visible under | |
380 | `var/run/netns/`. Here, the default VRF file is `vrf0`. | |
381 | At startup, FRR detects the presence of that file. It detects that the file | |
382 | statistics information matches the same file statistics information as | |
383 | `/proc/self/ns/net` ( through stat() function). As statistics information | |
384 | matches, then `vrf0` stands for the new default namespace name. | |
385 | Consequently, the VRF naming `Default` will be overriden by the new discovered | |
386 | namespace name `vrf0`. | |
387 | ||
388 | For those who don't use VRF backend with *Linux network namespace*, it is | |
389 | possible to statically configure and recompile FRR. It is possible to choose an | |
390 | alternate name for default VRF. Then, the default VRF naming will automatically | |
391 | be updated with the new name. To illustrate, if you want to recompile with | |
392 | `global` value, use the following command: | |
393 | ||
394 | .. code-block:: linux | |
395 | ||
396 | ./configure --with-defaultvrfname=global | |
397 | ||
b03d3432 PG |
398 | .. _zebra-mpls: |
399 | ||
400 | MPLS Commands | |
401 | ============= | |
402 | ||
403 | You can configure static mpls entries in zebra. Basically, handling MPLS | |
404 | consists of popping, swapping or pushing labels to IP packets. | |
405 | ||
406 | MPLS Acronyms | |
407 | ------------- | |
408 | ||
409 | :abbr:`LSR (Labeled Switch Router)` | |
410 | Networking devices handling labels used to forward traffic between and through | |
411 | them. | |
412 | ||
413 | :abbr:`LER (Labeled Edge Router)` | |
414 | A Labeled edge router is located at the edge of an MPLS network, generally | |
415 | between an IP network and an MPLS network. | |
416 | ||
417 | MPLS Push Action | |
418 | ---------------- | |
419 | ||
420 | The push action is generally used for LER devices, which want to encapsulate | |
421 | all traffic for a wished destination into an MPLS label. This action is stored | |
422 | in routing entry, and can be configured like a route: | |
423 | ||
424 | .. index:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL | |
425 | .. clicmd:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL | |
426 | ||
427 | NETWORK ans MASK stand for the IP prefix entry to be added as static | |
428 | route entry. | |
429 | GATEWAY is the gateway IP address to reach, in order to reach the prefix. | |
430 | INTERFACE is the interface behind which the prefix is located. | |
431 | LABEL is the MPLS label to use to reach the prefix abovementioned. | |
432 | ||
433 | You can check that the static entry is stored in the zebra RIB database, by | |
434 | looking at the presence of the entry. | |
435 | ||
436 | :: | |
437 | ||
438 | zebra(configure)# ip route 1.1.1.1/32 10.0.1.1 label 777 | |
439 | zebra# show ip route | |
440 | Codes: K - kernel route, C - connected, S - static, R - RIP, | |
441 | O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, | |
442 | T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, | |
443 | F - PBR, | |
444 | > - selected route, * - FIB route | |
445 | ||
446 | S>* 1.1.1.1/32 [1/0] via 10.0.1.1, r2-eth0, label 777, 00:39:42 | |
447 | ||
448 | MPLS Swap and Pop Action | |
449 | ------------------------ | |
450 | ||
451 | The swap action is generally used for LSR devices, which swap a packet with a | |
452 | label, with an other label. The Pop action is used on LER devices, at the | |
453 | termination of the MPLS traffic; this is used to remove MPLS header. | |
454 | ||
455 | .. index:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null | |
456 | .. clicmd:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null | |
457 | ||
458 | INCOMING_LABEL and OUTGOING_LABEL are MPLS labels with values ranging from 16 | |
459 | to 1048575. | |
460 | GATEWAY is the gateway IP address where to send MPLS packet. | |
461 | The outgoing label can either be a value or have an explicit-null label header. This | |
462 | specific header can be read by IP devices. The incoming label can also be removed; in | |
463 | that case the implicit-null keyword is used, and the outgoing packet emitted is an IP | |
464 | packet without MPLS header. | |
465 | ||
466 | You can check that the MPLS actions are stored in the zebra MPLS table, by looking at the | |
467 | presence of the entry. | |
468 | ||
469 | .. index:: show mpls table | |
470 | .. clicmd:: show mpls table | |
471 | ||
472 | :: | |
473 | ||
474 | zebra(configure)# mpls lsp 18 10.125.0.2 implicit-null | |
475 | zebra(configure)# mpls lsp 19 10.125.0.2 20 | |
476 | zebra(configure)# mpls lsp 21 10.125.0.2 explicit-null | |
477 | zebra# show mpls table | |
478 | Inbound Outbound | |
479 | Label Type Nexthop Label | |
480 | -------- ------- --------------- -------- | |
481 | 18 Static 10.125.0.2 implicit-null | |
482 | 19 Static 10.125.0.2 20 | |
483 | 21 Static 10.125.0.2 IPv4 Explicit Null | |
484 | ||
485 | ||
80ca5b6d QY |
486 | .. _multicast-rib-commands: |
487 | ||
42fc5d26 QY |
488 | Multicast RIB Commands |
489 | ====================== | |
490 | ||
491 | The Multicast RIB provides a separate table of unicast destinations which | |
d1a242fd | 492 | is used for Multicast Reverse Path Forwarding decisions. It is used with |
42fc5d26 QY |
493 | a multicast source's IP address, hence contains not multicast group |
494 | addresses but unicast addresses. | |
495 | ||
d1a242fd | 496 | This table is fully separate from the default unicast table. However, |
42fc5d26 QY |
497 | RPF lookup can include the unicast table. |
498 | ||
dc1046f7 | 499 | WARNING: RPF lookup results are non-responsive in this version of FRR, |
42fc5d26 QY |
500 | i.e. multicast routing does not actively react to changes in underlying |
501 | unicast topology! | |
502 | ||
d1a242fd QY |
503 | .. index:: ip multicast rpf-lookup-mode MODE |
504 | .. clicmd:: ip multicast rpf-lookup-mode MODE | |
42fc5d26 | 505 | |
d1a242fd QY |
506 | .. index:: no ip multicast rpf-lookup-mode [MODE] |
507 | .. clicmd:: no ip multicast rpf-lookup-mode [MODE] | |
42fc5d26 | 508 | |
d1a242fd | 509 | MODE sets the method used to perform RPF lookups. Supported modes: |
42fc5d26 | 510 | |
9eb95b3b QY |
511 | urib-only |
512 | Performs the lookup on the Unicast RIB. The Multicast RIB is never used. | |
42fc5d26 | 513 | |
9eb95b3b QY |
514 | mrib-only |
515 | Performs the lookup on the Multicast RIB. The Unicast RIB is never used. | |
42fc5d26 | 516 | |
9eb95b3b QY |
517 | mrib-then-urib |
518 | Tries to perform the lookup on the Multicast RIB. If any route is found, | |
519 | that route is used. Otherwise, the Unicast RIB is tried. | |
42fc5d26 | 520 | |
9eb95b3b QY |
521 | lower-distance |
522 | Performs a lookup on the Multicast RIB and Unicast RIB each. The result | |
523 | with the lower administrative distance is used; if they're equal, the | |
524 | Multicast RIB takes precedence. | |
42fc5d26 | 525 | |
9eb95b3b QY |
526 | longer-prefix |
527 | Performs a lookup on the Multicast RIB and Unicast RIB each. The result | |
528 | with the longer prefix length is used; if they're equal, the | |
529 | Multicast RIB takes precedence. | |
42fc5d26 | 530 | |
9eb95b3b QY |
531 | The `mrib-then-urib` setting is the default behavior if nothing is |
532 | configured. If this is the desired behavior, it should be explicitly | |
533 | configured to make the configuration immune against possible changes in | |
534 | what the default behavior is. | |
42fc5d26 | 535 | |
d1a242fd QY |
536 | .. warning:: |
537 | Unreachable routes do not receive special treatment and do not cause | |
538 | fallback to a second lookup. | |
42fc5d26 | 539 | |
d1a242fd QY |
540 | .. index:: show ip rpf ADDR |
541 | .. clicmd:: show ip rpf ADDR | |
42fc5d26 | 542 | |
d1a242fd QY |
543 | Performs a Multicast RPF lookup, as configured with ``ip multicast |
544 | rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look | |
545 | up. | |
42fc5d26 | 546 | |
d1a242fd | 547 | :: |
42fc5d26 QY |
548 | |
549 | > show ip rpf 192.0.2.1 | |
550 | Routing entry for 192.0.2.0/24 using Unicast RIB | |
d1a242fd QY |
551 | |
552 | Known via "kernel", distance 0, metric 0, best | |
553 | * 198.51.100.1, via eth0 | |
a8c90e15 | 554 | |
42fc5d26 | 555 | |
d1a242fd QY |
556 | Indicates that a multicast source lookup for 192.0.2.1 would use an |
557 | Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1. | |
42fc5d26 | 558 | |
d1a242fd QY |
559 | .. index:: show ip rpf |
560 | .. clicmd:: show ip rpf | |
42fc5d26 | 561 | |
d1a242fd QY |
562 | Prints the entire Multicast RIB. Note that this is independent of the |
563 | configured RPF lookup mode, the Multicast RIB may be printed yet not | |
564 | used at all. | |
42fc5d26 | 565 | |
d1a242fd QY |
566 | .. index:: ip mroute PREFIX NEXTHOP [DISTANCE] |
567 | .. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE] | |
42fc5d26 | 568 | |
d1a242fd QY |
569 | .. index:: no ip mroute PREFIX NEXTHOP [DISTANCE] |
570 | .. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE] | |
42fc5d26 | 571 | |
d1a242fd QY |
572 | Adds a static route entry to the Multicast RIB. This performs exactly as the |
573 | ``ip route`` command, except that it inserts the route in the Multicast RIB | |
574 | instead of the Unicast RIB. | |
42fc5d26 | 575 | |
0efdf0fe | 576 | .. _zebra-route-filtering: |
42fc5d26 QY |
577 | |
578 | zebra Route Filtering | |
579 | ===================== | |
580 | ||
0efdf0fe | 581 | Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes |
013f9762 | 582 | received from other FRR components. The permit/deny facilities provided by |
d1a242fd QY |
583 | these commands can be used to filter which routes zebra will install in the |
584 | kernel. | |
42fc5d26 | 585 | |
d1a242fd QY |
586 | .. index:: ip protocol PROTOCOL route-map ROUTEMAP |
587 | .. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP | |
42fc5d26 | 588 | |
013f9762 QY |
589 | Apply a route-map filter to routes for the specified protocol. PROTOCOL can |
590 | be **any** or one of | |
591 | ||
592 | - system, | |
593 | - kernel, | |
594 | - connected, | |
595 | - static, | |
596 | - rip, | |
597 | - ripng, | |
598 | - ospf, | |
599 | - ospf6, | |
600 | - isis, | |
601 | - bgp, | |
602 | - hsls. | |
d1a242fd QY |
603 | |
604 | .. index:: set src ADDRESS | |
605 | .. clicmd:: set src ADDRESS | |
606 | ||
607 | Within a route-map, set the preferred source address for matching routes | |
608 | when installing in the kernel. | |
609 | ||
610 | ||
611 | The following creates a prefix-list that matches all addresses, a route-map | |
612 | that sets the preferred source address, and applies the route-map to all | |
613 | *rip* routes. | |
614 | ||
9eb95b3b | 615 | .. code-block:: frr |
42fc5d26 | 616 | |
d1a242fd QY |
617 | ip prefix-list ANY permit 0.0.0.0/0 le 32 |
618 | route-map RM1 permit 10 | |
619 | match ip address prefix-list ANY | |
620 | set src 10.0.0.1 | |
42fc5d26 | 621 | |
d1a242fd | 622 | ip protocol rip route-map RM1 |
a8c90e15 | 623 | |
42fc5d26 | 624 | |
0efdf0fe | 625 | .. _zebra-fib-push-interface: |
42fc5d26 QY |
626 | |
627 | zebra FIB push interface | |
628 | ======================== | |
629 | ||
630 | Zebra supports a 'FIB push' interface that allows an external | |
dc1046f7 | 631 | component to learn the forwarding information computed by the FRR |
d1a242fd | 632 | routing suite. This is a loadable module that needs to be enabled |
0efdf0fe | 633 | at startup as described in :ref:`loadable-module-support`. |
42fc5d26 | 634 | |
dc1046f7 | 635 | In FRR, the Routing Information Base (RIB) resides inside |
42fc5d26 QY |
636 | zebra. Routing protocols communicate their best routes to zebra, and |
637 | zebra computes the best route across protocols for each prefix. This | |
638 | latter information makes up the Forwarding Information Base | |
639 | (FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in | |
640 | the kernel to forward packets according to the routes computed by | |
dc1046f7 | 641 | FRR. The kernel FIB is updated in an OS-specific way. For example, |
d1e7591e | 642 | the `Netlink` interface is used on Linux, and route sockets are |
42fc5d26 QY |
643 | used on FreeBSD. |
644 | ||
645 | The FIB push interface aims to provide a cross-platform mechanism to | |
646 | support scenarios where the router has a forwarding path that is | |
647 | distinct from the kernel, commonly a hardware-based fast path. In | |
648 | these cases, the FIB needs to be maintained reliably in the fast path | |
649 | as well. We refer to the component that programs the forwarding plane | |
650 | (directly or indirectly) as the Forwarding Plane Manager or FPM. | |
651 | ||
652 | The FIB push interface comprises of a TCP connection between zebra and | |
653 | the FPM. The connection is initiated by zebra -- that is, the FPM acts | |
654 | as the TCP server. | |
655 | ||
80ca5b6d QY |
656 | .. program:: configure |
657 | ||
42fc5d26 | 658 | The relevant zebra code kicks in when zebra is configured with the |
d1a242fd | 659 | :option:`--enable-fpm` flag. Zebra periodically attempts to connect to |
42fc5d26 QY |
660 | the well-known FPM port. Once the connection is up, zebra starts |
661 | sending messages containing routes over the socket to the FPM. Zebra | |
662 | sends a complete copy of the forwarding table to the FPM, including | |
663 | routes that it may have picked up from the kernel. The existing | |
664 | interaction of zebra with the kernel remains unchanged -- that is, the | |
665 | kernel continues to receive FIB updates as before. | |
666 | ||
667 | The encapsulation header for the messages exchanged with the FPM is | |
668 | defined by the file :file:`fpm/fpm.h` in the frr tree. The routes | |
d1e7591e | 669 | themselves are encoded in Netlink or protobuf format, with Netlink |
42fc5d26 QY |
670 | being the default. |
671 | ||
672 | Protobuf is one of a number of new serialization formats wherein the | |
673 | message schema is expressed in a purpose-built language. Code for | |
674 | encoding/decoding to/from the wire format is generated from the | |
675 | schema. Protobuf messages can be extended easily while maintaining | |
676 | backward-compatibility with older code. Protobuf has the following | |
d1e7591e | 677 | advantages over Netlink: |
42fc5d26 | 678 | |
d1a242fd QY |
679 | - Code for serialization/deserialization is generated automatically. This |
680 | reduces the likelihood of bugs, allows third-party programs to be integrated | |
681 | quickly, and makes it easy to add fields. | |
682 | - The message format is not tied to an OS (Linux), and can be evolved | |
42fc5d26 QY |
683 | independently. |
684 | ||
d1e7591e | 685 | As mentioned before, zebra encodes routes sent to the FPM in Netlink |
42fc5d26 | 686 | format by default. The format can be controlled via the FPM module's |
d1e7591e | 687 | load-time option to zebra, which currently takes the values `Netlink` |
42fc5d26 QY |
688 | and `protobuf`. |
689 | ||
690 | The zebra FPM interface uses replace semantics. That is, if a 'route | |
691 | add' message for a prefix is followed by another 'route add' message, | |
692 | the information in the second message is complete by itself, and | |
693 | replaces the information sent in the first message. | |
694 | ||
695 | If the connection to the FPM goes down for some reason, zebra sends | |
696 | the FPM a complete copy of the forwarding table(s) when it reconnects. | |
697 | ||
698 | zebra Terminal Mode Commands | |
699 | ============================ | |
700 | ||
d1a242fd QY |
701 | .. index:: show ip route |
702 | .. clicmd:: show ip route | |
42fc5d26 | 703 | |
d1a242fd | 704 | Display current routes which zebra holds in its database. |
42fc5d26 QY |
705 | |
706 | :: | |
707 | ||
42fc5d26 QY |
708 | Router# show ip route |
709 | Codes: K - kernel route, C - connected, S - static, R - RIP, | |
d1a242fd | 710 | B - BGP * - FIB route. |
42fc5d26 | 711 | |
d1a242fd QY |
712 | K* 0.0.0.0/0 203.181.89.241 |
713 | S 0.0.0.0/0 203.181.89.1 | |
714 | C* 127.0.0.0/8 lo | |
42fc5d26 | 715 | C* 203.181.89.240/28 eth0 |
a8c90e15 | 716 | |
42fc5d26 | 717 | |
d1a242fd QY |
718 | .. index:: show ipv6 route |
719 | .. clicmd:: show ipv6 route | |
42fc5d26 | 720 | |
d1a242fd QY |
721 | .. index:: show interface |
722 | .. clicmd:: show interface | |
42fc5d26 | 723 | |
d1a242fd QY |
724 | .. index:: show ip prefix-list [NAME] |
725 | .. clicmd:: show ip prefix-list [NAME] | |
42fc5d26 | 726 | |
d1a242fd QY |
727 | .. index:: show route-map [NAME] |
728 | .. clicmd:: show route-map [NAME] | |
42fc5d26 | 729 | |
d1a242fd QY |
730 | .. index:: show ip protocol |
731 | .. clicmd:: show ip protocol | |
42fc5d26 | 732 | |
d1a242fd QY |
733 | .. index:: show ipforward |
734 | .. clicmd:: show ipforward | |
42fc5d26 | 735 | |
d1a242fd QY |
736 | Display whether the host's IP forwarding function is enabled or not. |
737 | Almost any UNIX kernel can be configured with IP forwarding disabled. | |
738 | If so, the box can't work as a router. | |
42fc5d26 | 739 | |
d1a242fd QY |
740 | .. index:: show ipv6forward |
741 | .. clicmd:: show ipv6forward | |
42fc5d26 | 742 | |
d1a242fd | 743 | Display whether the host's IP v6 forwarding is enabled or not. |
42fc5d26 | 744 | |
d1a242fd QY |
745 | .. index:: show zebra |
746 | .. clicmd:: show zebra | |
42fc5d26 | 747 | |
d1a242fd QY |
748 | Display various statistics related to the installation and deletion |
749 | of routes, neighbor updates, and LSP's into the kernel. | |
42fc5d26 | 750 | |
d1a242fd QY |
751 | .. index:: show zebra fpm stats |
752 | .. clicmd:: show zebra fpm stats | |
42fc5d26 | 753 | |
d1a242fd QY |
754 | Display statistics related to the zebra code that interacts with the |
755 | optional Forwarding Plane Manager (FPM) component. | |
42fc5d26 | 756 | |
d1a242fd QY |
757 | .. index:: clear zebra fpm stats |
758 | .. clicmd:: clear zebra fpm stats | |
42fc5d26 | 759 | |
d1a242fd QY |
760 | Reset statistics related to the zebra code that interacts with the |
761 | optional Forwarding Plane Manager (FPM) component. | |
42fc5d26 | 762 |