Let’s say you’re implementing some changes on a router that has a large configuration file. Maybe something distracted you when you were making the change, but the new feature doesn’t work when you go to test it. You just want to back everything out and start from scratch.
How can you do that? You have a couple of options.
If you haven’t saved the configuration yet, you can just reload the router. This will work, but you don’t want to have to reload a production router. In addition, why should you wait for a router to reload if you don’t have to?
You can also use the copy startup-config running-config command. However, this command doesn’t do what you might think it does. It simply merges the commands from the startup-config with the running-config.
If there’s a conflict, it leaves the commands in the running-config in place. What you then end up with is a mix of these configurations. In addition, it could also cause some downtime due to unpredictable results caused by mixing modifications with the old config.
How do you restore that startup-config without causing downtime? The configure replace command is the answer to this dilemma. This command takes the running-config and compares it to the replacement configuration. It finds the distinctions between the two configurations and applies only the differences. This command doesn’t affect unchanged configurations, and it doesn’t cause any downtime.
Typically, you replace the running-config with the startup-config located in the router’s NVRAM. To do so, you would use the following command:
configure replace nvram:startup-config
However, the last parameter could be any valid config file in the accepted Cisco IOS URL format. For example, the config you’re using could actually be on a TFTP, FTP, HTTP, RCP, or SCP server. In that case, the command would look something like the following:
configure replace tftp://192.168.1.10/config-backup
The example below is a basic example of using the configure replace command.
First, shut down my FastEthernet1 interface, and then use the configure replace nvram:startup-config command to replace the running-configuration with the startup-configuration. While this is an oversimplified example, it shows how the command works:
! showing the current configuration for the Fa1 interface
Cell_Router1#show running-config interface fa1
Building configuration…
Current configuration : 71 bytes
!
interface FastEthernet4
no ip address
duplex auto
speed auto
end
The first thing we need to do is shut down the interface:
Cell_Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Cell_Router1(config)# interface fa1
Cell_Router1(config-if)# shutdown
Cell_Router1(config-if)#^Z
Cell_Router1#
*Aug 10 13:06:43.269: %LINK-5-CHANGED: Interface FastEthernet1, changed state to administratively down
*Aug 10 13:06:43.273: %SYS-5-CONFIG_I: Configured from console by console
*Aug 10 13:06:44.269: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1, changed state to down
Cell_Router1#
Now (just for safety) let’s verify that the Fa1 interface is shut down:
Cell_Router1#show running-config interface fa1
Building configuration…
Current configuration : 81 bytes
!
interface FastEthernet1
no ip address
shutdown
duplex auto
speed auto
end
Excellent. Next, we will replace the current configuration with the saved configuration:
Cell_Router1# configure replace nvram:startup-config
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
*Aug 10 13:06:55.189: Rollback:Acquired Configuration lock.
Total number of passes: 1
Rollback Done
! notice the “rollback done” message and how the interface immediately started coming up (below)
Cell_Router1#
*Aug 10 13:06:59.245: %LINK-3-UPDOWN: Interface FastEthernet1, changed state to up
*Aug 10 13:07:00.245: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1, changed state to up
Cell_Router1#
Fantastic! Now let’s verify that the interface is properly set up:
Cell_Router1# show running-config interface fa1
Building configuration…
Current configuration : 71 bytes
!
interface FastEthernet1
no ip address
duplex auto
speed auto
end
Cell_Router1#
The configure replace command is a very useful command — it gets you back to where you started while minimizing downtime. We hope this helps you.