Catalyst 2940 Switch Command Reference, Release 12.1(13)AY
Using the Command-Line Interface
Downloads: This chapterpdf (PDF - 194.0KB) The complete bookPDF (PDF - 3.64MB) | Feedback

Using the Command-Line Interface

Table Of Contents

Using the Command-Line Interface

Type of Memory

Platforms

CLI Command Modes

User EXEC Mode

Privileged EXEC Mode

Global Configuration Mode

Interface Configuration Mode

config-vlan Mode

VLAN Configuration Mode

Line Configuration Mode


Using the Command-Line Interface


The Catalyst 2940 switch is supported by Cisco IOS software. This chapter describes how to use the switch command-line interface (CLI) to configure the software features.

For a complete description of the commands that support these features, see "Cisco IOS Commands." For more information on IOS Release 12.1, refer to the IOS Release 12.1 Command Summary.

For configuration steps that are task oriented, refer to the Catalyst 2940 Switch Software Configuration Guide for this release.

The switches are preconfigured and begin forwarding packets as soon as they are attached to compatible devices.

By default, all ports belong to virtual LAN (VLAN) 1. Access to the switch itself is also through VLAN 1, which is the default management VLAN. The management VLAN is configurable. You manage the switch by using Telnet, web-based management, and Simple Network Management Protocol (SNMP) through devices connected to ports assigned to the management VLAN.

Type of Memory

The switch Flash memory stores the IOS software image, the startup and private configuration files, and helper files.

Platforms

This IOS release runs on a variety of switches. For a complete list, refer to the Release Notes for the Catalyst 2940 Switch.

CLI Command Modes

This section describes the CLI command mode structure. Command modes support specific Cisco IOS commands. For example, the interface type_number command works only when entered in global configuration mode. These are the main command modes:

User EXEC

Privileged EXEC

Global configuration

Interface configuration

Config-vlan

VLAN configuration

Line configuration

Table 1-1 lists the command modes, how to access each mode, the prompt you see in that mode, and how to exit that mode. The prompts listed assume the default name Switch.

Table 1-1 Command Modes Summary 

Command Mode
Access Method
Prompt
Exit or Access Next Mode

User EXEC

This is the first level of access.

(For the switch) Change terminal settings, perform basic tasks, and list system information.

Switch>

Enter the logout command.

To enter privileged EXEC mode, enter the enable command.

Privileged EXEC

From user EXEC mode, enter the enable command.

Switch#

To exit to user EXEC mode, enter the disable command.

To enter global configuration mode, enter the configure command.

Global configuration

From privileged EXEC mode, enter the configure command.

Switch(config)#

To exit to privileged EXEC mode, enter the exit or end command, or press Ctrl-Z.

To enter interface configuration mode, enter the interface command.

Interface configuration

From global configuration mode, specify an interface by entering the interface command.

Switch(config-if)#

To exit to privileged EXEC mode, enter the end command, or press Ctrl-Z.

To exit to global configuration mode, enter the exit command.

To enter subinterface configuration mode, specify a subinterface with the interface command.

Config-vlan

In global configuration mode, enter the vlan vlan-id command.

Switch(config-vlan)#

To exit to global configuration mode, enter the exit command.

To return to privileged EXEC mode, enter the end command, or press Ctrl-Z.

VLAN configuration

From privileged EXEC mode, enter the vlan database command.

Switch(vlan)#

To exit to privileged EXEC mode, enter the exit command.

Line configuration

From global configuration mode, specify a line by entering the line command.

Switch(config-line)#

To exit to global configuration mode, enter the exit command.

To return to privileged EXEC mode, enter the end command, or press Ctrl-Z.


User EXEC Mode

After you access the device, you are automatically in user EXEC command mode. The EXEC commands available at the user level are a subset of those available at the privileged level. In general, use the user EXEC commands to change terminal settings temporarily, to perform basic tests, and to list system information.

The supported commands can vary depending on the version of IOS software in use. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch> ? 

Privileged EXEC Mode

Because many of the privileged commands configure operating parameters, privileged access should be password-protected to prevent unauthorized use. The privileged command set includes those commands contained in user EXEC mode, as well as the configure command through which you access the remaining command modes.

If your system administrator has set a password, you are prompted to enter it before being granted access to privileged EXEC mode. The password does not appear on the screen and is case sensitive.

The privileged EXEC mode prompt is the device name followed by the pound sign (#).

Switch#  

Enter the enable command to access privileged EXEC mode:

Switch> enable 
Switch# 

The supported commands can vary depending on the version of IOS software in use. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch# ? 

To return to user EXEC mode, enter the disable command.

Global Configuration Mode

Global configuration commands apply to features that affect the device as a whole. Use the configure privileged EXEC command to enter global configuration mode. The default is to enter commands from the management console.

When you enter the configure command, a message prompts you for the source of the configuration commands:

Switch# configure 
Configuring from terminal, memory, or network [terminal]?

You can specify either the terminal or nonvolatile RAM (NVRAM) as the source of configuration commands.

This example shows you how to access global configuration mode:

Switch# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z. 

The supported commands can vary depending on the version of IOS software in use. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch(config)# ? 

To exit global configuration command mode and to return to privileged EXEC mode, enter the end or exit command, or press Ctrl-Z.

Interface Configuration Mode

Interface configuration commands modify the operation of the interface. Interface configuration commands always follow a global configuration command, which defines the interface type.

Use the interface type_number.subif command to access interface configuration mode. The new prompt shows interface configuration mode.

Switch(config-if)#

The supported commands can vary depending on the version of IOS software in use. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch(config-if)# ? 

To exit interface configuration mode and to return to global configuration mode, enter the exit command. To exit interface configuration mode and to return to privileged EXEC mode, enter the end command, or press Ctrl-Z.

config-vlan Mode

Use this mode to configure normal-range VLANs (VLAN IDs 1 to 1005). When VTP mode is transparent, the VLAN and VTP configuration is saved in the running configuration file, and you can save it to the switch startup configuration file by using the copy running-config startup-config privileged EXEC command. The configurations of VLAN IDs 1 to 1005 are saved in the VLAN database if VTP is in transparent or server mode.

Enter the vlan vlan-id global configuration command to access config-vlan mode:

Switch(config)# vlan 1000
Switch(config-vlan)# 

The supported keywords can vary but are similar to the commands available in VLAN configuration mode. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch(config-vlan)# ? 

To return to global configuration mode, enter exit; to return to privileged EXEC mode, enter end. All commands except shutdown take effect when you exit config-vlan mode.

VLAN Configuration Mode

You can use the VLAN configuration commands to create or modify VLAN parameters for VLANs 1 to 1005. Enter the vlan database privileged EXEC command to access VLAN configuration mode:

Switch# vlan database
Switch(vlan)# 

The supported commands can vary depending on the version of IOS software in use. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch(vlan)# ? 

To return to privileged EXEC mode, enter the abort command to abandon the proposed database. Otherwise, enter exit to implement the proposed new VLAN database and to return to privileged EXEC mode.

Line Configuration Mode

Line configuration commands modify the operation of a terminal line. Line configuration commands always follow a line command, which defines a line number. Use these commands to change terminal parameter settings line-by-line or for a range of lines.

Use the line vty line_number [ending_line_number] command to enter line configuration mode. The new prompt indicates line configuration mode.

This example shows how to enter line configuration mode for virtual terminal line 7:

Switch(config)# line vty 0 7 

The supported commands can vary depending on the version of IOS software in use. To view a comprehensive list of commands, enter a question mark (?) at the prompt.

Switch(config-line)# ? 

To exit line configuration mode and to return to global configuration mode, use the exit command.
To exit line configuration mode and to return to privileged EXEC mode, enter the end command, or press Ctrl-Z.