There are two primary modes of operation within the IOS: user mode and privileged mode. When you first connect to the router, you are placed in the user mode. The Cisco documentation refers to this as the user exec mode; I am going to omit “exec” throughout this book. The user mode is indicated by the prompt:
Router>
The show
commands in user mode are limited to a
few basic levels. You cannot edit or view configurations at this
stage; you can only view the router status and other miscellaneous
information. To obtain a basic listing of commands, type a
question mark:
Router>?
Editing the router’s
configuration
requires you to be in the privileged exec mode,
which I simply call “privileged mode.” Use the
enable
command to enter this mode:
Router>enable
Password:
Router# Privileged mode prompt
You can always tell whether you are in user mode or privileged mode
by looking at the
prompt. The user mode prompt has a
>
at the end; the privileged mode prompt always
has a #
at the end, regardless of the submode.
If you are familiar with Unix, you can equate privileged mode to
“root” access. You could also equate it to the
administrator level in NT or the supervisor in NetWare. In this mode,
you have permission to access everything inside the router, including
configuration commands. However, you can’t type configuration
commands directly. Before you can change the router’s actual
configuration, you must enter a submode of the
privileged mode by giving the
command configure terminal
(see Section 1.3 for a shortcut). This command can be
entered only when you are in the privileged mode.
Router#configure terminal
Enter configuration commands, one per line. End with Ctrl-Z
Router(config)# Configuration mode
To exit from configuration mode, you can
use the command exit
or type Ctrl-Z. To exit from
enable (privileged) mode, you can use the disable
command. So to exit both configuration and enable mode, use the
following sequence of commands:
Router(config)#exit
Router#disable
Router>
Privileged mode has several submodes in
addition to configuration mode; each has its own prompt. To enter
these submodes, you must first enter configuration mode by giving the
configure terminal
command. Here’s a summary
of the most common modes and
prompts (there are many others):
- Global configuration mode
Prompt:
Router(config)#
This level allows you to enter commands directly into the router configuration. From this level, you can enter any of the other three levels listed here. Once you are done entering commands into the configuration, use Ctrl-Z,
exit
, or theend
command to return to the privileged prompt. The device’s hostname is a good example of a configuration item you would find in the global configuration mode.- Interface configuration mode
Prompt:
Router(config-if)#
At this level, you are entering interface-specific commands. To enter this mode from theconfiguration prompt, use the command
interface
followed by an interface name, such asethernet0
,serial0
, orserial1
. Interface commands are discussed in Chapter 5. Use theexit
command to exit from this prompt and return to the configuration prompt.- Line configuration mode
Prompt:
Router(config-line)#
From this prompt, you can enter line-specific commands. To enter this mode from the configuration prompt, use the command
line
, followed by a line type—such asvty
,console
,tty
, orasync
—and a line number. The line configuration commands are discussed in Chapter 4. Once again, use theexit
command to exit this mode and return to the configuration prompt.- Router configuration mode
Prompt:
Router(config-router)#
From this prompt, you can enter only routing commands. To enter this mode from the configuration prompt, use the command
router
, followed by a routing protocol, such asrip
origrp
. These commands differ widely depending on the routing protocol being used. Routing configuration commands are discussed in Chapter 8 through Chapter 10. Use theexit
command to exit this mode and return to the configuration prompt.
Figure 1-1 is a flow chart that illustrates the transitions between the most common command modes and submodes. (This list is not comprehensive.) The arrows are labeled with the commands that cause the transitions between the modes.
Configuration submodes provide a context in which certain commands are legal and others disallowed. It’s one way that IOS tries to prevent you from making mistakes when configuring a router. In the quick-reference section, I list each command with the context (or mode) in which it can be given. Contexts are clearly important on the command line, where the prompt shows the submode you’re in. They are equally important in configuration files, where there are no such hints; you just have to know.
Get CISCO IOS in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.