Review of Cisco IOS for Routers and Switches
Cisco IOS CLI Functions
Cisco IOS Software uses a CLI as its traditional console environment to enter commands. This section reviews the functions of the Cisco IOS CLI.
Although Cisco IOS Software is a core technology that extends across many products, its operation details vary depending on the internetworking devices that are involved. To enter commands into the CLI, type or paste the entries within one of the several console configuration modes. In terminal configuration mode, each configuration command entered is parsed as soon as you press the Enter key.
If the syntax has no errors, the command is executed and stored in the running configuration, and it is effective immediately, but the command is not automatically saved to NVRAM.
Cisco IOS Software uses a hierarchy of commands in its configuration-mode structure. Each configuration mode is indicated with a distinctive prompt and supports specific Cisco IOS commands related to a type of operation on the device. As a security feature, Cisco IOS Software separates the EXEC sessions into the following two access levels:
- User EXEC: Allows access to only a limited number of basic monitoring commands.
- Privileged EXEC: Allows access to all device commands, such as those used for configuration and management, and can be password-protected to allow only authorized users to access the device.
Configuration Modes of Cisco IOS Software
Depending on the feature being used, there are different configuration modes when working with Cisco IOS Software. Figure 1-1 shows the various Cisco IOS configuration modes employed in this text.
The first method of configuration on a Cisco device is the setup utility, which lets you create a basic initial configuration. For more complex and specific configurations, you can use the CLI to enter terminal configuration mode.
Figure 1-1 Cisco IOS Configuration Modes
From privileged EXEC mode, you can enter global configuration mode using the configure terminal command. From global configuration mode, you can access specific configuration modes, which include, but are not limited to, the following:
- Interface: Supports commands that configure operations on a per-interface basis
- Subinterface: Supports commands that configure multiple virtual interfaces on a single physical interface
- Controller: Supports commands that configure controllers (for example, E1 and T1 controllers)
- Line: Supports commands that configure the operation of a terminal line (for example, the console or the vty ports)
- Router: Supports commands that configure an IP routing protocol
If you enter the exit command, the router backs out one level, eventually logging out. In general, you enter the exit command from one of the specific configuration modes to return to global configuration mode. Press Ctrl-Z or enter end to leave configuration mode completely and return to the privileged EXEC mode.
Commands that affect the entire device are called global commands. The hostname and enable password commands are examples of global commands.
Commands that point to or indicate a process or interface that will be configured are called major commands. When entered, major commands cause the CLI to enter a specific configuration mode. Major commands have no effect unless you immediately enter a subcommand that supplies the configuration entry. For example, the major command interface serial 0 has no effect unless you follow it with a subcommand that tells what is to be done to that interface.
Table 1-1 provides examples of some major commands and subcommands that go with them.
Table 1-1 Major Commands and Subcommands
Notice that entering a major command switches from one configuration mode to another.
NOTE You do not need to return to global configuration mode before entering another configuration mode.
Help Facilities of the Cisco IOS CLI
Cisco IOS Software uses several command-line input help facilities, including context-sensitive help. The following list provides details about the different help facilities of the Cisco IOS CLI.
- Context-sensitive help: Provides a list of commands and the arguments associated with a specific command.
- Console error messages: Identifies problems with any Cisco IOS commands that are incorrectly entered so that you can alter or correct them.
- Command history buffer:Allows recall of long or complex commands or entries for reentry, review, or corrections.
Context-sensitive help eliminates the need for memorization of Cisco IOS commands. At any time during an EXEC session, you can enter a question mark (?) to get help. The following two types of context-sensitive help are available:
- Word help: Enter the ? command to get word help for a list of commands that begin with a particular character sequence. Enter the character sequence followed immediately by the question mark. Do not include a space before the question mark. The router displays a list of commands that begin with the characters you entered.
- Command syntax help: Enter the ? command to get command syntax help for completing a command. Enter a question mark in place of a keyword or argument. Include a space before the question mark. The network device then displays a list of available command options.
This section reviews basic router and switch CLI commands in Cisco IOS Software. Table 1-2 outlines the Cisco IOS CLI commands used on both Cisco routers and switches to create a basic configuration in a small network environment.
Table 1-2 Cisco IOS CLI Command Review