|
|
This chapter introduces the Cisco IOS command-line interface (CLI) and provides procedures for configuring those switch features that require you to use the CLI.
The Catalyst 2900 Series XL Command Reference is a complete description of commands that have been created or changed for the switch. The documentation set for Cisco IOS Release 11.2(8) describes all commands supported by the switches.
This chapter describes how to perform the following tasks:
This section describes the Cisco IOS command-mode structure. Each command mode supports specific Cisco IOS commands. For example, the interface type_number command is used only from global configuration mode.
The switch supports the following command modes:
Table 6-1 describes how to access each mode, the prompt you see in that mode, and how to exit the mode. The examples in the table use the host name switch.
You can use the question mark (?) and arrow keys to help you enter commands.
For a list of available commands in a command mode, enter a question mark:
switch> ?
To complete a command, enter a few known characters followed by a tab (with no space):
switch# sh conf<tab>
switch#sh configuration
For a list of command variables, enter the command followed by a space and a question mark:
switch> show ?
To redisplay a command you previously entered, press the up-arrow key. You can continue to press the up-arrow key for more commands.
| Modes | Access Method | Prompt | Exit Method | About This Mode1 |
|---|---|---|---|---|
User EXEC | Begin a session with your switch. | switch> | Enter the logout command or quit. | Use this mode to
|
Privileged EXEC | Enter the enable command while in user EXEC mode. | switch# | Enter the disable command to exit. | Use this mode to verify commands you have entered. Access to this mode should be protected with a password. |
VLAN database (Enterprise Edition Software only) | Enter the vlan database command while in privileged EXEC mode. | switch(vlan)# | To exit to privileged EXEC mode, enter exit. | Use this mode to configure VLAN-specific parameters. |
Global configuration | Enter the configure command while in privileged EXEC mode. | switch(config)# | To exit to privileged EXEC mode, enter the exit or end command, or press Ctrl-Z. | Use this mode to configure parameters that apply to your switch as a whole. |
Interface configuration | Enter the interface command (with a specific interface) while in global configuration mode. | switch(config-if)# | To exit to global configuration mode, enter the exit command. Press Ctrl-Z or enter end to return to privileged EXEC mode. | Use this mode to configure parameters for the Ethernet interfaces. |
Line configuration | Specify a line with the line vty or line console command while in global configuration mode. | switch(config-line) # | To exit to global configuration mode, enter the exit command. Press Ctrl-Z or enter end to return to privileged EXEC mode. | Use this mode to configure parameters for the terminal line. |
| 1For any of the modes, you can see a comprehensive list of the available commands by entering a question mark (?) at the prompt. |
switch# show conf
The word no can be used to create a no form of a command. The no form of a command does the following:
Table 6-2 lists some error messages that you might encounter while using the CLI to configure your switch.
| Error Message | Meaning | How to Get Help |
|---|---|---|
% Ambiguous command: "show con" | You did not enter enough characters for your switch to recognize the command. | Reenter the command followed by a question mark (?) with a space between the command and the question mark. The possible keywords that you can enter with the command are displayed. |
% Incomplete command. | You did not enter all of the keywords or values required by this command. | Reenter the command followed by a question mark (?) with a space between the command and the question mark. The possible keywords that you can enter with the command are displayed. |
% Invalid input detected at `^' marker. | You entered the command incorrectly. The caret (^) marks the point of the error. | Enter a question mark (?) to display all of the commands that are available in this command mode. The possible keywords that you can enter with the command are displayed. |
Because many privileged EXEC commands are used to set operating parameters, you should password-protect these commands to prevent unauthorized use.
You use two commands to do this:
You must enter an enable password to gain access to privileged EXEC mode.
For maximum security, the passwords should be different. If you enter the same password for both during the setup process, your switch prompts you to make them different.
An enable secret password can contain from 1 to 25 uppercase and lowercase alphanumeric characters. An enable password can contain any number of uppercase and lowercase alphanumeric characters. In both cases, a number cannot be the first character. Spaces are also valid password characters; for example, two words is a valid password. Leading spaces are ignored; trailing spaces are recognized.
If you lose or forget your enable password, see the "Recovering from a Lost or Forgotten Password" section.
| Task | Prompt | Command |
|---|---|---|
Step 1 Enter privileged EXEC mode. | | enable |
Step 2 Enter global configuration mode. | | configure terminal |
Step 3 Enter interface configuration mode, and enter the interface to which the IP information is assigned. VLAN1 is the switch interface. | | interface vlan1 |
Step 4 Assign the IP address and subnet mask. | | ip address ip_address subnet_mask |
Step 5 Define the IP address of the default router. | | ip default-gateway ip_address |
Step 6 Return to privileged EXEC mode. | | end |
Step 7 Verify that the information was entered correctly by displaying the running configuration. If the information is incorrect, repeat the procedure. | | show running-config |
The following procedure describes one way to configure a password for Telnet.
| Task | Prompt | Command |
|---|---|---|
Step 1 Attach a PC or workstation with emulation software to the switch console port. The data characteristics of the console port are 9600, 8, 1, no parity. When the command line appears, go to Step 2. |
|
|
Step 2 Enter privileged EXEC mode. | | enable |
Step 3 Enter global configuration mode. | | configuration terminal |
Step 4 Enter the interface configuration mode for the Telnet interface. The 0 and 4 indicate that you are configuring all five possible Telnet sessions. | | line vty 0 4 |
Step 5 Enter a password. | | password password |
Step 6 Return to privileged EXEC mode so that you can verify the entry. | | end |
Step 7 Display the running configuration. The password is listed under the command line vty 0 4. | | show running-config |
Step 8 As an option, save the running configuration to the startup configuration. | | write mem |
You can use the file system in Flash memory to copy files and to troubleshoot configuration problems. Use the privileged EXEC dir flash: command to display the contents of Flash memory:
Switch# dir flash: Directory of flash: 2 -rwx 843947 Mar 01 1993 00:02:18 C2900XL-h-mz-112.8-SA 4 drwx 3776 Mar 01 1993 01:23:24 html 66 -rwx 130 Jan 01 1970 00:01:19 env_vars 68 -rwx 1296 Mar 01 1993 06:55:51 config.text 1728000 bytes total (456704 bytes free)
The file system uses a URL-based file specification. The following example uses the TFTP protocol to copy the file conffile.txt from the host arno to switch Flash memory with the name bootfile:
switch# copy tftp://arno//2900/conffile.txt flash:bootfile
You can enter the following parameters as part of a filename:
Use the copy running-config startup-config command to save your configuration changes to Flash memory so that they are not lost if there is a system reload or power outage. This example shows how to use this command to save your changes:
Switch# copy running-config startup-config Building configuration...
It might take a minute or two to save the configuration to Flash memory. After it has been saved, the following message appears:
[OK] switch#
After you have downloaded the new files to your PC or workstation, you can use the CLI to perform a TFTP transfer of the files to the switch.
The procedure that follows includes the commands to address the following issues:
Follow these steps to upgrade the switch software by using a TFTP transfer:
Step 1 If your PC or workstation cannot act as a TFTP server, copy the files to a TFTP server to which you have access.
Step 2 You can access the CLI by starting a Telnet session or by connecting to the console port via the RS-232 connector.
To start a Telnet session on your PC or workstation, enter the following command:
server% telnet switch_ip_address
Step 3 Enter privileged EXEC mode:
switch> enable
switch#
Step 4 Display the name of the current (default) image file. The following example shows the current name in italic:
switch# show boot
BOOT path-list: flash:current_image
Config file: flash:config.text
Enable Break: 1 Manual Boot: no
Step 5 If there is no file defined in the BOOT path-list, enter dir flash: to display the contents of Flash memory. The file named c2900XL-h-mz_current_version is your current image file.
Step 6 Rename the current image file to the name of the new image. This does not affect the operation of the switch.
switch# rename flash:current_image flash:new_image
Source filename [current_image]?
Destination filename [new_image]?
Step 7 Display the contents of Flash memory to verify the renaming of the file:
switch# dir flash:
Directory of flash:
-rwx 910426 Mar 06 1993 23:47:28 new_image -rwx 80971 Sep 14 1998 03:10:38 c2900XL-diag-mz-112.0.0.11-SA2
-rwx 4800 Mar 01 1993 00:04:14 html
-rwx 159 Jan 01 1970 00:00:34 env_vars
-rwx 1121 Mar 01 1993 18:46:01 config.text
Step 8 If you are upgrading models WS-C2908-XL, WS-C2924-XL, WS-C2924C-XL, or WS-2916M-XL, you need to delete the diagnostics file to make room for the new image.
The diagnostics file has a name in the following format: c2900XL-diag-mz-version_name. The string version_name depends on the switch and software you are running.
Display the diagnostics file:
switch# dir flash:c2900XL-diag-mz*
Directory of flash: -rwx 80971 Sep 14 1998 03:10:38 c2900XL-diag-mz-112.0.0.11-SA2
Delete the diagnostics file:
Switch# del flash:c2900XL-diag-mz-112.0.0.11-SA2 Delete filename [c2900XL-diag-mz-112.0.0.11-SA2]? Delete flash:c2900XL-diag-mz-112.0.0.11-SA2? [confirm] Switch#
Step 9 Enter terminal configuration mode:
switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Step 10 Disable access to the switch HTML pages:
switch(config)# no IP http server
Step 11 Change the name of the default image file:
switch(config)# boot system flash:new_image
Step 12 Return to privileged EXEC mode:
switch(config)# end
Step 13 Verify that the name of the default image file is correct:
switch# show boot
BOOT path-list: flash:new_image
Config file: flash:config.text
Enable Break: 1
Manual Boot: no
HELPER path-list:
NVRAM/Config file
buffer size: 32768
Step 14 Use the name of the new image file when you copy it from the TFTP server to the Flash memory:
switch# copy tftp://server_ip_address//path/new_image flash:new_image
Source IP address or hostname [server_ip_address]?
Source filename [path/filename]?
Destination filename [flash:new_image]?
Loading /path/filename.bin from server_ip_address (via!)
[OK - 843975 bytes]
Step 15 Remove the manager software HTML files:
switch# del flash:html/*.*
Press Enter to confirm the deletion of each file. Do not press any other keys during this process.
Step 16 If you are running Cisco IOS Release 11.2(8)SA3 or later, remove the files in the Snmp directory:
switch# del flash:html/Snmp/*.*
Press Enter to confirm the deletion of each file. Do not press any other keys during this process.
Step 17 If you are running Cisco IOS Release 11.2(8)SA2 or earlier, create a directory on the switch Flash memory to be used for the HTML files:
switch# mkdir flash:html/Snmp
Make sure the "S" in "Snmp" is uppercase.
Step 18 Enter the following command to copy the HTML file from the TFTP server to the switch Flash memory:
switch# tar /x tftp://server_ip_address//path/filename.tar flash:html Loading /path/filename.tar from server_ip_address (via!)
extracting advanced.gif (2648 bytes)
extracting amber.gif (530 bytes)!
extracting bar.gif (4156 bytes)!
extracting cool.gif (530 bytes)
extracting daytona.gif (1470 bytes)
extracting duplgnd.gif (639 bytes)!
. . .
Depending on the TFTP server being used, you might need to enter only one slash (/) after the server_ip_address in the tar command.
Step 19 Enter terminal configuration mode:
switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Step 20 Reenable access to the switch HTTP pages:
switch(config)# IP http server
Step 21 Return to privileged EXEC mode:
switch(config)# end
Step 22 Reload the new software with the following command:
switch# reload
System configuration has been modified. Save? [yes/no]:y
Proceed with reload? [confirm]
Step 23 Press Return to confirm the reload.
Your Telnet session ends when the switch resets.
|
|