In the last two parts of my series on the 4006 switch (“A better approach to upgrading the Cisco 4006 switch” and “Upgrading the Cisco 4006 switch”), I first demonstrated a case study in the art of how not to upgrade the switch, in which we dealt with several unusual problems associated with the upgrade process. Then I presented a straightforward upgrade process on a functioning switch with a running OS. For this Daily Feature, I’ll be discussing how to deal with either the recovery of a failed OS or loading a new OS on a switch without a running OS.
The recovery/upgrade process
So how do we recover a switch with a corrupt OS or upgrade to a new OS when no OS is loaded and running? We can perform this process in a very similar fashion to that described in my previous article, although the interface will appear a bit different. In a nutshell, the process consists of copying a new OS file to the flash file system and setting the boot variable to load the new OS. We’ll start by logging into the switch via the console port from a laptop. If the switch cannot load an OS file, you will be confronted with a rather abbreviated and somewhat less friendly interface known as rommon mode. Whenever a switch boots, it will load the OS file specified in the boot variable, unless the file is not present or is corrupt. If the system does start in rommon mode, it simply means that we have to approach the problem from a different viewpoint. The first thing to consider about rommon is which features are (and are not) available to you. By typing a question mark (?), you’ll get a help list of available commands, but that’s only part of it. Another issue to consider is what interfaces are available in rommon mode. If you type the following command, you’ll get a list of the interfaces:
rommon > show interface
It’s more than likely that you’ll see only one interface in the listing, me1. What, you may ask, is the me1 interface? Literally, it is the management Ethernet interface. Physically, it is an RJ-45 socket located on certain models of the 4006 switch supervisor engine. Unlike the sc0 interface, it is an out-of-band interface, which does not participate in the switching process. However, we can plug an Ethernet NIC directly into it and use it to upload the new OS file. The big question is, how? First, we’ll assign an address and mask to the me1 interface, as in the following example:
rommon > set interface me1 172.16.10.5 255.255.255.0
When setting the address for me1, be sure not to place it in the same subnet where the sc0 interface will reside, as this can cause conflicts when accessing the switch via the network after the upgrade process is complete. At this point, we should be able to connect a patch cable from the laptop NIC to the me1 interface and start a telnet session. That is, assuming that the laptop IP address is in the same subnet as me1. Now we have to think about how we’re going to get to the TFTP server. If we were loading the OS from a TFTP server on the network but on a different subnet, we would have to set up a default gateway on the switch. Fortunately, this too can be accomplished in rommon, as follows:
rommon > set ip route default 172.16.10.1
In this case, we’ll be running the TFTP server locally on the laptop where we have the new OS file loaded. Now we’ll configure the TFTP server environment variable on the switch with the address of our laptop:
rommon > TftpServer=172.16.10.12
At this point, it would be great if we could just copy the new OS image file to flash, but that isn’t the recommended method. Since the switch has now been configured with the location of the TFTP server, we can netboot the new OS. Then we can copy it to flash. To netboot the 4006 switch, execute the following command from rommon:
rommon > boot cat4000.5-5-1.bin TftpServer
After the switch reboots, we can reconnect via me1 and perform the copy process, as follows:
Console>(enable) copy tftp flash
Naturally, we’ll be prompted for filename information, TFTP server address, etc. Once the OS image download is complete, we’ll need to modify the boot variable to include the new OS filename, like so.
Be sure to add the prepend parameter if you've still got the old OS file in flash. Otherwise, the boot variable may list the old OS file first and the newly added OS second. You can check the load order with the show boot command. After this, we simply reload the switch to ensure that it is booting the new OS:
At this point, the task is nearly complete. We simply need to perform a basic switch configuration via the console interface. We’ll set up the sc0 management interface, a default gateway, and the switch name.
Now we can access the switch via the network to perform further configuration tasks, or we could copy a config file to the switch. Either way, the switch is up and running with a new OS version. Keep in mind that this operation is most appropriate in the two previously mentioned situations: recovering from a failed or corrupt OS, and upgrading the OS in a switch with no running image.