Friday, November 27, 2009

How to Backup and Restore the Configuration of a Cisco Router

SkyHi @ Friday, November 27, 2009
When would you need this: When you plan to upgrade the IOS, plan to implement something new in the configuration, or when you need to copy the configuration from one router to the other.

Special Requirements: None.


Before starting the procedure of configuration backup or restore, you will need to install TFTP server software on a PC connected to the router Ethernet interface. There are many free downloadable TFTP servers’ software on the Internet, however, our recommendation is Free TFTP Server 6.0.

Afterwards, you make sure to direct the TFTP server to the folder that you want to contain the backups, and that the TFTP server has enough free space to contain the backups.

1. Create a console connection with the default settings (9600 baud, 8 databits, 0 parity bits, 1 stop bit, no flow control).

2. Check the connectivity between the router and the TFTP server with the ‘ping’ command.

3. Start copying the configuration to the TFTP server:

Router#copy run tftp

Or

Router#copy start tftp

Then you will be asked for the IP address of the TFTP server

Address or name of remote host []? XXX.XXX.XXX.XXX

Afterwards, you will be asked for a destination file name to be saved on the TFTP server

Destination filename [Router-confg]? backup_cfg_for__routerX

It is better to choose a descriptive name so you would not mix the different configuration files.

Now you will see the progress of the operation

!!

xxxx bytes copied in y.yyy secs (zzz bytes/sec)

The configuration file is usually copied quickly because it usually not more than few kilobytes.

The backup procedure is now over. You can open the file copied to the TFTP server with the text editor and view or modify it.

The restore procedure is done by replacing step 3 of the previous procedure with the following:

Router#copy tftp run

Or

Router#copy tftp start

Now you will be asked to provide the TFTP server IP address

Address or name of remote host []? XXX.XXX.XXX.XXX

Then you will be asked for the source file name

Source filename []?backup_cfg_for__routerX

Destination filename [running-config]? <<< or [startup-config]

Accessing tftp://XXX.XXX.XXX.XXX/backup_cfg_for_routerX...

Loading backup_cfg_for_router from XXX.XXX.XXX.XXX (via FastEthernet0/0): !

[OK - xxxx bytes]



xxxx bytes copied in y.yyy secs (zzz bytes/sec)



It is advised that you remove any configuration lines containing ‘AAA’ commands from the backup file before restoring so you would not have any security problems accessing the router. You can do that with any text editor.

There are two other ways to backup and restore the configuration; FTP and the HyperTerminal.

You can use FTP to backup and restore the configuration by doing the following:

1. Give the router username and password to use for FTP access:

Router(config)#ip ftp username YOURUSERNAME

Router(config)#ip ftp password YOURPASSWORD

2. Use the following commands for copying the configuration to and from the FTP server:

Router#copy run ftp <<< or copy start ftp

And

Router#copy ftp run <<< or copy ftp start

And you will have to give the same info given in step 3 of the previous procedure to complete the transfers.

If you do not have TFTP or FTP servers around, you can use the good old HyperTerminal to backup and restore the configuration by doing the following steps:

1. Create a console connection with the default settings (9600 baud, 8 databits, 0 parity bits, 1 stop bit, no flow control).

2. Issue the following command:

Router#terminal length 0

This command will cause the show commands results to be displayed continuously without pagination.

3. On the HyperTerminal menu, select Transfer > Capture Text. The Capture Text window will appear.

4. Choose a name for the configuration file to be saved (ex: configuration.txt) and click Start.

5. Issue the command:

Router#show run <<< or show start depending on the configuration you want to backup

6. After you see the whole configuration displayed, on the HyperTerminal menu, select Transfer > Capture Text > Stop to end the screen capture.

This concludes the backup. You may also edit the file that you have saved to erase the lines containing ‘AAA’ commands to avoid access and security problems that may be caused by the restore operation.

The restore procedure goes as the following:

1. Open the configuration backup file with a text editor and select all the text by pressing Ctrl-A key simultaneously. Now choose ‘Copy’ from the Edit menu or simply press Ctrl-C.

2. Go to the HyperTerminal window that is connecting you to the router you want to perform the restore on. Afterwards, go to the privileged mode.

3. From the HyperTerminal menu, choose Edit > Paste to Host.

4. Check the configuration by ‘show run’ command. If everything sounds fine, use the ‘copy run start’ command to save the restored configuration.

Reference: http://www.routergeek.net/content/view/34/37/