Wednesday 4 February 2015

Restoring IOS to the device

If you're working quickly and not paying attention, it can be an easy mistake to make. All it takes is making a typo in the destination filename when you're trying to save a change.
Here's an example:
router# copy running-config startp-config
Destination filename [startp-config]?
Erasing the flash filesystem will remove all files!
Erase flash: before copying? [confirm]
Continue? [confirm]
Hitting [Enter] a couple of times out of habit can all too quickly wipe out the IOS. If you don't realize the mistake in time, rebooting the router means the IOS is gone for good, and the router won't boot up.
Losing the IOS can also happen when upgrading the flash on the router. As the Cisco IOS grows larger, having to upgrade your flash is a very common task. But when you install the new flash, it has no IOS, leaving you in the same position as if you had accidentally erased the flash.
Unfortunately, if you're like many people, when you wipe out the IOS, you may not have a backup copy of the IOS. Or, you may not have access to the Cisco IOS download site or have the time to download the somewhat large IOS file.
And if you're looking for the same IOS on all of your routers, it can be difficult to locate it on the Cisco IOS download site. Many times, it's much easier to take the IOS from an existing router and restore it on the router that's missing its IOS.
Let's look at the step-by-step process for restoring the Cisco IOS to a router using this method.

Install a TFTP server

First you need to install a (TFTP) server. I recommend the Tftpd32 server, which you can download from the Web. This is a great TFTP server, without a lot of the fluff that most of the others have. At less than 1 MB, it's very small and has no install application.Run the TFTP server on a PC
If you've just pulled the working router off a shelf, you can connect the PC to the router with a reverse Ethernet cable. Configure the router and PC on the same network. Make sure that you can ping the router and that the router can ping you.
If your working router is up on your network, you can just download the IOS over the network directly using instructions in the next section.

Copy the IOS from the working router to the PC

Here's an example of how to accomplish this:
copy c2600-12-3.xxxx.bin tftp://10.253.15.72
Replace 10.253.15.72 with the IP address of your PC, and replace c2600 with the name of your IOS. (You can locate the name of the IOS on the working router using theshow flash command.)
This saves the IOS on the PC in the directory configured by the TFTP server looks like while downloading. Make sure to note the directory in which you'll save the IOS.Download the IOS to the nonworking router
The best way to accomplish this is via Ethernet. The alternative—using XMODEM through the console—will be very slow, even if you increase the serial port baud rate to the maximum. So, instead, connect the PC's reverse Ethernet cable to the nonworking router (or use two normal/straight-through Ethernet cables and a switch).
Without an IOS, the nonworking router will boot up in ROMmon mode. The prompt will look like this:
rommon>
Verify the necessary settings
On the console of the nonworking router while in ROMmon mode, use the setcommand to display the current settings, which the program will use to download the IOS via TFTP. For example, here are the settings you must set for the tftpdnld command to work:
rommon> set
IP_ADDRESS=10.253.100.126
IP_SUBNET_MASK=255.255.0.0
TFTP_SERVER=10.253.15.72
TFTP_FILE={the name of the IOS that is saved on the PC}
DEFAULT_GATEWAY=10.253.1.1
However, your settings may not contain any of the required variables for the tftpdnldcommand. By default, it may look something like this:
rommon 9 > set
PS1=rommon ! > 
BSI=0
RET_2_RTS=
RET_2_RUTC=0
?=1
If this is the case, set the required variables. While it might seem obvious to use the setcommand to set the variables, you can actually set the variables simply by entering the name of the variable, the equal sign [=], and the value.
For example, to set the IP address of the broken router, you would use the following:
IP_ADDRESS=10.253.100.126
Final steps
After setting your values, run the tftpdnld command, which will replace the IOS.

No comments:

Post a Comment