Jamsud's Blogs

Computer Network Infrastructure, Network Design Simulation & Misc IT Stuff.


Booting IOS via TFTP from a rommon environment

While most of us are working on routers we occasionally do an IOS upgrade while doing so we encounter some problem which will not let boot the IOS properly. I will be sharing my experience on one of my IOS upgrade in which it turn out that the flash of the router is defective in this case I end up losing the IOS i have downloaded on the flash and no way to boot up from the flash itself so I’ve check the net and found how to bypass this problem and let the router boot-up with the IOS from an TFTP itself. (This is just a workaround to make sure the router is still working while purchasing a new Flash)

Network Setup (Assuming we have the TFTP Server connected Directly to the Router)

Rommon-TFTP

Here’s the logs on what I’ve done.

Below you could see that it could not detect the flash which our IOS is located

System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.
Initializing memory for ECC
.
c2821 platform with 262144 Kbytes of main memory
Main memory is configured to 64 bit mode with ECC enabled

Readonly ROMMON initialized
 loadprog: error - on file open
 boot: cannot load "flash:c2800nm-advipservicesk9-mz.124-15.T9.bin"
c2821 platform with 262144 Kbytes of main memory
Main memory is configured to 64 bit mode with ECC enabled

rommon 3 > dir flash
 bad device name
 usage: dir <device>
 usage: dir dir flash":
 monitor: missing closing "
 rommon 5 > dir flash:
 dir: cannot open device "flash:"
 rommon 6 > dir flash:
 dir: cannot open device "flash:"

Checking other media available on the router which an IOS reside so we could boot up an IOS but as you could see there are none.

rommon 7 > dev
Devices in device table:
id name
flash: compact flash
bootflash: boot flash
usbflash0: usbflash0
usbflash1: usbflash1
eprom: eprom
rommon 8 > dir bootflash:
device does not contain a valid FS
dir: cannot open device "bootflash:"

So our only option now is to boot via TFTP while on a rommon environment, to do that we need to set some parameters.

We need to set the following parameters

IP address/Subnet
Default Gateway (Optional if the TFTP server is on LAN)
The IOS image on the TFTP Server
Execute the tftpdnld –r

Below is the actual command in setting the parameter needed.

rommon 9 >  IP_ADDRESS=10.XXX.24.2
 rommon 10 > IP_SUBNET_MASK=255.255.254.0
 rommon 11 > DEFAULT_GATEWAY=10.XXX.24.1
 rommon 12 > TFTP_SERVER=10.XXX.24.55
 rommon 13 > TFTP_FILE=c2800nm-advipservicesk9-mz.124-15.T9.bin
 rommon 14 > tftpdnld -r 
IP_ADDRESS: 10.XXX.24.2
IP_SUBNET_MASK: 255.255.254.0
DEFAULT_GATEWAY: 10.XXX.24.1
TFTP_SERVER: 10.XXX.24.55
TFTP_FILE: c2800nm-advipservicesk9-mz.124-15.T9.bin
TFTP_VERBOSE: Progress
TFTP_RETRY_COUNT: 18
TFTP_TIMEOUT: 7200
TFTP_CHECKSUM: Yes
TFTP_MACADDR: XXX.XXX.XXX.XXX
GE_PORT: Gigabit Ethernet 0
GE_SPEED_MODE: Auto
.
Receiving c2800nm-advipservicesk9-mz.124-15.T9.bin from 10.XXX.24.55

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

File reception completed.
Validating checksum.
loading image c2800nm-advipservicesk9-mz.124-15.T9.bin
program load complete, entry point: 0x8000f000, size: 0x310cb04
Self decompressing the image :
##################################################
##################################################
##################################################
##################################################
##################################################
################################# [OK]

Smart Init is disabled. IOMEM set to: 20
Using iomem percentage: 20

Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706

Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T9, RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Tue 28-Apr-09 13:09 by prod_rel_team
Image text-base: 0x400AF910, data-base: 0x437AB3E0

Unknown file system detected.
Use format command to format the card as DOS File System.
Or use erase command to format the card as Low End File System.
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
 
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
 
If you require further assistance please contact us by sending email to
export@cisco.com.

Installed image archive
Cisco 2821 (revision 49.46) with 210944K/51200K bytes of memory.
Processor board ID XXXXXXXXXXX
2 Gigabit Ethernet interfaces
4 Channelized (E1 or T1)/PRI ports
2 Virtual Private Network (VPN) Modules
DRAM configuration is 64 bits wide with parity enabled.
239K bytes of non-volatile configuration memory.
0K bytes of ATA CompactFlash (Read/Write)

% Crashinfo may not be recovered at flash:crashinfo
 % This file system device reports an error

Press RETURN to get started!

As you could see we have successfully booted up a router via a TFTP server in a rommon environment.

Please note the that command

tftpdnld –r 


direct the router to load the IOS on memory rather than downloading it to the flash which is the cause of failure.

// < ![CDATA[
// < ![CDATA[

(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject‘]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);
 

ga(‘create’, ‘UA-53500012-1’, ‘auto’);
ga(‘send’, ‘pageview’);

 
// ]]>



Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.