Thursday, January 26, 2012

HOW TO Download a Cisco IOS image using tftpdnld ROM mon Command

I used to think ROM mon mode was something bad and scary, like the blue screen of death!  But actually you could interupt a regular startup sequence and jump into ROM mon mode on purpose, using Ctrl-break during a Hyper Terminal session. (or try Ctrl-c or escape).  Anyway, I arrived in ROM mon during a simple Cisco IOS upgrade that went bad.

WHAT WENT WRONG
Hardware: the Cisco 2800 Series

Somewhere along with the way, during a routine copy tftp flash, there was an incomplete copy of the new Cisco IOS software, and I ended up in ROM mon mode. There was no valid image in the flash, so the router would never boot beyond ROM mon so I had to the tftp transfer by tftpdnld in ROM mon mode.

I found a very useful solution on the Cisco Support website, which I can reference and make some notes for myself:
  • HOW TO Download a Cisco IOS image using tftpdnld ROM mon Command Document ID:12714
  • ROMmon Recovery for the Cisco 2600 Series Router and the VG200 Document ID:15079

Understanding tftpdnld
Use the "set" command to view the ROMmon environment variables.
See Cisco tftpdnld Document 12714 set the correct commands for the tftpdnld
Use TFTPDNLD for extreme disaster recovery only to recover the operating system image software via tftp.

rommon 3> set

Here is the sample settings
IP_ADDRESS: 10.10.10.1 (for your router)
IP_SUBNET_MASK:255.255.255.248
DEFAULT_GATEWAY:10.10.10.6
TFTP_SERVER:10.10.10.2 (the laptop acting as the tftp server)
TFTP_FILE: c2600-is-mz.113-2.0.3.Q

TFTP_CHECKSUM = 0 (If prompted, use this as a workaround for the bug).

rommon 9> sync
Use the "sync" command to save the ROMmon environment variables to NVAM

rommon 10> tftpdnld -r
Choose the -r option if you don't want to overwrite the flash, load to DRAM only and launch
-u means upgrade the rommon, system will reboot once upgrade is complete.

There is a question, WARNING: all existing data in all partitions on flash will be lost! Do you wish to continue, say no, but the file reception will still continue.

rommon 16> reload
Reload reboots the router and you should be back in business!

HOW TO Upgrade the Cisco IOS by TFTP
This is what should've happened... a regular run of the mill Cisco IOS Upgrade of course! The intent was to copy a Cisco IOS from a tftp server to flash.
#show running
#conf  t
(conf)# int eth 0
(conf-int-eth0)# ip address x.x.x.x y.y.y.y
set the IP address to one on the same network as the TFTP Server
#show flash
view the name of the current flash image, and make a copy to a tftp server for safekeeping
#copy flash:flashimage tftp://ipaddress/flashimage
#delete flashimage
copy tftp://ipaddress/flashimage flash:flashimage

However the flash memory was too small, which is normally not a big deal but I further damaged the flash card by accidently re-formatting on Windows and not the Cisco proprietary format.

Anyway if there are too many Cisco IOS software images on the flash, you'll have to update the following in the configuration file.

conf t
no boot system flash oldflashimagename
boot system flash flashimage
exit

ROMMON IN CONFIGURATION REGISTER
Check the value of configuration register.
The first four bits of the configuration register indicate the boot field, which defines the source of the default Cisco IOS software image (normally the flash). If it is 0 as in the configuration register value of XXX0 then at startup the system enters the ROM monitor mode prompt.

(rommon)>

Use the "confreg " command to verify the value of the configuration register and where it will look for the
Cisco IOS software image on startup to boot from.
(rommon) 2 > confreg
0 = ROM Monitor
1 = the boot helper image
2-15 = boot system

Make your choice, say 2 and issue the command to router to reset, to take effect.
(rommon) 3> reset

Looking for the Valid Image in Flash
(rommon) 1 > dir flash
(rommon) 2 > boot flash:c2600-i-mz.122-10b.bin

copy run start
wr or reload (does the same thing)

Cisco Field Notice
Months after I needed to decommission this router and do something else with it so I erased the start-up config and issued the reload command. Remember this is a new 256 MB card (not the 64MB card it came with) It went into ROM MON again, I couldn't see the flash and the confreg was set to something wierd. I believe I should've just set the confreg 0x2102 the factory default but I just swapped cards with the other router a 128MB card and it seemed fine. I fragments of a 64 MB error. I'll have to resolve this tomorrow but here's the scoop: http://www.cisco.com/en/US/ts/fn/620/fn62127.html

No comments:

Post a Comment