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 config with the config in file test.cfg. This command was introduced in 12.3(7)T
Here is an example of the effect:
Router#sh ip int brief
Interface IP-Address 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 unset administratively 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
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: 1
Rollback Done
r1#
Dec 18 00:44:05.927: Rollback:Acquired Configuration lock.
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#sh ip int brief
Interface IP-Address 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 unset administratively down down
NOTE the following:
1) Router name has changed
2) FastEthernet 0/1 no longer has an IP address
3) FastEthernet 0/1 is shutdown
This is great as rather than just MERGING a config, the command REPLACES the config. You can replace the running-config from many places:
r1#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
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
You could thus have a backup config in flash or on a TFTP server and restore immediately to running config.
David Bombal
CCIE #11023, CCSI, CCDP, CCIP, CCNP, CCSP, CCVP
David Bombal has been providing technical training and consulting for the last 7 years and has worked in the IT industry for over 10 years. He is Managing Director of Network Experts, a consulting and training company in the United Kingdom (http://www.ConfigureTerminal.com)
David passed his routing and switching exam on the first attempt putting him in the top few percent of networking engineers who accomplish this. He spends most of his time teaching and consulting on Cisco technologies with an emphasis in the last few years on VoIP technologies.
You can find out more about him and get more resources here:
http://www.ConfigureTerminal.com