Get to Know the CLI
Most connectivity devices can be configured using either a graphical user interface or a command line interface. A command line interface (CLI) can give the network administrator more detailed control and flexibility than a graphical user interface.
Manage Execution Modes
For security reasons, the Cisco IOS separates access to management functions into two command modes:
User EXEC mode: This mode provides limited functionality, but is still useful for basic operations. It allows only a limited number of basic monitoring commands, but doesn’t allow any command that would change the device configuration. User execution mode can be recognized from the CLI prompt ending with the > symbol.
Privileged EXEC mode: This mode allows the operator to execute configuration commands. To access higher configuration modes such as global configuration mode, you need to use privileged EXEC mode, which is the main mode that a network administrator would use. Privileged EXEC mode can be recognized from the CLI prompt ending with the # symbol.
The following table summarizes the two modes and displays the default command line interface prompts for Cisco switches and routers.
Execution Mode | Description | Default device prompt |
User EXEC mode |
| Switch> Router> |
Privileged EXEC mode |
| Switch# Router# |
To configure the device, the operator must use global configuration mode. This mode can be recognized from a command prompt that ends with(config)#
after the name of the device. For example: Switch(config)#
.
From global configuration mode, you can access two commonly used configuration sub-modes:
Line configuration mode: Used to configure access by console, SSH, Telnet or AUX. The default prompt for line configuration mode is
Switch(config-line)#
.Interface configuration mode: Used to configure the network interface of a port (or a number of ports) on a switch or router. The default prompt for interface configuration mode is
Switch(config-if)#
.
We’ll use different commands to enter and exit these different configuration modes:
To go from user mode to privileged mode, you’ll need to use the
enable
command.To go back from privileged mode to user mode, you’ll use the
disable
command.
To enter global configuration mode, use the privileged EXEC mode commandconfigure terminal
. To go back to privileged EXEC mode, use theexit
command.
There are a number of different configuration sub-modes available, but the most commonly used are:
Line configuration sub-mode, which can be accessed using the
line
command.Interface configuration sub-mode. Use
interface
to access it.
To exit a configuration sub-mode and return to the global configuration mode, use theexit
command.
Here are the different configuration modes we’ve previously seen when using the Cisco Packet Tracer CLI:
Switch> enable Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# line console 0 Switch(config-line)# exit Switch(config)# interface FastEthernet0/1 Switch(config-if)# exit Switch(config)# exit Switch# %SYS-5-CONFIG_I: Configured from console by console Switch#
To save time, try typing just the first characters of the command. Like this:
Switch> en Switch# conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# line c 0 Switch(config-line)# exit Switch(config)# int F0/1 Switch(config-if)# exit Switch(config)# exit Switch# %SYS-5-CONFIG_I: Configured from console by console Switch#
Most of the commands that you’re going to use in the various configuration modes and sub-modes can only be executed within that particular mode or sub-mode. If you're not sure, type the?
character to get help.
Let's Recap!
In this chapter, you’ve seen:
an introduction to the CLI (command line interface) of a Cisco connectivity device.
an introduction to the different configuration modes and sub-modes within a Cisco switch.
Now that you’ve been introduced to the CLI, you’ll be able to configure the basic parameters in a layer 2 switch.