Initially Configuring a Device

Initially configuring a device varies by platform. For information about performing an initial configuration, see the hardware installation documentation that is provided with the original packaging of the product or go to the Product/Technologies Support area of Cisco.com at http://www.cisco.com/go/techdocs.

After you have performed the initial configuration and connected the device to your network, you can configure the device by using the console port or a remote access method, such as Telnet or Secure Shell (SSH), to access the CLI or by using the configuration method provided on the device, such as Security Device Manager.

Changing the Default Settings for a Console or AUX Port

There are only two changes that you can make to a console port and an AUX port:

•Change the port speed with the config-register 0x command. Changing the port speed is not recommended. The well-known default speed is 9600.

•Change the behavior of the port; for example, by adding a password or changing the timeout value.

Note The AUX port on the Route Processor (RP) installed in a Cisco ASR 1000 series router does not serve any useful customer purpose and should be accessed only under the advisement of a customer support representative.

Understanding Command Modes

The CLI command mode structure is hierarchical, and each mode supports a set of specific commands. This section describes the most common of the many modes that exist.

Table 1 lists common command modes with associated CLI prompts, access and exit methods, and a brief description of how each mode is used.

Table 1 CLI Command Modes

Command Mode

Access Method

Prompt

Exit Method

Mode Usage

User EXEC

Log in.

Router>

Issue the logout or exit command.

•Change terminal settings.

•Perform basic tests.

•Display device status.

Privileged EXEC

From user EXEC mode, issue the enable command.

Router#

Issue the disable command or the exit command to return to user EXEC mode.

•Issue show and debug commands.

•Copy images to the device.

•Reload the device.

•Manage device configuration files.

•Manage device file systems.

Global configuration

From privileged EXEC mode, issue theconfigure terminalcommand.

Router(config)#

Issue the exit command or the end command to return to privileged EXEC mode.

Configure the device.

Interface configuration

From global configuration mode, issue the interface command.

Router(config-if)#

Issue the exit command to return to global configuration mode or the end command to return to privileged EXEC mode.

Configure individual interfaces.

Line configuration

From global configuration mode, issue the line vty or line console command.

Router(config-line)#

Issue the exit command to return to global configuration mode or the end command to return to privileged EXEC mode.

Configure individual terminal lines.

ROM monitor

From privileged EXEC mode, issue the reload command. Press the Break key during the first 60 seconds while the system is booting.

rommon # >

The # symbol represents the line number and increments at each prompt.

Issue the continuecommand.

•Run as the default operating mode when a valid image cannot be loaded.

•Access the fall-back procedure for loading an image when the device lacks a valid image and cannot be booted.

•Perform password recovery when a Ctrl-Break sequence is issued within 60 seconds of a power-on or reload event.

Diagnostic (available only on Cisco ASR 1000 series routers)

The router boots or enters diagnostic mode in the following scenarios. When a Cisco IOS process or processes fail, in most scenarios the router will reload.

•A user-configured access policy was configured using the transport-map command, which directed the user into diagnostic mode.

•The router was accessed using an RP auxiliary port.

•A break signal (Ctrl-C, Ctrl-Shift-6, or the send break command) was entered, and the router was configured to enter diagnostic mode when the break signal was received.

Router(diag)#

If a Cisco IOS process failure is the reason for entering diagnostic mode, the failure must be resolved and the router must be rebooted to exit diagnostic mode.

If the router is in diagnostic mode because of a transport-map configuration, access the router through another port or use a method that is configured to connect to the Cisco IOS CLI.

If the RP auxiliary port was used to access the router, use another port for access. Accessing the router through the auxiliary port is not useful for customer purposes.

•Inspect various states on the router, including the CiscoIOS state.

•Replace or roll back the configuration.

•Provide methods of restarting the Cisco IOS software or other processes.

•Reboot hardware (such as the entire router, an RP, an ESP, a SIP, a SPA) or other hardware components.

•Transfer files into or off of the router using remote access methods such as FTP, TFTP, and SCP.

EXEC commands are not saved when the software reboots. Commands that you issue in a configuration mode can be saved to the startup configuration. If you save the running configuration to the startup configuration, these commands will execute when the software is rebooted. Global configuration mode is the highest level of configuration mode. From global configuration mode, you can enter a variety of other configuration modes, including protocol-specific modes.

ROM monitor mode is a separate mode that is used when the software cannot load properly. If a valid software image is not found when the software boots or if the configuration file is corrupted at startup, the software might enter ROM monitor mode. Use the question symbol (?) to view the commands that you can use while the device is in ROM monitor mode.

rommon 1 > ?

alias set and display aliases command

boot boot up an external process

confreg configuration register utility

cont continue executing a downloaded image

context display the context of a loaded image

cookie display contents of cookie PROM in hex

.

.

.

rommon 2 >

The following example shows how the command prompt changes to indicate a different command mode:

Router> enable

Router# configure terminal

Router(config)# interface ethernet 1/1

Router(config-if)# ethernet

Router(config-line)# exit

Router(config)# end

Router#

Note A keyboard alternative to the end command is Ctrl-Z.

Using the Interactive Help Feature

The CLI includes an interactive Help feature. Table 2 describes the purpose of the CLI interactive Help commands.

Table 2 CLI Interactive Help Commands

Command

Purpose

help

Provides a brief description of the Help feature in any command mode.

?

Lists all commands available for a particular command mode.

partial command?

Provides a list of commands that begin with the character string (no space between the command and the question mark).

partial command<Tab>

Completes a partial command name (no space between the command and <Tab>).

command?

Lists the keywords, arguments, or both associated with the command (space between the command and the question mark).

command keyword ?

Lists the arguments that are associated with the keyword (space between the keyword and the question mark).

The following examples show how to use the help commands:

help

Router> help

Help may be requested at any point in a command by entering a question mark '?'. If nothing matches, the help list will be empty and you must backup until entering a '?' shows the available options.

Two styles of help are provided:

1. Full help is available when you are ready to enter a command argument (e.g. 'show ?') and describes each possible argument.

2. Partial help is provided when an abbreviated argument is entered and you want to know what arguments match the input (e.g. 'show pr?'.)

?

Router# ?

Exec commands:

access-enable Create a temporary access-List entry

access-profile Apply user-profile to interface

access-template Create a temporary access-List entry

alps ALPS exec commands

archive manage archive files

<snip>

partial command?

Router(config)# zo?

zone zone-pair

partial command<Tab>

Router(config)# we<Tab> webvpn

command?

Router(config-if)# pppoe ?

enable Enable pppoe

max-sessions Maximum PPPOE sessions

command keyword ?

Router(config-if)# pppoe enable ?

group attach a BBA group

<cr>

Understanding Command Syntax

Command syntax is the format in which a command should be entered in the CLI. Commands include the name of the command, keywords, and arguments. Keywords are alphanumeric strings that are used literally. Arguments are placeholders for values that a user must supply. Keywords and arguments may be required or optional.

Angle brackets (< >) are not always used to indicate that an IP address is an argument.

WORD (all capital letters)

Indicates that you must enter one word.

Angle brackets (< >) are not always used to indicate that a WORD is an argument.

LINE (all capital letters)

Indicates that you must enter more than one word.

Angle brackets (< >) are not always used to indicate that a LINE is an argument.

<cr> (carriage return)

Indicates the end of the list of available keywords and arguments, and also indicateswhen keywords and arguments are optional. When <cr> is the only option, you have reached the end of the branch or the end of the command if the command has only one branch.

—

The following examples show syntax conventions:

Router(config)# ethernet cfm domain ?

WORD domain name

Router(config)# ethernet cfm domain dname ?

level

Router(config)# ethernet cfm domain dname level ?

<0-7> maintenance level number

Router(config)# ethernet cfm domain dname level 7 ?

<cr>

Router(config)# snmp-server file-transfer access-group 10 ?

protocol protocol options

<cr>

Router(config)# logging host ?

Hostname or A.B.C.D IP address of the syslog server

ipv6 Configure IPv6 syslog server

Understanding Enable and Enable Secret Passwords

Some privileged EXEC commands are used for actions that impact the system, and it is recommended that you set a password for these commands to prevent unauthorized use. Two types of passwords, enable (not encrypted) and enable secret (encrypted), can be set. The following commands set these passwords and are issued in global configuration mode:

•enablepassword

•enable secretpassword

Using an enable secret password is recommended because it is encrypted and more secure than the enable password. When you use an enable secret password, text is encrypted (unreadable) before it is written to the config.text file. When you use an enable password, the text is written as entered (readable) to the config.text file.

Each type of password is case sensitive, can contain from 1 to 25 uppercase and lowercase alphanumeric characters, and can start with a numeral. Spaces are also valid password characters; for example, "two words" is a valid password. Leading spaces are ignored, but trailing spaces are recognized.

Note Both password commands have numeric keywords that are single integer values. If you choose a numeral for the first character of your password followed by a space, the system will read the number as if it were the numeric keyword and not as part of your password.

When both passwords are set, the enable secret password takes precedence over the enable password.

To remove a password, use the no form of the commands: no enable password or no enable secret password.

For more information about password recovery procedures for Cisco products, see the following:

Using the Command History Feature

The command history feature saves, in a command history buffer, the commands that you enter during a session. The default number of saved commands is 10, but the number is configurable within the range of 0 to 256. This command history feature is particularly useful for recalling long or complex commands.

To change the number of commands saved in the history buffer for a terminal session, issue the terminal historysize command:

Router# terminal historysizenum

A command history buffer is also available in line configuration mode with the same default and configuration options. To set the command history buffer size for a terminal session in line configuration mode, issue the history command:

Router(config-line)# history [sizenum]

To recall commands from the history buffer, use the following methods:

•Press Ctrl-P or the Up Arrow key—Recalls commands beginning with the most recent command. Repeat the key sequence to recall successively older commands.

•Press Ctrl-N or the Down Arrow key—Recalls the most recent commands in the history buffer after they have been recalled using Ctrl-P or the Up Arrow key. Repeat the key sequence to recall successively more recent commands.

Note The arrow keys function only on ANSI-compatible terminals such as the VT100.

•Issue the show history command in user EXEC or privileged EXEC mode—Lists the most recent commands that you entered. The number of commands that are displayed is determined by the setting of the terminal history size and history commands.

The command history feature is enabled by default. To disable this feature for a terminal session, issue the terminal no history command in user EXEC or privileged EXEC mode or the no history command in line configuration mode.

Abbreviating Commands

Typing a complete command name is not always required for the command to execute. The CLI recognizes an abbreviated command when the abbreviation contains enough characters to uniquely identify the command. For example, the show version command can be abbreviated as sh ver. It cannot be abbreviated as s ver because s could mean show, set, or systat. The sh v abbreviation also is not valid because the show command has vrrp as a keyword in addition to version. (Command and keyword examples are from Cisco IOS Release 12.4(13)T.)

Using Aliases for CLI Commands

To save time and the repetition of entering the same command multiple times, you can use a command alias. An alias can be configured to do anything that can be done at the command line, but an alias cannot move between modes, type in passwords, or perform any interactive functions.

Using the no and default Forms of Commands

Most configuration commands have a no form that is used to reset a command to its default value or to disable a feature or function. For example, the ip routing command is enabled by default. To disable this command, you would issue the no ip routing command. To re-enable IP routing, you would issue the ip routing command.

Configuration commands may also have a default form, which returns the command settings to their default values. For commands that are disabled by default, using the default form has the same effect as using the no form of the command. For commands that are enabled by default and have default settings, the default form enables the command and returns the settings to their default values. To see what default commands are available on your system, enter default ? in the appropriate command mode of the command-line interface.

The no form is documented in the command pages of Cisco IOS command references. The default form is generally documented in the command pages only when the default form performs a function different than that of the plain and no forms of the command.

Command pages often include a "Command Default" section as well. The "Command Default" section documents the state of the configuration if the command is not used (for configuration commands) or the outcome of using the command if none of the optional keywords or arguments is specified (for EXEC commands).

Using the debug Command

A debug command produces extensive output that helps you troubleshoot problems in your network. These commands are available for many features and functions within Cisco IOS software. Some debug commands are debug all, debug aaa accounting, and debug mpls packets. To use debug commands during a Telnet session with a device, you must first enter the terminal monitor command. To turn off debugging completely, you must enter the undebug all command.

For more information about debug commands, see the Cisco IOS Debug Command Reference:

Caution Debugging is a high priority and high CPU utilization process that can render your device unusable. Use
debug commands only to troubleshoot specific problems. The best times to run debugging are during periods of low network traffic and when few users are interacting with the network. Debugging during these periods decreases the likelihood that the
debug command processing overhead will affect network performance or user access or response times.

Filtering Output Using Output Modifiers

Many commands produce lengthy output that may use several screens to display. Using output modifiers, you can filter this output to show only the information that you want to see.

The following three output modifiers are available:

•beginregular-expression—Displays the first line in which a match of the regular expression is found and all lines that follow.

•includeregular-expression—Displays all lines in which a match of the regular expression is found.

•excluderegular-expression—Displays all lines except those in which a match of the regular expression is found.

To use one of these output modifiers, type the command followed by the pipe symbol (|), the modifier, and the regular expression that you want to search for or filter. A regular expression is a case-sensitive alphanumeric pattern. It can be a single character or number, a phrase, or a more complex string.

The following example illustrates how to filter output of the show interface command to display only lines that include the expression "protocol."

Router# show interface | include protocol

FastEthernet0/0 is up, line protocol is up

Serial4/0 is up, line protocol is up

Serial4/1 is up, line protocol is up

Serial4/2 is administratively down, line protocol is down

Serial4/3 is administratively down, line protocol is down

Understanding CLI Error Messages

You may encounter some error messages while using the CLI. Table 5 shows the common CLI error messages.

Table 5 Common CLI Error Messages

Error Message

Meaning

How to Get Help

% Ambiguous command: "show con"

You did not enter enough characters for the command to be recognized.

Reenter the command followed by a space and a question mark (?). The keywords that you are allowed to enter for the command appear.

% Incomplete command.

You did not enter all the keywords or values required by the command.

Reenter the command followed by a space and a question mark (?). The keywords that you are allowed to enter for the command appear.

% Invalid input detected at "^" marker.

You entered the command incorrectly. The caret (^) marks the point of the error.

Enter a question mark (?) to display all the commands that are available in this command mode. The keywords that you are allowed to enter for the command appear.

Saving Changes to a Configuration

To save changes that you made to the configuration of a device, you must issue the copy running-config startup-config command or the copy system:running-config nvram:startup-configcommand. When you issue these commands, the configuration changes that you made are saved to the startup configuration and saved when the software reloads or power to the device is turned off or interrupted. The following example shows the syntax of the copy running-config startup-config command:

Router# copy running-config startup-config

Destination filename [startup-config]?

You press Enter to accept the startup-config filename (the default), or type a new filename and then press Enter to accept that name. The following output is displayed indicating that the configuration was saved.

Building configuration...

[OK]

Router#

On most platforms, the configuration is saved to NVRAM. On platforms with a Class A flash file system, the configuration is saved to the location specified by the CONFIG_FILE environment variable. The CONFIG_FILE variable defaults to NVRAM.

All other trademarks mentioned in this document or website are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1002R)

Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.