Networking

Use the Cisco IOS archive command to archive your router's configuration

David Davis introduces the Archive command in Cisco, which you can configure to log all commands on your router. If you need to back up to a previous configuration, or see what went wrong after a change, the Archive command will help you find your way.

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!

14 comments
kiriki54
kiriki54

hello! i m trying this archive method using ftp : (config)#archive then (config-archive)#path ftp://username:password@192.168.217.1/filename and add (config-archive)#time-period 1440 to backup each 24 hours but when it backs up the file is only 133 bytes whike it should be 4 Kb since one week i can`t find the reason. can someone help me.

ravitripathi.81
ravitripathi.81

Hi and thanks for the great trick. I have made my XP PC a ssh server with openSSH and tested that i can ssh to it. I added the path on the cisco as path scp://User:password@PC_IP//cygdrive/d/router-backupp/router but when i am doing wr from the cisco then its giving me the error while writing (Portocol error) Can anyone suggest me any solution for this??or what i need to do to resolve it Thanks in advance Rak

aoladipo
aoladipo

I found this article interesting as many other articles from TR simply because it will save me much stress.I tried implementing it immediately on my network but while I could ping the tftp server from the router, once I issue the archive config command it came back with the reply %Error opening tftp://a.b.c.d/Rtr-1 (Timed out) Any tips?I am using tftpd32 if that is of any consequence. Thanks!

ahmedakther
ahmedakther

Indeed it is a valuable information given by a tech republic and looking forward for more information cisco router and thier new command and i need details on which router which command will work thanking you regard Akther Ahmed ahmedakther@hotmail.com

neelam.das
neelam.das

Sir First of all thanks for a nice article. But i have one question in my mind. if archive commnad is used for backing up the the router coniguration then what is the difference between copy run/start commnand and archive command. Hope for your reply Thanks

ravitripathi.81
ravitripathi.81

It working now..I got one clue that its not working just because of ssh version 1 which i was having at cisco. I generated keys and made the ssh version 2 to use and Hurreh..its now working all fine Cheers Rak

wratholix
wratholix

You should first have your tftp server in working condition. Perhaps look at your ACLs?

pjandrsn
pjandrsn

Ahmed, as Michael mentioned in his article: "Cisco IOS 12.3 introduced the Cisco IOS archive and archive config commands".So any router loaded with IOS 12.3 or greater I guess !

aoladipo
aoladipo

I found this article interesting as many other articles from TR simply because it will save me much stress.I tried implementing it immediately on my network but while I could ping the tftp server from the router, once I issue the archive config command it came back with the reply %Error opening tftp://a.b.c.d/Rtr-1 (Timed out) Any tips?I am using tftpd32 if that is of any consequence. Thanks!

walbro
walbro

Once the archive file is there, I am assuming that the rollback command (from an earlier article) would come in handy. Instead of- configure replace nvram:startup-config I'm guessing it would be- configure replace flash:my-backup1 Has anyone tried this combination yet?

pjandrsn
pjandrsn

Neelam, the Startup and Running are essentially the same except when you make a change which only affects the current config in memory, the startup config now contains the 'what was' config. So once you "copy run/start" any unintentional errors in the running config are now contained in the startup. Now suppose you decide to do a reboot because you can, and some minor network routing problem arises where there wasn't before. Now you say to yourself " Gee I must have done that wrong, if only I could remember exactly what changes I made". But because you did a 'wr' after the last change the difference is gone ! The Startup config is only a backup as long as you do not write the changes, once that's done it's too late.

neelam.das
neelam.das

Hi pjandsn Thanks for the reply, i understand the startup and running config concept, but my question is that suppose that i want to backup/save my running config i can save it to nvram or tftp simply using the copy commnad. Then whats the need of acrhive command in context of backing up the router configuration

wratholix
wratholix

You are right, it provides the same functionality. Only it is now automatised from now on and you gain the ability to do quick diff checks on your configs from the console. I like it

Editor's Picks