]> git.proxmox.com Git - mirror_frr.git/blob - doc/user/installation.rst
Merge pull request #4522 from LabNConsulting/working/master/issue4479
[mirror_frr.git] / doc / user / installation.rst
1 .. _installation:
2
3 Installation
4 ============
5
6 .. index:: How to install FRR
7 .. index:: Installation
8 .. index:: Installing FRR
9 .. index:: Building the system
10 .. index:: Making FRR
11
12 This section covers the basics of building, installing and setting up FRR.
13
14 From Packages
15 -------------
16
17 The project publishes packages for Red Hat, Centos, Debian and Ubuntu on the
18 `GitHub releases <https://github.com/FRRouting/frr/releases>`_. page. External
19 contributors offer packages for many other platforms including \*BSD, Alpine,
20 Gentoo, Docker, and others. There is currently no documentation on how to use
21 those but we hope to add it soon.
22
23 From Snapcraft
24 --------------
25
26 In addition to traditional packages the project also builds and publishes
27 universal Snap images, available at https://snapcraft.io/frr.
28
29 From Source
30 -----------
31
32 Building FRR from source is the best way to ensure you have the latest features
33 and bug fixes. Details for each supported platform, including dependency
34 package listings, permissions, and other gotchas, are in the developer's
35 documentation. This section provides a brief overview on the process.
36
37 Getting the Source
38 ^^^^^^^^^^^^^^^^^^
39
40 FRR's source is available on the project
41 `GitHub page <https://github.com/FRRouting/frr>`_.
42
43 .. code-block:: shell
44
45 git clone https://github.com/FRRouting/frr.git
46
47 When building from Git there are several branches to choose from. The
48 ``master`` branch is the primary development branch. It should be considered
49 unstable. Each release has its own branch named ``stable/X.X``, where ``X.X``
50 is the release version.
51
52 In addition, release tarballs are published on the GitHub releases page
53 `here <https://github.com/FRRouting/frr/releases>`_.
54
55 Configuration
56 ^^^^^^^^^^^^^
57
58 .. index:: Configuration options
59 .. index:: Options for configuring
60 .. index:: Build options
61 .. index:: Distribution configuration
62 .. index:: Options to `./configure`
63
64 FRR has an excellent configure script which automatically detects most host
65 configurations. There are several additional configure options to customize the
66 build to include or exclude specific features and dependencies.
67
68 First, update the build system. Change into your FRR source directory and issue:
69
70 .. code-block:: shell
71
72 ./bootstrap.sh
73
74 This will install any missing build scripts and update the Autotools
75 configuration. Once this is done you can move on to choosing your configuration
76 options from the list below.
77
78 .. _frr-configuration:
79
80 .. program:: configure
81
82 .. option:: --enable-tcmalloc
83
84 Enable the alternate malloc library. In some cases this is faster and more efficient,
85 in some cases it is not.
86
87 .. option:: --disable-doc
88
89 Do not build any documentation, including this one.
90
91 .. option:: --enable-doc-html
92
93 From the documentation build html docs as well in addition to the normal output.
94
95 .. option:: --disable-zebra
96
97 Do not build zebra daemon. This generally only be useful in a scenario where
98 you are building bgp as a standalone server.
99
100 .. option:: --disable-ripd
101
102 Do not build ripd.
103
104 .. option:: --disable-ripngd
105
106 Do not build ripngd.
107
108 .. option:: --disable-ospfd
109
110 Do not build ospfd.
111
112 .. option:: --disable-ospf6d
113
114 Do not build ospf6d.
115
116 .. option:: --disable-bgpd
117
118 Do not build bgpd.
119
120 .. option:: --disable-ldpd
121
122 Do not build ldpd.
123
124 .. option:: --disable-nhrpd
125
126 Do not build nhrpd.
127
128 .. option:: --disable-eigrpd
129
130 Do not build eigrpd.
131
132 .. option:: --disable-babeld
133
134 Do not build babeld.
135
136 .. option:: --disable-watchfrr
137
138 Do not build watchfrr. Watchfrr is used to integrate daemons into startup/shutdown
139 software available on your machine. This is needed for systemd integration, if you
140 disable watchfrr you cannot have any systemd integration.
141
142 .. option:: --enable-systemd
143
144 Build watchfrr with systemd integration, this will allow FRR to communicate with
145 systemd to tell systemd if FRR has come up properly.
146
147 .. option:: --disable-pimd
148
149 Turn off building of pimd. On some BSD platforms pimd will not build properly due
150 to lack of kernel support.
151
152 .. option:: --disable-pbrd
153
154 Turn off building of pbrd. This daemon currently requires linux in order to function
155 properly.
156
157 .. option:: --enable-sharpd
158
159 Turn on building of sharpd. This daemon facilitates testing of FRR and can also
160 be used as a quick and easy route generator.
161
162 .. option:: --disable-staticd
163
164 Do not build staticd. This daemon is necessary if you want static routes.
165
166 .. option:: --disable-bfdd
167
168 Do not build bfdd.
169
170 .. option:: --disable-bgp-announce
171
172 Make *bgpd* which does not make bgp announcements at all. This
173 feature is good for using *bgpd* as a BGP announcement listener.
174
175 .. option:: --disable-bgp-vnc
176
177 Turn off bgpd's ability to use VNC.
178
179 .. option:: --enable-datacenter
180
181 Enable system defaults to work as if in a Data Center. See defaults.h
182 for what is changed by this configure option.
183
184 .. option:: --enable-snmp
185
186 Enable SNMP support. By default, SNMP support is disabled.
187
188 .. option:: --disable-ospfapi
189
190 Disable support for OSPF-API, an API to interface directly with ospfd.
191 OSPF-API is enabled if --enable-opaque-lsa is set.
192
193 .. option:: --disable-ospfclient
194
195 Disable building of the example OSPF-API client.
196
197 .. option:: --disable-ospf-ri
198
199 Disable support for OSPF Router Information (RFC4970 & RFC5088) this
200 requires support for Opaque LSAs and Traffic Engineering.
201
202 .. option:: --disable-isisd
203
204 Do not build isisd.
205
206 .. option:: --disable-fabricd
207
208 Do not build fabricd.
209
210 .. option:: --enable-isis-topology
211
212 Enable IS-IS topology generator.
213
214 .. option:: --enable-isis-te
215
216 Enable Traffic Engineering Extension for ISIS (RFC5305)
217
218 .. option:: --enable-realms
219
220 Enable the support of Linux Realms. Convert tag values from 1-255 into a
221 realm value when inserting into the Linux kernel. Then routing policy can be
222 assigned to the realm. See the tc man page.
223
224 .. option:: --disable-rtadv
225
226 Disable support IPV6 router advertisement in zebra.
227
228 .. option:: --enable-gcc-rdynamic
229
230 Pass the ``-rdynamic`` option to the linker driver. This is in most cases
231 necessary for getting usable backtraces. This option defaults to on if the
232 compiler is detected as gcc, but giving an explicit enable/disable is
233 suggested.
234
235 .. option:: --disable-backtrace
236
237 Controls backtrace support for the crash handlers. This is autodetected by
238 default. Using the switch will enforce the requested behaviour, failing with
239 an error if support is requested but not available. On BSD systems, this
240 needs libexecinfo, while on glibc support for this is part of libc itself.
241
242 .. option:: --enable-dev-build
243
244 Turn on some options for compiling FRR within a development environment in
245 mind. Specifically turn on -g3 -O0 for compiling options and add inclusion
246 of grammar sandbox.
247
248 .. option:: --enable-fuzzing
249
250 Turn on some compile options to allow you to run fuzzing tools against the
251 system. This flag is intended as a developer only tool and should not be
252 used for normal operations.
253
254 .. option:: --disable-snmp
255
256 Build without SNMP support.
257
258 .. option:: --disable-vtysh
259
260 Build without VTYSH.
261
262 .. option:: --enable-fpm
263
264 Build with FPM module support.
265
266 .. option:: --enable-numeric-version
267
268 Alpine Linux does not allow non-numeric characters in the version string.
269 With this option, we provide a way to strip out these characters for APK dev
270 package builds.
271
272 .. option:: --enable-multipath=X
273
274 Compile FRR with up to X way ECMP supported. This number can be from 0-999.
275 For backwards compatibility with older configure options when setting X = 0,
276 we will build FRR with 64 way ECMP. This is needed because there are
277 hardcoded arrays that FRR builds towards, so we need to know how big to
278 make these arrays at build time. Additionally if this parameter is
279 not passed in FRR will default to 16 ECMP.
280
281 .. option:: --enable-shell-access
282
283 Turn on the ability of FRR to access some shell options( telnet/ssh/bash/etc. )
284 from vtysh itself. This option is considered extremely unsecure and should only
285 be considered for usage if you really really know what you are doing.
286
287 .. option:: --enable-gcov
288
289 Code coverage reports from gcov require adjustments to the C and LD flags.
290 With this option, gcov instrumentation is added to the build and coverage
291 reports are created during execution. The check-coverage make target is
292 also created to ease report uploading to codecov.io. The upload requires
293 the COMMIT (git hash) and TOKEN (codecov upload token) environment variables
294 be set.
295
296 .. option:: --enable-config-rollbacks
297
298 Build with configuration rollback support. Requires SQLite3.
299
300 .. option:: --enable-confd=<dir>
301
302 Build the ConfD northbound plugin. Look for the libconfd libs and headers
303 in `dir`.
304
305 .. option:: --enable-sysrepo
306
307 Build the Sysrepo northbound plugin.
308
309 You may specify any combination of the above options to the configure
310 script. By default, the executables are placed in :file:`/usr/local/sbin`
311 and the configuration files in :file:`/usr/local/etc`. The :file:`/usr/local/`
312 installation prefix and other directories may be changed using the following
313 options to the configuration script.
314
315 .. option:: --prefix <prefix>
316
317 Install architecture-independent files in `prefix` [/usr/local].
318
319 .. option:: --sysconfdir <dir>
320
321 Look for configuration files in `dir` [`prefix`/etc]. Note that sample
322 configuration files will be installed here.
323
324 .. option:: --localstatedir <dir>
325
326 Configure zebra to use `dir` for local state files, such as pid files and
327 unix sockets.
328
329 .. option:: --with-yangmodelsdir <dir>
330
331 Look for YANG modules in `dir` [`prefix`/share/yang]. Note that the FRR
332 YANG modules will be installed here.
333
334 .. option:: --with-libyang-pluginsdir <dir>
335
336 Look for libyang plugins in `dir` [`prefix`/lib/frr/libyang_plugins].
337 Note that the FRR libyang plugins will be installed here.
338
339 This option is meaningless with libyang 0.16.74 or newer and will be
340 removed once support for older libyang versions is dropped.
341
342 When it's desired to run FRR without installing it in the system, it's possible
343 to configure it as follows to look for YANG modules and libyang plugins in the
344 compile directory:
345 .. code-block:: shell
346
347 ./configure --with-libyang-pluginsdir="`pwd`/yang/libyang_plugins/.libs" \
348 --with-yangmodelsdir="`pwd`/yang"
349
350 Python dependency, documentation and tests
351 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
352
353 FRR's documentation and basic unit tests heavily use code written in Python.
354 Additionally, FRR ships Python extensions written in C which are used during
355 its build process.
356
357 To this extent, FRR needs the following:
358
359 * an installation of CPython, preferably version 3.2 or newer (2.7 works but
360 is end of life and will stop working at some point.)
361 * development files (mostly headers) for that version of CPython
362 * an installation of `sphinx` for that version of CPython, to build the
363 documentation
364 * an installation of `pytest` for that version of CPython, to run the unit
365 tests
366
367 The `sphinx` and `pytest` dependencies can be avoided by not building
368 documentation / not running ``make check``, but the CPython dependency is a
369 hard dependency of the FRR build process (for the `clippy` tool.)
370
371 .. _least-privilege-support:
372
373 Least-Privilege Support
374 """""""""""""""""""""""
375
376 .. index:: FRR Least-Privileges
377 .. index:: FRR Privileges
378
379 Additionally, you may configure zebra to drop its elevated privileges
380 shortly after startup and switch to another user. The configure script will
381 automatically try to configure this support. There are three configure
382 options to control the behaviour of FRR daemons.
383
384 .. option:: --enable-user <user>
385
386 Switch to user `user shortly after startup, and run as user `user` in normal
387 operation.
388
389 .. option:: --enable-group <user>
390
391 Switch real and effective group to `group` shortly after startup.
392
393 .. option:: --enable-vty-group <group>
394
395 Create Unix Vty sockets (for use with vtysh) with group ownership set to
396 `group`. This allows one to create a separate group which is restricted to
397 accessing only the vty sockets, hence allowing one to delegate this group to
398 individual users, or to run vtysh setgid to this group.
399
400 The default user and group which will be configured is 'frr' if no user or
401 group is specified. Note that this user or group requires write access to the
402 local state directory (see :option:`--localstatedir`) and requires at least
403 read access, and write access if you wish to allow daemons to write out their
404 configuration, to the configuration directory (see :option:`--sysconfdir`).
405
406 On systems which have the 'libcap' capabilities manipulation library (currently
407 only Linux), FRR will retain only minimal capabilities required and will only
408 raise these capabilities for brief periods. On systems without libcap, FRR will
409 run as the user specified and only raise its UID to 0 for brief periods.
410
411 Linux Notes
412 """""""""""
413
414 .. index:: Building on Linux boxes
415 .. index:: Linux configurations
416
417 There are several options available only to GNU/Linux systems. If you use
418 GNU/Linux, make sure that the current kernel configuration is what you want.
419 FRR will run with any kernel configuration but some recommendations do exist.
420
421 :makevar:`CONFIG_NETLINK`
422 Kernel/User Netlink socket. This enables an advanced interface between
423 the Linux kernel and *zebra* (:ref:`kernel-interface`).
424
425 :makevar:`CONFIG_RTNETLINK`
426 This makes it possible to receive Netlink routing messages. If you specify
427 this option, *zebra* can detect routing information updates directly from
428 the kernel (:ref:`kernel-interface`).
429
430 :makevar:`CONFIG_IP_MULTICAST`
431 This option enables IP multicast and should be specified when you use *ripd*
432 (:ref:`rip`) or *ospfd* (:ref:`ospfv2`) because these protocols use
433 multicast.
434
435 Linux sysctl settings and kernel modules
436 ````````````````````````````````````````
437
438 There are several kernel parameters that impact overall operation of FRR when
439 using Linux as a router. Generally these parameters should be set in a
440 sysctl related configuration file, e.g., :file:`/etc/sysctl.conf` on
441 Ubuntu based systems and a new file
442 :file:`/etc/sysctl.d/90-routing-sysctl.conf` on Centos based systems.
443 Additional kernel modules are also needed to support MPLS forwarding.
444
445 :makevar:`IPv4 and IPv6 forwarding`
446 The following are set to enable IP forwarding in the kernel:
447
448 .. code-block:: shell
449
450 net.ipv4.conf.all.forwarding=1
451 net.ipv6.conf.all.forwarding=1
452
453 :makevar:`MPLS forwarding`
454 Basic MPLS support was introduced in the kernel in version 4.1 and
455 additional capability was introduced in 4.3 and 4.5.
456 For some general information on Linux MPLS support, see
457 https://www.netdevconf.org/1.1/proceedings/slides/prabhu-mpls-tutorial.pdf.
458 The following modules should be loaded to support MPLS forwarding,
459 and are generally added to a configuration file such as
460 :file:`/etc/modules-load.d/modules.conf`:
461
462 .. code-block:: shell
463
464 # Load MPLS Kernel Modules
465 mpls_router
466 mpls_iptunnel
467
468 The following is an example to enable MPLS forwarding in the
469 kernel, typically by editing :file:`/etc/sysctl.conf`:
470
471 .. code-block:: shell
472
473 # Enable MPLS Label processing on all interfaces
474 net.mpls.conf.eth0.input=1
475 net.mpls.conf.eth1.input=1
476 net.mpls.conf.eth2.input=1
477 net.mpls.platform_labels=100000
478
479 Make sure to add a line equal to :file:`net.mpls.conf.<if>.input` for
480 each interface *'<if>'* used with MPLS and to set labels to an
481 appropriate value.
482
483 :makevar:`VRF forwarding`
484 General information on Linux VRF support can be found in
485 https://www.kernel.org/doc/Documentation/networking/vrf.txt. Kernel
486 support for VRFs was introduced in 4.3 and improved upon through
487 4.13, which is the version most used in FRR testing (as of June
488 2018). Additional background on using Linux VRFs and kernel specific
489 features can be found in
490 http://schd.ws/hosted_files/ossna2017/fe/vrf-tutorial-oss.pdf.
491
492 The following impacts how BGP TCP sockets are managed across VRFs:
493
494 .. code-block:: shell
495
496 net.ipv4.tcp_l3mdev_accept=0
497
498 With this setting a BGP TCP socket is opened per VRF. This setting
499 ensures that other TCP services, such as SSH, provided for non-VRF
500 purposes are blocked from VRF associated Linux interfaces.
501
502 .. code-block:: shell
503
504 net.ipv4.tcp_l3mdev_accept=1
505
506 With this setting a single BGP TCP socket is shared across the
507 system. This setting exposes any TCP service running on the system,
508 e.g., SSH, to all VRFs. Generally this setting is not used in
509 environments where VRFs are used to support multiple administrative
510 groups.
511
512 **Important note** as of June 2018, Kernel versions 4.14-4.18 have a
513 known bug where VRF-specific TCP sockets are not properly handled. When
514 running these kernel versions, if unable to establish any VRF BGP
515 adjacencies, either downgrade to 4.13 or set
516 'net.ipv4.tcp_l3mdev_accept=1'. The fix for this issue is planned to be
517 included in future kernel versions. So upgrading your kernel may also
518 address this issue.
519
520
521 Building
522 ^^^^^^^^
523
524 Once you have chosen your configure options, run the configure script and pass
525 the options you chose:
526
527 .. code-block:: shell
528
529 ./configure \
530 --prefix=/usr \
531 --enable-exampledir=/usr/share/doc/frr/examples/ \
532 --localstatedir=/var/run/frr \
533 --sbindir=/usr/lib/frr \
534 --sysconfdir=/etc/frr \
535 --enable-pimd \
536 --enable-watchfrr \
537 ...
538
539 After configuring the software, you are ready to build and install it in your
540 system.
541
542 .. code-block:: shell
543
544 make && sudo make install
545
546 If everything finishes successfully, FRR should be installed. You should now
547 skip to the section on :ref:`basic-setup`.