IOS User Modes
IOS has two primary modes of operation: user mode and privileged mode. When you first connect to the router, you are placed in 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 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 Windows 2000 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 "Command-Line Completion" later in this chapter for a shortcut). This command can be entered only when you are in privileged mode.
Router#configure terminal Enter configuration commands, one per line. End with Ctrl-Z Router(config)# Configuration mode
To exit configuration mode, you can use the command exit or type Ctrl-z. To exit 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 the end 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 the configuration prompt, use the command interface followed by an interface name, such as ethernet0, serial0, or serial1. Interface commands are discussed in Chapter 5. Use the exit command to exit 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 typesuch as vty, console, tty, or asyncand a line number. The line configuration commands are discussed in Chapter 4. Once again, use the exit 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 router command, followed by a routing protocol, such as rip or igrp. These commands differ widely depending on the routing protocol being used. Routing configuration commands are discussed in Chapters 8 through 10. Use the exit command to exit this mode and return to the configuration prompt.
Figure 1-1 is a flowchart 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.
Figure 1-1. Transitions between IOS command 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.