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:

  * ripd, ripngd, ospfd, ospf6d, bgpd

  * zebra

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

Config Commands
===============

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:

  INSTALL_PREFIX_ETC/*.conf

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

  INSTALL_PREFIX_ETC/zebra.conf

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

Basic Config Commands
---------------------

 -- Command: hostname HOSTNAME
     Set hostname of the router.

 -- Command: password PASSWORD
     Set password for vty interface.  If there is no password, a vty won't accept connections.

 -- Command: enable password PASSWORD
     Set enable password.

 -- Command: log stdout
 -- Command: no log stdout
     Set logging output to stdout.

 -- Command: log file FILENAME
     If you want to log into a file please specify filename as follows.

          log file /usr/local/etc/bgpd.log

 -- Command: log syslog
 -- Command: no log syslog
     Set logging output to syslog.

 -- Command: write terminal
     Displays the current configuration to the vty interface.

 -- Command: write file
     Write current configuration to configuration file.

 -- Command: configure terminal
     Change to configuration mode.  This command is the first step to configuration.

 -- Command: terminal length <0-512>
     Set terminal display length to <0-512>.  If length is 0, no display control is performed.

 -- Command: who

 -- Command: list
     List commands.

 -- Command: service password-encryption
     Encrypt password.

 -- Command: service advanced-vty
     Enable advanced mode VTY.

 -- Command: service terminal-length <0-512>
     Set system wide line configuration.  This configuration command applies to all VTY interfaces.

 -- Command: show version
     Show the current version of the Zebra and its build host information.

 -- Command: line vty
     Enter vty configuration mode.

 -- Command: banner motd default
     Set default motd string.

 -- Command: no banner motd
     No motd banner string will be printed.

 -- Line Command: exec-timeout MINUTE
 -- Line Command: exec-timeout MINUTE 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.

 -- Line Command: no exec-timeout
     Do not perform timeout at all.  This command is as same as exec-timeout 0 0.

 -- Line Command: access-class ACCESS-LIST
     Restrict vty connections with an access list.

Sample Config File
------------------

Below is a sample configuration file for the zebra daemon.

     !
     ! Zebra configuration file
     !
     hostname Router
     password zebra
     enable password zebra
     !
     log stdout
     !
     !

'!' 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.

     password zebra!password

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'.

Common Invocation Options
=========================

These options apply to all Zebra daemons.

-d
--daemon
     Runs in daemon mode.

-f FILE
--config_file=FILE
     Set configuration file name.

-h
--help
     Display this help and exit.

-P PORT
--vty_port=PORT
     Set the VTY port number.

-v
--version
     Print program version.

Virtual Terminal Interfaces
===========================

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

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.

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

     Hello, this is zebra (version VERSION)
     Copyright 1997-2000 Kunihiro Ishiguro

     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#

'?' is very useful for looking up commands.

VTY Modes
---------

There are three basic VTY modes:

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

VTY View Mode
.............

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

VTY Enable Mode
...............

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.

VTY Other Modes
...............

This page is for describing other modes.

VTY CLI Commands
----------------

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

CLI Movement Commands
.....................

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

C-f
RIGHT
     Move forward one character.

C-b
LEFT
     Move backward one character.

M-f
     Move forward one word.

M-b
     Move backward one word.

C-a
     Move to the beginning of the line.

C-e
     Move to the end of the line.

CLI Editing Commands
....................

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

C-h
DEL
     Delete the character before point.

C-d
     Delete the character after point.

M-d
     Forward kill word.

C-w
     Backward kill word.

C-k
     Kill to the end of the line.

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

C-t
     Transpose character.

CLI Advanced Commands
.....................

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

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

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

C-n
DOWN
     Move down to next line in the history buffer.

C-p
UP
     Move up to previous line in the history buffer.

TAB
     Use command line completion by typing TAB.

     You can use command line help by typing help at the beginning of the line.  Typing ? at any point in the line will show possible completions.