]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/basic.rst
bgpd: Allow peering via 127.0.0.0/8
[mirror_frr.git] / doc / user / basic.rst
CommitLineData
0efdf0fe 1.. _basic-commands:
42fc5d26
QY
2
3**************
db910447 4Basic Commands
42fc5d26
QY
5**************
6
2da6ccc3 7The following sections discuss commands common to all the routing daemons.
42fc5d26 8
0efdf0fe 9.. _config-commands:
42fc5d26
QY
10
11Config Commands
12===============
13
42fc5d26 14
42fc5d26 15
42fc5d26 16
42fc5d26
QY
17
18In a config file, you can write the debugging options, a vty's password,
2da6ccc3
QY
19routing daemon configurations, a log file name, and so forth. This information
20forms the initial command set for a routing beast as it is starting.
42fc5d26 21
dc5564c7 22Config files are generally found in |INSTALL_PREFIX_ETC|.
42fc5d26 23
d7432def 24Config Methods
d71b9156 25--------------
d7432def
QY
26
27There are two ways of configuring FRR.
28
29Traditionally each of the daemons had its own config file. The daemon name plus
30``.conf`` was the default config file name. For example, zebra's default config
31file was :file:`zebra.conf`. This method is deprecated.
32
33Because of the amount of config files this creates, and the tendency of one
34daemon to rely on others for certain functionality, most deployments now use
35"integrated" configuration. In this setup all configuration goes into a single
36file, typically :file:`/etc/frr/frr.conf`. When starting up FRR using an init
37script or systemd, ``vtysh`` is invoked to read the config file and send the
38appropriate portions to only the daemons interested in them. Running
39configuration updates are persisted back to this single file using ``vtysh``.
40This is the recommended method. To use this method, add the following line to
41:file:`/etc/frr/vtysh.conf`:
42
43.. code-block:: frr
44
45 service integrated-vtysh-config
46
47If you installed from source or used a package, this is probably already
48present.
49
50If desired, you can specify a config file using the :option:`-f` or
51:option:`--config_file` options when starting a daemon.
52
42fc5d26 53
0efdf0fe 54.. _basic-config-commands:
42fc5d26
QY
55
56Basic Config Commands
57---------------------
58
29adcd50
QY
59.. clicmd:: hostname HOSTNAME
60
8f58056c 61 Set hostname of the router. It is only for current ``vtysh``, it will not be
62 saved to any configuration file even with ``write file``.
63
64.. clicmd:: domainname DOMAINNAME
65
66 Set domainname of the router. It is only for current ``vtysh``, it will not
67 be saved to any configuration file even with ``write file``.
42fc5d26 68
03750f1e 69.. clicmd:: password PASSWORD
29adcd50 70
322e2d5c
PM
71 Set password for vty interface. The ``no`` form of the command deletes the
72 password. If there is no password, a vty won't accept connections.
42fc5d26 73
03750f1e 74.. clicmd:: enable password PASSWORD
29adcd50 75
322e2d5c
PM
76 Set enable password. The ``no`` form of the command deletes the enable
77 password.
42fc5d26 78
9b802bf4
DL
79.. clicmd:: service cputime-stats
80
81 Collect CPU usage statistics for individual FRR event handlers and CLI
82 commands. This is enabled by default and can be disabled if the extra
83 overhead causes a noticeable slowdown on your system.
84
85 Disabling these statistics will also make the
86 :clicmd:`service cputime-warning (1-4294967295)` limit non-functional.
87
88.. clicmd:: service cputime-warning (1-4294967295)
89
90 Warn if the CPU usage of an event handler or CLI command exceeds the
91 specified limit (in milliseconds.) Such warnings are generally indicative
92 of some routine in FRR mistakenly blocking/hogging the processing loop and
93 should be reported as a FRR bug.
94
95 The default limit is 5 seconds (i.e. 5000), but this can be changed by the
96 deprecated ``--enable-time-check=...`` compile-time option.
97
98 This command has no effect if :clicmd:`service cputime-stats` is disabled.
99
100.. clicmd:: service walltime-warning (1-4294967295)
101
102 Warn if the total wallclock time spent handling an event or executing a CLI
103 command exceeds the specified limit (in milliseconds.) This includes time
104 spent waiting for I/O or other tasks executing and may produce excessive
105 warnings if the system is overloaded. (This may still be useful to
106 provide an immediate sign that FRR is not operating correctly due to
107 externally caused starvation.)
108
109 The default limit is 5 seconds as above, including the same deprecated
110 ``--enable-time-check=...`` compile-time option.
111
03750f1e 112.. clicmd:: log trap LEVEL
29adcd50
QY
113
114 These commands are deprecated and are present only for historical
115 compatibility. The log trap command sets the current logging level for all
116 enabled logging destinations, and it sets the default for all future logging
117 commands that do not specify a level. The normal default logging level is
2da6ccc3
QY
118 debugging. The ``no`` form of the command resets the default level for
119 future logging commands to debugging, but it does not change the logging
120 level of existing logging destinations.
8d209861 121
29adcd50 122
03750f1e 123.. clicmd:: log stdout LEVEL
29adcd50
QY
124
125 Enable logging output to stdout. If the optional second argument specifying
126 the logging level is not present, the default logging level (typically
2da6ccc3
QY
127 debugging) will be used. The ``no`` form of the command disables logging to
128 stdout. The ``LEVEL`` argument must have one of these values: emergencies,
129 alerts, critical, errors, warnings, notifications, informational, or
130 debugging. Note that the existing code logs its most important messages with
131 severity ``errors``.
8d209861 132
f93640b8
DL
133 .. note::
134
135 If ``systemd`` is in use and stdout is connected to systemd, FRR will
136 automatically switch to ``journald`` extended logging for this target.
137
0eb5f938
DL
138 .. warning::
139
140 FRRouting uses the ``writev()`` system call to write log messages. This
141 call is supposed to be atomic, but in reality this does not hold for
142 pipes or terminals, only regular files. This means that in rare cases,
143 concurrent log messages from distinct threads may get jumbled in
144 terminal output. Use a log file and ``tail -f`` if this rare chance is
145 inacceptable to your setup.
146
03750f1e 147.. clicmd:: log file [FILENAME [LEVEL]]
8d209861 148
29adcd50 149 If you want to log into a file, please specify ``filename`` as
2da6ccc3 150 in this example:
8d209861 151
2da6ccc3
QY
152 ::
153
154 log file /var/log/frr/bgpd.log informational
8d209861 155
29adcd50
QY
156 If the optional second argument specifying the logging level is not present,
157 the default logging level (typically debugging, but can be changed using the
158 deprecated ``log trap`` command) will be used. The ``no`` form of the command
2da6ccc3
QY
159 disables logging to a file.
160
03750f1e 161.. clicmd:: log syslog [LEVEL]
8d209861 162
29adcd50
QY
163 Enable logging output to syslog. If the optional second argument specifying
164 the logging level is not present, the default logging level (typically
165 debugging, but can be changed using the deprecated ``log trap`` command) will
166 be used. The ``no`` form of the command disables logging to syslog.
8d209861 167
f93640b8
DL
168 .. note::
169
170 This uses the system's ``syslog()`` API, which does not support message
171 batching or structured key/value data pairs. If possible, use
172 :clicmd:`log extended EXTLOGNAME` with
173 :clicmd:`destination syslog [supports-rfc5424]` instead of this.
174
175.. clicmd:: log extended EXTLOGNAME
176
177 Create an extended logging target with the specified name. The name has
178 no further meaning and is only used to identify the target. Multiple
179 targets can be created and deleted with the ``no`` form.
180
181 Refer to :ref:`ext-log-target` for further details and suboptions.
182
03750f1e 183.. clicmd:: log monitor [LEVEL]
29adcd50 184
f93640b8 185 This command is deprecated and does nothing.
8d209861 186
03750f1e 187.. clicmd:: log facility [FACILITY]
29adcd50
QY
188
189 This command changes the facility used in syslog messages. The default
2da6ccc3
QY
190 facility is ``daemon``. The ``no`` form of the command resets the facility
191 to the default ``daemon`` facility.
8d209861 192
03750f1e 193.. clicmd:: log record-priority
29adcd50
QY
194
195 To include the severity in all messages logged to a file, to stdout, or to
196 a terminal monitor (i.e. anything except syslog),
197 use the ``log record-priority`` global configuration command.
198 To disable this option, use the ``no`` form of the command. By default,
199 the severity level is not included in logged messages. Note: some
32d9e333
DS
200 versions of syslogd can be configured to include the facility and
201 level in the messages emitted.
8d209861 202
03750f1e 203.. clicmd:: log timestamp precision [(0-6)]
29adcd50 204
2da6ccc3
QY
205 This command sets the precision of log message timestamps to the given
206 number of digits after the decimal point. Currently, the value must be in
207 the range 0 to 6 (i.e. the maximum precision is microseconds). To restore
208 the default behavior (1-second accuracy), use the ``no`` form of the
209 command, or set the precision explicitly to 0.
42fc5d26 210
2da6ccc3 211 ::
42fc5d26 212
2da6ccc3 213 log timestamp precision 3
42fc5d26 214
29adcd50
QY
215 In this example, the precision is set to provide timestamps with
216 millisecond accuracy.
42fc5d26 217
03750f1e 218.. clicmd:: log commands
29adcd50 219
2da6ccc3
QY
220 This command enables the logging of all commands typed by a user to all
221 enabled log destinations. The note that logging includes full command lines,
80d02adb
DS
222 including passwords. If the daemon startup option `--command-log-always`
223 is used to start the daemon then this command is turned on by default
224 and cannot be turned off and the [no] form of the command is dissallowed.
42fc5d26 225
9c2aa919
DL
226.. clicmd:: log filtered-file [FILENAME [LEVEL]]
227
228 Configure a destination file for filtered logs with the
229 :clicmd:`log filter-text WORD` command.
230
231.. clicmd:: log filter-text WORD
c103b19f
SW
232
233 This command forces logs to be filtered on a specific string. A log message
234 will only be printed if it matches on one of the filters in the log-filter
9c2aa919
DL
235 table. The filter only applies to file logging targets configured with
236 :clicmd:`log filtered-file [FILENAME [LEVEL]]`.
c103b19f 237
018fa5f8
SW
238 .. note::
239
240 Log filters help when you need to turn on debugs that cause significant
241 load on the system (enabling certain debugs can bring FRR to a halt).
242 Log filters prevent this but you should still expect a small performance
243 hit due to filtering each of all those logs.
244
9c2aa919
DL
245 .. note::
246
247 This setting is not saved to ``frr.conf`` and not shown in
248 :clicmd:`show running-config`. It is intended for ephemeral debugging
249 purposes only.
250
251.. clicmd:: clear log filter-text
c103b19f 252
9c2aa919 253 This command clears all current filters in the log-filter table.
c103b19f 254
7c945dff
MS
255
256.. clicmd:: log immediate-mode
257
258 Use unbuffered output for log and debug messages; normally there is
259 some internal buffering.
260
de75bdc3
DL
261.. clicmd:: log unique-id
262
263 Include ``[XXXXX-XXXXX]`` log message unique identifier in the textual part
264 of log messages. This is enabled by default, but can be disabled with
265 ``no log unique-id``. Please make sure the IDs are enabled when including
266 logs for FRR bug reports.
267
268 The unique identifiers are automatically generated based on source code
269 file name, format string (before filling out) and severity. They do not
270 change "randomly", but some cleanup work may cause large chunks of ID
271 changes between releases. The IDs always start with a letter, consist of
272 letters and numbers (and a dash for readability), are case insensitive, and
273 ``I``, ``L``, ``O`` & ``U`` are excluded.
274
275 This option will not affect future logging targets which allow putting the
276 unique identifier in auxiliary metadata outside the log message text
277 content. (No such logging target exists currently, but RFC5424 syslog and
278 systemd's journald both support it.)
279
280.. clicmd:: debug unique-id XXXXX-XXXXX backtrace
281
282 Print backtraces (call stack) for specific log messages, identified by
283 their unique ID (see above.) Includes source code location and current
284 event handler being executed. On some systems you may need to install a
285 `debug symbols` package to get proper function names rather than raw code
286 pointers.
287
288 This command can be issued inside and outside configuration mode, and is
289 saved to configuration only if it was given in configuration mode.
290
291 .. warning::
292
293 Printing backtraces can significantly slow down logging calls and cause
294 log files to quickly balloon in size. Remember to disable backtraces
295 when they're no longer needed.
296
0c896167
DS
297.. clicmd:: debug routemap [detail]
298
299 This command turns on debugging of routemaps. When detail is specified
300 more data is provided to the operator about the reasoning about what
301 is going on in the routemap code.
302
29adcd50
QY
303.. clicmd:: service password-encryption
304
305 Encrypt password.
42fc5d26 306
29adcd50 307.. clicmd:: service advanced-vty
42fc5d26 308
29adcd50 309 Enable advanced mode VTY.
42fc5d26 310
29adcd50
QY
311.. clicmd:: service terminal-length (0-512)
312
2da6ccc3
QY
313 Set system wide line configuration. This configuration command applies to
314 all VTY interfaces.
42fc5d26 315
29adcd50
QY
316.. clicmd:: line vty
317
318 Enter vty configuration mode.
42fc5d26 319
29adcd50
QY
320.. clicmd:: banner motd default
321
322 Set default motd string.
42fc5d26 323
038984fd
DA
324.. clicmd:: banner motd file FILE
325
326 Set motd string from file. The file must be in directory specified
327 under ``--sysconfdir``.
328
038984fd
DA
329.. clicmd:: banner motd line LINE
330
331 Set motd string from an input.
332
29adcd50
QY
333.. clicmd:: exec-timeout MINUTE [SECOND]
334
335 Set VTY connection timeout value. When only one argument is specified
336 it is used for timeout value in minutes. Optional second argument is
337 used for timeout value in seconds. Default timeout value is 10 minutes.
338 When timeout value is zero, it means no timeout.
42fc5d26 339
03750f1e
QY
340 Not setting this, or setting the values to 0 0, means a timeout will not be
341 enabled.
42fc5d26 342
29adcd50
QY
343.. clicmd:: access-class ACCESS-LIST
344
345 Restrict vty connections with an access list.
42fc5d26 346
a28af472
DA
347.. clicmd:: allow-reserved-ranges
348
349 Allow using IPv4 reserved (Class E) IP ranges for daemons. E.g.: setting
350 IPv4 addresses for interfaces or allowing reserved ranges in BGP next-hops.
351
8eb09e64
DA
352 If you need multiple FRR instances (or FRR + any other daemon) running in a
353 single router and peering via 127.0.0.0/8, it's also possible to use this
354 knob if turned on.
355
a28af472 356 Default: off.
2da6ccc3 357
0efdf0fe 358.. _sample-config-file:
42fc5d26
QY
359
360Sample Config File
361------------------
362
363Below is a sample configuration file for the zebra daemon.
364
9eb95b3b 365.. code-block:: frr
42fc5d26 366
9eb95b3b
QY
367 !
368 ! Zebra configuration file
369 !
a048cda5
DL
370 frr version 6.0
371 frr defaults traditional
372 !
9eb95b3b
QY
373 hostname Router
374 password zebra
375 enable password zebra
376 !
377 log stdout
378 !
379 !
42fc5d26 380
8d209861 381
2da6ccc3
QY
382``!`` and ``#`` are comment characters. If the first character of the word is
383one of the comment characters then from the rest of the line forward will be
384ignored as a comment.
42fc5d26 385
9eb95b3b 386.. code-block:: frr
42fc5d26 387
9eb95b3b 388 password zebra!password
42fc5d26 389
2da6ccc3
QY
390If a comment character is not the first character of the word, it's a normal
391character. So in the above example ``!`` will not be regarded as a comment and
392the password is set to ``zebra!password``.
42fc5d26 393
a048cda5
DL
394
395Configuration versioning, profiles and upgrade behavior
396-------------------------------------------------------
397
398All |PACKAGE_NAME| daemons share a mechanism to specify a configuration profile
399and version for loading and saving configuration. Specific configuration
400settings take different default values depending on the selected profile and
401version.
402
403While the profile can be selected by user configuration and will remain over
404upgrades, |PACKAGE_NAME| will always write configurations using its current
405version. This means that, after upgrading, a ``write file`` may write out a
406slightly different configuration than what was read in.
407
408Since the previous configuration is loaded with its version's defaults, but
409the new configuration is written with the new defaults, any default that
410changed between versions will result in an appropriate configuration entry
411being written out. **FRRouting configuration is sticky, staying consistent
412over upgrades.** Changed defaults will only affect new configuration.
413
414Note that the loaded version persists into interactive configuration
415sessions. Commands executed in an interactive configuration session are
416no different from configuration loaded at startup. This means that when,
417say, you configure a new BGP peer, the defaults used for configuration
418are the ones selected by the last ``frr version`` command.
419
420.. warning::
421
422 Saving the configuration does not bump the daemons forward to use the new
423 version for their defaults, but restarting them will, since they will then
424 apply the new ``frr version`` command that was written out. Manually
425 execute the ``frr version`` command in ``show running-config`` to avoid
426 this intermediate state.
427
428This is visible in ``show running-config``:
429
430.. code-block:: frr
431
432 Current configuration:
433 !
434 ! loaded from 6.0
435 frr version 6.1-dev
436 frr defaults traditional
437 !
438
439If you save and then restart with this configuration, the old defaults will
440no longer apply. Similarly, you could execute ``frr version 6.1-dev``, causing
441the new defaults to apply and the ``loaded from 6.0`` comment to disappear.
442
443
444Profiles
445^^^^^^^^
446
447|PACKAGE_NAME| provides configuration profiles to adapt its default settings
448to various usage scenarios. Currently, the following profiles are
449implemented:
450
451* ``traditional`` - reflects defaults adhering mostly to IETF standards or
452 common practices in wide-area internet routing.
453* ``datacenter`` - reflects a single administrative domain with intradomain
454 links using aggressive timers.
455
456Your distribution/installation may pre-set a profile through the ``-F`` command
457line option on all daemons. All daemons must be configured for the same
458profile. The value specified on the command line is only a pre-set and any
459``frr defaults`` statement in the configuration will take precedence.
460
461.. note::
462
463 The profile must be the same across all daemons. Mismatches may result
464 in undefined behavior.
465
466You can freely switch between profiles without causing any interruption or
467configuration changes. All settings remain at their previous values, and
468``show running-configuration`` output will have new output listing the previous
469default values as explicit configuration. New configuration, e.g. adding a
470BGP peer, will use the new defaults. To apply the new defaults for existing
471configuration, the previously-invisible old defaults that are now shown must
472be removed from the configuration.
473
474
475Upgrade practices for interactive configuration
476^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
477
478If you configure |PACKAGE_NAME| interactively and use the configuration
479writing functionality to make changes persistent, the following
480recommendations apply in regards to upgrades:
481
4821. Skipping major versions should generally work but is still inadvisable.
483 To avoid unneeded issue, upgrade one major version at a time and write
484 out the configuration after each update.
485
4862. After installing a new |PACKAGE_NAME| version, check the configuration
487 for differences against your old configuration. If any defaults changed
488 that affect your setup, lines may appear or disappear. If a new line
489 appears, it was previously the default (or not supported) and is now
485ac9a7 490 necessary to retain previous behavior. If a line disappears, it
a048cda5
DL
491 previously wasn't the default, but now is, so it is no longer necessary.
492
4933. Check the log files for deprecation warnings by using ``grep -i deprecat``.
494
4954. After completing each upgrade, save the configuration and either restart
496 |PACKAGE_NAME| or execute ``frr version <CURRENT>`` to ensure defaults of
497 the new version are fully applied.
498
499
500Upgrade practices for autogenerated configuration
501^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
502
503When using |PACKAGE_NAME| with generated configurations (e.g. Ansible,
504Puppet, etc.), upgrade considerations differ somewhat:
505
5061. Always write out a ``frr version`` statement in the configurations you
507 generate. This ensures that defaults are applied consistently.
508
5092. Try to not run more distinct versions of |PACKAGE_NAME| than necessary.
510 Each version may need to be checked individually. If running a mix of
511 older and newer installations, use the oldest version for the
512 ``frr version`` statement.
513
5143. When rolling out upgrades, generate a configuration as usual with the old
515 version identifier and load it. Check for any differences or deprecation
516 warnings. If there are differences in the configuration, propagate these
517 back to the configuration generator to minimize relying on actual default
518 values.
519
5204. After the last installation of an old version is removed, change the
521 configuration generation to a newer ``frr version`` as appropriate. Perform
522 the same checks as when rolling out upgrades.
523
524
0efdf0fe 525.. _terminal-mode-commands:
42fc5d26
QY
526
527Terminal Mode Commands
528======================
529
29adcd50
QY
530.. clicmd:: write terminal
531
d1a242fd 532 Displays the current configuration to the vty interface.
42fc5d26 533
29adcd50
QY
534.. clicmd:: write file
535
d1a242fd 536 Write current configuration to configuration file.
42fc5d26 537
982589a3 538.. clicmd:: configure [terminal]
29adcd50 539
d1a242fd
QY
540 Change to configuration mode. This command is the first step to
541 configuration.
42fc5d26 542
29adcd50
QY
543.. clicmd:: terminal length (0-512)
544
2da6ccc3
QY
545 Set terminal display length to ``(0-512)``. If length is 0, no display
546 control is performed.
42fc5d26 547
29adcd50
QY
548.. clicmd:: who
549
d1a242fd 550 Show a list of currently connected vty sessions.
42fc5d26 551
29adcd50
QY
552.. clicmd:: list
553
d1a242fd 554 List all available commands.
42fc5d26 555
29adcd50
QY
556.. clicmd:: show version
557
d1a242fd 558 Show the current version of |PACKAGE_NAME| and its build host information.
42fc5d26 559
29adcd50
QY
560.. clicmd:: show logging
561
2da6ccc3
QY
562 Shows the current configuration of the logging system. This includes the
563 status of all logging destinations.
42fc5d26 564
c103b19f
SW
565.. clicmd:: show log-filter
566
567 Shows the current log filters applied to each daemon.
568
aa270404 569.. clicmd:: show memory [DAEMON]
0a62b873
DL
570
571 Show information on how much memory is used for which specific things in
572 |PACKAGE_NAME|. Output may vary depending on system capabilities but will
573 generally look something like this:
574
575 ::
576
577 frr# show memory
578 System allocator statistics:
579 Total heap allocated: 1584 KiB
580 Holding block headers: 0 bytes
581 Used small blocks: 0 bytes
582 Used ordinary blocks: 1484 KiB
583 Free small blocks: 2096 bytes
584 Free ordinary blocks: 100 KiB
585 Ordinary blocks: 2
586 Small blocks: 60
587 Holding blocks: 0
588 (see system documentation for 'mallinfo' for meaning)
589 --- qmem libfrr ---
590 Buffer : 3 24 72
591 Buffer data : 1 4120 4120
592 Host config : 3 (variably sized) 72
593 Command Tokens : 3427 72 247160
594 Command Token Text : 2555 (variably sized) 83720
595 Command Token Help : 2555 (variably sized) 61720
596 Command Argument : 2 (variably sized) 48
597 Command Argument Name : 641 (variably sized) 15672
598 [...]
599 --- qmem Label Manager ---
600 --- qmem zebra ---
601 ZEBRA VRF : 1 912 920
602 Route Entry : 11 80 968
603 Static route : 1 192 200
604 RIB destination : 8 48 448
605 RIB table info : 4 16 96
606 Nexthop tracking object : 1 200 200
607 Zebra Name Space : 1 312 312
608 --- qmem Table Manager ---
609
610 To understand system allocator statistics, refer to your system's
611 :manpage:`mallinfo(3)` man page.
612
613 Below these statistics, statistics on individual memory allocation types
614 in |PACKAGE_NAME| (so-called `MTYPEs`) is printed:
615
616 * the first column of numbers is the current count of allocations made for
617 the type (the number decreases when items are freed.)
618 * the second column is the size of each item. This is only available if
619 allocations on a type are always made with the same size.
620 * the third column is the total amount of memory allocated for the
621 particular type, including padding applied by malloc. This means that
622 the number may be larger than the first column multiplied by the second.
623 Overhead incurred by malloc's bookkeeping is not included in this, and
624 the column may be missing if system support is not available.
625
626 When executing this command from ``vtysh``, each of the daemons' memory
aa270404
IR
627 usage is printed sequentially. You can specify the daemon's name to print
628 only its memory usage.
0a62b873 629
012f7ae4
SR
630.. clicmd:: show motd
631
632 Show current motd banner.
633
a65f4b5d
DS
634.. clicmd:: show history
635
636 Dump the vtysh cli history.
637
29adcd50
QY
638.. clicmd:: logmsg LEVEL MESSAGE
639
2da6ccc3
QY
640 Send a message to all logging destinations that are enabled for messages of
641 the given severity.
642
fdd40d51 643.. clicmd:: find REGEX...
8421b140 644
fdd40d51
QY
645 This command performs a regex search across all defined commands in all
646 modes. As an example, suppose you're in enable mode and can't remember where
647 the command to turn OSPF segment routing on is:
8421b140
QY
648
649 ::
650
651 frr# find segment-routing on
652 (ospf) segment-routing on
fdd40d51
QY
653 (isis) segment-routing on
654
8421b140
QY
655
656 The CLI mode is displayed next to each command. In this example,
657 :clicmd:`segment-routing on` is under the `router ospf` mode.
658
fdd40d51
QY
659 Similarly, suppose you want a listing of all commands that contain "l2vpn"
660 and "neighbor":
8421b140
QY
661
662 ::
663
fdd40d51
QY
664 frr# find l2vpn.*neighbor
665 (view) show [ip] bgp l2vpn evpn neighbors <A.B.C.D|X:X::X:X|WORD> advertised-routes [json]
666 (view) show [ip] bgp l2vpn evpn neighbors <A.B.C.D|X:X::X:X|WORD> routes [json]
667 (view) show [ip] bgp l2vpn evpn rd ASN:NN_OR_IP-ADDRESS:NN neighbors <A.B.C.D|X:X::X:X|WORD> advertised-routes [json]
668 (view) show [ip] bgp l2vpn evpn rd ASN:NN_OR_IP-ADDRESS:NN neighbors <A.B.C.D|X:X::X:X|WORD> routes [json]
8421b140
QY
669 ...
670
fdd40d51
QY
671
672 Note that when entering spaces as part of a regex specification, repeated
673 spaces will be compressed into a single space for matching purposes. This is
674 a consequence of spaces being used to delimit CLI tokens. If you need to
675 match more than one space, use the ``\s`` escape.
676
677 POSIX Extended Regular Expressions are supported.
678
679
8b1148bf
DS
680.. _common-show-commands:
681
8b1148bf
DS
682.. clicmd:: show thread cpu [r|w|t|e|x]
683
684 This command displays system run statistics for all the different event
685 types. If no options is specified all different run types are displayed
686 together. Additionally you can ask to look at (r)ead, (w)rite, (t)imer,
f75e802d
DS
687 (e)vent and e(x)ecute thread event types. If you have compiled with
688 disable-cpu-time then this command will not show up.
8b1148bf 689
8b1148bf
DS
690.. clicmd:: show thread poll
691
692 This command displays FRR's poll data. It allows a glimpse into how
693 we are setting each individual fd for the poll command at that point
694 in time.
42fc5d26 695
a698ba16
DS
696.. clicmd:: show thread timers
697
698 This command displays FRR's timer data for timers that will pop in
699 the future.
700
1c9bd416
RZ
701.. clicmd:: show yang operational-data XPATH [{format <json|xml>|translate TRANSLATOR|with-config}] DAEMON
702
703 Display the YANG operational data starting from XPATH. The default
704 format is JSON, but can be displayed in XML as well.
705
706 Normally YANG operational data are located inside containers marked
707 as `read-only`.
708
709 Optionally it is also possible to display configuration leaves in
710 addition to operational data with the option `with-config`. This
711 option enables the display of configuration leaves with their
712 currently configured value (if the leaf is optional it will only show
713 if it was created or has a default value).
714
0efdf0fe 715.. _common-invocation-options:
42fc5d26
QY
716
717Common Invocation Options
718=========================
719
be46d288 720These options apply to all |PACKAGE_NAME| daemons.
42fc5d26
QY
721
722
c9365894 723.. option:: -d, --daemon
42fc5d26 724
d1a242fd 725 Run in daemon mode.
29adcd50 726
c9365894 727.. option:: -f, --config_file <file>
42fc5d26 728
d1a242fd 729 Set configuration file name.
42fc5d26 730
d1a242fd 731.. option:: -h, --help
42fc5d26 732
d1a242fd 733 Display this help and exit.
29adcd50 734
c9365894 735.. option:: -i, --pid_file <file>
42fc5d26 736
d1a242fd
QY
737 Upon startup the process identifier of the daemon is written to a file,
738 typically in :file:`/var/run`. This file can be used by the init system
739 to implement commands such as ``.../init.d/zebra status``,
740 ``.../init.d/zebra restart`` or ``.../init.d/zebra stop``.
42fc5d26 741
2da6ccc3
QY
742 The file name is an run-time option rather than a configure-time option so
743 that multiple routing daemons can be run simultaneously. This is useful when
744 using |PACKAGE_NAME| to implement a routing looking glass. One machine can
745 be used to collect differing routing views from differing points in the
746 network.
29adcd50 747
c9365894 748.. option:: -A, --vty_addr <address>
42fc5d26 749
2da6ccc3
QY
750 Set the VTY local address to bind to. If set, the VTY socket will only be
751 bound to this address.
42fc5d26 752
c9365894 753.. option:: -P, --vty_port <port>
29adcd50 754
d1a242fd
QY
755 Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not
756 be opened.
42fc5d26 757
d1a242fd 758.. option:: -u <user>
42fc5d26 759
d1a242fd 760 Set the user and group to run as.
29adcd50 761
6ed85950
DS
762.. option:: -N <namespace>
763
764 Set the namespace that the daemon will run in. A "/<namespace>" will
765 be added to all files that use the statedir. If you have "/var/run/frr"
766 as the default statedir then it will become "/var/run/frr/<namespace>".
767
ac2cb9bf
IR
768.. option:: -o, --vrfdefaultname <name>
769
770 Set the name used for the *Default VRF* in CLI commands and YANG models.
771 This option must be the same for all running daemons. By default, the name
772 is "default".
773
774 .. seealso:: :ref:`zebra-vrf`
775
c9365894 776.. option:: -v, --version
42fc5d26 777
d1a242fd 778 Print program version.
42fc5d26 779
80d02adb
DS
780.. option:: --command-log-always
781
782 Cause the daemon to always log commands entered to the specified log file.
783 This also makes the `no log commands` command dissallowed. Enabling this
784 is suggested if you have need to track what the operator is doing on
785 this router.
786
ed74ddf4
DS
787.. option:: --log <stdout|syslog|file:/path/to/log/file>
788
789 When initializing the daemon, setup the log to go to either stdout,
790 syslog or to a file. These values will be displayed as part of
791 a show run. Additionally they can be overridden at runtime if
792 desired via the normal log commands.
793
3cf3e018
DS
794.. option:: --log-level <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>
795
796 When initializing the daemon, allow the specification of a default
797 log level at startup from one of the specified levels.
798
1c2facd1
RW
799.. option:: --tcli
800
801 Enable the transactional CLI mode.
802
1a9f340b
MS
803.. option:: --limit-fds <number>
804
805 Limit the number of file descriptors that will be used internally
806 by the FRR daemons. By default, the daemons use the system ulimit
807 value.
808
0efdf0fe 809.. _loadable-module-support:
42fc5d26
QY
810
811Loadable Module Support
812=======================
813
8d209861
QY
814FRR supports loading extension modules at startup. Loading, reloading or
815unloading modules at runtime is not supported (yet). To load a module, use
42fc5d26
QY
816the following command line option at daemon startup:
817
818
c9365894 819.. option:: -M, --module <module:options>
29adcd50 820
d1a242fd
QY
821 Load the specified module, optionally passing options to it. If the module
822 name contains a slash (/), it is assumed to be a full pathname to a file to
823 be loaded. If it does not contain a slash, the |INSTALL_PREFIX_MODULES|
824 directory is searched for a module of the given name; first with the daemon
825 name prepended (e.g. ``zebra_mod`` for ``mod``), then without the daemon
826 name prepended.
42fc5d26 827
d1a242fd
QY
828 This option is available on all daemons, though some daemons may not have
829 any modules available to be loaded.
42fc5d26 830
2da6ccc3 831
42fc5d26
QY
832The SNMP Module
833---------------
834
835If SNMP is enabled during compile-time and installed as part of the package,
2da6ccc3 836the ``snmp`` module can be loaded for the *Zebra*, *bgpd*, *ospfd*, *ospf6d*
8d209861 837and *ripd* daemons.
42fc5d26 838
2da6ccc3
QY
839The module ignores any options passed to it. Refer to :ref:`snmp-support` for
840information on its usage.
841
42fc5d26
QY
842
843The FPM Module
844--------------
845
d1a242fd
QY
846If FPM is enabled during compile-time and installed as part of the package, the
847``fpm`` module can be loaded for the *zebra* daemon. This provides the
848Forwarding Plane Manager ("FPM") API.
42fc5d26 849
d1e7591e
QY
850The module expects its argument to be either ``Netlink`` or ``protobuf``,
851specifying the encapsulation to use. ``Netlink`` is the default, and
d1a242fd 852``protobuf`` may not be available if the module was built without protobuf
0efdf0fe 853support. Refer to :ref:`zebra-fib-push-interface` for more information.
42fc5d26 854
2da6ccc3 855
0efdf0fe 856.. _virtual-terminal-interfaces:
42fc5d26
QY
857
858Virtual Terminal Interfaces
859===========================
860
861VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line
862interface (CLI) for user interaction with the routing daemon.
863
2da6ccc3 864
0efdf0fe 865.. _vty-overview:
42fc5d26
QY
866
867VTY Overview
868------------
869
8d209861 870VTY stands for Virtual TeletYpe interface. It means you can connect to
42fc5d26
QY
871the daemon via the telnet protocol.
872
8d209861 873To enable a VTY interface, you have to setup a VTY password. If there
42fc5d26
QY
874is no VTY password, one cannot connect to the VTY interface at all.
875
876::
877
9eb95b3b
QY
878 % telnet localhost 2601
879 Trying 127.0.0.1...
880 Connected to localhost.
881 Escape character is '^]'.
42fc5d26 882
9eb95b3b
QY
883 Hello, this is |PACKAGE_NAME| (version |PACKAGE_VERSION|)
884 |COPYRIGHT_STR|
42fc5d26 885
9eb95b3b 886 User Access Verification
42fc5d26 887
9eb95b3b
QY
888 Password: XXXXX
889 Router> ?
890 enable . . . Turn on privileged commands
891 exit . . . Exit current mode and down to previous mode
892 help . . . Description of the interactive help system
893 list . . . Print command list
894 show . . . Show system inform
8d209861 895
9eb95b3b
QY
896 wh. . . Display who is on a vty
897 Router> enable
898 Password: XXXXX
899 Router# configure terminal
900 Router(config)# interface eth0
901 Router(config-if)# ip address 10.0.0.1/8
902 Router(config-if)# ^Z
903 Router#
42fc5d26 904
8d209861 905
0efdf0fe 906.. _vty-modes:
42fc5d26
QY
907
908VTY Modes
909---------
910
911There are three basic VTY modes:
912
913There are commands that may be restricted to specific VTY modes.
914
0efdf0fe 915.. _vty-view-mode:
42fc5d26
QY
916
917VTY View Mode
918^^^^^^^^^^^^^
919
920This mode is for read-only access to the CLI. One may exit the mode by
921leaving the system, or by entering `enable` mode.
922
0efdf0fe 923.. _vty-enable-mode:
42fc5d26
QY
924
925VTY Enable Mode
926^^^^^^^^^^^^^^^
927
928This mode is for read-write access to the CLI. One may exit the mode by
929leaving the system, or by escaping to view mode.
930
0efdf0fe 931.. _vty-other-modes:
42fc5d26
QY
932
933VTY Other Modes
934^^^^^^^^^^^^^^^
935
936This page is for describing other modes.
937
0efdf0fe 938.. _vty-cli-commands:
42fc5d26
QY
939
940VTY CLI Commands
941----------------
942
943Commands that you may use at the command-line are described in the following
944three subsubsections.
945
0efdf0fe 946.. _cli-movement-commands:
42fc5d26
QY
947
948CLI Movement Commands
949^^^^^^^^^^^^^^^^^^^^^
950
951These commands are used for moving the CLI cursor. The :kbd:`C` character
952means press the Control Key.
953
8d209861 954:kbd:`C-f` / :kbd:`LEFT`
9eb95b3b 955 Move forward one character.
42fc5d26 956
8d209861 957:kbd:`C-b` / :kbd:`RIGHT`
9eb95b3b 958 Move backward one character.
42fc5d26 959
8d209861 960:kbd:`M-f`
9eb95b3b 961 Move forward one word.
42fc5d26 962
8d209861 963:kbd:`M-b`
9eb95b3b 964 Move backward one word.
42fc5d26 965
8d209861 966:kbd:`C-a`
9eb95b3b 967 Move to the beginning of the line.
42fc5d26 968
8d209861 969:kbd:`C-e`
9eb95b3b 970 Move to the end of the line.
42fc5d26
QY
971
972
0efdf0fe 973.. _cli-editing-commands:
42fc5d26
QY
974
975CLI Editing Commands
976^^^^^^^^^^^^^^^^^^^^
977
978These commands are used for editing text on a line. The :kbd:`C`
979character means press the Control Key.
980
981
8d209861 982:kbd:`C-h` / :kbd:`DEL`
9eb95b3b 983 Delete the character before point.
42fc5d26
QY
984
985
8d209861 986:kbd:`C-d`
9eb95b3b 987 Delete the character after point.
42fc5d26
QY
988
989
8d209861 990:kbd:`M-d`
9eb95b3b 991 Forward kill word.
42fc5d26
QY
992
993
8d209861 994:kbd:`C-w`
9eb95b3b 995 Backward kill word.
42fc5d26
QY
996
997
8d209861 998:kbd:`C-k`
9eb95b3b 999 Kill to the end of the line.
42fc5d26
QY
1000
1001
8d209861 1002:kbd:`C-u`
9eb95b3b 1003 Kill line from the beginning, erasing input.
42fc5d26
QY
1004
1005
8d209861 1006:kbd:`C-t`
9eb95b3b 1007 Transpose character.
42fc5d26
QY
1008
1009
1010CLI Advanced Commands
1011^^^^^^^^^^^^^^^^^^^^^
1012
1013There are several additional CLI commands for command line completions,
1014insta-help, and VTY session management.
1015
1016
8d209861 1017:kbd:`C-c`
9eb95b3b 1018 Interrupt current input and moves to the next line.
42fc5d26
QY
1019
1020
8d209861 1021:kbd:`C-z`
9eb95b3b 1022 End current configuration session and move to top node.
42fc5d26
QY
1023
1024
8d209861 1025:kbd:`C-n` / :kbd:`DOWN`
9eb95b3b 1026 Move down to next line in the history buffer.
42fc5d26
QY
1027
1028
8d209861 1029:kbd:`C-p` / :kbd:`UP`
9eb95b3b 1030 Move up to previous line in the history buffer.
42fc5d26
QY
1031
1032
8d209861 1033:kbd:`TAB`
9eb95b3b 1034 Use command line completion by typing :kbd:`TAB`.
42fc5d26
QY
1035
1036
8d209861 1037:kbd:`?`
9eb95b3b
QY
1038 You can use command line help by typing ``help`` at the beginning of the
1039 line. Typing :kbd:`?` at any point in the line will show possible
1040 completions.
42fc5d26 1041
4c54343f
QY
1042Pipe Actions
1043^^^^^^^^^^^^
1044
1045VTY supports optional modifiers at the end of commands that perform
1046postprocessing on command output or modify the action of commands. These do not
1047show up in the :kbd:`?` or :kbd:`TAB` suggestion lists.
1048
1049``... | include REGEX``
1050 Filters the output of the preceding command, including only lines which
1051 match the POSIX Extended Regular Expression ``REGEX``. Do not put the regex
1052 in quotes.
1053
1054 Examples:
1055
1056 ::
1057
1058 frr# show ip bgp sum json | include remoteAs
1059 "remoteAs":0,
1060 "remoteAs":455,
1061 "remoteAs":99,
1062
1063 ::
1064
1065 frr# show run | include neigh.*[0-9]{2}\.0\.[2-4]\.[0-9]*
1066 neighbor 10.0.2.106 remote-as 99
1067 neighbor 10.0.2.107 remote-as 99
1068 neighbor 10.0.2.108 remote-as 99
1069 neighbor 10.0.2.109 remote-as 99
1070 neighbor 10.0.2.110 remote-as 99
1071 neighbor 10.0.3.111 remote-as 111
1072