Table Of Contents
Configuration Replace and Configuration Rollback
Prerequisites for Configuration Replace and Configuration Rollback
Restrictions for Configuration Replace and Configuration Rollback
Information About Configuration Replace and Configuration Rollback
Benefits of Configuration Replace and Configuration Rollback
How to Use Configuration Replace and Configuration Rollback
Configuring the Configuration Archive
Performing a Configuration Replace or Configuration Rollback Operation
Monitoring and Troubleshooting the Configuration Replace and Configuration RollbackRollback Feature
Configuration Examples for Configuration Replace and Configuration Rollback
Configuring the Configuration Archive: Example
Replacing the Current Running Configuration with a Saved Cisco IOS Configuration File: Example
Reverting to the Startup Configuration File: Example
Performing a Configuration Replace Operation with the configure confirm Command: Example
Performing a Configuration Rollback Operation: Example
debug archive config timestamp
Feature Information for Configuration Replace and Configuration Rollback
Configuration Replace and Configuration Rollback
First Published: March 3, 2004Last Updated: December 4, 2006; Last Modifed: August 2007The Configuration Replace and Configuration Rollback feature provides the capability to replace the current running configuration with any saved Cisco IOS configuration file. This functionality can be used to revert to a previous configuration state, effectively rolling back any configuration changes that were made since that configuration file was saved.
Finding Feature Information in This Module
Your Cisco IOS software release may not support all of the features documented in this module. To reach links to specific feature documentation in this module and to see a list of the releases in which each feature is supported, use the "Feature Information for Configuration Replace and Configuration Rollback" section.
Finding Support Information for Platforms and Cisco IOS Software Images
Use Cisco Feature Navigator to find information about platform support and software image support. Cisco Feature Navigator enables you to determine which Cisco IOS and Catalyst OS software images support a specific software release, feature set, or platform. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
Contents
•
Prerequisites for Configuration Replace and Configuration Rollback
•
Restrictions for Configuration Replace and Configuration Rollback
•
Information About Configuration Replace and Configuration Rollback
•
How to Use Configuration Replace and Configuration Rollback
•
Configuration Examples for Configuration Replace and Configuration Rollback
•
Feature Information for Configuration Replace and Configuration Rollback
Prerequisites for Configuration Replace and Configuration Rollback
•
The format of the configuration files used as input by the Configuration Replace and Configuration Rollback feature must comply with standard Cisco IOS software configuration file indentation rules as follows:
–
Start all commands on a new line with no indentation, unless the command is within a configuration submode.
–
Indent commands within a first-level configuration submode one space.
–
Indent commands within a second-level configuration submode two spaces.
–
Indent commands within subsequent submodes accordingly.
These indentation rules describe how Cisco IOS software creates configuration files for such Cisco IOS commands as show running-config or copy running-config destination-url. Any configuration file generated on a Cisco IOS device complies with these rules.
•
Free memory larger than the combined size of the two configuration files (the current running configuration and the saved replacement configuration) is required.
Restrictions for Configuration Replace and Configuration Rollback
•
If the router does not have free memory larger than the combined size of the two configuration files (the current running configuration and the saved replacement configuration), the configuration replace operation is not performed.
•
Certain Cisco IOS configuration commands such as those pertaining to physical components of a networking device (for example, physical interfaces) cannot be added or removed from the running configuration. To illustrate, a configuration replace operation cannot remove the interface ethernet 0 command line from the current running configuration if that interface is physically present on the device. Similarly, the interface ethernet 1 command line cannot be added to the running configuration if no such interface is physically present on the device. A configuration replace operation that attempts to perform these types of changes results in error messages indicating that these specific command lines failed.
•
In very rare cases, certain Cisco IOS configuration commands cannot be removed from the Cisco IOS running configuration without reloading the router. A configuration replace operation that attempts to remove this type of command results in error messages indicating that these specific command lines failed.
Information About Configuration Replace and Configuration Rollback
To use the Configuration Replace and Configuration Rollback feature, you should understand the following concepts:
•
Benefits of Configuration Replace and Configuration Rollback
Configuration Archive
The Cisco IOS configuration archive is intended to provide a mechanism to store, organize, and manage an archive of Cisco IOS configuration files to enhance the configuration rollback capability provided by the configure replace command. Before this feature was introduced, you could save copies of the running configuration using the copy running-config destination-url command, storing the replacement file either locally or remotely. However, this method lacked any automated file management. On the other hand, the Configuration Replace and Configuration Rollback feature provides the capability to automatically save copies of the running configuration to the Cisco IOS configuration archive. These archived files serve as checkpoint configuration references and can be used by the configure replace command to revert to previous configuration states.
The archive config command allows you to save Cisco IOS configurations in the configuration archive using a standard location and filename prefix that is automatically appended with an incremental version number (and optional timestamp) as each consecutive file is saved. This functionality provides a means for consistent identification of saved Cisco IOS configuration files. You can specify how many versions of the running configuration are kept in the archive. After the maximum number of files are saved in the archive, the oldest file is automatically deleted when the next, most recent file is saved. The show archive command displays information for all configuration files saved in the Cisco IOS configuration archive.
The Cisco IOS configuration archive, in which the configuration files are stored and available for use with the configure replace command, can be located on the following file systems:
•
If your platform has disk0—disk0:, disk1:, ftp:, pram:, rcp:, slavedisk0:, slavedisk1:, or tftp:
•
If your platform does not have disk0—ftp:, http:, pram:, rcp:, or tftp:
Configuration Replace
The configure replace command provides the capability to replace the current running configuration with any saved Cisco IOS configuration file. This functionality can be used to revert to a previous configuration state, effectively rolling back any configuration changes that were made since the previous configuration state was saved.
When using the configure replace command, you must specify a saved Cisco IOS configuration as the replacement configuration file for the current running configuration. The replacement file must be a complete configuration generated by a Cisco IOS device (for example, a configuration generated by the copy running-config destination-url command), or, if generated externally, the replacement file must comply with the format of files generated by Cisco IOS devices. When the configure replace command is entered, the current running configuration is compared with the specified replacement configuration and a set of diffs is generated. The algorithm used to compare the two files is the same as that employed by the show archive config differences command. The resulting diffs are then applied by the Cisco IOS parser to achieve the replacement configuration state. Only the diffs are applied, avoiding potential service disruption from reapplying configuration commands that already exist in the current running configuration. This algorithm effectively handles configuration changes to order-dependent commands (such as access lists) through a multiple pass process. Under normal circumstances, no more than three passes are needed to complete a configuration replace operation, and a limit of five passes is performed to preclude any looping behavior.
The Cisco IOS copy source-url running-config command is often used to copy a stored Cisco IOS configuration file to the running configuration. When using the copy source-url running-config command as an alternative to the configure replace target-url command, the following major differences should be noted:
•
The copy source-url running-config command is a merge operation and preserves all the commands from both the source file and the current running configuration. This command does not remove commands from the current running configuration that are not present in the source file. In contrast, the configure replace target-url command removes commands from the current running configuration that are not present in the replacement file and adds commands to the current running configuration that need to be added.
•
The copy source-url running-config command applies every command in the source file, whether or not the command is already present in the current running configuration. This algorithm is inefficient and, in some cases, can result in service outages. In contrast, the configure replace target-url command only applies the commands that need to be applied—no existing commands in the current running configuration are reapplied.
•
A partial configuration file may be used as the source file for the copy source-url running-config command, whereas a complete Cisco IOS configuration file must be used as the replacement file for the configure replace target-url command.
Note
In Cisco IOS Release 12.2(25)S and 12.3(14)T, a locking feature for the configuration replace operation was introduced. When the configure replace command is used, the running configuration file is locked by default for the duration of the configuration replace operation. This locking mechanism prevents other users from changing the running configuration while the replacement operation is taking place, which might otherwise cause the replacement operation to terminate unsuccessfully. You can disable the locking of the running configuration by using the nolock keyword when issuing the configure replace command.
The running configuration lock is automatically cleared at the end of the configuration replace operation. You can display any locks that may be currently applied to the running configuration using the show configuration lock command.
Configuration Rollback
The concept of rollback comes from the transactional processing model common to database operations. In a database transaction, you might make a set of changes to a given database table. You then must choose whether to commit the changes (apply the changes permanently) or to roll back the changes (discard the changes and revert to the previous state of the table). In this context, rollback means that a journal file containing a log of the changes is discarded, and no changes are applied. The result of the rollback operation is to revert to the previous state, before any changes were applied.
The configure replace command allows you to revert to a previous configuration state, effectively rolling back changes that were made since the previous configuration state was saved. Instead of basing the rollback operation on a specific set of changes that were applied, the Cisco IOS configuration rollback capability uses the concept of reverting to a specific configuration state based on a saved Cisco IOS configuration file. This concept is similar to the database idea of saving a checkpoint (a saved version of the database) to preserve a specific state.
If the configuration rollback capability is desired, you must save the Cisco IOS running configuration before making any configuration changes. Then, after entering configuration changes, you can use that saved configuration file to roll back the changes (using the configure replace target-url command). Furthermore, since you can specify any saved Cisco IOS configuration file as the replacement configuration, you are not limited to a fixed number of rollbacks, as is the case in some rollback models based on a journal file.
Benefits of Configuration Replace and Configuration Rollback
•
Allows you to revert to a previous configuration state, effectively rolling back configuration changes.
•
Allows you to replace the current running configuration file with the startup configuration file without having to reload the router or manually undo CLI changes to the running configuration file, therefore reducing system downtime.
•
Allows you to revert to any saved Cisco IOS configuration state.
•
Simplifies configuration changes by allowing you to apply a complete configuration file to the router, where only the commands that need to be added or removed are affected.
•
When using the configure replace command as an alternative to the copy source-url running-config command, increases efficiency and prevents risk of service outages by not reapplying existing commands in the current running configuration.
How to Use Configuration Replace and Configuration Rollback
This section contains the following procedures:
•
Configuring the Configuration Archive (optional)
•
Performing a Configuration Replace or Configuration Rollback Operation (required)
•
Monitoring and Troubleshooting the Configuration Replace and Configuration RollbackRollback Feature (optional)
Configuring the Configuration Archive
No prerequisite configuration is needed to use the configure replace command. Using the configure replace command in conjunction with the Cisco IOS configuration archive and the archive config command is optional but offers significant benefit for configuration rollback scenarios. Before using the archive config command, the configuration archive must be configured. Perform this task to configure the characteristics of the configuration archive.
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
archive
4.
path url
5.
maximum number
6.
time-period minutes
7.
end
DETAILED STEPS
Command or Action PurposeStep 1
enable
Example:Router> enable
Enables privileged EXEC mode.
•
Enter your password if prompted.
Step 2
configure terminal
Example:Router# configure terminal
Enters global configuration mode.
Step 3
archive
Example:Router(config)# archive
Enters archive configuration mode.
Step 4
path url
Example:Router(config-archive)# path disk0:myconfig
Specifies the location and filename prefix for the files in the Cisco IOS configuration archive.
•
The url argument is a URL (accessible by the Cisco IOS file system) used for saving archive files of the running configuration file in the Cisco IOS configuration archive. You can set up an archive on any file system that your platform supports (see the "Configuration Archive" section).
Step 5
maximum number
Example:Router(config-archive)# maximum 14
(Optional) Sets the maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive.
•
The number argument is the maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive. Valid values are from 1 to 14. The default is 10.
Note
Before using this command, you must configure the path command to specify the location and filename prefix for the files in the Cisco IOS configuration archive.
Step 6
time-period minutes
Example:Router(config-archive)# time-period 10
(Optional) Sets the time increment for automatically saving an archive file of the current running configuration in the Cisco IOS configuration archive.
•
The minutes argument specifies how often, in minutes, to automatically save an archive file of the current running configuration in the Cisco IOS configuration archive.
Note
Before using this command, you must configure the path command to specify the location and filename prefix for the files in the Cisco IOS configuration archive.
Step 7
end
Example:Router(config-archive)# end
Exits to privileged EXEC mode.
Performing a Configuration Replace or Configuration Rollback Operation
Perform this task to replace the current running configuration file with a saved Cisco IOS configuration file.
SUMMARY STEPS
1.
Configure the Cisco IOS configuration archive.
2.
enable
3.
archive config
4.
configure terminal
5.
Enter changes to the current running configuration.
6.
exit
7.
configure replace target-url [list] [force] [time seconds] [nolock]
8.
configure confirm
9.
exit
DETAILED STEPS
Monitoring and Troubleshooting the Configuration Replace and Configuration RollbackRollback Feature
Perform this task to monitor and troubleshoot the Configuration Replace and Configuration Rollback feature.
SUMMARY STEPS
1.
enable
1.
show archive
2.
debug archive versioning
3.
debug archive config timestamp
4.
exit
DETAILED STEPS
Step 1
enable
Use this command to enable privileged EXEC mode. Enter your password if prompted. For example:
Router> enableRouter#Step 2
show archive
Use this command to display information about the files saved in the Cisco IOS configuration archive. For example:
Router# show archiveThere are currently 1 archive configurations saved.The next archive file will be named disk0:myconfig-2Archive # Name01 disk0:myconfig-1 <- Most Recent234567891011121314The following is sample output from the show archive command after several archive files of the running configuration have been saved. In this example, the maximum number of archive files to be saved is set to three.
Router# show archiveThere are currently 3 archive configurations saved.The next archive file will be named disk0:myconfig-8Archive # Name01 :Deleted2 :Deleted3 :Deleted4 :Deleted5 disk0:myconfig-56 disk0:myconfig-67 disk0:myconfig-7 <- Most Recent891011121314Step 3
debug archive versioning
Use this command to enable debugging of the Cisco IOS configuration archive activities to help monitor and troubleshoot configuration replace and rollback. For example:
Router# debug archive versioningJan 9 06:46:28.419:backup_running_configJan 9 06:46:28.419:Current = 7Jan 9 06:46:28.443:Writing backup file disk0:myconfig-7Jan 9 06:46:29.547: backup workedStep 4
debug archive config timestamp
Use this command to enable debugging of the processing time for each integral step of a configuration replace operation and the size of the configuration files being handled. For example:
Router# debug archive config timestampRouter# configure replace disk0:myconfig forceTiming Debug Statistics for IOS Config Replace operation:Time to read file slot0:sample_2.cfg = 0 msec (0 sec)Number of lines read:55Size of file :1054Starting Pass 1Time to read file system:running-config = 0 msec (0 sec)Number of lines read:93Size of file :2539Time taken for positive rollback pass = 320 msec (0 sec)Time taken for negative rollback pass = 0 msec (0 sec)Time taken for negative incremental diffs pass = 59 msec (0 sec)Time taken by PI to apply changes = 0 msec (0 sec)Time taken for Pass 1 = 380 msec (0 sec)Starting Pass 2Time to read file system:running-config = 0 msec (0 sec)Number of lines read:55Size of file :1054Time taken for positive rollback pass = 0 msec (0 sec)Time taken for negative rollback pass = 0 msec (0 sec)Time taken for Pass 2 = 0 msec (0 sec)Total number of passes:1Rollback DoneStep 5
exit
Use this command to exit to user EXEC mode. For example:
Router# exitRouter>
Configuration Examples for Configuration Replace and Configuration Rollback
This section provides the following configuration examples:
•
Configuring the Configuration Archive: Example
•
Replacing the Current Running Configuration with a Saved Cisco IOS Configuration File: Example
•
Reverting to the Startup Configuration File: Example
•
Performing a Configuration Replace Operation with the configure confirm Command: Example
•
Performing a Configuration Rollback Operation: Example
Configuring the Configuration Archive: Example
The following example shows how to perform the initial configuration of the Cisco IOS configuration archive. In this example, disk0:myconfig is specified as the location and filename prefix for the files in the configuration archive and a value of 10 is set as the maximum number of archive files to be saved.
configure terminal!archivepath disk0:myconfigmaximum 10endReplacing the Current Running Configuration with a Saved Cisco IOS Configuration File: Example
The following example shows how to replace the current running configuration with a saved Cisco IOS configuration file named disk0:myconfig. The configure replace command interactively prompts you to confirm the operation.
Router# configure replace disk0:myconfigThis will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: YTotal number of passes: 1Rollback DoneIn the following example, the list keyword is specified in order to display the command lines that were applied during the configuration replace operation:
Router# configure replace disk0:myconfig listThis will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: Y!Pass 1!List of Commands:no snmp-server community public rosnmp-server community mystring roendTotal number of passes: 1Rollback DoneReverting to the Startup Configuration File: Example
The following example shows how to revert to the Cisco IOS startup configuration file using the configure replace command. This example also shows the use of the optional force keyword to override the interactive user prompt.
Router# configure replace nvram:startup-config forceTotal number of passes: 1Rollback DonePerforming a Configuration Replace Operation with the configure confirm Command: Example
The following example shows the use of the configure replace command with the time seconds keyword and argument. You must enter the configure confirm command within the specified time limit to confirm replacement of the current running configuration file. If the configure confirm command is not entered within the specified time limit, the configuration replace operation is automatically reversed (in other words, the current running configuration file is restored back to the configuration state that existed prior to entering the configure replace command).
Router# configure replace nvram:startup-config time 120This will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: YTotal number of passes: 1Rollback DoneRouter# configure confirmPerforming a Configuration Rollback Operation: Example
The following example shows how to make changes to the current running configuration and then roll back the changes. As part of the configuration rollback operation, you must save the current running configuration before making changes to the file. In this example, the archive config command is used to save the current running configuration. The generated output of the configure replace command indicates that only one pass was performed to complete the rollback operation.
Note
Before using the archive config command, you must configure the path command to specify the location and filename prefix for the files in the Cisco IOS configuration archive.
You first save the current running configuration in the configuration archive as follows:
archive configYou then enter configuration changes as shown in the following example:
configure terminal!user netops2 password rainuser netops3 password snowexitAfter having made changes to the running configuration file, assume you now want to roll back these changes and revert to the configuration that existed before the changes were made. The show archive command is used to verify the version of the configuration to be used as a replacement file. The configure replace command is then used to revert to the replacement configuration file as shown in the following example:
Router# show archiveThere are currently 1 archive configurations saved.The next archive file will be named disk0:myconfig-2Archive # Name01 disk0:myconfig-1 <- Most Recent2345678910Router# configure replace disk0:myconfig-1Total number of passes: 1Rollback DoneAdditional References
The following sections provide references related to the Configuration Replace and Configuration Rollback feature.
Related Documents
Related Topic Document TitleConfiguration Locking
Exclusive Configuration Change Access and Access Session Locking, Release 12.4(11)T feature module
Commands for managing configuration files
Cisco IOS Configuration Fundamentals Command Reference, Release 12.4T
Information about managing configuration files
"Managing Configuration Files" chapter in the Cisco IOS Configuration Fundamentals Configuration Guide, Release 12.4T
Using the Contextual Configuration Diff Utility feature
Contextual Configuration Diff Utility, Cisco IOS Release 12.3(4)T feature module
Standards
Standards TitleNo new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature.
—
MIBs
RFCs
RFCs TitleNo new or modified RFCs are supported by this feature, and support for existing RFCs has not been modified by this feature.
—
Technical Assistance
Command Reference
This section documents new and modified commands only.
•
debug archive config timestamp
archive config
To save a copy of the current running configuration to the Cisco IOS configuration archive, use the archive config command in privileged EXEC mode.
archive config
Syntax Description
This command has no arguments or keywords.
Command Modes
Privileged EXEC
Command History
Usage Guidelines
Note
Before using this command, you must configure the path command in order to specify the location and filename prefix for the files in the Cisco IOS configuration archive.
The Cisco IOS configuration archive is intended to provide a mechanism to store, organize, and manage an archive of Cisco IOS configuration files to enhance the configuration rollback capability provided by the configure replace command. Before this feature was introduced, you could save copies of the running configuration using the copy running-config destination-url command, storing the target file either locally or remotely. However, this method lacked any automated file management. On the other hand, the Configuration Replace and Configuration Rollback feature provides the capability to automatically save copies of the running configuration to the Cisco IOS configuration archive. These archived files serve as checkpoint configuration references and can be used by the configure replace command to revert to previous configuration states.
The archive config command allows you to save Cisco IOS configurations in the configuration archive using a standard location and filename prefix that is automatically appended with an incremental version number (and optional time stamp) as each consecutive file is saved. This functionality provides a means for consistent identification of saved Cisco IOS configuration files. You can specify how many versions of the running configuration are kept in the archive. After the maximum number of files has been saved in the archive, the oldest file is automatically deleted when the next, most recent file is saved. The show archive command displays information for all configuration files saved in the Cisco IOS configuration archive.
Examples
The following example shows how to save the current running configuration to the Cisco IOS configuration archive using the archive config command. Before using the archive config command, you must configure the path command to specify the location and filename prefix for the files in the Cisco IOS configuration archive. In this example, the location and filename prefix are specified as disk0:myconfig as follows:
configure terminal!archivepath disk0:myconfigendYou then save the current running configuration in the configuration archive, as follows:
archive configThe show archive command displays information on the files saved in the configuration archive as shown in the following sample output:
Router# show archiveThere are currently 1 archive configurations saved.The next archive file will be named disk0:myconfig-2Archive # Name01 disk0:myconfig-1 <- Most Recent2345678910Related Commands
configure confirm
To confirm replacement of the current running configuration with a saved Cisco IOS configuration file, use the configure confirm command in privileged EXEC mode.
configure confirm
Syntax Description
This command has no arguments or keywords.
Command Modes
Privileged EXEC
Command History
Usage Guidelines
The configure confirm command is used only if the time seconds keyword and argument of the configure replace command are specified. If the configure confirm command is not entered within the specified time limit, the configuration replace operation is automatically reversed (in other words, the current running configuration file is restored to the configuration state that existed prior to entering the configure replace command).
Examples
The following example shows the use of the configure replace command with the time seconds keyword and argument. You must enter the configure confirm command within the specified time limit to confirm replacement of the current running configuration file:
Router# configure replace nvram:startup-config time 120This will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: YTotal number of passes: 1Rollback DoneRouter# configure confirmRelated Commands
configure replace
To replace the current running configuration with a saved Cisco IOS configuration file, use the configure replace command in privileged EXEC mode.
configure replace target-url [list] [force] [time seconds] [nolock]
Syntax Description
Command Modes
Privileged EXEC
Command History
Usage Guidelines
When configuring more than one keyword option, use the following rules:
•
The list keyword must be entered before the force and time keywords.
•
The force keyword must be entered before the time keyword.
If the current running configuration is replaced with a saved Cisco IOS configuration file that contains commands unaccepted by the Cisco IOS software parser, an error message is displayed listing the commands that were unaccepted. The total number of passes performed in the configuration replace operation is also displayed.
Note
In Cisco IOS Release 12.2(25)S, a locking feature for the configuration replace operation was introduced. When the configure replace command is enabled, the Cisco IOS running configuration file is locked by default for the duration of the configuration replace operation. This locking mechanism prevents other users from changing the running configuration while the replace operation is taking place, which might otherwise cause the replace operation to terminate unsuccessfully. You can disable the locking of the running configuration using the configure replace nolock command.
The running configuration lock is automatically cleared at the end of the configuration replace operation. It is not expected that you should need to clear the lock manually during the replace operation, but as a protection against any unforeseen circumstances, you can manually clear the lock using the clear configuration lock command. You can also display any locks that may be currently applied to the running configuration using the show configuration lock command.
Examples
This section contains the following examples:
•
Replacing the Current Running Configuration with a Saved Cisco IOS Configuration File
•
Reverting to the Startup Configuration File
•
Performing a Configuration Replace Operation with the configure confirm Command
•
Performing a Configuration Rollback Operation
Replacing the Current Running Configuration with a Saved Cisco IOS Configuration File
The following example shows how to replace the current running configuration with a saved Cisco IOS configuration file named disk0:myconfig. Note that the configure replace command interactively prompts you to confirm the operation.
Router# configure replace disk0:myconfigThis will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: YTotal number of passes: 1Rollback DoneIn the following example, the list keyword is specified to display the command lines that were applied during the configuration replace operation:
Router# configure replace disk0:myconfig listThis will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: Y!Pass 1!List of Commands:no snmp-server community public rosnmp-server community mystring roendTotal number of passes: 1Rollback DoneReverting to the Startup Configuration File
The following example shows how to revert to the Cisco IOS startup configuration file. This example also shows the use of the optional force keyword to override the interactive user prompt.
Router# configure replace nvram:startup-config forceTotal number of passes: 1Rollback DonePerforming a Configuration Replace Operation with the configure confirm Command
The following example shows the use of the configure replace command with the time seconds keyword and argument. You must enter the configure confirm command within the specified time limit to confirm replacement of the current running configuration file. If the configure confirm command is not entered within the specified time limit, the configuration replace operation is automatically reversed (in other words, the current running configuration file is restored to the configuration state that existed prior to entering the configure replace command).
Router# configure replace nvram:startup-config time 120This will apply all necessary additions and deletionsto replace the current running configuration with thecontents of the specified configuration file, which isassumed to be a complete configuration, not a partialconfiguration. Enter Y if you are sure you want to proceed. ? [no]: YTotal number of passes: 1Rollback DoneRouter# configure confirmPerforming a Configuration Rollback Operation
The following example shows how to make changes to the current running configuration and then roll back the changes. As part of the configuration rollback operation, you must save the current running configuration before making changes to the file. In this example, the archive config command is used to save the current running configuration. Note that the generated output of the configure replace command indicates that only one pass was performed to complete the rollback operation.
Note
The path command must be configured before using the archive config command.
You first save the current running configuration in the configuration archive as follows:
Router# archive configYou then enter configuration changes as shown in the following example:
Router# configure terminalRouter(config)# user netops2 password rainRouter(config)# user netops3 password snowRouter(config)# exitAfter making changes to the running configuration file, you might want to roll back these changes and revert to the configuration that existed before the changes were made. The show archive command is used to verify the version of the configuration to be used as a target file. The configure replace command is then used to revert to the target configuration file as shown in the following example:
Router# show archiveThere are currently 1 archive configurations saved.The next archive file will be named disk0:myconfig-2Archive # Name01 disk0:myconfig-1 <- Most Recent2345678910Router# configure replace disk0:myconfig-1Total number of passes: 1Rollback DoneRelated Commands
debug archive config timestamp
To enable debugging of the processing time for each integral step of a configuration replace operation and the size of the configuration files being handled, use the debug archive config timestamp command in privileged EXEC mode. To disable debugging output, use the no form of this command.
debug archive config timestamp
no debug archive config timestamp
Syntax Description
This command has no arguments or keywords.
Command Modes
Privileged EXEC
Command History
Examples
The following is sample output from the debug archive config timestamp command:
Router# debug archive config timestampRouter# configure replace disk0:myconfig forceTiming Debug Statistics for IOS Config Replace operation:Time to read file slot0:sample_2.cfg = 0 msec (0 sec)Number of lines read:55Size of file :1054Starting Pass 1Time to read file system:running-config = 0 msec (0 sec)Number of lines read:93Size of file :2539Time taken for positive rollback pass = 320 msec (0 sec)Time taken for negative rollback pass = 0 msec (0 sec)Time taken for negative incremental diffs pass = 59 msec (0 sec)Time taken by PI to apply changes = 0 msec (0 sec)Time taken for Pass 1 = 380 msec (0 sec)Starting Pass 2Time to read file system:running-config = 0 msec (0 sec)Number of lines read:55Size of file :1054Time taken for positive rollback pass = 0 msec (0 sec)Time taken for negative rollback pass = 0 msec (0 sec)Time taken for Pass 2 = 0 msec (0 sec)Total number of passes:1Rollback DoneRelated Commands
Command Descriptiondebug archive versioning
Enables debugging of the Cisco IOS configuration archive activities.
debug archive versioning
To enable debugging of the Cisco IOS configuration archive activities, use the debug archive versioning command in privileged EXEC mode. To disable debugging output, use the no form of this command.
debug archive versioning
no debug archive versioning
Syntax Description
This command has no arguments or keywords.
Command Modes
Privileged EXEC
Command History
Examples
The following is sample output from the debug archive versioning command:
Router# debug archive versioningJan 9 06:46:28.419:backup_running_configJan 9 06:46:28.419:Current = 7Jan 9 06:46:28.443:Writing backup file disk0:myconfig-7Jan 9 06:46:29.547: backup workedRelated Commands
maximum
To set the maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive, use the maximum command in archive configuration mode. To reset this command to its default, use the no form of this command.
maximum number
no maximum number
Syntax Description
number
Maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive. You can archive from 1 to 14 configuration files. The default is 10.
Command Default
By default, a maximum of 10 archive files of the running configuration are saved in the Cisco IOS configuration archive.
Command Modes
Archive configuration
Command History
Usage Guidelines
Note
Before using this command, you must configure the path command to specify the location and filename prefix for the files in the Cisco IOS configuration archive.
After the maximum number of files are saved in the Cisco IOS configuration archive, the oldest file is automatically deleted when the next, most recent file is saved.
Note
This command should only be used when a local writable file system is specified in the url argument of the path command. Network file systems may not support deletion of previously saved files.
Examples
In the following example, a value of 5 is set as the maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive:
configure terminal!archivepath disk0:myconfigmaximum 5endRelated Commands
path (archive configuration)
To specify the location and filename prefix for the files in the Cisco IOS configuration archive, use the path command in archive configuration mode. To disable this function, use the no form of this command.
path url
no path url
Syntax Description
url
URL (accessible by the Cisco IOS file system) used for saving archive files of the running configuration file in the Cisco IOS configuration archive.
Command Default
If this command is not configured, no location or filename prefix is specified for files in the Cisco IOS configuration archive.
Command Modes
Archive configuration
Command History
Usage Guidelines
When this command is entered, an archive file of the running configuration is saved when the archive config, write-memory, or copy running-config startup-config command is entered.
URLs are commonly used to specify files or location on the World Wide Web. On Cisco routers, URLs can be used to specify the location of a file or directory on a router or a remote file server. The path command uses a URL to specify the location and filename prefix for the Cisco IOS configuration archive.
The locations or file systems that you can specify in the url argument are as follows:
•
If your platform has disk0—disk0:, disk1:, ftp:, pram:, rcp:, slavedisk0:, slavedisk1:, or tftp:
•
If your platform does not have disk0—ftp:, http:, pram:, rcp:, or tftp:
The colon is required in the location format.
The filename of the first archive file is the filename specified in the url argument followed by -1. The filename of the second archive file is the filename specified in the url argument followed by -2 and so on.
Because some file systems are incapable of storing the date and time that a file was written, the filename of the archive file can contain the date, time, and router hostname. To include the router hostname in the archive file filename, enter the characters $h (for example, disk0:$h). To include the date and time in the archive file filename, enter the characters $t.
When a configuration archive operation is attempted on a local file system, the file system is tested to determine if it is writable and if it has sufficient space to save an archive file. If the file system is read-only or if there is not enough space to save an archive file, an error message is displayed.
If you specify the tftp: file server as the location with the path command, you need to create the configuration file on the TFTP file server and change the file's privileges before the archive config command works properly.
Examples
The following example of the path command shows how to specify the hostname, date, and time as the filename prefix for which to save archive files of the running configuration. In this example, the time-period command is also configured to automatically save an archive file of the running configuration every 20 minutes.
configure terminal!archivepath disk0:$h$ttime-period 20endThe following is sample output from the show archive command illustrating the format of the resulting configuration archive filenames.
Router# show archiveThere are currently 3 archive configurations saved.The next archive file will be named routerJan-16-01:12:23.019-4Archive # Name01 disk0:routerJan-16-00:12:23.019-12 disk0:routerJan-16-00:32:23.019-23 disk0:routerJan-16-00:52:23.019-3 <- Most Recent4567891011121314Cisco IOS Configuration Archive on the TFTP File Server
The following example shows how to use the path command to specify the TFTP file server, address 10.48.71.226, as the archive configuration location and router-cfg as the configuration filename. First you need to create the configuration file on the TFTP server and change the file's privileges, then you can save configuration file to the configuration archive.
The following example shows the commands to use to create the file and change the file's privileges on the TFTP server (UNIX commands):
> touch router-cfg-1> chmod 777 router-cfg-1The following example show how to create the configuration archive, save the running configuration to the archive, and display the files in the archive:
configure terminal!archivepath tftp://10.48.71.226/router-cfgexitexit!archive configRouter# show archiveThe next archive file will be named tftp://10.48.71.226/router-cfg-2Archive # Name01 tftp://10.48.71.226/router-cfg-1 <- Most Recent234567891011121314Router#The following is sample output from the show archive command if you did not create the configuration file on the TFTP server before attempting to archive the current running configuration file:
configure terminal!archivepath tftp://10.48.71.226/router-cfgexitexitarchive configRouter# show archiveThe next archive file will be named tftp://10.48.71.226/router-cfg-1Archive # Name01234567891011121314Related Commands
show archive
To display information about the files saved in the Cisco IOS configuration archive, use the show archive command in privileged EXEC mode.
show archive
Syntax Description
This command has no arguments or keywords.
Command Modes
Privileged EXEC
Command History
Examples
The following is sample output from the show archive command:
Router# show archiveThere are currently 1 archive configurations saved.The next archive file will be named disk0:myconfig-2Archive # Name01 disk0:myconfig-1 <- Most Recent234567891011121314The following is sample output from the show archive command after several archive files of the running configuration have been saved. In this example, the maximum number of archive files to be saved is set to three.
Router# show archiveThere are currently 3 archive configurations saved.The next archive file will be named disk0:myconfig-8Archive # Name01 :Deleted2 :Deleted3 :Deleted4 :Deleted5 disk0:myconfig-56 disk0:myconfig-67 disk0:myconfig-7 <- Most Recent891011121314Table 1 describes the significant fields shown in the displays.
Related Commands
show configuration lock
To display information about the lock status of the running configuration file during a configuration replace operation, use the show configuration lock command in privileged EXEC mode.
show configuration lock
Syntax Description
This command has no arguments or keywords.
Command Modes
Privileged EXEC
Command History
Examples
The following is sample output from the show configuration lock command when the running configuration file is locked by another user.
Cisco IOS Release 12.2(25)S, Release 12.2(27)SBC, Release 12.3(14)T, and Later Releases
Router# configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)# configuration mode exclusive ?auto Lock configuration mode automaticallymanual Lock configuration mode on-demandRouter(config)# configuration mode exclusive autoRouter(config)# endRouter# show running-config | include configurationconfiguration mode exclusive autoRouter#Router# configure terminal !<----------- Acquires the lockEnter configuration commands, one per line. End with CNTL/Z. Router(config)#Router(config)# show configuration lockParser Configure Lock --------------------- Owner PID : 3 User : unknown TTY : 0 Type : EXCLUSIVE State : LOCKED Class : EXPOSED Count : 1 Pending Requests : 0 User debug info : configure terminal Router(config)# Router(config)# end ! <------------ Releases the lockThe following is sample output from the show configuration lock command when the running configuration file is not locked by another user.
Router# show configuration lockParser Configure Lock --------------------- Owner PID : -1 User : unknown TTY : -1 Type : NO LOCK State : FREE Class : unknown Count : 0 Pending Requests : 0 User debug info : Router#Cisco IOS Release 12.0(31)S, 12.2(33)SRA, and Later Releases
Router# show configuration lockParser Configure Lock------------------------------------------------------Owner PID : 3User : unknownTTY : 0Type : EXCLUSIVEState : LOCKEDClass : EXPOSEDCount : 1Pending Requests : 0User debug info : configure terminalSession idle state : TRUENo of exec cmds getting executed : 0No of exec cmds blocked : 0Config wait for show completion : FALSERemote ip address : UnknownLock active time (in Sec) : 6Lock Expiration timer (in Sec) : 593Router(config)#Table 2 describes the significant fields shown in the displays.
The following example shows how to configure the configuration file for single user auto configuration mode (using the configuration mode exclusive auto command). Use the configure terminal command to enter global configuration mode and lock the configuration mode exclusively. Once the Cisco IOS configuration mode is locked exclusively, you can verify the lock using the show configuration lock command.
Router#Router# configure terminalRouter(config)# configuration mode exclusive autoRouter(config)# endRouter# configure terminalRouter(config)#Router(config)# show configuration lockParser Configure LockOwner PID : 10User : User1TTY : 3Type : EXCLUSIVEState : LOCKEDClass : ExposedCount : 0Pending Requests : 0User debug info : 0Related Commands
time-period
To set the time increment for automatically saving an archive file of the current running configuration in the Cisco IOS configuration archive, use the time-period command in archive configuration mode. To disable this function, use the no form of this command.
time-period minutes
no time-period minutes
Syntax Description
minutes
Specifies how often, in minutes, to automatically save an archive file of the current running configuration in the Cisco IOS configuration archive.
Command Default
By default, no time increment is set.
Command Modes
Archive configuration
Command History
Usage Guidelines
Note
Before using this command, you must configure the path command to specify the location and filename prefix for the files in the Cisco IOS configuration archive.
If this command is configured, an archive file of the current running configuration is automatically saved after the given time specified by the minutes argument. Archive files continue to be automatically saved at this given time increment until this function is disabled. Use the maximum command to set the maximum number of archive files of the running configuration to be saved.
Note
This command saves the current running configuration to the configuration archive whether or not the running configuration has been modified since the last archive file was saved.
Examples
In the following example, a value of 20 minutes is set as the time increment for which to automatically save an archive file of the current running configuration in the Cisco IOS configuration archive:
configure terminal!archivepath disk0:myconfigtime-period 20endRelated Commands
Feature Information for Configuration Replace and Configuration Rollback
Table 3 lists the release history for this feature.
Not all commands may be available in your Cisco IOS software release. For release information about a specific command, see the command reference documentation.
Cisco IOS software images are specific to a Cisco IOS software release, a feature set, and a platform. Use Cisco Feature Navigator to find information about platform support and Cisco IOS software image support. Access Cisco Feature Navigator at http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
Note
Table 3 lists only the Cisco IOS software release that introduced support for a given feature in a given Cisco IOS software release. Unless noted otherwise, subsequent releases of that Cisco IOS software release also support that feature.
Table 3 Feature Information for Configuration Replace and Configuration Rollback
Feature Name Releases Feature InformationConfiguration Replace and Configuration Rollback (F-4239)
12.3(7)T,
12.2(25)S, 12.3(14)T, 12.2(27)SBC,
12.2(31)SB2,
12.2(33)SRA,
12.2(33)SXHThe Configuration Replace and Configuration Rollback feature provides the capability to replace the current running configuration with any saved Cisco IOS configuration file. This functionality can be used to revert to a previous configuration state, effectively rolling back any configuration changes that were made since that configuration file was saved.
In 12.3(7)T, this feature was introduced.
In 12.2(25)S, support was added for a Cisco IOS 12.2S release. A locking mechanism for configuration replace (the Exclusive Configuration Change Access feature) was introduced.
In 12.3(14)T, support for a locking mechanism for configuration replace (the Exclusive Configuration Change Access feature) was added for a Cisco IOS 12.3T release.
In 12.2(27)SBC, support was added for a Cisco IOS 12.2SB release.
In 12.2(33)SRA, support was added for a Cisco IOS 12.2SR release.
In 12.2(31)SB2, this feature was implemented on the Cisco 10000 series.
In 12.2(33)SXH, the "Configuration Rollback" feature was implemented in Release 12.2SX.
The following sections provide information about this feature:
•
Benefits of Configuration Replace and Configuration Rollback
•
Configuring the Configuration Archive
•
Performing a Configuration Replace or Configuration Rollback Operation
•
Monitoring and Troubleshooting the Configuration Replace and Configuration RollbackRollback Feature
The following commands were modified by this feature: archive config, configure confirm, configure replace, debug archive config timestamp, debug archive versioning, maximum, path (archive configuration), show archive, show configuration lock, time-period.
Configuration Versioning
12.3(7)T, 12.2(25)S, 12.2(33)SRA
The Configuration Versioning feature allows you to maintain and manage backup copies of the Cisco IOS running configuration on or off the device. The Configuration Replace feature uses the Configuration Versioning feature to provide a rollback to a saved copy of the running configuration.
Exclusive Configuration Change Access (F-4600)
12.2(25)S, 12.3(14)T, 12.2(33)SRA, 12.2(33)SXH
The Exclusive Configuration Change Access feature (also called the "Configuration Lock" feature) allows you to have exclusive change access to the Cisco IOS running configuration, preventing multiple users from making concurrent configuration changes.
The following command was modified by this feature and applies to the Configuration Replace and Configuration Rollback feature: show configuration lock.
Any Internet Protocol (IP) addresses used in this document are not intended to be actual addresses. Any examples, command display output, and figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses in illustrative content is unintentional and coincidental.
© 2004 - 2006 Cisco Systems, Inc. All rights reserved.

