summaryrefslogtreecommitdiffstats
path: root/doc/basic.texi
blob: 77fceee1ed4ed406a808ce725fc522a9a50b925d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
@node Basic commands
@chapter Basic commands

There are five routing daemons in use, and there is one manager daemon.
These daemons may be located on separate machines from the manager
daemon.  Each of these daemons will listen on a particular port for
incoming VTY connections.  The routing daemons are:

@itemize @bullet
@item @command{ripd}, @command{ripngd}, @command{ospfd}, @command{ospf6d}, @command{bgpd}
@item @command{zebra}
@end itemize

The following sections discuss commands common to all the routing
daemons.

@menu
* Terminal Mode Commands::      Common commands used in a VTY
* Config Commands::             Commands used in config files
* Common Invocation Options::   Starting the daemons
* Virtual Terminal Interfaces:: Interacting with the daemons
@end menu



@node Config Commands
@section Config Commands

@cindex Configuration files for running the software
@c A -not configuration files for installing the software
@cindex Files for running configurations
@cindex Modifying the herd's behavior
@cindex Getting the herd running


@menu
* Basic Config Commands::       Some of the generic config commands
* Sample Config File::          An example config file
@end menu


In a config file, you can write the debugging options, a vty's password,
routing daemon configurations, a log file name, and so forth. This
information forms the initial command set for a routing beast as it is
starting.

Config files are generally found in:

@itemize @asis
@item @file{@value{INSTALL_PREFIX_ETC}/*.conf}
@end itemize

Each of the daemons has its own
config file.  For example, zebra's default config file name is:

@itemize @asis
@item @file{@value{INSTALL_PREFIX_ETC}/zebra.conf}
@end itemize

The daemon name plus @file{.conf} is the default config file name. You
can specify a config file using the @kbd{-f} or @kbd{--config-file}
options when starting the daemon.



@node Basic Config Commands
@subsection Basic Config Commands

@deffn Command {hostname @var{hostname}} {}
Set hostname of the router.
@end deffn

@deffn Command {password @var{password}} {}
Set password for vty interface.  If there is no password, a vty won't
accept connections.
@end deffn

@deffn Command {enable password @var{password}} {}
Set enable password.
@end deffn

@deffn Command {log trap @var{level}} {}
@deffnx Command {no log trap} {}
These commands are deprecated and are present only for historical compatibility.
The log trap command sets the current logging level for all enabled
logging destinations, and it sets the default for all future logging commands
that do not specify a level.  The normal default
logging level is debugging.  The @code{no} form of the command resets
the default level for future logging commands to debugging, but it does
not change the logging level of existing logging destinations.
@end deffn


@deffn Command {log stdout} {}
@deffnx Command {log stdout @var{level}} {}
@deffnx Command {no log stdout} {}
Enable logging output to stdout. 
If the optional second argument specifying the
logging level is not present, the default logging level (typically debugging,
but can be changed using the deprecated @code{log trap} command) will be used.
The @code{no} form of the command disables logging to stdout.
The @code{level} argument must have one of these values: 
emergencies, alerts, critical, errors, warnings, notifications, informational, or debugging.  Note that the existing code logs its most important messages
with severity @code{errors}.
@end deffn

@deffn Command {log file @var{filename}} {}
@deffnx Command {log file @var{filename} @var{level}} {}
@deffnx Command {no log file} {}
If you want to log into a file, please specify @code{filename} as
in this example:
@example
log file /var/log/quagga/bgpd.log informational
@end example
If the optional second argument specifying the
logging level is not present, the default logging level (typically debugging,
but can be changed using the deprecated @code{log trap} command) will be used.
The @code{no} form of the command disables logging to a file.

Note: if you do not configure any file logging, and a daemon crashes due
to a signal or an assertion failure, it will attempt to save the crash
information in a file named /var/tmp/quagga.<daemon name>.crashlog.
For security reasons, this will not happen if the file exists already, so
it is important to delete the file after reporting the crash information.
@end deffn

@deffn Command {log syslog} {}
@deffnx Command {log syslog @var{level}} {}
@deffnx Command {no log syslog} {}
Enable logging output to syslog.
If the optional second argument specifying the
logging level is not present, the default logging level (typically debugging,
but can be changed using the deprecated @code{log trap} command) will be used.
The @code{no} form of the command disables logging to syslog.
@end deffn

@deffn Command {log monitor} {}
@deffnx Command {log monitor @var{level}} {}
@deffnx Command {no log monitor} {}
Enable logging output to vty terminals that have enabled logging
using the @code{terminal monitor} command.
By default, monitor logging is enabled at the debugging level, but this
command (or the deprecated @code{log trap} command) can be used to change 
the monitor logging level.
If the optional second argument specifying the
logging level is not present, the default logging level (typically debugging,
but can be changed using the deprecated @code{log trap} command) will be used.
The @code{no} form of the command disables logging to terminal monitors.
@end deffn

@deffn Command {log facility @var{facility}} {}
@deffnx Command {no log facility} {}
This command changes the facility used in syslog messages.  The default
facility is @code{daemon}.  The @code{no} form of the command resets
the facility to the default @code{daemon} facility.
@end deffn

@deffn Command {log record-priority} {}
@deffnx Command {no log record-priority} {}
To include the severity in all messages logged to a file, to stdout, or to
a terminal monitor (i.e. anything except syslog),
use the @code{log record-priority} global configuration command.
To disable this option, use the @code{no} form of the command.  By default,
the severity level is not included in logged messages.  Note: some
versions of syslogd (including Solaris) can be configured to include
the facility and level in the messages emitted.
@end deffn

@deffn Command {log timestamp precision @var{<0-6>}} {}
@deffnx Command {no log timestamp precision} {}
This command sets the precision of log message timestamps to the
given number of digits after the decimal point.  Currently,
the value must be in the range 0 to 6 (i.e. the maximum precision
is microseconds).
To restore the default behavior (1-second accuracy), use the
@code{no} form of the command, or set the precision explicitly to 0.

@example
@group
log timestamp precision 3
@end group
@end example

In this example, the precision is set to provide timestamps with
millisecond accuracy.
@end deffn

@deffn Command {service password-encryption} {}
Encrypt password.
@end deffn

@deffn Command {service advanced-vty} {}
Enable advanced mode VTY.
@end deffn

@deffn Command {service terminal-length @var{<0-512>}} {}
Set system wide line configuration.  This configuration command applies
to all VTY interfaces.
@end deffn

@deffn Command {line vty} {}
Enter vty configuration mode.
@end deffn

@deffn Command {banner motd default} {}
Set default motd string.
@end deffn

@deffn Command {no banner motd} {}
No motd banner string will be printed.
@end deffn

@deffn {Line Command} {exec-timeout @var{minute}} {}
@deffnx {Line Command} {exec-timeout @var{minute} @var{second}} {}
Set VTY connection timeout value.  When only one argument is specified
it is used for timeout value in minutes.  Optional second argument is
used for timeout value in seconds. Default timeout value is 10 minutes.
When timeout value is zero, it means no timeout.
@end deffn

@deffn {Line Command} {no exec-timeout} {}
Do not perform timeout at all.  This command is as same as
@command{exec-timeout 0 0}.
@end deffn

@deffn {Line Command} {access-class @var{access-list}} {}
Restrict vty connections with an access list.
@end deffn

@node Sample Config File
@subsection Sample Config File


Below is a sample configuration file for the zebra daemon.

@example
@group
!
! Zebra configuration file
!
hostname Router
password zebra
enable password zebra
!
log stdout
!
!
@end group
@end example

'!' and '#' are comment characters.  If the first character of the word
is one of the comment characters then from the rest of the line forward
will be ignored as a comment.

@example
password zebra!password
@end example

If a comment character is not the first character of the word, it's a
normal character. So in the above example '!' will not be regarded as a
comment and the password is set to 'zebra!password'.



@node Terminal Mode Commands
@section Terminal Mode Commands

@deffn Command {write terminal} {}
Displays the current configuration to the vty interface.
@end deffn

@deffn Command {write file} {}
Write current configuration to configuration file.
@end deffn

@deffn Command {configure terminal} {}
Change to configuration mode.  This command is the first step to
configuration.
@end deffn

@deffn Command {terminal length @var{<0-512>}} {}
Set terminal display length to @var{<0-512>}.  If length is 0, no
display control is performed.
@end deffn

@deffn Command {who} {}
Show a list of currently connected vty sessions.
@end deffn

@deffn Command {list} {}
List all available commands.
@end deffn

@deffn Command {show version} {}
Show the current version of @value{PACKAGE_NAME} and its build host information.
@end deffn

@deffn Command {show logging} {}
Shows the current configuration of the logging system.  This includes
the status of all logging destinations.
@end deffn

@deffn Command {logmsg @var{level} @var{message}} {}
Send a message to all logging destinations that are enabled for messages
of the given severity.
@end deffn




@node Common Invocation Options
@section Common Invocation Options
@c COMMON_OPTIONS
@c OPTIONS section of the man page

These options apply to all @value{PACKAGE_NAME} daemons.

@table @samp

@item -d
@itemx --daemon
Runs in daemon mode.

@item -f @var{file}
@itemx --config_file=@var{file}
Set configuration file name.

@item -h
@itemx --help
Display this help and exit.

@item -i @var{file}
@itemx --pid_file=@var{file}

Upon startup the process identifier of the daemon is written to a file,
typically in @file{/var/run}.  This file can be used by the init system
to implement commands such as @command{@dots{}/init.d/zebra status},
@command{@dots{}/init.d/zebra restart} or @command{@dots{}/init.d/zebra
stop}.

The file name is an run-time option rather than a configure-time option
so that multiple routing daemons can be run simultaneously.  This is
useful when using @value{PACKAGE_NAME} to implement a routing looking glass.  One
machine can be used to collect differing routing views from differing
points in the network.

@item -A @var{address}
@itemx --vty_addr=@var{address}
Set the VTY local address to bind to. If set, the VTY socket will only
be bound to this address. 

@item -P @var{port}
@itemx --vty_port=@var{port}
Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not
be opened.

@item -u @var{user}
@itemx --vty_addr=@var{user}
Set the user and group to run as.

@item -v
@itemx --version
Print program version.

@end table



@node Virtual Terminal Interfaces
@section Virtual Terminal Interfaces

VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line
interface (CLI) for user interaction with the routing daemon.

@menu
* VTY Overview::                Basics about VTYs                
* VTY Modes::                   View, Enable, and Other VTY modes
* VTY CLI Commands::            Commands for movement, edition, and management
@end menu



@node VTY Overview
@subsection VTY Overview


VTY stands for Virtual TeletYpe interface.  It means you can connect to
the daemon via the telnet protocol.

To enable a VTY interface, you have to setup a VTY password.  If there
is no VTY password, one cannot connect to the VTY interface at all.

@example
@group
% telnet localhost 2601
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is @value{PACKAGE_NAME} (version @value{VERSION})
@value{COPYRIGHT_STR}

User Access Verification

Password: XXXXX
Router> ?
  enable            Turn on privileged commands
  exit              Exit current mode and down to previous mode
  help              Description of the interactive help system
  list              Print command list
  show              Show running system information
  who               Display who is on a vty
Router> enable
Password: XXXXX
Router# configure terminal
Router(config)# interface eth0
Router(config-if)# ip address 10.0.0.1/8
Router(config-if)# ^Z
Router#
@end group
@end example

'?' is very useful for looking up commands.

@node VTY Modes
@subsection VTY Modes

There are three basic VTY modes:

@menu
* VTY View Mode::               Mode for read-only interaction               
* VTY Enable Mode::             Mode for read-write interaction
* VTY Other Modes::             Special modes (tftp, etc)
@end menu

There are commands that may be restricted to specific VTY modes. 

@node VTY View Mode
@subsubsection VTY View Mode
@c to be written (gpoul)


This mode is for read-only access to the CLI. One may exit the mode by
leaving the system, or by entering @code{enable} mode.

@node VTY Enable Mode
@subsubsection VTY Enable Mode

@c to be written (gpoul)
This mode is for read-write access to the CLI. One may exit the mode by
leaving the system, or by escaping to view mode.

@node VTY Other Modes
@subsubsection VTY Other Modes


@c to be written (gpoul)
This page is for describing other modes.

@node VTY CLI Commands
@subsection VTY CLI Commands

Commands that you may use at the command-line are described in the following
three subsubsections.

@menu
* CLI Movement Commands::       Commands for moving the cursor about
* CLI Editing Commands::        Commands for changing text
* CLI Advanced Commands::       Other commands, session management and so on
@end menu

@node CLI Movement Commands
@subsubsection CLI Movement Commands

These commands are used for moving the CLI cursor. The @key{C} character
means press the Control Key.

@table @kbd

@item C-f
@itemx @key{RIGHT}
@kindex C-f
@kindex @key{RIGHT}
Move forward one character.

@item C-b
@itemx @key{LEFT}
@kindex C-b
@kindex @key{LEFT}
Move backward one character.

@item M-f
@kindex M-f
Move forward one word.

@item M-b
@kindex M-b
Move backward one word.

@item C-a
@kindex C-a
Move to the beginning of the line.

@item C-e
@kindex C-e
Move to the end of the line.

@end table

@node CLI Editing Commands
@subsubsection CLI Editing Commands

These commands are used for editing text on a line. The @key{C}
character means press the Control Key.

@table @kbd

@item C-h
@itemx @key{DEL}
@kindex C-h
@kindex @key{DEL}
Delete the character before point.

@item C-d
@kindex C-d
Delete the character after point.

@item M-d
@kindex M-d
Forward kill word.

@item C-w
@kindex C-w
Backward kill word.

@item C-k
@kindex C-k
Kill to the end of the line.

@item C-u
@kindex C-u
Kill line from the beginning, erasing input.

@item C-t
@kindex C-t
Transpose character.

@end table

@node CLI Advanced Commands
@subsubsection CLI Advanced Commands

There are several additional CLI commands for command line completions,
insta-help, and VTY session management.

@table @kbd

@item C-c
@kindex C-c
Interrupt current input and moves to the next line.

@item C-z
@kindex C-z
End current configuration session and move to top node.


@item C-n
@itemx @key{DOWN}
@kindex C-n
@kindex @key{DOWN}
Move down to next line in the history buffer.

@item C-p
@itemx @key{UP}
@kindex C-p
@kindex @key{UP}
Move up to previous line in the history buffer.

@item TAB
@kindex @key{TAB}
Use command line completion by typing @key{TAB}.

@item
@kindex ?
You can use command line help by typing @code{help} at the beginning of
the line.  Typing @kbd{?} at any point in the line will show possible
completions.

@end table