Replace a running config without reloading
The new Cisco IOS 12.4 train has many new features that any engineer will find useful; one of the features that fix a pain point for me is the new config options available in 12.4. Have you ever been in a situation where an entered configuration does not work as expected? Now usually you have to back out the configuration one command at a time and hope for the best. Sometimes you may even reach a point where you can not completely remove a configuration without reloading the device, this is the case sometimes when trying to remove sub interfaces. Now if this is a data center or work environment then you may not be able to reload the router.
It is for situations just like these that Cisco changed the configure command. If you have ever used the copy startup-config running-config command you know that this command does not replace what is running but instead merges the two configurations which often times will create a bigger mess.
Cisco has added the configure replace command. This command will go through the configuration line by line and replace your configuration with the configuration you specify and it will go through the config as many times as it takes to back out all of the differences and replace them with the file specified. The amazing thing about this command is that it does not interrupt the operation of the router, so you can rollback changes without affecting business continuity.
Here is an excerpt from my router running the command to replace the running configuration with the startup configuration:
Lord_Yu# configure replace ?
archive: URL of config file that will replace running-config
cns: URL of config file that will replace running-config
flash: URL of config file that will replace running-config
ftp: URL of config file that will replace running-config
http: URL of config file that will replace running-config
https: URL of config file that will replace running-config
null: URL of config file that will replace running-config
nvram: URL of config file that will replace running-config
pram: URL of config file that will replace running-config
rcp: URL of config file that will replace running-config
scp: URL of config file that will replace running-config
snmp: URL of config file that will replace running-config
system: URL of config file that will replace running-config
tftp: URL of config file that will replace running-config
xmodem: URL of config file that will replace running-config
ymodem: URL of config file that will replace running-config
Lord_Yu# configure replace nv
Lord_Yu# configure replace nvram:?
nvram:ifIndex-table nvram:persistent-data nvram:private-config
nvram:startup-config
Lord_Yu# configure replace nvram:sta
Lord_Yu# configure replace nvram:startup-config ?
force Forcibly replace without prompting for user input
ignorecase Ignore case
list List the commands applied in each pass
time Time for which to wait for confirmation
Lord_Yu# 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
Total number of passes: 0
Rollback Done