Overview
Configuration Replace
The configuration replace feature enables you to replace the running configuration of the Cisco Nexus switch with the user provided configuration without reloading the device. The device reload may be required only when a configuration itself requires a reload. The running configuration file that is provided by the user should be taken using copy running file. Unlike copy file: to running , the configuration replace feature is not a merge operation. This feature replaces the entire running configuration with a new configuration that is provided by the user. If there is a failure in the configuration replace, the original configuration is restored in the switch. From Cisco NX-OS Release 9.3(1), best-effort option is introduced. This option enables the configuration replace to execute the full patch despite any error in the commands and the original configuration is not restored in the switch.
The commit-timeout feature enables you to rollback to the previous configuration after successfully performing the configuration replace operation. If the commit timer expires, the rollback operation is automatically initiated.
Operation Steps
![]() Note |
|
The configuration replace feature has the following operation steps:
-
Configuration replace intelligently calculates the difference between the current running-configuration and the user-provided configuration in the Cisco Nexus switch and generates a patch file which is the difference between the two files. You can view this patch file which includes a set of configuration commands.
-
Configuration replace applies the configuration commands from the patch file similarly to executing commands.
-
The configuration rolls back to or restores the previous running configuration under the following situations:
-
If there is a mismatch in the configuration after the patch file has been applied.
-
If you perform the configuration operation with a commit timeout and the commit timer expires.
-
-
The configuration does not roll back to or does not restore the previous running configuration when the best-effort option is used. This option enables the configuration replace to execute the full patch despite any error in the commands and will not roll back to the previous configuration.
-
You can view the exact configuration that caused a failure using the show config-replace log exec command.
-
Restore operations that fail while restoring the switch to the original configuration, are not interrupted. The restore operation continues with the remaining configuration. Use the show config-replace log exec command to list the commands that failed during the restore operation.
-
If you enter the configure replace commit command before the timer expires, the commit timer stops and the switch runs on the user provided configuration that has been applied through the configuration replace feature.
-
If the commit timer expires, roll back to the previous configuration is initiated automatically.
-
In Cisco NX-OS Release 9.3(1), semantic validation support is added for the configuration replace. This semantic validation is done as part of the precheck in configuration replace. The patch gets applied only when the semantic validation is successful. After applying the patch file, configuration replace triggers the verification process. The configuration replace compares the running-configuration with the user configuration file during the verification process. If there is a mismatch, it restores the device to the original configuration.
|
Configuration Replace |
Copying a file |
|---|---|
|
The configure replace <target-url> command removes the commands from the current running-configuration that are not present in the replacement file. It also adds commands that need to be added to the current running-configuration. |
The copy <source-url> running-config command is a merge operation which preserves all the commands from, both the source file and the current running-configuration. This command does not remove the commands from the current running-configuration that are not present in the source file. |
|
You must use a complete Cisco NX-OS configuration file as the replacement file for the configure replace <target-url> command. |
You can use a partial configuration file as a source file for the copy <source-url> running-config command. |
Benefits
-
You can replace the current running-configuration file with the user-provided configuration file without having to reload the switch or manually undo CLI changes to the running-configuration file. As a result, the system downtime is reduced.
-
You can revert to the saved Cisco NX-OS configuration state.
-
It simplifies the configuration changes by allowing you to apply a complete configuration file to the device, where only the commands that need to be added or removed are affected. The other service and configurations that are not modified remain untouched.
-
If you configure the commit-timeout feature, you can rollback to the previous configuration even when the configuration replace operation has been successful.
Recommended Workflow
Verification
To check and verify configuration replace and its status, use the commands that are outlined in the table:
|
Command |
Purpose |
|---|---|
|
configure replace [bootflash /scp /sftp ]<user-configuration-file ] show-patch |
Displays the difference between the running-configurations and user-provided configurations. |
|
show config-replace log exec |
Displays a log of all the configurations executed and those that failed. In case of an error, it displays an error message against that configuration. |
|
show config-replace log verify |
Displays the configurations that failed, along with an error message. It does not display configurations that were successful. |
|
show config-replace status |
Displays the status of the configuration replace operations, including in-progress, successful, and failure. If you have configured the commit-timeout feature, the commit and timer status and the commit timeout time remaining is also displayed. |
Configuration Examples
See the following configuration examples for configuration replace:
-
Use the configure replace bootflash: <file> show-patch CLI command to display the difference between the running-configurations and user-provided configurations.
switch(config)# configure replace bootflash:<file> show-patch Collecting Running-Config Converting to checkpoint file #Generating Rollback Patch !! no role name abc -
Use the configure replace bootflash: <file> verbose CLI command to replace the entire running-configuration in the switch with the user-configuration.
switch(config)# configure replace bootflash:<file> verbose Collecting Running-Config Generating Rollback patch for switch profile Rollback Patch is Empty Note: Applying config parallelly may fail Rollback verification Collecting Running-Config #Generating Rollback Patch Executing Rollback Patch ======================================================== config t no role name abc ======================================================== Generating Running-config for verification Generating Patch for verification Rollback completed successfully. Sample Example with adding of BGP configurations. switch(config)# sh run | section bgp switch(config)# sh file bootflash:file | section bgp feature bgp router bgp 1 address-family ipv4 unicast neighbor 1.1.1.1 switch(config)# switch(config)# configure replace bootflash:file verbose Collecting Running-Config Generating Rollback patch for switch profile Rollback Patch is Empty Note: Applying config parallelly may fail Rollback verification Collecting Running-Config #Generating Rollback Patch Executing Rollback Patch ======================================================== config t feature bgp router bgp 1 address-family ipv4 unicast neighbor 1.1.1.1 ======================================================== Generating Running-config for verification Generating Patch for verification Rollback completed successfully. switch(config)# sh run | section bgp feature bgp router bgp 1 address-family ipv4 unicast neighbor 1.1.1.1 Sample Example with ACL switch(config)# configure replace bootflash:run_1.txt Collecting Running-Config Generating Rollback patch for switch profile Rollback Patch is Empty Note: Applying config parallelly may fail Rollback verification Collecting Running-Config #Generating Rollback Patch Executing Rollback Patch ======================================================== config t no ip access-list nexus-50-new-xyz ip access-list nexus-50-new-xyz-jkl-abc 10 remark Newark 20 permit ip 17.31.5.0/28 any 30 permit ip 17.34.146.193/32 any 40 permit ip 17.128.199.0/27 any 50 permit ip 17.150.128.0/22 any ======================================================== Generating Running-config for verification Generating Patch for verification Rollback completed successfully. switch(config)# switch(config)# show run aclmgr | sec nexus-50-new-xyz-jkl-abc ip access-list nexus-50-new-xyz-jkl-abc 10 remark Newark 20 permit ip 17.31.5.0/28 any 30 permit ip 17.34.146.193/32 any 40 permit ip 17.128.199.0/27 any 50 permit ip 17.150.128.0/22 any -
Use the configure replace bootflash:user-config.cfg verify-only CLI command to generate and verify the patch semantically.
switch(config)# configure replace bootflash:user-config.cfg verify-only Version match between user file and running configuration. Pre-check for User config PASSED Collecting Running-Config Converting to checkpoint file Generating Rollback Patch Validating Patch ======================================================== `config t ` `interface Ethernet1/1` `shutdown` `no switchport trunk allowed vlan` `no switchport mode` `no switchport` `exit` Skip non dme command for CR validation `interface Vlan1` `shutdown` `interface Ethernet1/1` `shutdown` `no switchport` `ip address 1.1.1.1/24` `exit` Skip non dme command for CR validation ============================================= Patch validation completed successful switch(config)# -
Use the configure replace bootflash:user-config.cfg best-effort verify-and-commit CLI command to replace the switch running configuration with the given user configuration after performing the sematic validation on patch.
switch(config)# configure replace bootflash:user-config.cfg best-effort verify-and-commit Version match between user file and running configuration. Pre-check for User config PASSED ADVISORY: Config Replace operation started... Modifying running configuration from another VSH terminal in parallel is not recommended, as this may lead to Config Replace failure. Collecting Running-Config Generating Rollback patch for switch profile Rollback Patch is Empty Collecting Running-Config Generating Rollback Patch Validating Patch Patch validation completed successful Executing Rollback Patch During CR operation,will retain L3 configuration when vrf member change on interface Generating Running-config for verification Generating Rollback Patch Configure replace completed successfully. Please run 'show config-replace log exec' to see if there is any configuration that requires reload to take effect. switch(config)# -
Use the show config-replace log exec CLI command to check all the configuration that is executed and failures if any.
switch(config)# show config-replace log exec Operation : Rollback to Checkpoint File Checkpoint file name : .replace_tmp_28081 Scheme : tmp Rollback done By : admin Rollback mode : atomic Verbose : enabled Start Time : Wed, 06:39:34 25 Jan 2017 -------------------------------------------------------------------------------- time: Wed, 06:39:47 25 Jan 2017 Status: SUCCESS End Time : Wed, 06:39:47 25 Jan 2017 Rollback Status : Success Executing Patch: ---------------- switch#config t switch#no role name abc -
Use the show config-replace log verify CLI command to check the failed configuration if any.
switch(config)# show config-replace log verify Operation : Rollback to Checkpoint File Checkpoint file name : .replace_tmp_28081 Scheme : tmp Rollback done By : admin Rollback mode : atomic Verbose : enabled Start Time : Wed, 06:39:34 25 Jan 2017 End Time : Wed, 06:39:47 25 Jan 2017 Status : Success Verification patch contains the following commands: --------------------------------------------------- !! ! No changes -------------------------------------------------------------------------------- time: Wed, 06:39:47 25 Jan 2017 Status: SUCCESS -
Use the show config-replace status CLI command to check the status of configuration replace.
switch(config)# show config-replace status Last operation : Rollback to file Details: Rollback type: atomic replace_tmp_28081 Start Time: Wed Jan 25 06:39:28 2017 End Time: Wed Jan 25 06:39:47 2017 Operation Status: Success switch(config)#

Feedback