HCC Cisco Networking Academy
Educational Resources

IOS / Flash Recovery Procedure


Overview

It happens that the Flash memory of a router may be accidentally erased.  Also you may have a newer version of IOS to load on a router.  To restore the IOS to flash memory on one router, you must have a TFTP server accessible to that router on your network.  In a CNAP classroom this will typically mean using a second router connected to the same hub or switch as the first router.  (It is also possible to use any host computer as a TFTP server, since software for Macintosh, Windows, Unix, and Linux is readily available.)

To recover the Flash using a second router requires two steps.  First set up a working router (with the correct version of IOS for the non-working router) as a TFTP server.  Then you must boot the non-working router to the ROM Monitor / ROM BootStrap interface and start a TFTP download.  These steps are detailed below for Cisco 2600 series routers.

Step 1:  Setup Working Router as a TFTP Server

Determine the name of the IOS file to use and the IP address of an accessible interface, then start the TFTP server.  This is done using the show flash (or show version may be used instead) and tftp-server privledge exec command as follows.  Your output may be slightly different.  Input is shown in boldface, the relevant output is shown in red, and some omitted output is shown as "...":

Router-B# show flash

System flash directory:
File  Length   Name/status
  1   8148676  c2600-j-l.112-20.P.bin
[8148740 bytes used, 239868 available, 8388608 total]
8192K bytes of processor board System flash (Read ONLY)

Router-B# show version
Cisco Internetwork Operating System Software
IOS (tm) 2600 Software (C2600-J-L), Version 12(0)P,  RELEASE SOFTWARE (fc1)
...
System image file is "flash:c2600-j-l.112-20.P.bin", booted via flash
...
Router-B# show interface ethernet 0/0
Ethernet0/0 is up, line protocol is up
  Hardware is Lance, address is 00c0.4903.5ec3 (bia 00c0.4903.5ec3)
  Internet address is 210.93.105.2/24
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 1/255
  ...
Router-B# tftp-server flash:c2600-j-l.112-20.P.bin
Router-B#

Step 2:  Perform TFTP Download From Non-working Router

If the router has had it's flash memory erased, it will boot to ROM Monitor mode by itself.  The router should display a message and show the ROM Monitor prompt, something like this (user input shown in boldface):

rommon 1 >

In order to perform a TFTP download the router must be setup with certain information, including the IP address of the accessible interface of the TFTP server, the name file the file to download, and other information.  This is done in a Unix-like manner by setting certain environment variables to the required values like this:

rommon 1 > NAME=value
rommon 2 >

Both the case of the letters and spacing is significant when setting environment variables, so be careful!  Once this is done the download can be started using the tftpdnld command.  Finally use the reset command to reboot the router using the new IOS.

In this example we will assume the working router's accessible interface (Ethernet 0/0) has an IP address of 210.93.105.2/24, and that it is connected to the same switch as the non-working router.  Since no real gateway is needed in this case, that environment variable will be set to the same address as the working router.  Note all these values are temporary and will be lost when the router is rebooted.

The whole process looks like the following, using the information given above:

rommon 1 >IP_ADDRESS=210.93.105.1
rommon 2 >IP_SUBNET_MASK=255.255.255.0
rommon 3 >TFTP_SERVER=210.93.105.2
rommon 4 >DEFAULT_GATEWAY=210.93.105.2
rommon 5 >TFTP_FILE=c2600-j-l.112-20.P.bin
rommon 6 >tftpdnld
...
continue? y
...

Troubling Shooting Tips

Check the environment variables were set correctly.  Common errors include using lower-case, using hyphens instead of underscores, using spaces, or mis-spelling the name.  The names and values can be verified using the set command.  If you made an error, just type in the line correctly, the new value will replace the old one.  (Mis-spelled variables will be ignored.)

Check the switch between the two routers.  Make sure both ports are in the same VLAN, and are set up for the proper duplex setting.  (The router default is half-duplex). 




Send comments to Wayne Pollock.