Skip to Content

Use the Configure Replace command to speed up your labbing

I've been labbing quite a bit lately, working on Narbik's R&S workbooks, and I've been rebooting my rack after nearly every lab to clear things out. Well, I was perusing the Interwebs and a forum post reminded me of the config replace command. Sheesh! I wish I would have remembered that a few hundred reboots ago...

Even though I knew about this command, and have even included it in a blog post or two in the past, I had forgotten about it since I wasn't using it all that often. So, just in case someone else out there has forgotten about it, I figured I'd do a quick write up demonstrating the command in action and hopefully jostle some memories (or just help me remember if I forget it again).

Here is a 1841 router that used to be R5, but I changed it's hostname to Testing and did a no shutdown on all it's interfaces. Follow the config below for the usage:

Testing(config-if)#end
Testing#show ip int bri
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  up                    up      
FastEthernet0/1            10.1.2.3        YES manual up                    up      
Serial0/0/0                unassigned      YES NVRAM  up                    up      
Serial0/1/0                unassigned      YES NVRAM  down                  down    
SSLVPN-VIF0                unassigned      NO  unset  up                    up      
Testing#
*Jan 16 03:18:28.327: %SYS-5-CONFIG_I: Configured from console by console
Testing#
Testing#
Testing#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]: yes
Total number of passes: 1
Rollback Done

Notice the Hostname changes back to R5 and the interfaces all drop after typing Yes to proceed.

R5#
*Jan 16 03:18:50.379: Rollback:Acquired Configuration lock.
*Jan 16 03:18:52.119: %PARSER-6-EXPOSEDLOCKRELEASED: Exclusive configuration lock 
released from terminal '0' -Process= "Exec", ipl= 0, pid= 3 *Jan 16 03:18:52.539: %LINK-5-CHANGED: Interface Serial0/1/0, changed state to administratively down *Jan 16 03:18:53.287: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down *Jan 16 03:18:53.295: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down *Jan 16 03:18:53.315: %LINK-5-CHANGED: Interface Serial0/0/0, changed state to administratively down R5# *Jan 16 03:18:54.287: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down *Jan 16 03:18:54.295: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down *Jan 16 03:18:54.315: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to down R5#show ip int bri Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES NVRAM administratively down down FastEthernet0/1 unassigned YES manual administratively down down Serial0/0/0 unassigned YES NVRAM administratively down down Serial0/1/0 unassigned YES NVRAM administratively down down SSLVPN-VIF0 unassigned NO unset up up R5#

Couldn't be simpler! Now if only there was a simple way to keep from forgetting things...

Your rating: None Average: 5 (3 votes)

Comments

Juniper replace command

Juniper have a similar replace command, that replace a specific pattern, it seems better.

Adam's picture

So, if you are studying for

So, if you are studying for your JNCIE you can save time while labbing too ;)

Juniper

It is easier to use the rollback function (depends on the rollback count you have on the device) or save a rescue config before you start.

is it available on the ASA

is it available on the ASA

Adam's picture

Doesn't look like it...

I just checked an ASA running 8.4 and didn't see this command.

asa(config)# configure ?

configure mode commands/options:
  WORD             Configure from HTTP:
                   http(s)://[:@][:]/.
                   Place IPv6 address within square brackets if a port is
                   specified.
  factory-default  Configure from factory-default
  memory           Configure from memory
  net              Configure from tftp

exec mode commands/options:
  terminal  Configure using terminal/console

Also, you probably don't want to use the configure memory command. There might be a corner case where you need to merge the startup-config and the running-config, but in my experience, it just ruins a good running-config and causes a traffic interruption.

Replace Command

Been doing this with my home CCIE lab but Switches dont always like this command....

Brocade

The company I work for is pretty much arrested to Brocade because that is our network. I am curious does Brocade have a similar command to this as Cisco?

what if it is? # copy start

what if it is?

# copy start run

does it produce the same result?

Adam's picture

Merge rather than replace

Copy start run does not produce the same results as the config replace command. Copy start run would merge the startup-config with the running-config. This would likely produce undesired results in a production environment.

why R5 and not Router?

If this is supposed to produce a fresh "blank" config file then why does it show R5 instead of the default "Router"?

Thanks Kevin

TIA

I know this is and older

I know this is and older thread but I don't think it produces a blank config. It just replaces the running config with the startup config. That way you can change the running config all you want and as long as you don't write mem or copy run start you can go back to exactly what you had without rebooting the router.



Dr. Radut | blog