This is a quick-and-dirty howto guide describing how to backup your router’s IOS and config prior to performing an upgrade.  This is aggregated from notes taken during a recent upgrade of a 7206VXR during which an NPE-400 network processing engine was installed.

I am going to assume you know how to connect to a Cisco router using telnet, ssh, a modem via the AUX port, or a rollover cable via the Console port.  I am also going to assume you have a working knowledge of the IOS, at least to the extent that I don’t have to explain in much detail the difference between modes on the CLI.  I am also going to assume that you’re running a TFTP server to which these backups can be sent.  I set up a simple TFTP server on my Macbook Pro, but there are dozens of freeware FTP server packages available for Mac, Windows, and Linux.

So I turn on my TFTP server, which is associating it’s root directory with a desktop folder I am calling /backupIOS, and I connect to my 7206VXR via the rollover cable and console port.  I login and invoke privileged mode using the “enable” command.  I ping the IP of my TFTP server to verify it is online and when I see that my ping was successful I am ready to backup my IOS.

Now, my 7206VXR has an NPE-300 in it which means it has a separate PCMCIA IO card.  Until I upgrade to a G1 (which would cost about 9 grand) I am stuck with PCMCIA cards.  Be aware that other routers store the IOS is other places, such as onboard.  If you store you IOS onboard then the command you will need to copy the IOS remotely is:

Router#copy flash tftp

see the Router# prompt?  That tells you that you are in privileged mode.  If you saw Router> you are in user mode and won’t have the authority to perform the copy action.  If you are using a router with PCMCIA flash then you should use a command like:

Router#copy slot0: tftp

my PCMCIA card is plugged into the “top” slot, so I use slot0 ( you might use slot1 ).  Regardless of the location of your flash storage, this command will return a prompt asking you for the IP address of your TFTP server.  Enter the IP of your TFTP server and press the ENTER key and you will see another prompt about renaming the IOS image at the remote location – do yourself a favor and keep the existing name.  Press ENTER again to keep the existing name, or throw caution to the wind and rename it if you want, and you’ll see the file transfer progress which looks alot like this:

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

you get the idea.  When it completes you will see a message indicating the transfer was complete and the size of the file transfered.  It will also tell you how long the file transfer took.  Congratulations, you have backed up your IOS image to a remote location and have added a safeguard for which you should be rewarded.

Now let us backup your running-config in case something goes wrong and you need to perform a restore on a second device.  Invoke privileged mode and enter the following:

Router#copy run tftp

this command can be interpreted as “copy my current running-config to a remote tftp server” – as an alternative you can backup the startup-config using:

Router#copy start tftp

Either command, depending on your needs, will return the prompt that asks for the IP of the TFTP server and in that respect nothing has changed.  When you hit ENTER the prompt will ask you for the filename and, in this situation, it may be beneficial to name this file something descriptive like “7206VXR_NPE300_RunConfig_mmddyy” indicating the device type, configuration parameters, type of config, and the date the copy was made.  You’ll see the !!!!!! progress again and you’ll be provided with a message indicating the success of transfer and how long it took to complete.

You can now backup IOS images and configs which is a great first step before any kind of upgrade.  You really don’t want to find yourself without a known good IOS and running-config in an emergency.  I know I certainly don’t.  But what if you need to restore?

To restore you get yourself into privileged mode and ping the TFTP server.  Then invoke the following command to copy the IOS image from TFTP to your Router (first example is a regular router like a 2524):

Router#copy tftp flash

this will bring up the dialog prompting for the IP of your TFTP server.  When you hit ENTER after submitting the IP it will ask for the source file you would like to upload and here you must enter the full name of the IOS image you would like to upload and when you hit ENTER you should choose to use the same destination file name.  Assuming you saved the binary file using it’s Cisco name this should never cause a problem.  You’ll find that the Integrated Service Router (ISR) IOS image names are much easier to understand since they also provide a description of their purpose.

After you decide on the destination filename you’ll be asked if you want to erase the current flash.  This is scary, but remember that you have already copied the contents of flash to TFTP, so hit ENTER to erase.  You’ll wait a few moments as the current flash is erased, biting your nails, and then you’ll see that the binary image you chose is being uploaded.  Again, after the upload is complete there will be a dialog indicating success and how long it took to complete.  You should also see the checksum dialog verify your image and return a hex value.  As long as you see the all important “OK” then you’ve uploaded your IOS image properly.

At this point you may be anxious to restart the router and see if your IOS has taken properly BUT FIRST YOU SHOULD STOP…..

that got your attention.  Prior to reloading the router you need to be sure that the configuration register is set to 0×2102.  This can be done by looked at the output of the “show version” command.  If the configuration register is something else you can change it using:

Router#config-register 0×2102

Next you want to ensure that when this device boots it loads the new .bin IOS image.  You can do this using:

Router#no boot system

Router#boot system flash <image name>.bin

you can then reload safe in the knowledge that the binary image passed the checksum, you have a backup anyway, and the system will boot the binary file you specified just in case there were a couple in there or you failed to erase the flash properly.  When you enter the reload command, “reload,” you’ll have to choose to save the current system configuration as well as to continue the reload.  After it comes back online you can use “show version” to see the new IOS image is in use.

This process is similar for the startup config and the rules above can be used as a good general guideline for uploading that via TFTP:

Router#copy tftp start

enter the TFTP server’s IP, choose the correct source file name, enter the appropriate destination name whichever it happens to be, and allow to complete and then reload.  You should also edit the config file and remove any “AAA” commands from the config – these might cause problems accessing the router but can be done in notepad or textedit.

Restoring the IOS and configs is a little different if you have PCMCIA flash.  You will need to make sure that your PCMCIA card has enough room left on it for the binary file.  You can do this by using:

Router#dir slot0

you’ll see a summary of available space and, as I most often see, you will come to the conclusion that you need to get rid of the previous IOS image.  You can do this using:

Router#delete slot0: <image name>.bin

this is a bad time to lose power or reload the router – maybe the worst possible time – at this point you have NO functional IOS image with which to boot.

now upload the IOS image like so:

Router#copy tftp slot0:

You will see the familiar request for the TFTP server’s IP, the request for the IOS image name source and destination, and you will be asked if you want to erase your flash again.  After the IOS image has been uploaded you’ll see the dialogue verifying checksum, indicating completion, and telling you how long it took.  Now you verify the flash image just like before:

Router#dir slot0:

Router#no boot system

Router#boot system flash slot0: <image name>.bin

you’ll need to set the config register as well:

Router#config-register 0×2102

Router#copy run start

Router#reload

those last two commands copy the running-config to the startup-config and reload the router which should boot up using the IOS, verified using “sho ver,” and the former running-config.

ADDENDUM:  something you should be aware of when dealing with the 7206VXR and other 7000-class modular devices is that your NPE module and your supervisor module must match up in terms of IO.  Because of this idiosyncrasy it is wise to first backup your IOS and running-config prior to making a hardware upgrade.  If this upgrade results in an IO mismatch issue you can copy your IOS image and running config back to restore.