Saturday, September 1, 2007

Router Troubleshooting

Q.Restore the Cisco IOS to a router

Ans.Have you ever accidentally wiped out the IOS on your router? 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]?
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! 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 the show flash command.)

This saves the IOS on the PC in the directory configured by the TFTP server. Figure A shows an example of what it 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 set command to display the current settings, which the program will use to download the IOS via TFTP. (For a Cisco example of these steps, check out this Cisco documentation.)

For example, here are the settings you must set for the tftpdnld command to work:

rommon> setIP_ADDRESS=10.253.100.126
IP_SUBNET_MASK=255.255.0.0
TFTP_SERVER=10.253.15.72
DEFAULT_GATEWAY=10.253.1.1
TFTP_FILE={the name of the IOS that is saved on the PC}
However, your settings may not contain any of the required variables for the tftpdnld command. By default, it may look something like this:

rommon 9 > set
PS1=rommon ! >
BSI=0
RET_2_RUTC=0
RET_2_RTS=?=1
If this is the case, set the required variables. While it might seem obvious to use the set command 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:For example, to set the IP address of the broken router, you would use the following:

IP_ADDRESS=10.253.100.126Final steps

After setting your values, run the tftpdnld command, which will replace the IOS. Listing A provides an example of how I restored a router

An alternate approach to the tftpdnld command

However, if the tftpdnld command doesn't work for some reason, you can use the xmodem command to send the IOS over the serial console line. (For instructions for this process, check out this Cisco documentation.) However, if you decide to take this route, it's a good idea to change the baud rate on the console and your PC to 115,200 so it doesn't take more than four hours for an 8-MB IOS file to transfer over the 9600-baud console.

On a final note, keep in mind that different models of Cisco routers and different Cisco firmware versions respond differently. For example, these commands performed on a 2600 series router may not work on a 3600 series router. However, the basic process remains the same

Q.You want to load configuration commands via the Trivial File Transfer Protocol (TFTP).

Ans. You can use the copy tftp: command to configure the router via the TFTP:
Router1#copy tftp://172.25.1.1/NEWCONFIG
running-configDestination filename [running-config]?
Accessing tftp://172.25.1.1/NEWCONFIG...
Loading NEWCONFIG from 172.25.1.1 (via FastEthernet0/0.1): !
[OK - 24 bytes] 24 bytes copied in 0.192 secs (125 bytes/sec)
Router1#


Q,You want to store a backup copy of your router's configuration on a TFTP server.
Ans. This example shows how to use TFTP to upload a copy of the router's active configuration to a remote server:
router#telnet Router1
Trying 172.25.1.5...
Connected to Router1.Escape character is '^]'.
User Access Verification
Password:
Router1>enPassword:
Router1#copy running-config tftp://172.25.1.1/router1-confg
Address or name of remote host [172.25.1.1]? Destination filename [router1-confg]? !!!9640 bytes copied in 3.956 secs (2437 bytes/sec)
Router1#


Q.You want to boot the router using an alternate configuration.

Ans. The following set of commands allows you to automatically load a configuration file located on a remote TFTP server when the router boots:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#service config
Router1(config)#boot network tftp Network-auto 172.25.1.1
Router1(config)#boot host tftp Router8-auto 172.25.1.1
Router1(config)#end
Router1#

Q.Your configuration file has become larger than the router's available NVRAM.

Ans.You can compress your router's configuration file before saving it to NVRAM to allow you to save more configuration information. The command service compress-config will compress the configuration information when the router saves the file, and uncompress it when it is required:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#service compress-config
Router1(config)#end
Router1#


No comments: