Do you want to create archives of your configuration before every configuration change is made? What was the difference between the configuration you saved last year and the one you saved today? The archive command can help you answer these questions and more. Check it out.

What is the Cisco IOS archive command?

The Cisco IOS archive command actually has a number of functions. For example, it can help you create archives of your router configuration. These archives can either be created manually by the admin or automatically by the router.

Also, and equally as important, the archive command can be used to automatically log all commands on a router and the name of the person who entered that command. From a security perspective, this is very powerful! Of course, you would want to make sure that you had individual usernames for all users logging in to the router. I would recommend Windows AD integrated authentication. (See my article “Configure Cisco Routers to Use Active Directory Authentication — the Router Side.”)

Like many Cisco IOS features, the archive command has many options. I’ll show you the basics of configuring Cisco IOS archiving.

How do you archive your router configuration?

Have you ever made a router configuration change, have something blow up the next day, and wish that you could go back to the old one? What if you neglected to save the config before you changed it? Can you figure out exactly what you did and try to put it back the way it was? The new Cisco IOS feature can help you solve that problem — or at least make it easier.

Cisco IOS 12.3 introduced the Cisco IOS archive and archive config commands. To configure archiving, you go into global configuration mode and then enter archive mode. This is done by entering the archive command. From here, the minimum requirement to configure archiving is to enter a path to where the archive files will be stored. You have the option to store the archived configuration in the router’s flash or just about any other destination, on or off the router (off the router, using HTTP, FTP, RCP, or TFTP). Of course, the recommendation would be to store it off the router and that way you have an automatic backup of your configuration in case the router’s flash goes bad.
In this example, I will just configure the basic path command and point the archives to go to the router’s flash; I will archive the configuration with the archive config command, and then show the contents of the archive with the show archive command.

Here is how you do it:

Router#
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)# archive 
Router(config-archive)#?
Archive configuration commands:
  default       Set a command to its defaults
  exit          Exit from archive configuration mode
  log           Logging commands
  maximum       Maximum number of backup copies
  no            Negate a command or set its defaults
  path          Path for backups
  rollback      Rollback parameters
  time-period   Period of time in minutes to automatically archive the
running-config
  write-memory  Enable automatic backup generation during write memory

Router(config-archive)# path flash:mybackup
Router(config-archive)#^Z
Router#
Router# archive config
Router#
Router# archive config
Router#
Router# show archive 
There are currently 3 archive configurations saved.
The next archive file will be named flash:mybackup-3
 Archive #  Name
   0
   1       flash:mybackup-1
   2       flash:mybackup-2 <- Most Recent
   3
   4
   5
   6
   7
   8
   9
   10
   11
   12
   13
   14
Router#

Something else I can do is to compare the differences between two archived configurations or the running config and an archived config, using the show archive config differences or incremental-diffs, like this:

Router# show archive config ?
  differences              Display the differences between two config
files
  incremental-diffs        Display lines in config file which will be
added to running-config

As these archived configurations are just text files in the flash memory, you can copy them back to the startup or running config anytime you want. Besides viewing them with the show archive command, you can view them with the dir flash command:

Router# dir
Directory of flash:/

    1  -rw-    14906116  Feb 08 2007 17:26:08 +00:00  c2800nm-ipbase-mz.124-3g.bin
    2  -rw-        1823  Feb 08 2007 17:34:32 +00:00  sdmconfig-2811.cfg
    3  -rw-     4734464  Feb 08 2007 17:35:04 +00:00  sdm.tar
    4  -rw-      833024  Feb 08 2007 17:35:20 +00:00  es.tar
    5  -rw-     1052160  Feb 08 2007 17:35:38 +00:00  common.tar
    6  -rw-        1038  Feb 08 2007 17:35:52 +00:00  home.shtml
    7  -rw-      102400  Feb 08 2007 17:36:06 +00:00  home.tar
    8  -rw-      491213  Feb 08 2007 17:36:22 +00:00  128MB.sdf
    9  -rw-     1684577  Feb 08 2007 17:36:44 +00:00  securedesktop-ios-3.1.1.27-k9.pkg
   10  -rw-      398305  Feb 08 2007 17:37:04 +00:00  sslclient-win-1.1.0.154.pkg
   11  -rw-        1964  May 27 2008 19:56:16 +00:00  mybackup-1
   12  -rw-        1964  May 27 2008 19:56:18 +00:00  mybackup-2

64016384 bytes total (39784448 bytes free)
Router#

Other options of the archive command are:

  • Save a set maximum number of backup copies of the configuration.
  • Automatically save your configuration periodically.
  • Automatically back up your configuration whenever you do a “write mem.”

These options can be configured in the global “archive configuration mode.” See below:

Router(config)# archive
Router(config-archive)# ?
Archive configuration commands:
  default            Set a command to its defaults
  exit               Exit from archive configuration mode
  log                Logging commands
  maximum            Maximum number of backup copies
  no                 Negate a command or set its defaults
  path               Path for backups
  rollback           Rollback parameters
  time-period        Period of time in minutes to automatically archive
the running-config
  write-memory       Enable automatic backup generation during
write memory
Router(config-archive)#

Back up your router configuration

The archive command is a powerful tool that I recommend to Cisco admins to be implemented on all routers. You can do both local backups of configurations as well as remote backups. You can configure the archive function to automatically make configuration backups at set times or whenever you save your changes. In an upcoming article, I’ll show you how to use the archive command to log all commands entered on the router.

Miss a column?

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays