Thursday, February 24, 2011

Booting a Cisco router from a USB Flash Drive


Cisco routers typically store a copy of the device’s operating system (Cisco IOS) in their flash memory, and load this operating system image into RAM during the boot-up process. The flash memory of Cisco routers is usually internal or can be a removable flash card on higher end routers.
However, it may happen that for various reasons the operating system image may not be available, maybe due to file corruption, flash memory corruption, accidental deletion, etc. In this case the device does not have a valid image to load and therefore the router boots into ROM monitor mode (rommon). This mode gives a reduced set of commands that essentially allow the administrator to manually run the boot sequence.
For such cases, and using commands in the ROMMON mode, the Cisco ISR routers have 1 or 2 USB ports that can be used to load the IOS image from a USB flash drive.

How to Boot from USB
The obvious prerequisite of this procedure is to have a valid IOS image, which is suitable for the device you want to put into operation, stored on a USB flash drive. Once we have this resource, we must enter into ROM Monitor mode (rommon). If the device did not have a valid IOS image in the internal flash memory, it will go directly in that mode. If not, we can force entry into rommon mode by interrupting the boot sequence using “Ctrl + Break”.
From this point, we can see the rommon mode prompt:
rommon 1>
In this mode we can see the list of available commands using the question mark or helpcommand:
rommon 1>? 
or
rommon 1> help
Then we can check our image stored on USB flash drive:
rommon 2> dir usbflash0:
program load complete, entry point: 0x8000f000, size: 0x3d240
Directory of usbflash0:
2 …… 14871760-… ..- rw-ipbase c2800nm-mz.124-3.bin
Note: The command is dir usbflashx: where x assumes a value of 0 or 1 depending on which USB port of the router you are using.
Then run the command that orders the router to boot from the image stored on USB flash:
rommon 3> boot usbflash0: c2800nm-ipbase-mz.124-3.bin
program load complete, entry point: 0x8000f000, size: 0x3d240
program load complete, entry point: 0x8000f000, size: 0xe2eb30
Self decompressing the image:
################################################## ########################################
################################################## ############# [OK]
Once the router has booted up, you can now work with the normal IOS command line interface. You can copy the image we have in our USB flash into the internal router’s flash memory:
Router> enable
Router # copy usbflash0: c2800nm-ipbase-mz.124-3.bin flash: c2800nm-ipbase-mz.124-3.bin

From now on, the router will be booting up from the internal flash memory.

source

No comments: