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