Let’s say that you’ve made numerous changes to your running config, but you haven’t yet saved the config to NVRAM. Now, for whatever reason, you decide that you’d like to roll back the running config to what you had before you made the changes. Easy enough … you’d simply use copy start run, right?
Remember that whenever you copy anything into the running config (be it from config mode, the startup config, a TFTP server, or wherever) it’s a modified merge, or as Cisco sometimes calls it, a “gentle overlay”. In other words, things in the running config might be overwritten, or things might be added, but with few exceptions nothing would be removed.
Prior to IOS 12.3, you had two choices:
- Undo everything manually, using the opposite commands, adding, deleting and modifying as needed. This is messy and could take a while (bad).
- Do a reload without saving the running config to NVRAM. This could, as they say, “severely impact network performance” (possibly worse).
It would be up to you to choose the lesser of the two evils. Nowadays, though (meaning if you’re running current IOS code), you have another option … configure replace. For example, to roll back the running config to the existing startup config, you could use:
Router#configure replace nvram:startup-config
When you execute this command, you’ll see the following message that prompts you to confirm the “replace”:
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
*Mar 1 01:04:23.012: Rollback:Acquired Configuration lock.
Total number of passes: 1
Unlike the copy command, when using configure replace you need to completely specify the location (nvram or wherever) and the filename (no shortcutting startup-config as start). In addition to NVRAM, the replace option can specify other source file locations, such as file servers or flash. In other words, if you have saved a modified running config to NVRAM (and maybe wish you hadn’t!), you can use the replace option to retrieve the old config from elsewhere, and shoot it back in without having to reload the box. Use configure replace ? from privileged mode to see what source options are available.
Next time, we’ll look at another nifty thing you can do by manipulating config.