]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/basic.rst
doc: spelling fixes
[mirror_frr.git] / doc / user / basic.rst
CommitLineData
0efdf0fe 1.. _basic-commands:
42fc5d26
QY
2
3**************
4Basic commands
5**************
6
7There are five routing daemons in use, and there is one manager daemon.
8These daemons may be located on separate machines from the manager
8d209861
QY
9daemon. Each of these daemons will listen on a particular port for
10incoming VTY connections. The routing daemons are:
42fc5d26 11
8d209861
QY
12- *ripd*
13- *ripngd*
14- *ospfd*
15- *ospf6d*
16- *bgpd*
17- *zebra*
42fc5d26
QY
18
19The following sections discuss commands common to all the routing
20daemons.
21
0efdf0fe 22.. _config-commands:
42fc5d26
QY
23
24Config Commands
25===============
26
27.. index:: Configuration files for running the software
28
29.. index:: Files for running configurations
30
31.. index:: Modifying the herd's behavior
32
33.. index:: Getting the herd running
34
35In a config file, you can write the debugging options, a vty's password,
36routing daemon configurations, a log file name, and so forth. This
37information forms the initial command set for a routing beast as it is
38starting.
39
dc5564c7 40Config files are generally found in |INSTALL_PREFIX_ETC|.
42fc5d26 41
d1a242fd
QY
42Each of the daemons has its own config file. The daemon name plus ``.conf`` is
43the default config file name. For example, zebra's default config file name is
44:file:`zebra.conf`. You can specify a config file using the :option:`-f` or
9eb95b3b 45:option:`--config_file` options when starting the daemon.
42fc5d26 46
0efdf0fe 47.. _basic-config-commands:
42fc5d26
QY
48
49Basic Config Commands
50---------------------
51
8d209861 52.. index:: hostname HOSTNAME
42fc5d26 53
29adcd50
QY
54.. clicmd:: hostname HOSTNAME
55
56 Set hostname of the router.
42fc5d26 57
8d209861 58.. index:: password PASSWORD
42fc5d26 59
29adcd50
QY
60.. clicmd:: password PASSWORD
61
62 Set password for vty interface. If there is no password, a vty won't
63 accept connections.
42fc5d26 64
8d209861 65.. index:: enable password PASSWORD
42fc5d26 66
29adcd50
QY
67.. clicmd:: enable password PASSWORD
68
69 Set enable password.
42fc5d26 70
8d209861 71.. index::
d1a242fd
QY
72 single: no log trap [LEVEL]
73 single: log trap LEVEL
29adcd50
QY
74
75.. clicmd:: [no] log trap LEVEL
76
77 These commands are deprecated and are present only for historical
78 compatibility. The log trap command sets the current logging level for all
79 enabled logging destinations, and it sets the default for all future logging
80 commands that do not specify a level. The normal default logging level is
81 debugging. The ``no`` form of the command resets the default level for future
82 logging commands to debugging, but it does not change the logging level of
83 existing logging destinations.
8d209861
QY
84
85.. index::
d1a242fd
QY
86 single: no log stdout [LEVEL]
87 single: log stdout [LEVEL]
29adcd50
QY
88
89.. clicmd:: [no] log stdout LEVEL
90
91 Enable logging output to stdout. If the optional second argument specifying
92 the logging level is not present, the default logging level (typically
93 debugging, but can be changed using the deprecated ``log trap`` command) will
94 be used. The ``no`` form of the command disables logging to stdout. The
95 ``LEVEL`` argument must have one of these values: emergencies, alerts,
96 critical, errors, warnings, notifications, informational, or debugging. Note
97 that the existing code logs its most important messages with severity
98 ``errors``.
8d209861
QY
99
100.. index::
d1a242fd
QY
101 single: no log file [FILENAME [LEVEL]]
102 single: log file FILENAME [LEVEL]
29adcd50
QY
103
104.. clicmd:: [no] log file [FILENAME [LEVEL]]
8d209861 105
29adcd50
QY
106 If you want to log into a file, please specify ``filename`` as
107 in this example: ::
8d209861 108
29adcd50 109 log file /var/log/frr/bgpd.log informational
8d209861 110
29adcd50
QY
111 If the optional second argument specifying the logging level is not present,
112 the default logging level (typically debugging, but can be changed using the
113 deprecated ``log trap`` command) will be used. The ``no`` form of the command
114 disables logging to a file. *Note:* if you do not configure any file logging,
115 and a daemon crashes due to a signal or an assertion failure, it will attempt
116 to save the crash information in a file named /var/tmp/frr.<daemon
117 name>.crashlog. For security reasons, this will not happen if the file exists
118 already, so it is important to delete the file after reporting the crash
119 information.
8d209861
QY
120
121.. index::
d1a242fd
QY
122 single: no log syslog [LEVEL]
123 single: log syslog [LEVEL]
29adcd50
QY
124
125.. clicmd:: [no] log syslog [LEVEL]
8d209861 126
29adcd50
QY
127 Enable logging output to syslog. If the optional second argument specifying
128 the logging level is not present, the default logging level (typically
129 debugging, but can be changed using the deprecated ``log trap`` command) will
130 be used. The ``no`` form of the command disables logging to syslog.
8d209861
QY
131
132.. index::
d1a242fd
QY
133 single: no log monitor [LEVEL]
134 single: log monitor [LEVEL]
29adcd50
QY
135
136.. clicmd:: [no] log monitor [LEVEL]
137
138 Enable logging output to vty terminals that have enabled logging using the
139 ``terminal monitor`` command. By default, monitor logging is enabled at the
140 debugging level, but this command (or the deprecated ``log trap`` command) can
141 be used to change the monitor logging level. If the optional second argument
142 specifying the logging level is not present, the default logging level
143 (typically debugging, but can be changed using the deprecated ``log trap``
144 command) will be used. The ``no`` form of the command disables logging to
145 terminal monitors.
8d209861
QY
146
147.. index::
d1a242fd
QY
148 single: no log facility [FACILITY]
149 single: log facility [FACILITY]
8d209861 150
29adcd50
QY
151.. clicmd:: [no] log facility [FACILITY]
152
153 This command changes the facility used in syslog messages. The default
154 facility is ``daemon``. The ``no`` form of the command resets
155 the facility to the default ``daemon`` facility.
8d209861
QY
156
157.. index::
d1a242fd
QY
158 single: no log record-priority
159 single: log record-priority
29adcd50
QY
160
161.. clicmd:: [no] log record-priority
162
163 To include the severity in all messages logged to a file, to stdout, or to
164 a terminal monitor (i.e. anything except syslog),
165 use the ``log record-priority`` global configuration command.
166 To disable this option, use the ``no`` form of the command. By default,
167 the severity level is not included in logged messages. Note: some
168 versions of syslogd (including Solaris) can be configured to include
169 the facility and level in the messages emitted.
8d209861
QY
170
171.. index::
d1a242fd
QY
172 single: log timestamp precision (0-6)
173 single: [no] log timestamp precision (0-6)
8d209861 174
29adcd50
QY
175.. clicmd:: [no] log timestamp precision [(0-6)]
176
177 This command sets the precision of log message timestamps to the given number
178 of digits after the decimal point. Currently, the value must be in the range
179 0 to 6 (i.e. the maximum precision is microseconds). To restore the default
180 behavior (1-second accuracy), use the ``no`` form of the command, or set the
181 precision explicitly to 0.
42fc5d26
QY
182
183::
184
29adcd50 185 log timestamp precision 3
42fc5d26 186
29adcd50
QY
187 In this example, the precision is set to provide timestamps with
188 millisecond accuracy.
42fc5d26 189
8d209861 190.. index:: log commands
42fc5d26 191
29adcd50
QY
192.. clicmd:: log commands
193
194 This command enables the logging of all commands typed by a user to
195 all enabled log destinations. The note that logging includes full
196 command lines, including passwords. Once set, command logging can only
197 be turned off by restarting the daemon.
42fc5d26 198
8d209861 199.. index:: service password-encryption
42fc5d26 200
29adcd50
QY
201.. clicmd:: service password-encryption
202
203 Encrypt password.
42fc5d26 204
8d209861 205.. index:: service advanced-vty
42fc5d26 206
29adcd50 207.. clicmd:: service advanced-vty
42fc5d26 208
29adcd50 209 Enable advanced mode VTY.
42fc5d26 210
29adcd50
QY
211.. index:: service terminal-length (0-512)
212
213.. clicmd:: service terminal-length (0-512)
214
215 Set system wide line configuration. This configuration command applies
216 to all VTY interfaces.
42fc5d26 217
8d209861 218.. index:: line vty
42fc5d26 219
29adcd50
QY
220.. clicmd:: line vty
221
222 Enter vty configuration mode.
42fc5d26 223
8d209861 224.. index:: banner motd default
42fc5d26 225
29adcd50
QY
226.. clicmd:: banner motd default
227
228 Set default motd string.
42fc5d26 229
8d209861 230.. index:: no banner motd
42fc5d26 231
29adcd50
QY
232.. clicmd:: no banner motd
233
234 No motd banner string will be printed.
42fc5d26 235
8d209861 236.. index:: exec-timeout MINUTE [SECOND]
42fc5d26 237
29adcd50
QY
238.. clicmd:: exec-timeout MINUTE [SECOND]
239
240 Set VTY connection timeout value. When only one argument is specified
241 it is used for timeout value in minutes. Optional second argument is
242 used for timeout value in seconds. Default timeout value is 10 minutes.
243 When timeout value is zero, it means no timeout.
42fc5d26 244
8d209861 245.. index:: no exec-timeout
42fc5d26 246
29adcd50
QY
247.. clicmd:: no exec-timeout
248
249 Do not perform timeout at all. This command is as same as *exec-timeout 0 0*.
42fc5d26 250
8d209861 251.. index:: access-class ACCESS-LIST
42fc5d26 252
29adcd50
QY
253.. clicmd:: access-class ACCESS-LIST
254
255 Restrict vty connections with an access list.
42fc5d26 256
0efdf0fe 257.. _sample-config-file:
42fc5d26
QY
258
259Sample Config File
260------------------
261
262Below is a sample configuration file for the zebra daemon.
263
9eb95b3b 264.. code-block:: frr
42fc5d26 265
9eb95b3b
QY
266 !
267 ! Zebra configuration file
268 !
269 hostname Router
270 password zebra
271 enable password zebra
272 !
273 log stdout
274 !
275 !
42fc5d26 276
8d209861
QY
277
278'!' and '#' are comment characters. If the first character of the word
42fc5d26
QY
279is one of the comment characters then from the rest of the line forward
280will be ignored as a comment.
281
9eb95b3b 282.. code-block:: frr
42fc5d26 283
9eb95b3b 284 password zebra!password
42fc5d26
QY
285
286If a comment character is not the first character of the word, it's a
287normal character. So in the above example '!' will not be regarded as a
288comment and the password is set to 'zebra!password'.
289
0efdf0fe 290.. _terminal-mode-commands:
42fc5d26
QY
291
292Terminal Mode Commands
293======================
294
8d209861 295.. index:: write terminal
42fc5d26 296
29adcd50
QY
297.. clicmd:: write terminal
298
d1a242fd 299 Displays the current configuration to the vty interface.
42fc5d26 300
8d209861 301.. index:: write file
42fc5d26 302
29adcd50
QY
303.. clicmd:: write file
304
d1a242fd 305 Write current configuration to configuration file.
42fc5d26 306
8d209861 307.. index:: configure terminal
42fc5d26 308
29adcd50
QY
309.. clicmd:: configure terminal
310
d1a242fd
QY
311 Change to configuration mode. This command is the first step to
312 configuration.
42fc5d26 313
29adcd50 314.. index:: terminal length (0-512)
42fc5d26 315
29adcd50
QY
316.. clicmd:: terminal length (0-512)
317
d1a242fd
QY
318 Set terminal display length to ``(0-512)``. If length is 0, no
319 display control is performed.
42fc5d26 320
8d209861 321.. index:: who
42fc5d26 322
29adcd50
QY
323.. clicmd:: who
324
d1a242fd 325 Show a list of currently connected vty sessions.
42fc5d26 326
8d209861 327.. index:: list
42fc5d26 328
29adcd50
QY
329.. clicmd:: list
330
d1a242fd 331 List all available commands.
42fc5d26 332
8d209861 333.. index:: show version
42fc5d26 334
29adcd50
QY
335.. clicmd:: show version
336
d1a242fd 337 Show the current version of |PACKAGE_NAME| and its build host information.
42fc5d26 338
8d209861 339.. index:: show logging
42fc5d26 340
29adcd50
QY
341.. clicmd:: show logging
342
d1a242fd
QY
343 Shows the current configuration of the logging system. This includes
344 the status of all logging destinations.
42fc5d26 345
8d209861 346.. index:: logmsg LEVEL MESSAGE
42fc5d26 347
29adcd50
QY
348.. clicmd:: logmsg LEVEL MESSAGE
349
d1a242fd
QY
350 Send a message to all logging destinations that are enabled for messages
351 of the given severity.
42fc5d26 352
0efdf0fe 353.. _common-invocation-options:
42fc5d26
QY
354
355Common Invocation Options
356=========================
357
be46d288 358These options apply to all |PACKAGE_NAME| daemons.
42fc5d26
QY
359
360
c9365894 361.. option:: -d, --daemon
42fc5d26 362
d1a242fd 363 Run in daemon mode.
29adcd50 364
c9365894 365.. option:: -f, --config_file <file>
42fc5d26 366
d1a242fd 367 Set configuration file name.
42fc5d26 368
d1a242fd 369.. option:: -h, --help
42fc5d26 370
d1a242fd 371 Display this help and exit.
29adcd50 372
c9365894 373.. option:: -i, --pid_file <file>
42fc5d26 374
d1a242fd
QY
375 Upon startup the process identifier of the daemon is written to a file,
376 typically in :file:`/var/run`. This file can be used by the init system
377 to implement commands such as ``.../init.d/zebra status``,
378 ``.../init.d/zebra restart`` or ``.../init.d/zebra stop``.
42fc5d26 379
d1a242fd
QY
380 The file name is an run-time option rather than a configure-time option
381 so that multiple routing daemons can be run simultaneously. This is
382 useful when using |PACKAGE_NAME| to implement a routing looking glass. One
383 machine can be used to collect differing routing views from differing
384 points in the network.
29adcd50 385
c9365894 386.. option:: -A, --vty_addr <address>
42fc5d26 387
d1a242fd
QY
388 Set the VTY local address to bind to. If set, the VTY socket will only
389 be bound to this address.
42fc5d26 390
c9365894 391.. option:: -P, --vty_port <port>
29adcd50 392
d1a242fd
QY
393 Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not
394 be opened.
42fc5d26 395
d1a242fd 396.. option:: -u <user>
42fc5d26 397
d1a242fd 398 Set the user and group to run as.
29adcd50 399
c9365894 400.. option:: -v, --version
42fc5d26 401
d1a242fd 402 Print program version.
42fc5d26 403
0efdf0fe 404.. _loadable-module-support:
42fc5d26
QY
405
406Loadable Module Support
407=======================
408
8d209861
QY
409FRR supports loading extension modules at startup. Loading, reloading or
410unloading modules at runtime is not supported (yet). To load a module, use
42fc5d26
QY
411the following command line option at daemon startup:
412
413
c9365894 414.. option:: -M, --module <module:options>
29adcd50 415
d1a242fd
QY
416 Load the specified module, optionally passing options to it. If the module
417 name contains a slash (/), it is assumed to be a full pathname to a file to
418 be loaded. If it does not contain a slash, the |INSTALL_PREFIX_MODULES|
419 directory is searched for a module of the given name; first with the daemon
420 name prepended (e.g. ``zebra_mod`` for ``mod``), then without the daemon
421 name prepended.
42fc5d26 422
d1a242fd
QY
423 This option is available on all daemons, though some daemons may not have
424 any modules available to be loaded.
42fc5d26
QY
425
426The SNMP Module
427---------------
428
429If SNMP is enabled during compile-time and installed as part of the package,
8d209861
QY
430the ``snmp`` module can be loaded for the *zebra*, *bgpd*, *ospfd*, *ospf6d*
431and *ripd* daemons.
42fc5d26 432
0efdf0fe 433The module ignores any options passed to it. Refer to :ref:`snmp-support`
42fc5d26
QY
434for information on its usage.
435
436The FPM Module
437--------------
438
d1a242fd
QY
439If FPM is enabled during compile-time and installed as part of the package, the
440``fpm`` module can be loaded for the *zebra* daemon. This provides the
441Forwarding Plane Manager ("FPM") API.
42fc5d26 442
d1e7591e
QY
443The module expects its argument to be either ``Netlink`` or ``protobuf``,
444specifying the encapsulation to use. ``Netlink`` is the default, and
d1a242fd 445``protobuf`` may not be available if the module was built without protobuf
0efdf0fe 446support. Refer to :ref:`zebra-fib-push-interface` for more information.
42fc5d26 447
0efdf0fe 448.. _virtual-terminal-interfaces:
42fc5d26
QY
449
450Virtual Terminal Interfaces
451===========================
452
453VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line
454interface (CLI) for user interaction with the routing daemon.
455
0efdf0fe 456.. _vty-overview:
42fc5d26
QY
457
458VTY Overview
459------------
460
8d209861 461VTY stands for Virtual TeletYpe interface. It means you can connect to
42fc5d26
QY
462the daemon via the telnet protocol.
463
8d209861 464To enable a VTY interface, you have to setup a VTY password. If there
42fc5d26
QY
465is no VTY password, one cannot connect to the VTY interface at all.
466
467::
468
9eb95b3b
QY
469 % telnet localhost 2601
470 Trying 127.0.0.1...
471 Connected to localhost.
472 Escape character is '^]'.
42fc5d26 473
9eb95b3b
QY
474 Hello, this is |PACKAGE_NAME| (version |PACKAGE_VERSION|)
475 |COPYRIGHT_STR|
42fc5d26 476
9eb95b3b 477 User Access Verification
42fc5d26 478
9eb95b3b
QY
479 Password: XXXXX
480 Router> ?
481 enable . . . Turn on privileged commands
482 exit . . . Exit current mode and down to previous mode
483 help . . . Description of the interactive help system
484 list . . . Print command list
485 show . . . Show system inform
8d209861 486
9eb95b3b
QY
487 wh. . . Display who is on a vty
488 Router> enable
489 Password: XXXXX
490 Router# configure terminal
491 Router(config)# interface eth0
492 Router(config-if)# ip address 10.0.0.1/8
493 Router(config-if)# ^Z
494 Router#
42fc5d26 495
8d209861 496
d1a242fd 497:kbd:`?` and the ``find`` command are very useful for looking up commands.
42fc5d26 498
0efdf0fe 499.. _vty-modes:
42fc5d26
QY
500
501VTY Modes
502---------
503
504There are three basic VTY modes:
505
506There are commands that may be restricted to specific VTY modes.
507
0efdf0fe 508.. _vty-view-mode:
42fc5d26
QY
509
510VTY View Mode
511^^^^^^^^^^^^^
512
513This mode is for read-only access to the CLI. One may exit the mode by
514leaving the system, or by entering `enable` mode.
515
0efdf0fe 516.. _vty-enable-mode:
42fc5d26
QY
517
518VTY Enable Mode
519^^^^^^^^^^^^^^^
520
521This mode is for read-write access to the CLI. One may exit the mode by
522leaving the system, or by escaping to view mode.
523
0efdf0fe 524.. _vty-other-modes:
42fc5d26
QY
525
526VTY Other Modes
527^^^^^^^^^^^^^^^
528
529This page is for describing other modes.
530
0efdf0fe 531.. _vty-cli-commands:
42fc5d26
QY
532
533VTY CLI Commands
534----------------
535
536Commands that you may use at the command-line are described in the following
537three subsubsections.
538
0efdf0fe 539.. _cli-movement-commands:
42fc5d26
QY
540
541CLI Movement Commands
542^^^^^^^^^^^^^^^^^^^^^
543
544These commands are used for moving the CLI cursor. The :kbd:`C` character
545means press the Control Key.
546
8d209861 547:kbd:`C-f` / :kbd:`LEFT`
9eb95b3b 548 Move forward one character.
42fc5d26 549
8d209861 550:kbd:`C-b` / :kbd:`RIGHT`
9eb95b3b 551 Move backward one character.
42fc5d26 552
8d209861 553:kbd:`M-f`
9eb95b3b 554 Move forward one word.
42fc5d26 555
8d209861 556:kbd:`M-b`
9eb95b3b 557 Move backward one word.
42fc5d26 558
8d209861 559:kbd:`C-a`
9eb95b3b 560 Move to the beginning of the line.
42fc5d26 561
8d209861 562:kbd:`C-e`
9eb95b3b 563 Move to the end of the line.
42fc5d26
QY
564
565
0efdf0fe 566.. _cli-editing-commands:
42fc5d26
QY
567
568CLI Editing Commands
569^^^^^^^^^^^^^^^^^^^^
570
571These commands are used for editing text on a line. The :kbd:`C`
572character means press the Control Key.
573
574
8d209861 575:kbd:`C-h` / :kbd:`DEL`
9eb95b3b 576 Delete the character before point.
42fc5d26
QY
577
578
8d209861 579:kbd:`C-d`
9eb95b3b 580 Delete the character after point.
42fc5d26
QY
581
582
8d209861 583:kbd:`M-d`
9eb95b3b 584 Forward kill word.
42fc5d26
QY
585
586
8d209861 587:kbd:`C-w`
9eb95b3b 588 Backward kill word.
42fc5d26
QY
589
590
8d209861 591:kbd:`C-k`
9eb95b3b 592 Kill to the end of the line.
42fc5d26
QY
593
594
8d209861 595:kbd:`C-u`
9eb95b3b 596 Kill line from the beginning, erasing input.
42fc5d26
QY
597
598
8d209861 599:kbd:`C-t`
9eb95b3b 600 Transpose character.
42fc5d26
QY
601
602
603CLI Advanced Commands
604^^^^^^^^^^^^^^^^^^^^^
605
606There are several additional CLI commands for command line completions,
607insta-help, and VTY session management.
608
609
8d209861 610:kbd:`C-c`
9eb95b3b 611 Interrupt current input and moves to the next line.
42fc5d26
QY
612
613
8d209861 614:kbd:`C-z`
9eb95b3b 615 End current configuration session and move to top node.
42fc5d26
QY
616
617
8d209861 618:kbd:`C-n` / :kbd:`DOWN`
9eb95b3b 619 Move down to next line in the history buffer.
42fc5d26
QY
620
621
8d209861 622:kbd:`C-p` / :kbd:`UP`
9eb95b3b 623 Move up to previous line in the history buffer.
42fc5d26
QY
624
625
8d209861 626:kbd:`TAB`
9eb95b3b 627 Use command line completion by typing :kbd:`TAB`.
42fc5d26
QY
628
629
8d209861 630:kbd:`?`
9eb95b3b
QY
631 You can use command line help by typing ``help`` at the beginning of the
632 line. Typing :kbd:`?` at any point in the line will show possible
633 completions.
42fc5d26 634