Cisco IOS schedule automatic configuration backup

Backing up a Cisco router or switch configuration is crucial for any network administrator. Wouldn’t it be useful if you could schedule an automatic configuration backup to an offline location? Or backup your configuration automatically to an offline location whenever you execute a “copy run start” command?

Introducing the “archive” command

1. First enter config terminal mode and enter archive

Router#config t

2. Then select the destination path you want to write to. You can write to many different locations, the most useful I find is tftp as you do not need to go through authentication when saving a file.

Router(config-archive)#path ?
  ftp:    Write archive on ftp: file system
  http:   Write archive on http: file system
  https:  Write archive on https: file system
  pram:   Write archive on pram: file system
  rcp:    Write archive on rcp: file system
  scp:    Write archive on scp: file system
  tftp:   Write archive on tftp: file system
Router(config-archive)#path tftp://backupserver/cisco/Router-

3. Then enter the write-memory command as that will enable automatic backup generation during a copy run start.


4. Next you want to set how long it takes before it saves the configuration to your desired location. I have set 1440 which is 24hrs.

Router(config-archive)#time-period ?
    Number of minutes to wait between archive creation
Router(config-archive)#time-period 1440

5. Once you are done whenever you make do a copy run start, IOS will automatically save a copy of your configuration to your configured destination. In addition every 24hrs (the time period you have set) the configuration will be automatically saved onto your destination.
6. To display your saved configuration you may do a “sh archive” command and it will give you a list of the last 15 configurations you have saved as well as the filename that will be named after on your next save.

Router#sh archive
The next archive file will be named scp://
 Archive #  Name
   1       scp://

Backup to a Linux Server using SSH/SCP

This one is easy to do as long as you have a Linux server with sshd enabled.
Below is an example. The username and password will be exposed in the configuration however:

path scp://username:password@sshserver/filename

Useful tips on shorthands and variables you can use on filenames

The archive command provides some useful variables you can use in naming your config file. I use the following variables for saving the filename with hostname appended with date/time.

path scp://username:password@sshserver/$h-$t

Here’s a sample output of the filename when using the above:


$h – C1751V is my router name
$t – May-24-22:55:52.145-PDT-7 is the date and time.

Related Posts with Thumbnails

About the Author

Alfred Tong
Author and owner of this blog. A Networking enthusiast, full time networking and systems Engineer. Generally curious about all things IT.Certifications: GIAC GSEC, CCNP-S, CCNP, CCSP, CCDP, CCNA, RHCE, JNCIA - FWV