Saturday, January 31, 2009

Loading IOS image via TFTP in ROMMON

Always a pain in the backside, isn’t it, when you’re stuck with a router that has no image on it. Even if you up the baud rate to 115,200 it still takes an age to download an image over the serial port to the thing.

More recent routers seem to have a TFTP client built-into the ROMMON software though. Not entirely sure how recent a router has to be in order to have this facility, but it’s very handy and saves a lot of time.

You basically set a few environment variables so that the router knows what its IP address is, where the server is and what the file it should download is. After that, just issue the “tftpdnld” command and off it goes. Here’s what you do:

rommon 11 > IP_ADDRESS=192.168.1.5
rommon 12 > IP_SUBNET_MASK=255.255.255.0
rommon 13 > DEFAULT_GATEWAY=192.168.1.1
rommon 14 > TFTP_SERVER=192.168.1.10
rommon 15 > TFTP_FILE=c1841-advipservicesk9-mz.124-13a.bin
rommon 16 > tftpdnld
.
IP_ADDRESS: 192.168.1.5
IP_SUBNET_MASK: 255.255.255.0
DEFAULT_GATEWAY: 192.168.1.1
TFTP_SERVER: 192.168.1.10
TFTP_FILE: c1841-advipservicesk9-mz.124-13a.bin
TFTP_MACADDR: 00:13:80:7b:20:1e
TFTP_VERBOSE: Progress
TFTP_RETRY_COUNT: 18
TFTP_TIMEOUT: 7200
TFTP_CHECKSUM: Yes
FE_PORT: 0
FE_SPEED_MODE: Auto Detect
.
Invoke this command for disaster recovery only.
WARNING: all existing data in all partitions on flash will be lost!
Do you wish to continue? y/n: [n]: y

Receiving c1841-advipservicesk9-mz.124-13a.bin from 192.168.1.10 !!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
….
File reception completed.
Validating checksum.
Copying file c1841-advipservicesk9-mz.124-13a.bin to flash.
program load complete, entry point: 0×8000f000, size: 0xc100
.
Initializing ATA monitor library…….
.
Format: Drive communication & 1st Sector Write OK…
Writing Monlib sectors.
……………………………………………………………………..
………………
Monlib write complete
Format: All system sectors written. OK…
Format: Operation completed successfully.
Format of flash: complete
program load complete, entry point: 0×8000f000, size: 0xc100
Initializing ATA monitor library…….
rommon 17 >

Once that’s done, just issue a reset command and it should boot into IOS.


from : http://dataplumber.wordpress.com/2007/03/16/loading-ios-image-via-tftp-in-rommon/
© yankandpaste®

No comments: