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