Have you ever made changes to your Cisco router or switch and then needed to remove them? There are several ways to do this, but which is the safest and easiest method? Rebooting the router or switch isn't the answer. In fact, a simple command is a much better bet.
Let's say you're implementing some changes on a router that has a large configuration file. Maybe something distracted you when you were making the change, but the new feature doesn't work when you go to test it.
You just want to back everything out and start from scratch. How can you do that? You have a couple of options.
If you haven't saved the configuration yet, you can just reload the router. This will work, but you don't want to have to reload a production router. In addition, why should you wait for a router to reload if you don't have to?
You can also use the copy startup-config running-config command. However, this command doesn't do what you might think it does. It simply merges the commands from the startup-config with the running-config.
If there's a conflict, it leaves the commands in the running-config in place. What you then end up with is a mix of these configurations. In addition, it could also cause some downtime due to unpredictable results caused by mixing modifications with the old config.
How do you restore that startup-config without causing downtime? The configure replace command is the answer to this dilemma. This command takes the running-config and compares it to the replacement configuration. It finds the distinctions between the two configurations and applies only the differences. This command doesn't affect unchanged configurations, and it doesn't cause any downtime.
Typically, you replace the running-config with the startup-config located in the router's NVRAM. To do so, you would use the following command:
configure replace nvram:startup-config
However, the last parameter could be any valid config file in the accepted Cisco IOS URL format. For example, the config you're using could actually be on a TFTP, FTP, HTTP, RCP, or SCP server. In that case, the command would look something like the following:
configure replace tftp://192.168.1.107/config-bu
Listing A offers a basic example of using the configure replace command. First, I shut down my FastEthernet4 interface, and then I used the configure replace nvram:startup-config command to replace my running-configuration with the startup-configuration. While this is an oversimplified example, it shows how the command works.
The configure replace command is a very useful command -- it gets you back to where you started while minimizing downtime. For more information, check out Cisco's Configuration Replace and Configuration Rollback documentation.
Miss a column?
Check out the Cisco Routers and Switches Archive, and catch up on David Davis' most recent columns.
Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!
David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.