Cisco IOS Command Line Interface Tutorial
Cisco IOS Command Line Interface Tutorial
1.1 Abstract
The focus of this document is to introduce a new Cisco Internetworking Operating
System (IOS) user to the IOS command line interface (CLI). After reading this
document, a new user will understand how to use the IOS CLI to configure and
manage an IOS router. For easier reference, Table 1 displays a collection of
important terms and acronyms that are used throughout the document.
As a security feature, Cisco IOS separates EXEC sessions into two different access
levels - user EXEC level and privileged EXEC level. User EXEC level allows a
person to access only a limited amount of basic monitoring commands. Privileged
EXEC level allows a person to access all router commands (e.g. configuration and
management) and can be password protected to allow only authorized users the
ability to configure or maintain the router.
For example, when an EXEC session is started, the router will display a "Router>"
prompt. The right arrow (>) in the prompt indicates that the router is at the user
EXEC level. The user EXEC level does not contain any commands that might
control (e.g. reload or configure) the operation of the router. To list the commands
available at the user EXEC level, type a question mark (?) at the Router> prompt.
(This feature is referred to as context sensitive help.)
Critical commands (e.g. configuration and management) require that the user be at
the privileged EXEC level. To change to the privileged EXEC level, type "enable" at
the Router> prompt. If an enable password is configured, the router will then prompt
for that password. When the correct enable password is entered, the router prompt
will change to "Router#" indicating that the user is now at the privileged EXEC level.
To switch back to user EXEC level, type "disable" at the Router# prompt. Typing a
question mark (?) at the privileged EXEC level will now reveal many more
command options than those available at the user EXEC level. The text below
illustrates the process of changing EXEC levels.
Router> enable
Password: [enable password]
Router# disable
Router>
Note: For security reasons, the router will not echo the password that is entered.
Also, be advised that if configuring a router via telnet, the password is sent in clear
text. Telnet does not offer a method to secure packets.
Command options and applications vary depending on position within this hierarchy.
Referring to the diagram in figure 1, configuration command options will not be
available until the user has navigated to the configuration branch of the IOS CLI
structure. Once in the configuration branch, a user may enter system level
configuration commands that apply to the entire router at the global configuration
level. Interface specific configuration commands are available once the user has
switched to the particular interface configuration level. More detailed information
and examples on how to navigate through the IOS CLI hierarchy are offered in
the Router Configuration section.
To assist users in navigation through IOS CLI, the command prompt will change to
reflect the position of a user within the command hierarchy. This allows users to
easily identify where within the command structure they are at any given moment.
Table 2 is a summary of command prompts and the corresponding location within
the command structure.
Cisco IOS CLI offers context sensitive help. This is a useful tool for a new user
because at any time during an EXEC session, a user can type a question mark (?)
to get help. Two types of context sensitive help are available - word help and
command syntax help.
Word help can be used to obtain a list of commands that begin with a particular
character sequence. To use word help, type in the characters in question followed
immediately by the question mark (?). Do not include a space before the question
mark. The router will then display a list of commands that start with the characters
that were entered. The following is an example of word help:
Router# co?
configure connect
copy
Router# configure ?
memory Configure from NV memory
network Configure from a TFTP network host
overwrite-network Overwrite NV memory from TFTP network
host=20
terminal Configure from the terminal
<cr>
Router(config)#interface ethernat
^
% Invalid input detected at '^' marker.
cisco(config)#i
% Ambiguous command: "i"
For many editing functions, the IOS CLI editor provides hot keys. The following
table lists some editing shortcuts that are available.
3 ROUTER CONFIGURATION
3.1 Entering Configurations
Perhaps the best way to illustrate IOS CLI navigation is by walking through a simple
router configuration. The comments in the example do not attempt to explain the
meaning of each individual command, but rather intend to display where
configuration commands are entered within the IOS command structure. Pay
particular attention to how the command prompt changes as the user navigates
through the IOS CLI hierarchy. Also notice that global parameters are configured at
the global configuration level (indicated by the "Router(config)#" prompt) whereas
interface specific commands are entered after switching to the particular interface
(indicated by the "Router(config-if)#" prompt). Global parameters and interface
parameters are discussed further in the Displaying Configurations section
under Router Management.
In the above example, notice how the exit command is used to back up a level
within the IOS hierarchy. For example, if in the interface configuration level (i.e.
Router (config-if)# prompt), typing exit will put the user back in the global
configuration level (i.e. Router (config)# prompt).
Note: Prior to 11.x software, the command to save the running-configuration to the
startup-configuration was different. Use the following command if your IOS version
is prior to 11.x:
Router#write memory
4 ROUTER MANAGEMENT
IOS supports many different types of show commands. This section covers a few of
the common show commands used to both manage and troubleshoot a router. The
scope of this document is not to instruct how to use these commands to
troubleshoot a router, but to make the user aware that these management options
exist. For specific information about troubleshooting a network using these
commands, refer to the appropriate troubleshooting document.
Router#show running-config
Router#show startup-config
The following is the show running-config output from the example used in
the Router Configuration section.
Current configuration:
!
version 11.2
!
hostname cisco
!
enable password cisco
!
interface Ethernet0
ip address 10.1.1.1 255.0.0.0
!
interface Serial0
ip address 20.2.2.2 255.0.0.0
!
router rip
network 10.0.0.0
network 20.0.0.0
!
ip route 0.0.0.0 0.0.0.0 20.2.2.3
!
line vty 0 4
password telnet
login
!
end
Note: If an interface was in a shutdown state, the word 'shutdown' would appear
indented under the particular interface in shutdown state. Also, commands that are
enabled by default are not displayed in the configuration listing.
3 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up