Scenario 10-5: File Management on Cisco Catalyst Switches


Every Catalyst switch requires an operating system to ensure the ongoing operation of the switch, as well as ensure the configuration applied to the switch is implemented by the various hardware components. Cisco Catalyst switches include a main operating system that is loaded into memory on switch boot. On most Catalyst switches, an operating system image file comprises the code that is loaded to form the operating system, and a configuration file also exists that contains the various configuration parameters that are applied to the switch. Obviously, without these files, a switch cannot operate properly if at all so it is important that you understand how to work with these files should you need to back up, recover, or upgrade them. Other files might also exist that might or might not be crucial to the operation of the switch.

In this scenario you learn how to work with the various files that are essential for Cisco Catalyst switch operation, learning how to back up files to remote network locations, upgrade operating system files, and recover from a lost or corrupted operating system image file. Figure 10-7 shows the topology used for this scenario.

Figure 10-7. Scenario 10-5 Topology


In Figure 10-7, Server-A is a Windows 2000 host that has a TFTP Server application installed, which allows Switch-A and Switch-B to send and receive files across the network using Trivial File Transfer Protocol (TFTP).

Understanding File Management on Cisco Catalyst Switches

Before delving into the specifics of managing files, you must understand the different types of files that exist and the management requirements for each file type on each different Catalyst switch platform. This section describes file management on Cisco IOS-based switches and CatOS-based switches.

File Management on Cisco IOS-based Switches

On Cisco IOS-based switches several files on Cisco IOS enable the switch to operate:

  • Operating system image This file includes the code that enables the switch to perform all operations required to implement the various features of the switch.

  • Configuration file This file includes custom configuration attributes that control how the switch behaves. When you configure a switch, you are working with the commands that are placed into the configuration file.

  • VLAN Database file This file includes all VLANs and associated parameters known to the switch. The VLAN Trunking Protocol (VTP) configuration is also stored in this file.

  • HTML files These files are used to provide HTTP management of the switch via cluster management software (CMS). Currently, only the Cisco Catalyst 2900XL, 3500XL, 2950, 3550, and 3750 series switches support CMS.

The operating system image is normally stored on a local Flash file system, with the image being copied and loaded into dynamic memory when the switch boots. The configuration file is saved as a text file called config.text located on the Flash file system; however, this file is emulated as virtual nonvolatile RAM (NVRAM) to Cisco IOS, which is a special file system used purely for the storage of the configuration file on Cisco IOS devices. The switch reads the configuration file on boot up and loads the configuration into memory. The configuration file stored in virtual NVRAM is known as the startup configuration file, while the configuration loaded into memory is known as the running configuration file. When you make configuration changes to a Cisco IOS-based switch, you are actually modifying the running configuration file loaded into memory. If you want to save the configuration changes permanently, you must explicitly overwrite the startup configuration file (in NVRAM) with the running configuration file (in memory). The VLAN database is a binary file that is used to store information about each configured VLAN on the switch. You cannot work with this file directly; you must use the operating system (Cisco IOS) to modify the file. The VLAN database file is called VLAN.DAT.

TIP

In newer releases of IOS (12.1(8a)EW and higher), VLAN configuration can now be stored within the startup configuration file if VTP transparent mode is configured. A VLAN database file still exists; however, each time the switch boots, the VLAN configuration in the startup configuration file is loaded and stored in the VLAN database file.


File Management on CatOS-based Switches

On CatOS-based switches, two main files enable the switch to operate:

  • Operating system image This file includes the code that enables the switch to perform all operations required to implement the various features of the switch.

  • Configuration file This file includes custom configuration attributes that control how the switch behaves. When you configure a switch, you are working with the commands that are placed into the configuration file.

The operating system image is normally stored on a local Flash file system, with the image being copied and loaded into dynamic memory when the switch boots. By default, the configuration file on a CatOS-based file is saved as a binary file in non-volatile RAM (NVRAM), which is a special file system used purely for the storage of the configuration file. The switch reads the configuration file on boot up and loads the configuration into memory. The switch operating system converts the binary information stored in the configuration file into the text-based configuration commands that you as the administrator work with. Similarly, when you enter commands, the switch operating system applies the configuration parameters and also converts these parameters appropriately into the binary format of the saved configuration file. When using the binary storage mechanism, you don't need to explicitly save your configuration on a CatOS-based switch; any changes you make are immediately saved as the new, permanent configuration.

TIP

You can configure CatOS-based switches to save the configuration file as a text-based file in either NVRAM or Flash using the set config mode command. Using this method reduces the size of the configuration file because only the commands that specify a non-default con-figuration must be stored. When using text-based storage, you must explicitly save any configuration changes you have made (just as you must for Cisco IOS-based switches) by using the write memory command (the copy running-config startup-config command is not supported on CatOS).


Configuration Tasks

This scenario demonstrates file management on Cisco Catalyst switches. In this section you learn how to perform the following configuration tasks:

  • Transferring Files using TFTP

  • Upgrading/Rolling Back the Operating System Image

  • Copying and Deleting Operating System Files

  • Modifying the Boot Environment Variable

  • Recovering from a Corrupt Operating System Image

Transferring Files using TFTP

A key requirement for managing operating system files is to possess the capability to back up, recover, and upgrade these files. All of these operations normally require that the operating system files are either read from or written to a remote location other than the local switch itself. For example, you would hardly back up an important configuration file to another file located locally on the same switch; for the best result you would back this file up to a remote location, where you could then implement a more robust backup solution such as using a tape backup mechanism.

Cisco Catalyst switches allow you to transfer files remotely across an IP-based network using a protocol known as Trivial File Transfer Protocol or TFTP. TFTP is a very simple client/server protocol. Cisco Catalyst switches normally act as the TFTP client, while a remote TFTP server (which can be running on a Windows or UNIX-based host) provides both read and write access to files stored on the remote server. Some Cisco Catalyst switches also support File Transfer Protocol (FTP), which provides slightly more security than TFTP (both are considered insecure protocols). When a Cisco Catalyst switch uses TFTP to read or write files, it does so using its management interface IP address. For example, on a CatOS-based switch, this is normally via the sc0 interface, while on a Cisco IOS-based switch this is normally via the vlan 1 interface. This means that you must configure IP correctly on each switch, ensuring that the correct routes are also configured if the TFTP server does not reside on the same subnet as the switch.

Historically, Cisco has provided a free TFTP server application called Cisco TFTP Server that runs on any Windows-based platform. As of February 2003, however, this software is no longer available, with Cisco recommending the use of freeware or shareware TFTP servers instead. This is perhaps due to a serious security vulnerability found in the software where attackers can gain access to any file on the Cisco TFTP server system (see www.securityfocus.com/bid/2886/discussion for more details). A good TFTP server product that is free and supports multiple simultaneous TFTP send and receive operations is SolarWinds TFTP Server product, downloadable from www2.solarwinds.net/downloads/SolarWinds-TFTP-Server.exe.

NOTE

UNIX-based systems typically include TFTP server functionality as part of the operating system.


Upgrading/Rolling Back the Operating System Image

The most common reason for transferring operating system images across the network is to upgrade (or rollback) the switch operating system. Upgrading a Cisco Catalyst switch is relatively easy and requires three tasks:

  • Verifying current operating system boot settings (optional)

  • Copying and deleting operating system files

  • Modifying the boot environment variable

Verifying Current Operating System Boot Settings

Before upgrading your Cisco Catalyst switch, it is a good idea to have a firm understanding of the current boot environment so that you can easily rollback after an upgrade if problems surface that are associated with the new operating system upgrade. This requires the collection of the following information:

  • The current file(s) stored in Flash

  • The value of the switch boot environment variable used to boot the switch

To view the current files stored in Flash, you must have an understanding of the current file storage devices installed on your Catalyst switch. By default, Catalyst switches include internal Flash devices, which are referred to as follows:

  • CatOS The internal Flash device is referred to as bootflash:.

  • Cisco IOS The internal Flash device is referred to as flash: on Cisco Catalyst 29xx, 35xx, and 3750 switches. On Cisco IOS-based Catalyst 4000/4500 and Catalyst 6000/6500 native IOS switches, the Supervisor internal Flash device is referred to as bootflash:.

Some Catalyst switches with Supervisor modules include PCMCIA slots that enable you to install additional Flash memory. Each PCMCIA Flash card is normally referred to as slot0: or slot1: depending on the number of PCMCIA cards installed. In this scenario, Switch-A is a Cisco Catalyst 3550 switch, which supports only a single internal Flash device, while Switch-B is a Cisco Catalyst 4006 switch with only a single internal Flash device (PCMCIA Flash is supported on the Supervisor 2; however, is not present for this scenario).

On Cisco IOS and CatOS, to view the files contained within a Flash device, you use the dir command:

 dir [device-name] 

The optional device-name parameter allows you to view the contents of a specific file system. Example 10-55 and Example 10-56 demonstrate the use of the dir command on Switch-A and Switch-B respectively.

Example 10-55. Viewing the Contents of the Default Flash Device on Cisco IOS
 Switch-A# dir flash: Directory of flash:/     3  drwx         192   Mar 01 1993 04:12:16  c3550-i5k2l2q3-mz.121-13.EA1a    22  -rwx           0   Mar 01 1993 04:12:16  env_vars    23  -rwx         348   Mar 01 1993 04:12:17  system_env_vars    20  -rwx        4277   Mar 01 1993 01:08:02  config.text    21  -rwx         796   Mar 01 1993 00:00:36  vlan.dat    25  -rwx          24   Mar 01 1993 01:08:02  private-config.text 15998976 bytes total (9402368 bytes free) Switch-A# cd c3550-i5k2l2q3-mz.121-13.EA1a Switch-A# dir Directory of flash:/c3550-i5k2l2q3-mz.121-13.EA1a/     4  drwx         832   Mar 01 1993 04:10:43  html    18  -rwx     4578754   Mar 01 1993 04:12:16  c3550-i5k2l2q3-mz.121-13.EA1a.bin    19  -rwx         261   Mar 01 1993 04:12:16  info 15998976 bytes total (9404928 bytes free) 

Example 10-56. Viewing the Contents of the Default Flash Device on CatOS
 Switch-B> (enable) dir bootflash: -#- -length- -----date/time------ name   1  4309944 Feb 22 2002 14:00:00 cat4000-k8.7-4-2.bin   2  4111884 Feb 22 2002 14:00:00 cat4000.6-3-2a.bin 8355388 bytes available (8421828 bytes used) 

In Example 10-55, you can see the various files and directories that comprise the Catalyst 3550 Flash file system. Notice that c3550-i5k2l2q3-mz.121-13.EA1a is a directory, not a file, as indicated by the d in the field drwx near the beginning of the first shaded line in Example 10-55. The cd command is used to change the present working directory to the c3550-i5k2l2q3-mz.121-13.EA1a, and then the dir command is used to list the contents of this directory. Within this directory, the operating system file (c3550-i5k2l2q3-mz.121-13.EA1a.bin) and cluster management software (html directory) are installed.

In Example 10-56, you can see that currently two files are located in bootflash on Switch-B. Each is an operating system file, as indicated by the .bin extension, with the appropriate version number included in the file name.

Now that you know exactly what files are present on both switch's file systems, it is time to determine exactly which file is booted from by each switch. This information can be found by inspecting the boot environment variable on a Cisco Catalyst switch. On Cisco IOS, the command used for viewing the boot environment variable differs, depending on the switch platform. On the Catalyst 3550, the show boot command is used to display current boot settings, as shown in Example 10-57.

Example 10-57. Viewing Boot Environment Variables
 Switch-A# show boot BOOT path-list:       flash:c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.     121-13.EA1a.bin Config file:          flash:/config.text Private Config file:  flash:/private-config.text Enable Break:         no Manual Boot:          no HELPER path-list: NVRAM/Config file       buffer size:    393216 

In Example 10-57, you can see that Switch-A is booting from the file flash:/c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.121-13.EA1a.bin and the configuration file used is the file /config.text.

NOTE

On the Cisco IOS-based Catalyst 4000/4500 and Catalyst 6000/6500 native IOS switches, the show boot var command is used to display boot environment variables.


On CatOS, the show boot command is used for viewing the boot environment variables, as shown in Example 10-58.

Example 10-58. Viewing Boot Environment Variables on CatOS
 Switch-B> (enable) show boot BOOT variable = bootflash:cat4000-k8.7-4-2.bin,1; CONFIG_FILE variable = bootflash:switch.cfg Configuration register is 0x1 ignore-config: disabled auto-config: recurring console baud: 9600 boot: image specified by the boot system commands 

The BOOT variable determines which file the switch should boot off. Notice that the current file the switch boots from is the file cat4000-k8.7-1-1a.bin.

Copying and Deleting Operating System Files

At this stage, you are ready to begin the process of transferring the new operating system image to the Flash file system over the network from a remote TFTP server. Before doing so, however, it is a good idea to back up your current operating system file and configuration file first and then proceed with the upgrade.

Backing up Files

All file transfer operations on Cisco IOS and CatOS use the copy command, which copies files within the same file system or from one file system to another file system (which could be another file system on the local switch or a remote file system accessed using TFTP). Example 10-59 demonstrates copying both the operating system and configuration files on Cisco IOS.

NOTE

Example 10-59 and Example 10-60 assume a working IP address has been configured on each switch as per Figure 10-7 and that the TFTP server (Server-A) has been set up and configured to allow read and write access from network devices.


Example 10-59. Backing Up Files on Cisco IOS
 Switch-A# copy startup-config tftp Address or name of remote host []? 192.168.1.10 Destination filename [switch-a-confg]? Switch-A.cfg !! 4277 bytes copied in 0.052 secs (82250 bytes/sec) Switch-A# copy flash tftp Source filename []? flash:c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.121-13     .EA1a.bin Address or name of remote host []? 192.168.1.10 Destination filename []? c3550-i5k2l2q3-mz.121-13.EA1a.bin !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! 4578754 bytes copied in 18.876 secs (242570 bytes/sec) 

In Example 10-59, the copy startup-config tftp command is used to copy the startup configuration file to a TFTP server. Notice that this command interactively prompts for TFTP server address and what the name of the file should be on the destination TFTP server. Next, the copy flash tftp command is used to copy the operating system file to a TFTP server.

NOTE

You can specify the full path to the file that you want to copy, as well as the full path to the file on the destination TFTP server, instead of specifying just the flash and tftp parameters. For example, the copy flash:config.text tftp://192.168.1.10/config.text command copies the config.text file in Flash to a TFTP server of 192.168.1.10 and saves the copied file as config.text on the destination server.


On the Catalyst 2950/3550 switches, the Flash file system not only contains an operating system image file, but also contains many other files used for the cluster management software (CMS). CMS is a Web-based management application that enables the configuration of multiple Cisco Catalyst 29xx/35xx switches in a single physical location, removing the requirement to use command-line interface (CLI) for configuration by allowing all configuration to be performed via CMS. It is important to understand that the CMS files are matched to a specific version of operating system image file (as CMS must support new features as they are released in new versions); hence, you should always back up and restore the operating system image together with the matching CMS files. This can be achieved by using the archive command, as demonstrated in Example 10-60 on Switch-A.

Example 10-60. Backing Up Files on CatOS
 Switch-A#archive upload-sw tftp://192.168.1.10/c3550-i5k2l2q3-mz.121-13.EA1a.tar Image info:     Version Suffix: i5k2l2q3-121-13.EA1a     Image Name: c3550-i5k2l2q3-mz.121-13.EA1a.bin     Version Directory: c3550-i5k2l2q3-mz.121-13.EA1a     Ios Image Size: 4580864     Total Image Size: 6596096     Image Feature: LAYER_3|MIN_DRAM_MEG=64     Image Family: C3550 archiving info (261 bytes) archiving c3550-i5k2l2q3-mz.121-13.EA1a (directory) archiving c3550-i5k2l2q3-mz.121-13.EA1a/html (directory) archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/homepage.htm (3992 bytes)! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/not_supported.html (1392 bytes) archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/common.js (9529 bytes)!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/cms_splash.gif (22152 bytes)!!!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/cms_13.html (1211 bytes) archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/cluster.html (2823 bytes)! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/Redirect.jar (4195 bytes)! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/mono_disc.sgz (16232 bytes)!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/CMS.sgz (1343769   bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/images.sgz (86920 bytes)!!!!!!!!!!! !!!!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/help.sgz (316438 bytes) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/CiscoChartPanel.sgz (135599 bytes) !!!!!!!!!!!!!!!!!!!!!!!!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/html/cms_boot.jar (58861 bytes)!!!!!!!!! !!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.121-13.EA1a.bin      (4578754 bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! archiving c3550-i5k2l2q3-mz.121-13.EA1a/info (261 bytes)! archiving info.ver (261 bytes) 

In Example 10-60, the archive upload-sw command is used to archive all current operating system files (including operating system image and CMS files) into a single file, which is specified as c3550-i5k2l2q3-mz.121-13.EA1a.tar, and then "upload" the archive file to the TFTP server 192.168.1.10. The archive upload-sw command works by checking the current boot environment variable (flash:c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.121-13.EA1a.binsee Example 10-57) and then checking the directory the operating system image is located in for a file called info. This file contains the information indicated in the shaded output of Example 10-60 and allows the switch to determine the current Cisco IOS version and the directory in which all files related to the current IOS version are stored. The switch then archives all files within the directory and copies the archive to the configured destination in the archive command.

NOTE

The archive command is used to create tape archive (TAR) files, which are common in UNIX environments for backing up a collection of files into a single file, allowing for easy restoration. The archive command is supported only on the Catalyst 2950/3550 switches and is not supported on the Catalyst 2900XL/3500XL, 4000/4500, or 6000/6500 Cisco IOS-based platforms.


Example 10-61 demonstrates copying both the operating system and configuration files on CatOS.

Example 10-61. Backing Up Files on CatOS
 Switch-B> (enable) copy config tftp This command uploads non-default configurations only. Use 'copy config tftp all' to upload both default and non-default      configurations. IP address or name of remote host []? 192.168.1.10 Name of file to copy to [Switch-B.cfg]?  Upload configuration to tftp:Switch-B.cfg, (y/n) [n]? y ............... ......................... .. / Configuration has been copied successfully. Switch-B> (enable) copy flash tftp Flash device [bootflash]?  Name of file to copy from []? cat4000-k8.7-4-2.bin IP address or name of remote host []? 192.168.1.10 Name of file to copy to []? cat4000-k8.7-4-2.bin CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC| File has been copied successfully. Switch-B> (enable) copy bootflash:cat4000-k8.7-4-2.bin tftp IP address or name of remote host [192.168.1.10]?  Name of file to copy to [cat4000-k8.7-2-2.bin]?  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC/ File has been copied successfully. 

In Example 10-61, the copy config tftp command is used to copy the current non-default configuration to a TFTP server. Just like Cisco IOS, a series of interactive prompts are presented to collect information, such as the TFTP server and filename on the destination server. The copy flash tftp command is then used to copy the operating system file. Notice that you can specify the full path to the file that you are copying, as demonstrated by the copy bootflash:cat4000-k8.7-4-2.bin tftp command.

Deleting Files

After backing up the current operating system files and configuration files, you are almost ready to upgrade/restore the operating system. When copying files from the network to Flash, it is important that enough Flash is available for the new file. If there is not enough Flash, you need to delete files to make space. This is achieved by using the delete command and, depending on the switch model, might also require the use of the squeeze command. If you attempt to copy a file to Flash and there is not enough space, the copy is interrupted as soon as the file system is filled.

TIP

To determine the amount of free space, you can use the dir command (see Example 10-55 and Example 10-56).


Example 10-62 demonstrates deleting files on Cisco IOS to free up Flash space.

Example 10-62. Deleting Files on Cisco IOS
 Switch-A# cd flash:c3550-i5k2l2q3-mz.121-13.EA1a Switch-A# delete c3550-i5k2l2q3-mz.121-13.EA1a.bin Delete filename [c3550-i5k2l2q3-mz.121-13.EA1a.bin]?  Delete flash:c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.121-13.EA1a.bin? [confirm] y 

In Example 10-62, notice the use of the cd (change directory) command, which is used to change the current working directory. Because the current operating system file is located in the c3550-i5k2l2q3-mz.121-13.EA1a directory (see Example 10-55), your working directory must be changed to this directory for the delete c3550-i5k2l2q3-mz.121-13.EA1a.bin command to work (alternatively you could specify the full path to the file in the delete command). Notice after executing the delete command, you are prompted with the Delete filename […] prompt; at this prompt, always just press Enter, which confirms that you want to delete the filename you specified in the delete command. Many administrators not familiar with using file management commands often mistake this as a prompt for confirmation of file deletion (which is in fact performed during the next prompt), and enter in y or yes. The switch interprets this as meaning "delete the file called y" (or yes), which of course causes the delete process to fail as it is unlikely such a file exists.

WARNING

On the Catalyst 29xx/35xx switches, it is not recommended to delete operating system files because a large number of files comprise the operating system (i.e., image file and CMS files) that are all related to each other and deleting specific files might break interdependencies.


Example 10-63 demonstrates deleting files on Cisco IOS to free up Flash space.

Example 10-63. Deleting Files on CatOS
 Switch-B> (enable) dir bootflash: -#- -length- -----date/time------ name   1  4309944 Feb 22 2002 14:00:00 cat4000-k8.7-4-2.bin   2  4111884 Feb 22 2002 14:00:00 cat4000.6-3-2a.bin 8355388 bytes available (8421828 bytes used) Switch-B> (enable) delete cat4000.6-3-2a.bin Switch-B> (enable) dir bootflash: -#- -length- -----date/time------ name   1  4309944 Feb 22 2002 14:00:00 cat4000-k8.7-4-2.bin 8355388 bytes available (8421828 bytes used) Switch-B> (enable) undelete Usage: undelete <index> [[m/]device:] Switch-B> (enable) undelete 2 Switch-B> (enable) dir -#- -length- -----date/time------ name   1  4309944 Feb 22 2002 14:00:00 cat4000-k8.7-4-2.bin   2  4111884 Feb 22 2002 14:00:00 cat4000.6-3-2a.bin 8355388 bytes available (8421828 bytes used) Switch-B> (enable) delete cat4000.6-3-2a.bin Switch-B> (enable) squeeze bootflash: All deleted files will be removed, proceed (y/n) [n]? y Squeeze operation may take a while, proceed (y/n) [n]? y Erasing squeeze log Switch-B> (enable) dir -#- -length- -----date/time------ name   1  4309944 Feb 22 2002 14:00:00 cat4000-k8.7-4-2.bin 12467272 bytes available (4309944 bytes used) 

In Example 10-63, the dir command is first used to view files currently in Flash. Next the delete command is used to remove the file cat4000.6-3-2a.bin, with the dir command being used immediately afterwards to verify the file has been deleted. Notice that although the file is no longer listed, the bytes available and used in Flash are the same as when the file was present before the deletion. This is because CatOS does not delete files completely when you use the delete command, instead just removing the file system pointer to the file. This allows the undelete command to be used, which can be used to restored deleted files. In Example 10-63, you can see that the undelete command is used to restore the deleted file, by specifying the index of the file. The index is the first number on the left for each file listed using the dir command. If you look at the first dir command executed in Example 10-63, you can see that the index of the cat4000.6-3-2a.bin file is 2; consequently, the undelete 2 command restores this file. After the undelete process is demonstrated, the file is once again deleted, and this time, the squeeze command is used to permanently erase any deleted files on the bootflash: device.

NOTE

If you want to permanently erase a deleted file on CatOS, you must always delete the file using the delete command and then perform the squeeze operation. The same applies on some Cisco IOS-based switches such as the Catalyst 4000/4500 Supervisor 3/4 and Catalyst 6000/6500 running native IOS.


Upgrading/Restoring Operating System Files

After verifying the current file system contents, backing up important files and ensuring enough space is available on Flash, you can copy new operating system files to perform an upgrade. As you might expect, copying files from a TFTP server to Flash is performed using the copy command. You can use this command to upgrade the operating system, as well as restore or apply a new configuration.

Example 10-64 demonstrates copying the configuration file and operating system file backed up in Example 10-59 from the TFTP server to Switch-A.

Example 10-64. Copying Files from TFTP on Cisco IOS
 Switch-A# copy tftp startup-config Address or name of remote host []? 192.168.1.10 Source filename []? Switch-A.cfg Destination filename [startup-config]?  Accessing tftp://192.168.1.10/Switch-A.cfg... Loading Switch-A.cfg from 192.168.1.10 (via Vlan1): ! [OK - 4277 bytes] 4277 bytes copied in 0.088 secs (48602 bytes/sec) 01:40:22: %SYS-5-CONFIG_NV_I: Nonvolatile storage configured from     tftp://192.168.1.10/Switch-A.cfg by console Switch-A# cd flash:/ Switch-A# mkdir temp Create directory filename [temp]?  Created dir flash:/temp Switch-A# copy tftp flash Address or name of remote host []? 192.168.1.10 Source filename []? c3550-i5k2l2q3-mz.121-13.EA1a.bin Destination filename [c3550-i5k2l2q3-mz.121-13.EA1a.bin]? flash:/temp/c3550-   i5k2l2q3-mz.121-13.EA1a.bin Accessing tftp://192.168.1.10/c3550-i5k2l2q3-mz.121-13.EA1a.bin... Loading c3550-i5k2l2q3-mz.121-13.EA1a.bin from 192.168.1.10 (via Vlan1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! [OK - 4578754 bytes] 4578754 bytes copied in 70.248 secs (65180 bytes/sec) Switch-A# verify flash:/temp/c3550-i5k2l2q3-mz.121-13.EA1a.bin Verified flash:/temp/c3550-i5k2l2q3-mz.121-13.EA1a.bin 

In Example 10-64, the copy tftp startup-config command is used to copy the file Switch-A.cfg on the TFTP server to startup configuration (NVRAM). Next, the cd flash:/ command is used to ensure the present working directory on Switch-A is the root directory. The mkdir command is then used to create a directory called temp, after which the copy tftp flash command is used to copy the operating system image file to Flash. Notice that the destination path of /temp/ c3550-i5k2l2q3-mz.121-13.EA1a.bin is specified, meaning the file is to be copied to the new temp folder. Finally, the verify command is used to ensure the copied file is not corrupt; Cisco IOS operating system files include a checksum, which allows for any changes to the content of a file to be detected. If a file is corrupted, you should immediately delete the file and copy the file from the TFTP server once again.

On Cisco Catalyst 2950/3550 switches, rather than using copy tftp flash to upgrade operating system software, it is recommended to use the archive command (previously demonstrated in Example 10-60 for backup purposes) because this can upgrade not just the operating system image file but also the related CMS files, ensuring CMS is compatible with the upgraded operating system. Example 10-65 demonstrates using the archive command on Switch-A to restore the operating system archive created in Example 10-60.

Example 10-65. Upgrading the Operating System Using archive on Cisco IOS
 Switch-A# archive download-sw ?   /force-reload  Unconditionally reload system after successful sw upgrade   /imageonly     Load only the IOS image   /leave-old-sw  Leave old sw installed after successful sw upgrade   /no-set-boot   Don't set BOOT -- leave existing boot config alone   /overwrite     OK to overwrite an existing image   /reload        Reload system (if no unsaved config changes) after successful                  sw upgrade   /safe          Always load before deleting old version   flash:         Image file   ftp:           Image file   rcp:           Image file   tftp:          Image file Switch-A# archive download-sw /overwrite tftp://192.168.1.10/c3550-i5k2l2q3-mz  .121-13.EA1a.tar examining image... Loading c3550-i5k2l2q3-mz.121-13.EA1a.tar from 192.168.1.10 (via Vlan1): ! extracting info (261 bytes) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [OK - 6596096 bytes] Image info:     Version Suffix: i5k2l2q3-121-13.EA1a     Image Name: c3550-i5k2l2q3-mz.121-13.EA1a.bin     Version Directory: c3550-i5k2l2q3-mz.121-13.EA1a     Ios Image Size: 4580864     Total Image Size: 6596096     Image Feature: LAYER_3|MIN_DRAM_MEG=64     Image Family: C3550 Extracting files... Loading c3550-i5k2l2q3-mz.121-13.EA1a.tar from 192.168.1.10 (via Vlan1): ! extracting info (261 bytes) c3550-i5k2l2q3-mz.121-13.EA1a (directory) c3550-i5k2l2q3-mz.121-13.EA1a/html (directory) extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/homepage.htm (3992 bytes)! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/not_supported.html (1392 bytes) extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/common.js (9529 bytes)!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/cms_splash.gif (22152 bytes)!!!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/cms_13.html (1211 bytes) extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/cluster.html (2823 bytes)! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/Redirect.jar (4195 bytes)! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/mono_disc.sgz (16232 bytes)!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/CMS.sgz (1343769   bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/images.sgz (86920 bytes)!!!!!!!!!! !!!!!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/help.sgz (316438   bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/CiscoChartPanel.sgz (135599   bytes)!!!!!!!!!!!!!!!!!!!!!!!!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/html/cms_boot.jar (58861 bytes)!!!!!!!! !!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/c3550-i5k2l2q3-mz.121-13.EA1a.bin      (4578754 bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! extracting c3550-i5k2l2q3-mz.121-13.EA1a/info (261 bytes)! extracting info.ver (261 bytes) [OK - 6596096 bytes] New software image installed in flash:c3550-i5k2l2q3-mz.121-13.EA1a Configuring system to use new image...done. 

In Example 10-65, the archive download-sw command is used to download a TAR archive and extract the archive. Notice the options that you can specify with the command. In Example 10-63, the archive download-sw command is used with the /overwrite switch to overwrite any existing files if required, and the archive is obtained via TFTP. After the archive is obtained, it is then extracted and the entire directory structure and associated files restored to a root directory specific to the version of software (e.g., the c3550-i5k2l2q3-mz.121-13.EA1a directory in Example 10-65). Once the archive extraction process is complete, notice that the archive command even configures the system to use the new image, meaning the boot environment variables are automatically modified.

Example 10-66 demonstrates copying the configuration file and operating system file backed up in Example 10-61 from the TFTP server to Switch-B.

Example 10-66. Copying Files from TFTP on CatOS
 Switch-B> (enable) copy tftp config IP address or name of remote host []? 192.168.1.10 Name of file to copy from []? Switch-B.cfg Configure using tftp:Switch-B.cfg (y/n) [n]? y Finished network download.  (8602 bytes) >> set password $2$p8hX$98Gs/eXM2L/jjCTGhLPec. Password changed. >> set enablepass $2$NMK/$VnHGG4PHSDFPFG28d7IpP0 Password changed. >> set system name  Switch-B System name set. ... (Output Truncated) ... Switch-B> (enable) copy tftp flash IP address or name of remote host []? 192.168.1.10 Name of file to copy from []? cat4000-k8.7-4-2.bin Flash device [bootflash]?  Name of file to copy to [cat4000-k8.7-4-2.bin]?  Overwrite image file (y/n) [n]? y 12467272 bytes available on device bootflash, proceed (y/n) [n]? y CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC File has been copied successfully. Switch-B> (enable) verify bootflash:cat4000-k8.7-4-2.bin CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC Starting verification on file bootflash:cat4000-k8.7-2-2.bin. ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................... File bootflash:cat4000-k8.7-2-2.bin verified and is Ok. 

In Example 10-66, the copy tftp config command is used to copy a configuration file from TFTP to the current configuration on CatOS. Notice that after the configuration file has been copied via TFTP, it is immediately applied to the current configuration. Next, the copy tftp flash command is used to copy a new operating system file via TFTP. If you are attempting to overwrite the current operating system file, notice that you are prompted if you want to do so. After the file is copied, the verify command is used to verify the new file.

Modifying the Boot Environment Variable

If you are upgrading or rolling back the switch operating system file, after the appropriate operating system files are copied to Flash, you must modify the boot environment variable so that the switch boots from the new operating system image file. After this has been performed, the next time the switch is rebooted, the switch should boot from the new operating system image.

On Cisco IOS, the boot system global configuration command is used to set the boot environment variable, as demonstrated in Example 10-67.

NOTE

If you use the archive download-sw command to upgrade Catalyst 29xx/35xx switches, you do not need to modify the boot environment variable as this is performed automatically during the upgrade process (see Example 10-63).


Example 10-67. Modifying the BOOT Environment Variable on Cisco IOS
 Switch-A# configure terminal Switch-A(config)# boot system flash:temp/c3550-i5k2l2q3-mz.121-13.EA1a.bin Switch-A(config)# exit Switch-A# show boot BOOT path-list:       flash:temp/c3550-i5k2l2q3-mz.121-13.EA1a.bin Config file:          flash:/config.text Private Config file:  flash:/private-config.text Enable Break:         no Manual Boot:          no HELPER path-list: NVRAM/Config file       buffer size:    393216 

In Example 10-67, notice that after modifying the boot environment variable, the show boot command confirms the switch is now configured to boot from the new operating system file located in the temp directory (see Example 10-59).

On CatOS, the clear boot command is first used to clear the boot environment variable, and then the set boot configuration command is used to set the boot environment variable, as demonstrated in Example 10-68.

Example 10-68. Modifying the BOOT Environment Variable on CatOS
 Switch-B> (enable) clear boot system all BOOT variable = Switch-B> (enable) set boot system flash bootflash:cat4000-k8.7-4-2.bin BOOT variable = bootflash: cat4000-k8.7-4-2.bin,1; 

In Example 10-68, the BOOT variable is first cleared, as the set boot command does not overwrite the BOOT variable (just appends or prepends to the variable). After clearing the BOOT variable, the switch is then configured to boot from the new image file. You can add further files to boot from (only booted if primary files are not present) by using the set boot command again.

At this point, an upgraded switch should be rebooted to ensure that the new operating system file is loaded. After reboot, the switch should boot from the new image file, which you can verify using the show version command after the switch has rebooted.

Recovering from a Corrupt Operating System Image

In the previous section you learned how you can copy new image files to Flash and modify the switch to boot from these new files. Sometimes, the CatOS image file might get corrupted or (more likely) you accidentally copy in the wrong version of software or maybe even install an image that requires more RAM than your switch contains. In these circumstances, the switch fails to boot, instead booting to ROM Monitor (ROMMON) mode. Depending on the hardware platform, the ROM monitor provides one or more basic mechanisms that allow you to restore or boot from a new operating system image file. These mechanisms might include one or more of the following:

  • Transferring the file via the console port using a serial file transfer protocol such XMODEM or KERMIT.

  • Transferring the file from another PCMCIA Flash device installed locally.

  • Transferring the file from an IP network using TFTP.

The mechanisms available vary based upon the hardware platform. Table 10-1 describes the mechanisms available for the various CatOS-based platforms from ROM Monitor mode.

Table 10-1. Operating System Recovery Options from ROM Monitor for Cisco Catalyst Switches

Platform

Recovery Mechanism

Catalyst 2900XL/3500XL

Catalyst 2950/3550/3750

(Cisco IOS)

XMODEM (via console)

Catalyst 2900

Catalyst 4000 (Sup 1/2)

(CatOS)

TFTP (via management port)

Catalyst 4000/4500

(Supervisor 3/4)

(Cisco IOS)

Local Flash

TFTP (via management port)

[*]Catalyst 5000/5500

(Sup. 1/2/2G/3G)

(CatOS)

KERMIT (via console)

TFTP (via linecard)

Catalyst 5000/5500

(Supervisor 3)

Catalyst 6000/6500

(CatOS)

PCMCIA Flash

XMODEM (via console)

Catalyst 6000/6500

(Native IOS)

Local Flash

XMODEM (via console)


[*] To access ROM Monitor mode, you must enable jumpers on the Supervisor module. See www.cisco.com/warp/public/473/26.html#recovery2 for more details.

Operating system recovery is now demonstrated on Switch-A (Catalyst 3550) and on Switch-B (CatOS).

Operating System Recovery on a Catalyst 29xx/35xx Switch (Cisco IOS)

Operating system recovery on the Catalyst 29xx/35xx switches can be performed only via a console connection using XMODEM. Most terminal emulation programs (e.g., HyperTerminal on Windows) support the transfer of files via XMODEM and in this scenario, you learn how to transfer files via XMODEM using HyperTerminal.

If the operating system image becomes corrupted or is deleted, when a switch starts up you will find that the switch cannot boot because it no longer has an operating system image to boot from. This causes the switch to be placed into ROM Monitor mode, as demonstrated in Example 10-69.

Example 10-69. Boot Failure on the Catalyst 3550
 Base ethernet MAC Address: 00:09:b7:aa:9c:80 Xmodem file system is available. The password-recovery mechanism is enabled. Initializing Flash... flashfs[0]: 0 files, 1 directories flashfs[0]: 0 orphaned files, 0 orphaned directories flashfs[0]: Total bytes: 15998976 flashfs[0]: Bytes used: 1024 flashfs[0]: Bytes available: 15997952 flashfs[0]: flashfs fsck took 12 seconds. ...done Initializing Flash. Boot Sector Filesystem (bs:) installed, fsid: 3 Loading ""...: permission denied Error loading "" Interrupt within 5 seconds to abort boot process. Boot process failed... The system is unable to boot automatically.  The BOOT environment variable needs to be set to a bootable image. switch: 

Example 10-69 shows the boot process when no files are present in Flash. Notice that a message is displayed, indicating the boot process failed, with the switch being placed into ROM monitor mode as indicated by the switch: prompt.

At this point, the Flash file system has been mounted during the boot process in an attempt to boot the switch; hence, you do not need to explicitly mount the Flash file system using the flash_init and load_helper commands.

NOTE

If you enter ROM monitor mode by holding down the MODE button while powering on the switch, you must use the flash_init and load_helper commands to mount the Flash file system.


Assuming the Flash file system is mounted, to ensure the XMODEM file transfer is as fast as possible, you should change the baud rate used for the console connection from 9600 bps to 57600 bps, using the set BAUD command (case sensitive) as demonstrated in Example 10-70.

NOTE

Although a speed of 115200 bps is supported on the Catalyst 3550, setting such a speed results in numerous CRC errors, with the copy process failing.


Example 10-70. Configuring a High-Speed Baud Rate
 switch: set BAUD 57600                        ÿ¿ Figure 10-8. Preparing HyperTerminal to Send a File via XMODEM 


NOTE

There is no archive command in ROM Monitor mode, so you must ensure you copy an operating system image file if recovering from ROM Monitor mode. After the switch has booted from the recovered operating system image, you can then use the archive command to completely restore the entire operating system and CMS files.


Once the Send button is clicked, the file transfer begins. Figure 10-9 shows the HyperTerminal XModem file send screen.

Figure 10-9. Using HyperTerminal to Send a File via XMODEM


Depending on the size of the image and the baud rate configured, the XMODEM file copy could take hours to complete. Notice in Figure 10-9 that at 57600 bps, the file transfer takes approximate 25 minutes.

Once the XMODEM file copy is complete, you should set the console speed to 9600 bps using the set BAUD 9600 command, re-establish a console connection at 9600 bps, and then use the boot command to boot the switch from the new image (e.g., boot flash:c3550-i5k2l2q3-mz.121-13.EA1a.bin). Once the switch has booted, you should restore the complete operating system using the archive command, or at least ensure the boot environment variable is set to boot from the new image using the boot system global configuration command.

Operating System Recovery on a Catalyst 2900/4000 Switch (CatOS)

Operating system recovery on the Catalyst 2900/4000 switches is a lot quicker than on the Catalyst 3550 because the onboard Ethernet management interface can be accessed from ROM Monitor mode, allowing for an operating system image file to be recovered using TFTP rather than a slow serial file transfer protocol such as XMODEM.

If the operating system image on a CatOS switch becomes corrupted or is deleted, when the switch starts up, you will find that the switch cannot boot because it no longer has an operating system image to boot from. This causes the switch to be placed into ROM Monitor mode, as demonstrated in Example 10-72.

Example 10-72. Boot Failure on the Cisco Catalyst 2900/4000
 0:00.575648: Please set IPAddr variable 0:00.576244: Please set Netmask variable 0:00.576605: Please set Broadcast variable 0:00.577211: Please set TftpServer variable to do tftp downloads 0:00.577757: Network is not configuredWS-X2948G bootrom version 6.1(4), built on   2001.07.30 14:43:26 H/W Revisions:    Fin: 2    Head: 11    Board: 1 Supervisor MAC addresses: 00:30:24:48:d4:00 through 00:30:24:48:d7:ff (1024 addresses) Installed memory: 64 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-k8.7-4-2.bin" loadprog: error - on file open Booting "bootflash:cat4000-k8.7-4-2.bin" failed. (loadprog() returned -1.) Resetting system... WS-X2948G bootrom version 6.1(4), built on 2001.07.30 14:43:26 H/W Revisions:    Fin: 2    Head: 11    Board: 1 Supervisor MAC addresses: 00:30:24:48:d4:00 through 00:30:24:48:d7:ff (1024 addresses) Installed memory: 64 MB Testing LEDs.... done! rommon 1> dir bootflash:          File size           Checksum   File name 

In Example 10-72, the switch cannot find an operating system file to boot from, and eventually the switch is placed into ROM monitor mode. Notice that the dir bootflash: command is used to check the Flash file system. No files are present on Flash; hence, the reason why the switch cannot boot.

The Catalyst 2900 series and Catalyst 4000 Supervisor 1/2 series include an external Ethernet management interface, which can be used to recover an operating system image from an IP network using TFTP. Assuming that the management interface is either directly attached to a TFTP server using a crossover cable or attached to LAN infrastructure that provides connectivity to the TFTP server, you can configure an IP address for the management interface that allows TFTP communications. This is achieved using the set interface me1 ROMMON command, where me1 refers to the Ethernet management interface. You must also configure a route using the set ip route default ROMMON command if your TFTP server is not attached to the same IP subnet. Example 10-73 demonstrates the configuration of an IP address on the management interface (me1) and a default gateway.

Example 10-73. Configuring the Management Interface in ROMMON Mode
 rommon 2> set interface me1 192.168.1.2 255.255.255.0 15:46.811393: Please set TftpServer variable to do tftp downloads 15:46.813026: ig0: 00:30:24:48:d7:fe is 192.168.1.2 15:46.813619: netmask: 255.255.255.0 15:46.813973: broadcast: 192.168.1.255 15:46.814336: gateway: 0.0.0.0 rommon 3> set ip route default 192.168.1.1 

NOTE

Other CatOS Catalyst switches might not include a dedicated Ethernet management interface and require the new operating system image to be downloaded via the console connection (using a protocol such as XMODEM). For example, the Catalyst 6000/6500 Supervisor 1 and 2 require you to download a new image via the console port that runs at 9600 bps by default, which can be changed to operate at speeds of up 115200 bps by modifying configuration registers on the switch.


Notice in Example 10-73 that you must set an environment variable called TftpServer if you want to download a file via TFTP. Example 10-74 demonstrates setting this variable with the IP address of the TFTP server and then verifying the configuration.

Example 10-74. Configuring the TFTP Server Environment Variable
 rommon 4> TftpServer=192.168.1.10 rommon 5> set PS1=rommon ! > DiagBootMode=post MemorySize=64 ResetCause=198 TmpfsAddr=2197815296 TmpfsSize=12582912 TmpfsDirectorySize=10240 DiagFreePageLimit=12288 AutobootStatus=fail TftpServer=192.168.1.10 ?=0 BOOT=bootflash:,1; CONFIG_FILE=bootflash:switch.cfg WHICHBOOT=bootflash:cat4000.7-4-2.bin ROMVERSION=5.4(1) 

In Example 10-74, the set command is used to display all environment variables. Notice that the TftpServer variable is now set to 192.168.1.10.

After setting the TFTP server IP address, you can next begin the process of operating system recovery. The Catalyst 2900/4000 ROM Monitor program allows you to boot from an image operating system file located on the network (via TFTP), rather than allowing you to download the file from a TFTP server to Flash and then booting from Flash. The TftpServer environment variable is used by the boot command to locate the TFTP server on which an image is located. Example 10-75 demonstrates configuring the switch to boot from an operating system image file located on the TFTP server.

Example 10-75. Booting the Switch via TFTP
 rommon 6> boot cat4000-k8.7-4-2.bin 2:52.639673: Loading file 192.168.1.10:cat4000-k8.7-4-2.bin 3:42.148276: 4458444 bytes received (checksum 0x9dbb) ################################ Starting Off-line Diagnostics Mapping in TempFs Board type is WS-X2948 DiagBootMode value is "post" Loading diagnostics... Power-on-self-test for Module 1:  WS-X2948 Status: (. = Pass, F = Fail) processor: .           cpu sdram: .           eprom: . nvram: .               flash: .               enet console port: . switch registers: .    switch sram: . Module 1 Passed Exiting Off-line Diagnostics Cisco Systems, Inc. Console Enter password: ***** Switch-B> enable Enter password: ***** Switch-B> (enable) 

Notice that you don't need to specify any indication in the boot command that you are using TFTP; the switch first looks in the local Flash file system for the file and, if it is not present, assumes that the file is reachable via the TFTP server configured using the TftpServer variable. The shaded line indicates that the switch is using 192.168.1.10 to load the image via TFTP. After the file is downloaded via TFTP, it is used to boot the switch. Notice that the switch configuration is maintained, even though the Flash file system is empty. This is because the switch configuration is stored in separate NVRAM.

Now that the full CatOS image is loaded, the appropriate image can be restored to a Flash device on the switch. If you suspect that the file system on the device is corrupted, you must first format the file system, as demonstrated in Example 10-76.

WARNING

All files on the formatted Flash device are erased during the format process. If you don't need to format the file system, ignore this step and proceed to the next step.


Example 10-76. Formatting the Flash File System on CatOS
 Switch-B> (enable) format bootflash: All sectors will be erased, proceed (y/n) [n]? y Enter volume id (up to 31 characters):  Formatting sector 1 Format device bootflash completed 

After optionally formatting the file system, you can obtain the operating system image file using TFTP, either using the sc0 interface or the me1 (external management) interface.

NOTE

The me1 interface has no connection to the switch backplane whatsoever, meaning you must connect this interface directly to the appropriate network you are trying to access.


Example 10-77 shows the process of downloading a new image to Flash and the subsequent verification of the image.

Example 10-77. Downloading a New Operating System Image
 Switch-A> (enable) copy tftp flash IP address or name of remote host []? 192.168.1.10 Name of file to copy from []? cat4000-k8.7-4-2.bin Flash device [bootflash]?  Name of file to copy to [cat4000-k8.7-4-2.bin]? cat4000-k8.7-4-2.bin 15599146 bytes available on device bootflash, proceed (y/n) [n]? y / CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC ... ... File has been copied successfully. Switch-A> (enable) verify cat4000-k8.7-4-2.bin CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCC File bootflash:cat4000-k8.7-4-2.bin verified OK 

Finally, the BOOT environment variable must be configured correctly to ensure that the switch boots from the new image, as demonstrated in Example 10-78.

Example 10-78. Configuring the BOOT Environment Variable on CatOS
 Switch-B> (enable) clear boot system all BOOT variable = XYZSW1> (enable) set boot system flash bootflash:cat4000-k8.7-4-2.bin BOOT variable = bootflash:cat4000-k8.7-4-2.bin,1; 

At this point, the operating system image is restored to Flash and the switch is configured to boot from the restored image file. If the switch is rebooted, the switch should boot normally with no problems.




CCNP Self-Study CCNP Practical Studies. Switching
CCNP(R) Practical Studies: Switching (CCNP Self-Study)
ISBN: 1587200600
EAN: 2147483647
Year: 2002
Pages: 135
Authors: Justin Menga

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net