blob: 92e8d9ebd6d1f480fb7e596f395b3006f35b460a [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001@node Basic commands
paul718e3742002-12-13 20:15:29 +00002@chapter Basic commands
3
4There are five routing daemons in use, and there is one manager daemon.
5These daemons may be located on separate machines from the manager
6daemon. Each of these daemons will listen on a particular port for
7incoming VTY connections. The routing daemons are:
8
9@itemize @bullet
10@item @command{ripd}, @command{ripngd}, @command{ospfd}, @command{ospf6d}, @command{bgpd}
11@item @command{zebra}
12@end itemize
13
14The following sections discuss commands common to all the routing
15daemons.
16
17@menu
18* Config Commands:: Commands used in config files
David Lamparterf16195c2014-11-28 08:40:58 +010019* Terminal Mode Commands:: Common commands used in a VTY
paul718e3742002-12-13 20:15:29 +000020* Common Invocation Options:: Starting the daemons
ajs274a4a42004-12-07 15:39:31 +000021* Virtual Terminal Interfaces:: Interacting with the daemons
paul718e3742002-12-13 20:15:29 +000022@end menu
23
24
25
paul76b89b42004-11-06 17:13:09 +000026@node Config Commands
paul718e3742002-12-13 20:15:29 +000027@section Config Commands
28
29@cindex Configuration files for running the software
30@c A -not configuration files for installing the software
31@cindex Files for running configurations
32@cindex Modifying the herd's behavior
33@cindex Getting the herd running
34
35
36@menu
37* Basic Config Commands:: Some of the generic config commands
38* Sample Config File:: An example config file
39@end menu
40
41
42In a config file, you can write the debugging options, a vty's password,
43routing daemon configurations, a log file name, and so forth. This
44information forms the initial command set for a routing beast as it is
45starting.
46
47Config files are generally found in:
48
Paul Jakmaa20a4062012-03-08 16:42:31 +000049@itemize @w{}
paul718e3742002-12-13 20:15:29 +000050@item @file{@value{INSTALL_PREFIX_ETC}/*.conf}
51@end itemize
52
53Each of the daemons has its own
54config file. For example, zebra's default config file name is:
55
Paul Jakmaa20a4062012-03-08 16:42:31 +000056@itemize @w{}
paul718e3742002-12-13 20:15:29 +000057@item @file{@value{INSTALL_PREFIX_ETC}/zebra.conf}
58@end itemize
59
60The daemon name plus @file{.conf} is the default config file name. You
61can specify a config file using the @kbd{-f} or @kbd{--config-file}
62options when starting the daemon.
63
64
65
paul76b89b42004-11-06 17:13:09 +000066@node Basic Config Commands
paul718e3742002-12-13 20:15:29 +000067@subsection Basic Config Commands
68
69@deffn Command {hostname @var{hostname}} {}
70Set hostname of the router.
71@end deffn
72
73@deffn Command {password @var{password}} {}
74Set password for vty interface. If there is no password, a vty won't
75accept connections.
76@end deffn
77
78@deffn Command {enable password @var{password}} {}
79Set enable password.
80@end deffn
81
ajs274a4a42004-12-07 15:39:31 +000082@deffn Command {log trap @var{level}} {}
83@deffnx Command {no log trap} {}
84These commands are deprecated and are present only for historical compatibility.
85The log trap command sets the current logging level for all enabled
86logging destinations, and it sets the default for all future logging commands
87that do not specify a level. The normal default
88logging level is debugging. The @code{no} form of the command resets
89the default level for future logging commands to debugging, but it does
90not change the logging level of existing logging destinations.
91@end deffn
92
93
paul718e3742002-12-13 20:15:29 +000094@deffn Command {log stdout} {}
ajs274a4a42004-12-07 15:39:31 +000095@deffnx Command {log stdout @var{level}} {}
paul718e3742002-12-13 20:15:29 +000096@deffnx Command {no log stdout} {}
ajs274a4a42004-12-07 15:39:31 +000097Enable logging output to stdout.
98If the optional second argument specifying the
99logging level is not present, the default logging level (typically debugging,
100but can be changed using the deprecated @code{log trap} command) will be used.
101The @code{no} form of the command disables logging to stdout.
102The @code{level} argument must have one of these values:
103emergencies, alerts, critical, errors, warnings, notifications, informational, or debugging. Note that the existing code logs its most important messages
104with severity @code{errors}.
paul718e3742002-12-13 20:15:29 +0000105@end deffn
106
107@deffn Command {log file @var{filename}} {}
ajs274a4a42004-12-07 15:39:31 +0000108@deffnx Command {log file @var{filename} @var{level}} {}
109@deffnx Command {no log file} {}
110If you want to log into a file, please specify @code{filename} as
111in this example:
paul718e3742002-12-13 20:15:29 +0000112@example
ajs274a4a42004-12-07 15:39:31 +0000113log file /var/log/quagga/bgpd.log informational
paul718e3742002-12-13 20:15:29 +0000114@end example
ajs274a4a42004-12-07 15:39:31 +0000115If the optional second argument specifying the
116logging level is not present, the default logging level (typically debugging,
117but can be changed using the deprecated @code{log trap} command) will be used.
118The @code{no} form of the command disables logging to a file.
ajsc70257d2005-02-03 17:12:01 +0000119
120Note: if you do not configure any file logging, and a daemon crashes due
121to a signal or an assertion failure, it will attempt to save the crash
122information in a file named /var/tmp/quagga.<daemon name>.crashlog.
123For security reasons, this will not happen if the file exists already, so
124it is important to delete the file after reporting the crash information.
paul718e3742002-12-13 20:15:29 +0000125@end deffn
126
127@deffn Command {log syslog} {}
ajs274a4a42004-12-07 15:39:31 +0000128@deffnx Command {log syslog @var{level}} {}
paul718e3742002-12-13 20:15:29 +0000129@deffnx Command {no log syslog} {}
ajs274a4a42004-12-07 15:39:31 +0000130Enable logging output to syslog.
131If the optional second argument specifying the
132logging level is not present, the default logging level (typically debugging,
133but can be changed using the deprecated @code{log trap} command) will be used.
134The @code{no} form of the command disables logging to syslog.
paul718e3742002-12-13 20:15:29 +0000135@end deffn
136
ajs274a4a42004-12-07 15:39:31 +0000137@deffn Command {log monitor} {}
138@deffnx Command {log monitor @var{level}} {}
139@deffnx Command {no log monitor} {}
140Enable logging output to vty terminals that have enabled logging
141using the @code{terminal monitor} command.
142By default, monitor logging is enabled at the debugging level, but this
143command (or the deprecated @code{log trap} command) can be used to change
144the monitor logging level.
145If the optional second argument specifying the
146logging level is not present, the default logging level (typically debugging,
147but can be changed using the deprecated @code{log trap} command) will be used.
148The @code{no} form of the command disables logging to terminal monitors.
paul718e3742002-12-13 20:15:29 +0000149@end deffn
150
ajs274a4a42004-12-07 15:39:31 +0000151@deffn Command {log facility @var{facility}} {}
152@deffnx Command {no log facility} {}
153This command changes the facility used in syslog messages. The default
154facility is @code{daemon}. The @code{no} form of the command resets
155the facility to the default @code{daemon} facility.
paul718e3742002-12-13 20:15:29 +0000156@end deffn
157
ajs274a4a42004-12-07 15:39:31 +0000158@deffn Command {log record-priority} {}
159@deffnx Command {no log record-priority} {}
160To include the severity in all messages logged to a file, to stdout, or to
161a terminal monitor (i.e. anything except syslog),
162use the @code{log record-priority} global configuration command.
163To disable this option, use the @code{no} form of the command. By default,
164the severity level is not included in logged messages. Note: some
165versions of syslogd (including Solaris) can be configured to include
166the facility and level in the messages emitted.
paul718e3742002-12-13 20:15:29 +0000167@end deffn
168
Andrew J. Schorrd3d7e232007-04-29 15:24:15 +0000169@deffn Command {log timestamp precision @var{<0-6>}} {}
170@deffnx Command {no log timestamp precision} {}
171This command sets the precision of log message timestamps to the
172given number of digits after the decimal point. Currently,
173the value must be in the range 0 to 6 (i.e. the maximum precision
174is microseconds).
175To restore the default behavior (1-second accuracy), use the
176@code{no} form of the command, or set the precision explicitly to 0.
177
178@example
179@group
180log timestamp precision 3
181@end group
182@end example
183
184In this example, the precision is set to provide timestamps with
185millisecond accuracy.
186@end deffn
187
Lou Berger86b2a0a2016-05-17 12:19:51 -0400188@deffn Command {log commands} {}
189This command enables the logging of all commands typed by a user to
190all enabled log destinations. The note that logging includes full
191command lines, including passwords. Once set, command logging can only
192be turned off by restarting the daemon.
193@end deffn
194
paul718e3742002-12-13 20:15:29 +0000195@deffn Command {service password-encryption} {}
196Encrypt password.
197@end deffn
198
199@deffn Command {service advanced-vty} {}
200Enable advanced mode VTY.
201@end deffn
202
203@deffn Command {service terminal-length @var{<0-512>}} {}
204Set system wide line configuration. This configuration command applies
205to all VTY interfaces.
206@end deffn
207
paul718e3742002-12-13 20:15:29 +0000208@deffn Command {line vty} {}
209Enter vty configuration mode.
210@end deffn
211
212@deffn Command {banner motd default} {}
213Set default motd string.
214@end deffn
215
216@deffn Command {no banner motd} {}
217No motd banner string will be printed.
218@end deffn
219
220@deffn {Line Command} {exec-timeout @var{minute}} {}
221@deffnx {Line Command} {exec-timeout @var{minute} @var{second}} {}
222Set VTY connection timeout value. When only one argument is specified
223it is used for timeout value in minutes. Optional second argument is
224used for timeout value in seconds. Default timeout value is 10 minutes.
225When timeout value is zero, it means no timeout.
226@end deffn
227
228@deffn {Line Command} {no exec-timeout} {}
229Do not perform timeout at all. This command is as same as
230@command{exec-timeout 0 0}.
231@end deffn
232
233@deffn {Line Command} {access-class @var{access-list}} {}
234Restrict vty connections with an access list.
235@end deffn
236
paul76b89b42004-11-06 17:13:09 +0000237@node Sample Config File
paul718e3742002-12-13 20:15:29 +0000238@subsection Sample Config File
239
240
241Below is a sample configuration file for the zebra daemon.
242
243@example
244@group
245!
246! Zebra configuration file
247!
248hostname Router
249password zebra
250enable password zebra
251!
252log stdout
253!
254!
255@end group
256@end example
257
258'!' and '#' are comment characters. If the first character of the word
259is one of the comment characters then from the rest of the line forward
260will be ignored as a comment.
261
262@example
263password zebra!password
264@end example
265
266If a comment character is not the first character of the word, it's a
267normal character. So in the above example '!' will not be regarded as a
268comment and the password is set to 'zebra!password'.
269
270
271
ajs274a4a42004-12-07 15:39:31 +0000272@node Terminal Mode Commands
273@section Terminal Mode Commands
274
275@deffn Command {write terminal} {}
276Displays the current configuration to the vty interface.
277@end deffn
278
279@deffn Command {write file} {}
280Write current configuration to configuration file.
281@end deffn
282
283@deffn Command {configure terminal} {}
284Change to configuration mode. This command is the first step to
285configuration.
286@end deffn
287
288@deffn Command {terminal length @var{<0-512>}} {}
289Set terminal display length to @var{<0-512>}. If length is 0, no
290display control is performed.
291@end deffn
292
293@deffn Command {who} {}
294Show a list of currently connected vty sessions.
295@end deffn
296
297@deffn Command {list} {}
298List all available commands.
299@end deffn
300
301@deffn Command {show version} {}
302Show the current version of @value{PACKAGE_NAME} and its build host information.
303@end deffn
304
305@deffn Command {show logging} {}
306Shows the current configuration of the logging system. This includes
307the status of all logging destinations.
308@end deffn
309
310@deffn Command {logmsg @var{level} @var{message}} {}
311Send a message to all logging destinations that are enabled for messages
312of the given severity.
313@end deffn
314
315
316
317
paul76b89b42004-11-06 17:13:09 +0000318@node Common Invocation Options
paul718e3742002-12-13 20:15:29 +0000319@section Common Invocation Options
320@c COMMON_OPTIONS
321@c OPTIONS section of the man page
322
paul76b89b42004-11-06 17:13:09 +0000323These options apply to all @value{PACKAGE_NAME} daemons.
paul718e3742002-12-13 20:15:29 +0000324
325@table @samp
326
327@item -d
328@itemx --daemon
329Runs in daemon mode.
330
331@item -f @var{file}
332@itemx --config_file=@var{file}
333Set configuration file name.
334
335@item -h
336@itemx --help
337Display this help and exit.
338
339@item -i @var{file}
340@itemx --pid_file=@var{file}
341
342Upon startup the process identifier of the daemon is written to a file,
343typically in @file{/var/run}. This file can be used by the init system
344to implement commands such as @command{@dots{}/init.d/zebra status},
345@command{@dots{}/init.d/zebra restart} or @command{@dots{}/init.d/zebra
346stop}.
347
348The file name is an run-time option rather than a configure-time option
349so that multiple routing daemons can be run simultaneously. This is
paul76b89b42004-11-06 17:13:09 +0000350useful when using @value{PACKAGE_NAME} to implement a routing looking glass. One
paul718e3742002-12-13 20:15:29 +0000351machine can be used to collect differing routing views from differing
352points in the network.
353
paul971a4492003-06-20 01:18:07 +0000354@item -A @var{address}
355@itemx --vty_addr=@var{address}
356Set the VTY local address to bind to. If set, the VTY socket will only
357be bound to this address.
358
paul718e3742002-12-13 20:15:29 +0000359@item -P @var{port}
360@itemx --vty_port=@var{port}
paul971a4492003-06-20 01:18:07 +0000361Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not
362be opened.
363
364@item -u @var{user}
365@itemx --vty_addr=@var{user}
366Set the user and group to run as.
paul718e3742002-12-13 20:15:29 +0000367
368@item -v
369@itemx --version
370Print program version.
371
372@end table
373
374
375
paul76b89b42004-11-06 17:13:09 +0000376@node Virtual Terminal Interfaces
paul718e3742002-12-13 20:15:29 +0000377@section Virtual Terminal Interfaces
378
379VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line
380interface (CLI) for user interaction with the routing daemon.
381
382@menu
383* VTY Overview:: Basics about VTYs
384* VTY Modes:: View, Enable, and Other VTY modes
385* VTY CLI Commands:: Commands for movement, edition, and management
386@end menu
387
388
389
paul76b89b42004-11-06 17:13:09 +0000390@node VTY Overview
paul718e3742002-12-13 20:15:29 +0000391@subsection VTY Overview
392
393
394VTY stands for Virtual TeletYpe interface. It means you can connect to
395the daemon via the telnet protocol.
396
397To enable a VTY interface, you have to setup a VTY password. If there
398is no VTY password, one cannot connect to the VTY interface at all.
399
400@example
401@group
402% telnet localhost 2601
403Trying 127.0.0.1...
404Connected to localhost.
405Escape character is '^]'.
406
paul76b89b42004-11-06 17:13:09 +0000407Hello, this is @value{PACKAGE_NAME} (version @value{VERSION})
408@value{COPYRIGHT_STR}
paul718e3742002-12-13 20:15:29 +0000409
410User Access Verification
411
412Password: XXXXX
413Router> ?
414 enable Turn on privileged commands
415 exit Exit current mode and down to previous mode
416 help Description of the interactive help system
417 list Print command list
418 show Show running system information
419 who Display who is on a vty
420Router> enable
421Password: XXXXX
422Router# configure terminal
423Router(config)# interface eth0
424Router(config-if)# ip address 10.0.0.1/8
425Router(config-if)# ^Z
426Router#
427@end group
428@end example
429
430'?' is very useful for looking up commands.
431
paul76b89b42004-11-06 17:13:09 +0000432@node VTY Modes
paul718e3742002-12-13 20:15:29 +0000433@subsection VTY Modes
434
paul718e3742002-12-13 20:15:29 +0000435There are three basic VTY modes:
436
437@menu
438* VTY View Mode:: Mode for read-only interaction
439* VTY Enable Mode:: Mode for read-write interaction
440* VTY Other Modes:: Special modes (tftp, etc)
441@end menu
442
443There are commands that may be restricted to specific VTY modes.
444
paul76b89b42004-11-06 17:13:09 +0000445@node VTY View Mode
paul718e3742002-12-13 20:15:29 +0000446@subsubsection VTY View Mode
447@c to be written (gpoul)
448
449
450This mode is for read-only access to the CLI. One may exit the mode by
451leaving the system, or by entering @code{enable} mode.
452
paul76b89b42004-11-06 17:13:09 +0000453@node VTY Enable Mode
paul718e3742002-12-13 20:15:29 +0000454@subsubsection VTY Enable Mode
455
paul718e3742002-12-13 20:15:29 +0000456@c to be written (gpoul)
457This mode is for read-write access to the CLI. One may exit the mode by
458leaving the system, or by escaping to view mode.
459
paul76b89b42004-11-06 17:13:09 +0000460@node VTY Other Modes
paul718e3742002-12-13 20:15:29 +0000461@subsubsection VTY Other Modes
462
463
464@c to be written (gpoul)
465This page is for describing other modes.
466
paul76b89b42004-11-06 17:13:09 +0000467@node VTY CLI Commands
paul718e3742002-12-13 20:15:29 +0000468@subsection VTY CLI Commands
469
paul76b89b42004-11-06 17:13:09 +0000470Commands that you may use at the command-line are described in the following
471three subsubsections.
paul718e3742002-12-13 20:15:29 +0000472
473@menu
474* CLI Movement Commands:: Commands for moving the cursor about
475* CLI Editing Commands:: Commands for changing text
476* CLI Advanced Commands:: Other commands, session management and so on
477@end menu
478
paul76b89b42004-11-06 17:13:09 +0000479@node CLI Movement Commands
paul718e3742002-12-13 20:15:29 +0000480@subsubsection CLI Movement Commands
481
paul718e3742002-12-13 20:15:29 +0000482These commands are used for moving the CLI cursor. The @key{C} character
483means press the Control Key.
484
485@table @kbd
486
487@item C-f
488@itemx @key{RIGHT}
489@kindex C-f
490@kindex @key{RIGHT}
491Move forward one character.
492
493@item C-b
494@itemx @key{LEFT}
495@kindex C-b
496@kindex @key{LEFT}
497Move backward one character.
498
499@item M-f
500@kindex M-f
501Move forward one word.
502
503@item M-b
504@kindex M-b
505Move backward one word.
506
507@item C-a
508@kindex C-a
509Move to the beginning of the line.
510
511@item C-e
512@kindex C-e
513Move to the end of the line.
514
515@end table
516
paul76b89b42004-11-06 17:13:09 +0000517@node CLI Editing Commands
paul718e3742002-12-13 20:15:29 +0000518@subsubsection CLI Editing Commands
519
paul718e3742002-12-13 20:15:29 +0000520These commands are used for editing text on a line. The @key{C}
521character means press the Control Key.
522
523@table @kbd
524
525@item C-h
526@itemx @key{DEL}
527@kindex C-h
528@kindex @key{DEL}
529Delete the character before point.
530
531@item C-d
532@kindex C-d
533Delete the character after point.
534
535@item M-d
536@kindex M-d
537Forward kill word.
538
539@item C-w
540@kindex C-w
541Backward kill word.
542
543@item C-k
544@kindex C-k
545Kill to the end of the line.
546
547@item C-u
548@kindex C-u
549Kill line from the beginning, erasing input.
550
551@item C-t
552@kindex C-t
553Transpose character.
554
Paul Jakma126b0e72016-11-18 14:40:41 +0000555@item C-v
556@kindex C-v
557Interpret following character literally. Do not treat it specially.
558This can be used to, e.g., type in a literal @kbd{?} rather than do
559help completion.
560
paul718e3742002-12-13 20:15:29 +0000561@end table
562
paul76b89b42004-11-06 17:13:09 +0000563@node CLI Advanced Commands
paul718e3742002-12-13 20:15:29 +0000564@subsubsection CLI Advanced Commands
565
paul718e3742002-12-13 20:15:29 +0000566There are several additional CLI commands for command line completions,
567insta-help, and VTY session management.
568
569@table @kbd
570
571@item C-c
572@kindex C-c
573Interrupt current input and moves to the next line.
574
575@item C-z
576@kindex C-z
577End current configuration session and move to top node.
578
579
580@item C-n
581@itemx @key{DOWN}
582@kindex C-n
583@kindex @key{DOWN}
584Move down to next line in the history buffer.
585
586@item C-p
587@itemx @key{UP}
588@kindex C-p
589@kindex @key{UP}
590Move up to previous line in the history buffer.
591
592@item TAB
593@kindex @key{TAB}
594Use command line completion by typing @key{TAB}.
595
David Lamparterf16195c2014-11-28 08:40:58 +0100596@item ?
597@kindex @key{?}
paul718e3742002-12-13 20:15:29 +0000598You can use command line help by typing @code{help} at the beginning of
599the line. Typing @kbd{?} at any point in the line will show possible
600completions.
601
Paul Jakma126b0e72016-11-18 14:40:41 +0000602To enter an actual @kbd{?} character rather show completions, e.g. to
603enter into a regexp, use @kbd{@key{C}-v ?}.
604
paul718e3742002-12-13 20:15:29 +0000605@end table