Automatic IOS configuration backup

#network edit this page

If you are like me you frequently forget to backup router and switch configurations before making changes. Ok, maybe not so frequently but it happens… There are some ways to prevent this from happening, we can make manual backups or use the automatic archiving feature which is built into IOS.

Manual backup

A manual backup can always be taken using the ‘copy startup-config' command, typing a question mark ‘?’ after that command lists possible backup destinations:

RT#copy startup-config ?
  archive:        Copy to archive: file system
  flash:          Copy to flash: file system
  ftp:            Copy to ftp: file system
  http:           Copy to http: file system

So to backup a routers current startup-config to a FTP server you would simply type something like this:

RT#copy startup-config ftp://user:[email protected]

The username and password can also be configured so that you don’t need to type them in every time you are performing a backup.

RT(config)#ip ftp username tom
RT(config)#ip ftp password secret

Ok, that’s better but since the backup still has to be started manually chances are that one could forget it…

Automatic archive

The archive feature allows for automatic configuration backup that is triggered by a timer and the ‘write memory’ command. The following example configures the archive feature on router RT to create a backup once every 24 hours and additionally every time someone enters the ‘write-memory’ command, that is, every time someone makes a configuration change and decides to save that change:

time-period 1440

The time-period keyword simply configures how often a scheduled backup runs, if the write-memory command is configured a configuration backup is performed every time someone saves the config. The ‘show archive’ command displays the 10 latest configuration files:

RT#show archive
The maximum archive configurations allowed is 10.
The next archive file will be named<timestamp>-50
Archive #  Name

Obviously other backup destinations such as tftp or flash can be configured. IOS does not take care of the removal of old files, so even though only the 10 latest configuration versions are shown in the ‘show archive’ output, there might be more on the server.

Restoring configuration

If a configuration change needs to be rolled back the ‘configure replace’ command can be used. So if a configuration change had unintended consequences the ‘configure replace’ command could be used to restore the current running-config from a backup.