Overwrite running configuration instead of merging on a Cisco router
To replace the current running configuration with a saved Cisco IOS configuration file, use the configure replace command in privileged EXEC mode.
Router#configure replace flash:test.cfg
This command will replace (NOTE: not merge) the running configuration with the configuration in the test.cfg file. This command was introduced in 12.3(7)T
here’s a example of the effect:
Router#ship ip int short
Is the IP address of the interface ok? Method Status Protocol
FastEthernet0/0 10.10.10.3 YES manual up up
FastEthernet0/1 10.1.1.1 YES manual up up
Serial0/3/0 unassigned YES not administratively configured down down
Router#configure replace flash:test.cfg
This will apply all necessary additions and deletions.
to replace the current running configuration with the
contents of the specified configuration file, which is
it’s supposed to be a complete setup, not a partial one
setting. Enter Y if you are sure you want to continue. ? [no]: there
Total number of passes: 1
Revert Done
r1#
Dec 18 00:44:05.927: Rollback: Lock acquired configuration.
Dec 18 00:44:07.703: %PARSER-3-CONFIGNOTLOCKED: Unlock requested by process ‘3’.
Configuration not locked.
Dec 18 00:44:08.819: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
r1#ship ip int short
Is the IP address of the interface ok? Method Status Protocol
FastEthernet0/0 10.10.10.3 YES manual up up
FastEthernet0/1 10.1.1.1 YES manual administratively down down
Serial0/3/0 unassigned YES not administratively configured down down
Consider the following:
1) The name of the router has changed
2) FastEthernet 0/1 no longer has an IP address
3) FastEthernet 0/1 is down
This is great since instead of just MERGE a configuration, the command REPLACES the configuration. You can override the running configuration from many places:
r1#configure replace?
file: URL of the configuration file that will replace the running configuration
cns: URL of the configuration file that will replace the running configuration
flash: URL of the configuration file that will replace the running configuration
ftp: URL of the configuration file that will replace the running configuration
http: URL of the configuration file that will replace the running configuration
https: URL of the configuration file that will replace the running configuration
null: URL of the configuration file that will replace the running configuration
nvram: URL of the configuration file that will replace the running configuration
pram: URL of the configuration file that will replace running-config
rcp: URL of the configuration file that will replace the running configuration
scp: URL of the configuration file that will replace the running configuration
system: URL of the configuration file that will replace the running configuration
tftp: URL of the configuration file that will replace the running configuration
xmodem: URL of the configuration file that will replace the running configuration
ymodem: URL of the configuration file that will replace the running configuration
So you could have a backup configuration in flash or on a TFTP server and immediately restore it to the running configuration.