]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/basic.rst
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
[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
29adcd50
QY
297.. clicmd:: service password-encryption
298
299 Encrypt password.
42fc5d26 300
29adcd50 301.. clicmd:: service advanced-vty
42fc5d26 302
29adcd50 303 Enable advanced mode VTY.
42fc5d26 304
29adcd50
QY
305.. clicmd:: service terminal-length (0-512)
306
2da6ccc3
QY
307 Set system wide line configuration. This configuration command applies to
308 all VTY interfaces.
42fc5d26 309
29adcd50
QY
310.. clicmd:: line vty
311
312 Enter vty configuration mode.
42fc5d26 313
29adcd50
QY
314.. clicmd:: banner motd default
315
316 Set default motd string.
42fc5d26 317
038984fd
DA
318.. clicmd:: banner motd file FILE
319
320 Set motd string from file. The file must be in directory specified
321 under ``--sysconfdir``.
322
038984fd
DA
323.. clicmd:: banner motd line LINE
324
325 Set motd string from an input.
326
29adcd50
QY
327.. clicmd:: exec-timeout MINUTE [SECOND]
328
329 Set VTY connection timeout value. When only one argument is specified
330 it is used for timeout value in minutes. Optional second argument is
331 used for timeout value in seconds. Default timeout value is 10 minutes.
332 When timeout value is zero, it means no timeout.
42fc5d26 333
03750f1e
QY
334 Not setting this, or setting the values to 0 0, means a timeout will not be
335 enabled.
42fc5d26 336
29adcd50
QY
337.. clicmd:: access-class ACCESS-LIST
338
339 Restrict vty connections with an access list.
42fc5d26 340
2da6ccc3 341
0efdf0fe 342.. _sample-config-file:
42fc5d26
QY
343
344Sample Config File
345------------------
346
347Below is a sample configuration file for the zebra daemon.
348
9eb95b3b 349.. code-block:: frr
42fc5d26 350
9eb95b3b
QY
351 !
352 ! Zebra configuration file
353 !
a048cda5
DL
354 frr version 6.0
355 frr defaults traditional
356 !
9eb95b3b
QY
357 hostname Router
358 password zebra
359 enable password zebra
360 !
361 log stdout
362 !
363 !
42fc5d26 364
8d209861 365
2da6ccc3
QY
366``!`` and ``#`` are comment characters. If the first character of the word is
367one of the comment characters then from the rest of the line forward will be
368ignored as a comment.
42fc5d26 369
9eb95b3b 370.. code-block:: frr
42fc5d26 371
9eb95b3b 372 password zebra!password
42fc5d26 373
2da6ccc3
QY
374If a comment character is not the first character of the word, it's a normal
375character. So in the above example ``!`` will not be regarded as a comment and
376the password is set to ``zebra!password``.
42fc5d26 377
a048cda5
DL
378
379Configuration versioning, profiles and upgrade behavior
380-------------------------------------------------------
381
382All |PACKAGE_NAME| daemons share a mechanism to specify a configuration profile
383and version for loading and saving configuration. Specific configuration
384settings take different default values depending on the selected profile and
385version.
386
387While the profile can be selected by user configuration and will remain over
388upgrades, |PACKAGE_NAME| will always write configurations using its current
389version. This means that, after upgrading, a ``write file`` may write out a
390slightly different configuration than what was read in.
391
392Since the previous configuration is loaded with its version's defaults, but
393the new configuration is written with the new defaults, any default that
394changed between versions will result in an appropriate configuration entry
395being written out. **FRRouting configuration is sticky, staying consistent
396over upgrades.** Changed defaults will only affect new configuration.
397
398Note that the loaded version persists into interactive configuration
399sessions. Commands executed in an interactive configuration session are
400no different from configuration loaded at startup. This means that when,
401say, you configure a new BGP peer, the defaults used for configuration
402are the ones selected by the last ``frr version`` command.
403
404.. warning::
405
406 Saving the configuration does not bump the daemons forward to use the new
407 version for their defaults, but restarting them will, since they will then
408 apply the new ``frr version`` command that was written out. Manually
409 execute the ``frr version`` command in ``show running-config`` to avoid
410 this intermediate state.
411
412This is visible in ``show running-config``:
413
414.. code-block:: frr
415
416 Current configuration:
417 !
418 ! loaded from 6.0
419 frr version 6.1-dev
420 frr defaults traditional
421 !
422
423If you save and then restart with this configuration, the old defaults will
424no longer apply. Similarly, you could execute ``frr version 6.1-dev``, causing
425the new defaults to apply and the ``loaded from 6.0`` comment to disappear.
426
427
428Profiles
429^^^^^^^^
430
431|PACKAGE_NAME| provides configuration profiles to adapt its default settings
432to various usage scenarios. Currently, the following profiles are
433implemented:
434
435* ``traditional`` - reflects defaults adhering mostly to IETF standards or
436 common practices in wide-area internet routing.
437* ``datacenter`` - reflects a single administrative domain with intradomain
438 links using aggressive timers.
439
440Your distribution/installation may pre-set a profile through the ``-F`` command
441line option on all daemons. All daemons must be configured for the same
442profile. The value specified on the command line is only a pre-set and any
443``frr defaults`` statement in the configuration will take precedence.
444
445.. note::
446
447 The profile must be the same across all daemons. Mismatches may result
448 in undefined behavior.
449
450You can freely switch between profiles without causing any interruption or
451configuration changes. All settings remain at their previous values, and
452``show running-configuration`` output will have new output listing the previous
453default values as explicit configuration. New configuration, e.g. adding a
454BGP peer, will use the new defaults. To apply the new defaults for existing
455configuration, the previously-invisible old defaults that are now shown must
456be removed from the configuration.
457
458
459Upgrade practices for interactive configuration
460^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
461
462If you configure |PACKAGE_NAME| interactively and use the configuration
463writing functionality to make changes persistent, the following
464recommendations apply in regards to upgrades:
465
4661. Skipping major versions should generally work but is still inadvisable.
467 To avoid unneeded issue, upgrade one major version at a time and write
468 out the configuration after each update.
469
4702. After installing a new |PACKAGE_NAME| version, check the configuration
471 for differences against your old configuration. If any defaults changed
472 that affect your setup, lines may appear or disappear. If a new line
473 appears, it was previously the default (or not supported) and is now
474 neccessary to retain previous behavior. If a line disappears, it
475 previously wasn't the default, but now is, so it is no longer necessary.
476
4773. Check the log files for deprecation warnings by using ``grep -i deprecat``.
478
4794. After completing each upgrade, save the configuration and either restart
480 |PACKAGE_NAME| or execute ``frr version <CURRENT>`` to ensure defaults of
481 the new version are fully applied.
482
483
484Upgrade practices for autogenerated configuration
485^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
486
487When using |PACKAGE_NAME| with generated configurations (e.g. Ansible,
488Puppet, etc.), upgrade considerations differ somewhat:
489
4901. Always write out a ``frr version`` statement in the configurations you
491 generate. This ensures that defaults are applied consistently.
492
4932. Try to not run more distinct versions of |PACKAGE_NAME| than necessary.
494 Each version may need to be checked individually. If running a mix of
495 older and newer installations, use the oldest version for the
496 ``frr version`` statement.
497
4983. When rolling out upgrades, generate a configuration as usual with the old
499 version identifier and load it. Check for any differences or deprecation
500 warnings. If there are differences in the configuration, propagate these
501 back to the configuration generator to minimize relying on actual default
502 values.
503
5044. After the last installation of an old version is removed, change the
505 configuration generation to a newer ``frr version`` as appropriate. Perform
506 the same checks as when rolling out upgrades.
507
508
0efdf0fe 509.. _terminal-mode-commands:
42fc5d26
QY
510
511Terminal Mode Commands
512======================
513
29adcd50
QY
514.. clicmd:: write terminal
515
d1a242fd 516 Displays the current configuration to the vty interface.
42fc5d26 517
29adcd50
QY
518.. clicmd:: write file
519
d1a242fd 520 Write current configuration to configuration file.
42fc5d26 521
982589a3 522.. clicmd:: configure [terminal]
29adcd50 523
d1a242fd
QY
524 Change to configuration mode. This command is the first step to
525 configuration.
42fc5d26 526
29adcd50
QY
527.. clicmd:: terminal length (0-512)
528
2da6ccc3
QY
529 Set terminal display length to ``(0-512)``. If length is 0, no display
530 control is performed.
42fc5d26 531
29adcd50
QY
532.. clicmd:: who
533
d1a242fd 534 Show a list of currently connected vty sessions.
42fc5d26 535
29adcd50
QY
536.. clicmd:: list
537
d1a242fd 538 List all available commands.
42fc5d26 539
29adcd50
QY
540.. clicmd:: show version
541
d1a242fd 542 Show the current version of |PACKAGE_NAME| and its build host information.
42fc5d26 543
29adcd50
QY
544.. clicmd:: show logging
545
2da6ccc3
QY
546 Shows the current configuration of the logging system. This includes the
547 status of all logging destinations.
42fc5d26 548
c103b19f
SW
549.. clicmd:: show log-filter
550
551 Shows the current log filters applied to each daemon.
552
aa270404 553.. clicmd:: show memory [DAEMON]
0a62b873
DL
554
555 Show information on how much memory is used for which specific things in
556 |PACKAGE_NAME|. Output may vary depending on system capabilities but will
557 generally look something like this:
558
559 ::
560
561 frr# show memory
562 System allocator statistics:
563 Total heap allocated: 1584 KiB
564 Holding block headers: 0 bytes
565 Used small blocks: 0 bytes
566 Used ordinary blocks: 1484 KiB
567 Free small blocks: 2096 bytes
568 Free ordinary blocks: 100 KiB
569 Ordinary blocks: 2
570 Small blocks: 60
571 Holding blocks: 0
572 (see system documentation for 'mallinfo' for meaning)
573 --- qmem libfrr ---
574 Buffer : 3 24 72
575 Buffer data : 1 4120 4120
576 Host config : 3 (variably sized) 72
577 Command Tokens : 3427 72 247160
578 Command Token Text : 2555 (variably sized) 83720
579 Command Token Help : 2555 (variably sized) 61720
580 Command Argument : 2 (variably sized) 48
581 Command Argument Name : 641 (variably sized) 15672
582 [...]
583 --- qmem Label Manager ---
584 --- qmem zebra ---
585 ZEBRA VRF : 1 912 920
586 Route Entry : 11 80 968
587 Static route : 1 192 200
588 RIB destination : 8 48 448
589 RIB table info : 4 16 96
590 Nexthop tracking object : 1 200 200
591 Zebra Name Space : 1 312 312
592 --- qmem Table Manager ---
593
594 To understand system allocator statistics, refer to your system's
595 :manpage:`mallinfo(3)` man page.
596
597 Below these statistics, statistics on individual memory allocation types
598 in |PACKAGE_NAME| (so-called `MTYPEs`) is printed:
599
600 * the first column of numbers is the current count of allocations made for
601 the type (the number decreases when items are freed.)
602 * the second column is the size of each item. This is only available if
603 allocations on a type are always made with the same size.
604 * the third column is the total amount of memory allocated for the
605 particular type, including padding applied by malloc. This means that
606 the number may be larger than the first column multiplied by the second.
607 Overhead incurred by malloc's bookkeeping is not included in this, and
608 the column may be missing if system support is not available.
609
610 When executing this command from ``vtysh``, each of the daemons' memory
aa270404
IR
611 usage is printed sequentially. You can specify the daemon's name to print
612 only its memory usage.
0a62b873 613
a65f4b5d
DS
614.. clicmd:: show history
615
616 Dump the vtysh cli history.
617
29adcd50
QY
618.. clicmd:: logmsg LEVEL MESSAGE
619
2da6ccc3
QY
620 Send a message to all logging destinations that are enabled for messages of
621 the given severity.
622
fdd40d51 623.. clicmd:: find REGEX...
8421b140 624
fdd40d51
QY
625 This command performs a regex search across all defined commands in all
626 modes. As an example, suppose you're in enable mode and can't remember where
627 the command to turn OSPF segment routing on is:
8421b140
QY
628
629 ::
630
631 frr# find segment-routing on
632 (ospf) segment-routing on
fdd40d51
QY
633 (isis) segment-routing on
634
8421b140
QY
635
636 The CLI mode is displayed next to each command. In this example,
637 :clicmd:`segment-routing on` is under the `router ospf` mode.
638
fdd40d51
QY
639 Similarly, suppose you want a listing of all commands that contain "l2vpn"
640 and "neighbor":
8421b140
QY
641
642 ::
643
fdd40d51
QY
644 frr# find l2vpn.*neighbor
645 (view) show [ip] bgp l2vpn evpn neighbors <A.B.C.D|X:X::X:X|WORD> advertised-routes [json]
646 (view) show [ip] bgp l2vpn evpn neighbors <A.B.C.D|X:X::X:X|WORD> routes [json]
647 (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]
648 (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
649 ...
650
fdd40d51
QY
651
652 Note that when entering spaces as part of a regex specification, repeated
653 spaces will be compressed into a single space for matching purposes. This is
654 a consequence of spaces being used to delimit CLI tokens. If you need to
655 match more than one space, use the ``\s`` escape.
656
657 POSIX Extended Regular Expressions are supported.
658
659
8b1148bf
DS
660.. _common-show-commands:
661
8b1148bf
DS
662.. clicmd:: show thread cpu [r|w|t|e|x]
663
664 This command displays system run statistics for all the different event
665 types. If no options is specified all different run types are displayed
666 together. Additionally you can ask to look at (r)ead, (w)rite, (t)imer,
f75e802d
DS
667 (e)vent and e(x)ecute thread event types. If you have compiled with
668 disable-cpu-time then this command will not show up.
8b1148bf 669
8b1148bf
DS
670.. clicmd:: show thread poll
671
672 This command displays FRR's poll data. It allows a glimpse into how
673 we are setting each individual fd for the poll command at that point
674 in time.
42fc5d26 675
a698ba16
DS
676.. clicmd:: show thread timers
677
678 This command displays FRR's timer data for timers that will pop in
679 the future.
680
0efdf0fe 681.. _common-invocation-options:
42fc5d26
QY
682
683Common Invocation Options
684=========================
685
be46d288 686These options apply to all |PACKAGE_NAME| daemons.
42fc5d26
QY
687
688
c9365894 689.. option:: -d, --daemon
42fc5d26 690
d1a242fd 691 Run in daemon mode.
29adcd50 692
c9365894 693.. option:: -f, --config_file <file>
42fc5d26 694
d1a242fd 695 Set configuration file name.
42fc5d26 696
d1a242fd 697.. option:: -h, --help
42fc5d26 698
d1a242fd 699 Display this help and exit.
29adcd50 700
c9365894 701.. option:: -i, --pid_file <file>
42fc5d26 702
d1a242fd
QY
703 Upon startup the process identifier of the daemon is written to a file,
704 typically in :file:`/var/run`. This file can be used by the init system
705 to implement commands such as ``.../init.d/zebra status``,
706 ``.../init.d/zebra restart`` or ``.../init.d/zebra stop``.
42fc5d26 707
2da6ccc3
QY
708 The file name is an run-time option rather than a configure-time option so
709 that multiple routing daemons can be run simultaneously. This is useful when
710 using |PACKAGE_NAME| to implement a routing looking glass. One machine can
711 be used to collect differing routing views from differing points in the
712 network.
29adcd50 713
c9365894 714.. option:: -A, --vty_addr <address>
42fc5d26 715
2da6ccc3
QY
716 Set the VTY local address to bind to. If set, the VTY socket will only be
717 bound to this address.
42fc5d26 718
c9365894 719.. option:: -P, --vty_port <port>
29adcd50 720
d1a242fd
QY
721 Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not
722 be opened.
42fc5d26 723
d1a242fd 724.. option:: -u <user>
42fc5d26 725
d1a242fd 726 Set the user and group to run as.
29adcd50 727
6ed85950
DS
728.. option:: -N <namespace>
729
730 Set the namespace that the daemon will run in. A "/<namespace>" will
731 be added to all files that use the statedir. If you have "/var/run/frr"
732 as the default statedir then it will become "/var/run/frr/<namespace>".
733
ac2cb9bf
IR
734.. option:: -o, --vrfdefaultname <name>
735
736 Set the name used for the *Default VRF* in CLI commands and YANG models.
737 This option must be the same for all running daemons. By default, the name
738 is "default".
739
740 .. seealso:: :ref:`zebra-vrf`
741
c9365894 742.. option:: -v, --version
42fc5d26 743
d1a242fd 744 Print program version.
42fc5d26 745
80d02adb
DS
746.. option:: --command-log-always
747
748 Cause the daemon to always log commands entered to the specified log file.
749 This also makes the `no log commands` command dissallowed. Enabling this
750 is suggested if you have need to track what the operator is doing on
751 this router.
752
ed74ddf4
DS
753.. option:: --log <stdout|syslog|file:/path/to/log/file>
754
755 When initializing the daemon, setup the log to go to either stdout,
756 syslog or to a file. These values will be displayed as part of
757 a show run. Additionally they can be overridden at runtime if
758 desired via the normal log commands.
759
3cf3e018
DS
760.. option:: --log-level <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>
761
762 When initializing the daemon, allow the specification of a default
763 log level at startup from one of the specified levels.
764
1c2facd1
RW
765.. option:: --tcli
766
767 Enable the transactional CLI mode.
768
1a9f340b
MS
769.. option:: --limit-fds <number>
770
771 Limit the number of file descriptors that will be used internally
772 by the FRR daemons. By default, the daemons use the system ulimit
773 value.
774
0efdf0fe 775.. _loadable-module-support:
42fc5d26
QY
776
777Loadable Module Support
778=======================
779
8d209861
QY
780FRR supports loading extension modules at startup. Loading, reloading or
781unloading modules at runtime is not supported (yet). To load a module, use
42fc5d26
QY
782the following command line option at daemon startup:
783
784
c9365894 785.. option:: -M, --module <module:options>
29adcd50 786
d1a242fd
QY
787 Load the specified module, optionally passing options to it. If the module
788 name contains a slash (/), it is assumed to be a full pathname to a file to
789 be loaded. If it does not contain a slash, the |INSTALL_PREFIX_MODULES|
790 directory is searched for a module of the given name; first with the daemon
791 name prepended (e.g. ``zebra_mod`` for ``mod``), then without the daemon
792 name prepended.
42fc5d26 793
d1a242fd
QY
794 This option is available on all daemons, though some daemons may not have
795 any modules available to be loaded.
42fc5d26 796
2da6ccc3 797
42fc5d26
QY
798The SNMP Module
799---------------
800
801If SNMP is enabled during compile-time and installed as part of the package,
2da6ccc3 802the ``snmp`` module can be loaded for the *Zebra*, *bgpd*, *ospfd*, *ospf6d*
8d209861 803and *ripd* daemons.
42fc5d26 804
2da6ccc3
QY
805The module ignores any options passed to it. Refer to :ref:`snmp-support` for
806information on its usage.
807
42fc5d26
QY
808
809The FPM Module
810--------------
811
d1a242fd
QY
812If FPM is enabled during compile-time and installed as part of the package, the
813``fpm`` module can be loaded for the *zebra* daemon. This provides the
814Forwarding Plane Manager ("FPM") API.
42fc5d26 815
d1e7591e
QY
816The module expects its argument to be either ``Netlink`` or ``protobuf``,
817specifying the encapsulation to use. ``Netlink`` is the default, and
d1a242fd 818``protobuf`` may not be available if the module was built without protobuf
0efdf0fe 819support. Refer to :ref:`zebra-fib-push-interface` for more information.
42fc5d26 820
2da6ccc3 821
0efdf0fe 822.. _virtual-terminal-interfaces:
42fc5d26
QY
823
824Virtual Terminal Interfaces
825===========================
826
827VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line
828interface (CLI) for user interaction with the routing daemon.
829
2da6ccc3 830
0efdf0fe 831.. _vty-overview:
42fc5d26
QY
832
833VTY Overview
834------------
835
8d209861 836VTY stands for Virtual TeletYpe interface. It means you can connect to
42fc5d26
QY
837the daemon via the telnet protocol.
838
8d209861 839To enable a VTY interface, you have to setup a VTY password. If there
42fc5d26
QY
840is no VTY password, one cannot connect to the VTY interface at all.
841
842::
843
9eb95b3b
QY
844 % telnet localhost 2601
845 Trying 127.0.0.1...
846 Connected to localhost.
847 Escape character is '^]'.
42fc5d26 848
9eb95b3b
QY
849 Hello, this is |PACKAGE_NAME| (version |PACKAGE_VERSION|)
850 |COPYRIGHT_STR|
42fc5d26 851
9eb95b3b 852 User Access Verification
42fc5d26 853
9eb95b3b
QY
854 Password: XXXXX
855 Router> ?
856 enable . . . Turn on privileged commands
857 exit . . . Exit current mode and down to previous mode
858 help . . . Description of the interactive help system
859 list . . . Print command list
860 show . . . Show system inform
8d209861 861
9eb95b3b
QY
862 wh. . . Display who is on a vty
863 Router> enable
864 Password: XXXXX
865 Router# configure terminal
866 Router(config)# interface eth0
867 Router(config-if)# ip address 10.0.0.1/8
868 Router(config-if)# ^Z
869 Router#
42fc5d26 870
8d209861 871
0efdf0fe 872.. _vty-modes:
42fc5d26
QY
873
874VTY Modes
875---------
876
877There are three basic VTY modes:
878
879There are commands that may be restricted to specific VTY modes.
880
0efdf0fe 881.. _vty-view-mode:
42fc5d26
QY
882
883VTY View Mode
884^^^^^^^^^^^^^
885
886This mode is for read-only access to the CLI. One may exit the mode by
887leaving the system, or by entering `enable` mode.
888
0efdf0fe 889.. _vty-enable-mode:
42fc5d26
QY
890
891VTY Enable Mode
892^^^^^^^^^^^^^^^
893
894This mode is for read-write access to the CLI. One may exit the mode by
895leaving the system, or by escaping to view mode.
896
0efdf0fe 897.. _vty-other-modes:
42fc5d26
QY
898
899VTY Other Modes
900^^^^^^^^^^^^^^^
901
902This page is for describing other modes.
903
0efdf0fe 904.. _vty-cli-commands:
42fc5d26
QY
905
906VTY CLI Commands
907----------------
908
909Commands that you may use at the command-line are described in the following
910three subsubsections.
911
0efdf0fe 912.. _cli-movement-commands:
42fc5d26
QY
913
914CLI Movement Commands
915^^^^^^^^^^^^^^^^^^^^^
916
917These commands are used for moving the CLI cursor. The :kbd:`C` character
918means press the Control Key.
919
8d209861 920:kbd:`C-f` / :kbd:`LEFT`
9eb95b3b 921 Move forward one character.
42fc5d26 922
8d209861 923:kbd:`C-b` / :kbd:`RIGHT`
9eb95b3b 924 Move backward one character.
42fc5d26 925
8d209861 926:kbd:`M-f`
9eb95b3b 927 Move forward one word.
42fc5d26 928
8d209861 929:kbd:`M-b`
9eb95b3b 930 Move backward one word.
42fc5d26 931
8d209861 932:kbd:`C-a`
9eb95b3b 933 Move to the beginning of the line.
42fc5d26 934
8d209861 935:kbd:`C-e`
9eb95b3b 936 Move to the end of the line.
42fc5d26
QY
937
938
0efdf0fe 939.. _cli-editing-commands:
42fc5d26
QY
940
941CLI Editing Commands
942^^^^^^^^^^^^^^^^^^^^
943
944These commands are used for editing text on a line. The :kbd:`C`
945character means press the Control Key.
946
947
8d209861 948:kbd:`C-h` / :kbd:`DEL`
9eb95b3b 949 Delete the character before point.
42fc5d26
QY
950
951
8d209861 952:kbd:`C-d`
9eb95b3b 953 Delete the character after point.
42fc5d26
QY
954
955
8d209861 956:kbd:`M-d`
9eb95b3b 957 Forward kill word.
42fc5d26
QY
958
959
8d209861 960:kbd:`C-w`
9eb95b3b 961 Backward kill word.
42fc5d26
QY
962
963
8d209861 964:kbd:`C-k`
9eb95b3b 965 Kill to the end of the line.
42fc5d26
QY
966
967
8d209861 968:kbd:`C-u`
9eb95b3b 969 Kill line from the beginning, erasing input.
42fc5d26
QY
970
971
8d209861 972:kbd:`C-t`
9eb95b3b 973 Transpose character.
42fc5d26
QY
974
975
976CLI Advanced Commands
977^^^^^^^^^^^^^^^^^^^^^
978
979There are several additional CLI commands for command line completions,
980insta-help, and VTY session management.
981
982
8d209861 983:kbd:`C-c`
9eb95b3b 984 Interrupt current input and moves to the next line.
42fc5d26
QY
985
986
8d209861 987:kbd:`C-z`
9eb95b3b 988 End current configuration session and move to top node.
42fc5d26
QY
989
990
8d209861 991:kbd:`C-n` / :kbd:`DOWN`
9eb95b3b 992 Move down to next line in the history buffer.
42fc5d26
QY
993
994
8d209861 995:kbd:`C-p` / :kbd:`UP`
9eb95b3b 996 Move up to previous line in the history buffer.
42fc5d26
QY
997
998
8d209861 999:kbd:`TAB`
9eb95b3b 1000 Use command line completion by typing :kbd:`TAB`.
42fc5d26
QY
1001
1002
8d209861 1003:kbd:`?`
9eb95b3b
QY
1004 You can use command line help by typing ``help`` at the beginning of the
1005 line. Typing :kbd:`?` at any point in the line will show possible
1006 completions.
42fc5d26 1007
4c54343f
QY
1008Pipe Actions
1009^^^^^^^^^^^^
1010
1011VTY supports optional modifiers at the end of commands that perform
1012postprocessing on command output or modify the action of commands. These do not
1013show up in the :kbd:`?` or :kbd:`TAB` suggestion lists.
1014
1015``... | include REGEX``
1016 Filters the output of the preceding command, including only lines which
1017 match the POSIX Extended Regular Expression ``REGEX``. Do not put the regex
1018 in quotes.
1019
1020 Examples:
1021
1022 ::
1023
1024 frr# show ip bgp sum json | include remoteAs
1025 "remoteAs":0,
1026 "remoteAs":455,
1027 "remoteAs":99,
1028
1029 ::
1030
1031 frr# show run | include neigh.*[0-9]{2}\.0\.[2-4]\.[0-9]*
1032 neighbor 10.0.2.106 remote-as 99
1033 neighbor 10.0.2.107 remote-as 99
1034 neighbor 10.0.2.108 remote-as 99
1035 neighbor 10.0.2.109 remote-as 99
1036 neighbor 10.0.2.110 remote-as 99
1037 neighbor 10.0.3.111 remote-as 111
1038