Catalyst 4500 Series Software Configuration Guide, 7.5
Using the Command-Line Interface

Table Of Contents

Using the Command-Line Interface

Overview of the Switch CLI

Accessing the Switch CLI

Accessing the CLI Through the Console Port

Accessing the CLI Through Telnet

Switch CLI Command Modes

Accessing Help

Command-Line Editing

History Substitution

Abbreviating a Command

Completing a Partial Command

Scrolling Through Command Output

Using Command Aliases

Specifying Modules, Ports, and VLANs

Specifying MAC Addresses

Specifying IP Addresses, Host Names, and IP Aliases

ROM Monitor CLI

Example of a Catalyst 4003 Bootup Display


Using the Command-Line Interface


This chapter describes the command-line interface (CLI) that you use to configure the Catalyst enterprise LAN switches and modules.


Note For descriptions of all switch and ROM monitor commands, refer to the Command Reference—Catalyst 4000 Family, Catalyst 2948G, and Catalyst 2980G Switches. For descriptions of the commands used to configure the Route Switch Module (RSM) and Route Switch Feature Card (RSFC), refer to the Cisco IOS software command reference publications.


This chapter consists of these major sections:

Overview of the Switch CLI

Accessing the Switch CLI

Switch CLI Command Modes

Accessing Help

Command-Line Editing

History Substitution

Abbreviating a Command

Completing a Partial Command

Scrolling Through Command Output

Using Command Aliases

Specifying Modules, Ports, and VLANs

Specifying MAC Addresses

Specifying IP Addresses, Host Names, and IP Aliases

ROM Monitor CLI

Example of a Catalyst 4003 Bootup Display

Overview of the Switch CLI

The switch CLI is a basic command-line interpreter, similar to the UNIX C shell. However, switch commands are not case sensitive. You can abbreviate commands and parameters as long as they contain enough letters to be distinguished from any other currently available commands or parameters.

The Catalyst enterprise LAN switches are multi-module systems. Commands you enter from the CLI might apply to the entire system or to a specific module, port, or VLAN.

You configure the switch using set and clear commands. Enter set commands to change switch parameters. Use clear commands (or, in some cases, set commands) to overwrite or erase configuration parameters. Use show commands to display the current configuration and to monitor the switch.

Accessing the Switch CLI

You can access the CLI through the supervisor engine console port or through a Telnet session.

These sections describe how to access the switch CLI:

Accessing the CLI Through the Console Port

Accessing the CLI Through Telnet

Accessing the CLI Through the Console Port


Note For complete information on how to connect a terminal to the supervisor engine console port, refer to the hardware documentation for your switch.


To access the switch CLI through the console port, you first must connect a console terminal to the console port through an EIA/TIA-232 (RS-232) cable. Make sure that the terminal is connected to the switch and that the terminal is on.

To access the switch CLI through the console port, follow these steps:


Step 1 Connect to the supervisor engine console port using the appropriate application or commands on the terminal (for example, using a terminal emulation program on a PC or using the tip command on a UNIX system).

Step 2 If the switch is not on, power up the switch. The bootup display should appear on the screen (see the "Example of a Catalyst 4003 Bootup Display" section). If the switch is already booted, press Enter to see this display:

Cisco Systems, Inc. Console

Enter password:


After you successfully connect to the switch through the console port, you can use normal-mode commands to monitor the switch or enter privileged mode to change the configuration. For more information, see the "Switch CLI Command Modes" section.

Accessing the CLI Through Telnet

Before you can open a Telnet session to the switch, you must first set the IP address (and in some cases the default gateway) for the switch. For information about setting the IP address and default gateway, see "Configuring the Switch IP Address and Default Gateway."


Note For more information about using Telnet, see the "Using Telnet" section.


To access the switch CLI from a remote host using Telnet, follow these steps:


Step 1 Make sure that the switch is on and is properly configured with an IP address and default gateway, if necessary.

Step 2 Using the appropriate application or command on your host system, Telnet to the switch using the IP address or the DNS host name of the switch. (You must configure DNS properly on the switch and on your network name server in order to use DNS host names. For more information on DNS, see "Configuring DNS.")

This example shows how to telnet to a switch with the DNS host name Catalyst_1.

unix_host% telnet Catalyst_1
Trying 172.16.10.10...
Connected to Catalyst_1.
Escape character is '^]'.

Cisco Systems Console

Enter password:


After you successfully connect to the switch using Telnet, you can use normal-mode commands to monitor the switch, or enter privileged mode to change the configuration. For more information, see the following section.

Switch CLI Command Modes

The switch CLI supports two modes of operation:

Normal (also called login or user mode)

Privileged (also called enable mode)

Both modes are password protected. Use normal-mode commands for system monitoring. Use privileged-mode commands to change the system configuration.


Note For complete information on configuring passwords and controlling access to the switch, see "Configuring Switch Access Using AAA."


To enter normal command mode, follow these steps:


Step 1 Connect to the switch CLI through the console port or using Telnet (for more information, see the "Accessing the Switch CLI" section).

Step 2 On a new switch, the normal-mode password is null. If you are connecting to a new switch, press Return at the Enter Password prompt. Otherwise, enter the normal-mode password for the switch.

You will see the user-level command-line prompt.

Enter Password: <normal_mode_password>
Console>

Step 3 To disconnect from the switch CLI, enter the exit command.

Console> exit
Session Disconnected...

Cisco Systems Console           Fri Aug 27 1999, 16:14:41 

Enter password:


Many commands (for example, commands that modify the configuration) can be used only in privileged mode. To enter and exit privileged command mode, follow these steps:


Step 1 From normal mode, enter the enable command. On a new switch, the privileged-mode password is null. If you are connecting to a new switch, press Return at the Enter Password prompt. Otherwise, enter the privileged-mode password for the switch.

Console> enable
Enter password: <privileged_mode_password>
Console> (enable)

Step 2 To exit privileged mode and return to normal mode, enter the disable command.

Console> (enable) disable
Console> 


Accessing Help

Enter help or ? in normal or privileged mode to see the commands available in those modes. Command usage, the help menu, and, when appropriate, parameter ranges are provided if you enter a command using the wrong number of arguments or inappropriate arguments.

Additionally, appending ? to a command displays a list of valid keywords and arguments for the command. Insert a space between the last parameter and the question mark (?). For example, eight parameters are used by the set mls command. To see these parameters, enter set ip ? at the privileged mode prompt. The system displays all valid keywords and arguments as follows:

Console> (enable) set ip ?
  alias                      Set alias for IP Address
  dns                        Set DNS information
  fragmentation              Set IP fragmentation enable/disable
  http                       Set IP HTTP server information
  permit                     Set IP Permit List
  redirect                   Set ICMP redirect enable/disable
  route                      Set IP routing table entry
  unreachable                Set ICMP unreachable messages
Console> (enable) set ip 

Note The system repeats the command you entered without the question mark (?).


To use the partial-keyword-lookup function, enter ? to display a list of commands that begin with a specific set of characters. Do not insert a space between the last letter of the variable and the question mark (?). For example, enter co? at the privileged prompt to display a list of commands that start with co. The system displays all commands that begin with co, as follows:

Console> (enable) co? 
  configure                  Configure system from network
  copy                       Copy files between TFTP/RCP/module/flash devices
Console> (enable) co

Note The system repeats the command you entered without the question mark (?).


Command-Line Editing

The switch CLI supports a number of command-line editing keystrokes. Table 2-1 lists the keystrokes you can use when entering and editing switch commands.

Table 2-1 Command-Line Editing Keystrokes  

Keystroke
Function

Ctrl-A

Jumps to the first character of the command line.

Ctrl-B or the Left Arrow key1

Moves the cursor back one character.

Ctrl-C

Escapes and terminates prompts and lengthy tasks.

Ctrl-D

Deletes the character at the cursor.

Ctrl-E

Jumps to the end of the current command line.

Ctrl-F or the Right Arrow key1

Moves the cursor forward one character.

Ctrl-K

Deletes from the cursor to the end of the command line.

Ctrl-L; Ctrl-R

Repeats current command line on a new line.

Ctrl-N or the Down Arrow key1

Enters next command line from the history buffer.

Ctrl-P or the Up Arrow key1

Enters previous command line from the history buffer.

Ctrl-U; Ctrl-X

Deletes from the cursor to the beginning of the command line.

Ctrl-W

Deletes last word typed.

Esc B

Moves the cursor backward one word.

Esc D

Deletes from the cursor to the end of the word.

Esc F

Moves the cursor forward one word.

Delete key or Backspace key

Erases characters on the command line.

1 The arrow keys function only on ANSI-compatible terminals, such as VT100s.


History Substitution

The history buffer stores the last 20 commands you entered during a terminal session. History substitution allows you to repeat these commands using special abbreviated commands, similar to those used on the UNIX command line. Table 2-2 lists the history substitution commands.

Table 2-2 History Substitution Commands 

Command
Function
To repeat recent commands:

!!

Repeats the most recent command.

!-nn

Repeats the nnth most recent command.

!n

Repeats command n.

!aaa

Repeats the command beginning with string aaa.

!?aaa

Repeats the command containing the string aaa.

To modify and repeat the most recent command:

^aaa^bbb

Replaces the string aaa with the string bbb in the most recent command.

To add a string to the end of a previous command and repeat it:

!!aaa

Adds string aaa to the end of the most recent command.

!n aaa

Adds string aaa to the end of command n.

!aaa bbb

Adds string bbb to the end of the command beginning with string aaa.

!?aaa bbb

Adds string bbb to the end of the command containing the string aaa.


Abbreviating a Command

When typing a command, you can abbreviate any command or keyword to the number of characters that uniquely define the command. For example, you can abbreviate the show command to sh. After entering the command at the system prompt, press Return to execute the command.

Completing a Partial Command

The Tab key allows you to use the command-completion feature. When you enter a unique partial character string and press Tab, the system completes the command or keyword on the command line. For example, if you enter co and press the Tab key, the system completes the command as configure because it is the only command that matches the criteria.

Scrolling Through Command Output

When the output of a command fills more than one terminal screen, the output is displayed through the More program; a ---More--- prompt is displayed at the bottom of the screen. The More program is used for any output that has more lines than can be displayed on the terminal screen, including show command output. To view the next line or screen, use the following tasks.

Task
Keystrokes

To scroll down one line

Press the Return key

To scroll down one screen

Press the Spacebar

To quit from the More program

Press the Q key


Using Command Aliases

Aliases are not case sensitive; also, some aliases cannot be abbreviated. Table 2-3 lists the switch CLI aliases that cannot be abbreviated.

Table 2-3 Command Aliases That Cannot Be Abbreviated

Alias
Command

?

help

batch

configure

di

show

exit

quit

logout

quit


Specifying Modules, Ports, and VLANs

The Catalyst 4000 family switches sequentially number modules, ports, and VLANs, beginning with 1. The supervisor engine module is module 1, residing in slot 1.

To designate a specific module, use the module number. In most systems, the module number and the slot number are the same.

On the fixed-configuration switches, there are two logical modules. On the Catalyst 4912G, the Catalyst 2948G, and the Catalyst 2980G switches, there are two modules but only one slot. When you enter configuration commands on these switches, you must refer to the module number, not the slot number. For example, all of the user-configurable ports on these switches are logically on module 2.

On modules that have user-configurable ports, the left-most port is always port 1. To designate a specific port on a specific module, the command syntax is mod_num/port_num. For example, 3/1 specifies module 3, port 1. On the Catalyst 4912G, the Catalyst 2948G, and the Catalyst 2980G switches, the left-most switch port is numbered 2/1 instead of  1/1 because logically the ports are located on module 2.

With many commands, you can enter lists of ports. To specify a range of ports, use a comma-separated list (do not insert spaces) to specify individual ports, or a hyphen (-) between the port numbers to specify a range of ports.

Table 2-4 shows examples of how to designate ports and port ranges.

Table 2-4 Designating Ports and Port Ranges

Example
Function

2/1

Specifies port 1 on module 2

3/4-8

Specifies ports 4, 5, 6, 7, and 8 on module 3

5/2,5/4,6/10

Specifies ports 2 and 4 on module 5 and port 10 on module 6

3/1-2,4/8

Specifies ports 1 and 2 on module 3 and port 8 on module 4


VLANs are identified using the VLAN ID, a single number associated with the VLAN. To specify a list of VLANs, use a comma-separated list (do not insert spaces) to specify individual VLANs or a hyphen (-) between the VLAN numbers to specify a range of VLANs.

Table 2-5 shows examples of how to designate VLANs and VLAN ranges.

Table 2-5 Designating VLANs and VLAN Ranges

Example
Function

10

Specifies VLAN 10

5,10,15

Specifies VLANs 5, 10, and 15

10-50,500

Specifies VLANs 10 through 50, inclusive, and VLAN 500


Specifying MAC Addresses

Some commands require you to specify a MAC address, which must be designated in a standard format. The MAC address format must be six hexadecimal numbers separated by hyphens, as shown in this example:

00-00-0c-24-d2-fe

Specifying IP Addresses, Host Names, and IP Aliases

Some commands require an IP address, IP host name, or IP alias. The IP address format is 32 bits, written in dotted decimal format, as shown in the following example:

172.16.10.1

If DNS is configured properly on the switch, you can use IP host names instead of IP addresses. For information on configuring DNS, see "Configuring DNS."

You can also configure IP aliases on the switch, which you can use in place of IP addresses. IP aliases can be used for most commands that use an IP address, except for commands that define the IP address or IP alias. For information on using IP aliases, see the "Defining and Using IP Aliases" section.

ROM Monitor CLI

The ROM monitor is a ROM-based program that executes when the switch is powered on, reset, or when a fatal exception occurs. The system enters ROM monitor mode if the nonvolatile RAM (NVRAM) configuration is corrupted, if the switch does not find a valid system image, or if the configuration register is set to enter ROM monitor mode. From the ROM monitor mode, you can load a system image manually from Flash memory or the network interface (me1).

You can enter ROM monitor mode by pressing Ctrl-C within the first five seconds of startup. Once you are in ROM monitor mode, the prompt changes to rommon>. Enter the ? command to see the available ROM monitor commands.


Note For complete descriptions of all ROM monitor commands, refer to the Command Reference—Catalyst 4000 Family, Catalyst 2948G, and Catalyst 2980G Switches.


Example of a Catalyst 4003 Bootup Display

This example shows the bootup display of a Catalyst 4003 switch. The display on the Catalyst 4912G, the Catalyst 2948G, and the Catalyst 2980G switches will be similar.

WS-X4012 bootrom version 4.5(1), built on 1999.03.29 21:04:04
H/W Revisions:    Meteor: 4    Comet: 8    Board: 2
Supervisor MAC addresses: 00:d0:58:70:a1:00 through 00:d0:58:70:a4:ff (1024 addresses)
Installed memory: 32 MB
Testing LEDs.... done!
The system will autoboot in 5 seconds.
Type control-C to prevent autobooting.
rommon 1 > 
The system will now begin autobooting.
Autobooting image: "bootflash:cat4000.5-1-1a.bin"
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCC############################
Starting Off-line Diagnostics
Mapping in TempFs
Board type is WS-X4012
DiagBootMode value is "post"
Loading diagnostics...

Power-on-self-test for Module 1:  WS-X4012
Status: (. = Pass, F = Fail)
processor: .           cpu sdram: .           temperature sensor: .  
enet console port: .   nvram: .               switch sram: .         
switch registers: .    switch port 0: .       switch port 1: .       
switch port 2: .       switch port 3: .       switch port 4: .       
switch port 5: .       switch port 6: .       switch port 7: .       
switch port 8: .       switch port 9: .       switch port 10: .      
switch port 11: .      switch bandwidth: .    

Module 1 Passed

Power-on-self-test for Module 2:  WS-X4148
Port status: (. = Pass, F = Fail)
 1: .   2: .   3: .   4: .   5: .   6: .   7: .   8: .  
 9: .  10: .  11: .  12: .  13: .  14: .  15: .  16: .  
17: .  18: .  19: .  20: .  21: .  22: .  23: .  24: .  
25: .  26: .  27: .  28: .  29: .  30: .  31: .  32: .  
33: .  34: .  35: .  36: .  37: .  38: .  39: .  40: .  
41: .  42: .  43: .  44: .  45: .  46: .  47: .  48: .  

Module 2 Passed

Power-on-self-test for Module 3:  WS-X4306
Port status: (. = Pass, F = Fail, ? = no GBIC)
 1: .   2: .   3: .   4: ?   5: ?   6: ?  

Module 3 Passed

Exiting Off-line Diagnostics

IP address for Catalyst not configured
BOOTP/DHCP will commence after the ports are online
Ports are coming online ...


Cisco Systems, Inc. Console


Enter password: 
1999 Aug 12 14:34:05 %SYS-5-MOD_OK:Module 1 is online
1999 Aug 12 14:34:08 %SYS-5-MOD_OK:Module 3 is online
1999 Aug 12 14:34:11 %SYS-5-MOD_OK:Module 2 is online
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
Sending RARP request with address 00:d0:58:70:a4:ff
Sending BOOTP request with address: 00:d0:58:70:a4:ff
No bootp or rarp response received

Note The system initiates DHCP/BOOTP and Reverse Address Resolution Protocol (RARP) requests at startup only when the sc0 interface IP address is set to 0.0.0.0. For more information, see the "Using DHCP or RARP to Obtain an IP Address Configuration" section.