The
configurereplace 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
configurereplace
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
copyrunning-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
configurereplace 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
showarchiveconfigdifferences
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-urlrunning-config command is often used to copy a
stored Cisco IOS configuration file to the running configuration. When using
the
copy source-urlrunning-config command as an alternative to the
configurereplace target-url command, the following major
differences should be noted:
-
The
copy source-urlrunning-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
configurereplace 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-urlrunning-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
configurereplace 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-urlrunning-config command, whereas a complete Cisco
IOS configuration file must be used as the replacement file for the
configurereplace target-url command.
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
configurereplace 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
configurereplace 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
showconfigurationlock command.
Note
|
In a scenario when you are performing a configuration replace using a
configuration that is not sourced from IOS(such as a custom written
configuration) if the login banner has a delimiter that is not the EXT
character (ASCII code 003), the banner configuration is rejected and not
included in the replaced configuration. Non-working delimiters include ^C, %,
#, CC etc.
|