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