Overview

The archive command is available to manage configuration file versions. The archive command allows you to save a configuration file at a point in time and then roll back to the saved configuration file at a later time.

This section describes how to use the archive command to manage configuration file versions.

What is version management of configuration files?

Configuration file versioning means that the configuration file (running-config) at a certain point in time is stored in an archive. The archive is an area where a version of a configuration file at a particular point in time is stored. Local storage such as the router’s flash memory or an FTP/TFTP server can be configured as the archive. In addition, the following timing can be configured as a trigger to save the configuration file to the archive

  • When saving configuration(copy running-config startup-config/write memory)
  • Specific time interval
  • Arbitrary timing (manual archiving)
Figure Save version of configuration file in archive
Figure Save version of configuration file in archive

archive command

The archive command is used to create an archive to store the version of the configuration file and the trigger to save it.

archive command(config)#archive
(config-archive)#path <url>
(config-archive)#maximum <number>
(config-archive)#write-memory
(config-archive)#time-period <minutes>

<url> : path of the archive and file name of the configuration file to be saved
<number> : Number of versions of configuration files to keep
<minutes> : Interval to save automatically (minutes)

Specify the path and file name of the archive for saving the configuration file version in path. You can specify an FTP/TFTP server as well as local storage on the router. You can also specify a variable as the name of the file to be saved in the archive.

$h : hostname
$t : timestamp

The file name is also appended with “-<number>” to identify the version.

Determines the number of versions of the configuration file to be kept by maximum. The default is 14. When the archive is full of configuration files, the oldest configuration is overwritten.

The write-memory option saves a version of the configuration file in the archive at the time of copy running-config startup-config or write memory. A version of the configuration file is archived at the time interval specified by time-period.

Example of archive command

Consider the following configuration of the archive command under the following conditions

  • Archive Path : flash:config/
  • Include the router’s hostname in the file name
  • Save the configuration in the archive at the time of saving and every day.

You must create a “config” directory in the flash memory for configuring the archive path.

Create directory for archive

Router#mkdir config
Create directory filename [config]?
Created dir flash:config

Create a directory named “config” for the archive in the flash memory, and then configure the archive command as follows.

Example of archive command

archive
 path flash:/config/$h
 maximum 5
 write-memory
 time-period 1440

Manually archive

You can also save the configuration file to the archive at any time. Enter the following command in privileged EXEC mode

Manually save to archive#archive config

Verify archive

To verify the archive, use the show archive command.

CommandInformation
#show archiveDisplays configuration files stored in the archive.
#show archive config difference <file-path>Displays the difference between running-config and the configuration file in the specified archive.
Table show archive command

show archive

You can use the show archive command to verify the version of the configuration file stored in the archive.

show archive

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

Use the more command to review the contents of the configuration file in the archive.

Display the contents of the configuration file in the archive

Gene#more flash:/config/Gene-2
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Gene
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip cef
!
!
!
~省略~

show archive config difference <file-path>

The show archive difference command shows the difference between running-config and the configuration file in the archive.

+ : Not in running-config, but in the comparison
– : In running-config and not in the comparison

Figure show archive config difference
Figure show archive config difference

The following is a sample of show archive config difference.

show archive config difference

Gene#show archive config differences flash:/config/Gene-2
Contextual Config Diffs:
-ip route 192.168.1.0 255.255.255.0 192.168.0.1

Here is an example of the display “-ip route 192.168.1.0 255.255.255.0 192.168.0.1”. Comparing “running-config” and “Gene-2”, “ip route 192.168.1.0 255.255.255.0 192.168.0.1” is missing in “Gene-2”.

Roll back to archived configuration file

You can roll back running-config to a configuration file saved in the archive. Enter the following command in privileged EXEC mode

Rollback of configuration file#configure replace <file-path>

<file-path> : Path of configuration file to rollback

Figure configure replace command
Figure configure replace command

The following is a sample of a configuration file being rolled back.

configure replace

Gene#show archive config differences flash:/config/Gene-2
Contextual Config Diffs:
-ip route 192.168.1.0 255.255.255.0 192.168.0.1

Gene#configure replace flash:config/Gene-2
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [no]: y
Total number of passes: 1
Rollback Done

Gene#
*Jan  1 00:18:29.891: Rollback:Acquired Configuration lock.
*Jan  1 00:18:31.387: %PARSER-3-CONFIGNOTLOCKED: Unlock requested by process '25'. Configuration not locked.
Gene#show archive config differences flash:/config/Gene-2
Contextual Config Diffs:
!No changes were found

Conculusion

Points

  • Version management of the configuration file means that the running-config at a certain point in time is stored in archive.
  • The archive command sets the path of the archive and the triggers to be stored in the archive.
  • Verify the archived configuration file with the show archive command.
  • Archived configuration files can be rolled back with the configure replace command.

Cisco Basic