Image of Jeremy L. Gaddis, CCNA, CCNP (and Cortney, in case you were wondering)

Erasing and Saving Configurations on Cisco Devices

by Jeremy L. Gaddis on September 8, 2011 · 0 comments

Post image for Erasing and Saving Configurations on Cisco Devices

In the previous article, we made our first configuration change to a Cisco device. In this article, you’ll learn how to save your configuration and make those changes permanent. In addition, you’ll learn how to completely wipe out a device’s configuration and start with a clean slate.

Running Configuration versus Startup Configuration

In Introduction to Cisco Devices and Cisco IOS, I briefly explained the concept of the running configuration and the startup configuration. The startup configuration is saved in memory called NVRAM and is loaded during the boot-up process. Once the startup configuration has been loaded, it becomes the device’s running configuration.

Unlike the startup configuration, the running configuration exists only in RAM. You probably already know that if you type a document in a text editor and turn off your computer, the changes you made will be lost. The running configuration of a Cisco device works in a similar manner.

In Assigning Hostnames to Cisco Devices, we changed the running configuration of our router by giving it a new hostname, however that configuration change exists only in RAM. If you turn the router off and then power it back on, you will find that the hostname has been set back to the default (either “Router” or “Switch”, depending on the type of device).

After we change a device’s configuration, we have three options:

  • make the changes permanent
  • undo the changes
  • completely erase the configuration

Making Configuration Changes Permanent

Save changes?To make our changes permanent and have them persist across reloads, we’ll use the copy command. The syntax of this command may be familiar to you if you’ve ever worked at the command-line in other operating systems. The copy command expects two parameters: the source and the destination.

In this case, the source is the running configuration and the destination is the startup configuration — we want to copy the current running config to the startup config. Makes sense, right?

Just like the hostname command, this one is also very simple. First set the hostname (if you haven’t already):

Router> enable
Router# configure terminal
Router(config)# hostname Miami

Now, we can make that change permanent:

Miami(config)# copy running-config startup-config
% Invalid input detected at '^' marker.


Uh oh!? What happened!? Remember when we said that certain commands can only be run in certain IOS modes? This is another one of them. Let’s try again in global configuration mode:

Miami(config)# end
Miami# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...

After entering the copy running-config startup-config command, IOS will ask you to confirm the destination. While you can type in “startup-config” if you want to, you can simply press <ENTER> (this is another Cisco IOS shortcut). After you confirm the destination, IOS will copy the running configuration (with the changes that we made) and make it the new startup configuration.

At this point, our changes have been made permanent. You can turn the router off and on and you will see that the changes have persisted.

I like to be lazy efficient and use shortcuts whenever possible. Instead of copy running-config startup-config, we can also use the write memory command to save your configuration. Officially, write memory is deprecated but, so far, it still works. We can also use the abbreviated version, wr mem, or, if you want to really save some keystrokes, just wr also works.

Miami# wr
Building configuration...

Undo Changes

Discard all changesAt some point, perhaps while troubleshooting, you will make a configuration change that does not have the result that you were wanting. In this case, you will often want to “undo” the change. There are a few different ways to do this, depending on the changes that you made.

The easiest way to revert changes — although not always the best — is to simply reload the device, assuming you have not saved the changes to the startup configuration. This is done by issuing the reload command.

If you have made changes to the running configuration and you tell the device to reload, you will be asked if you want to save the changes. To permanently discard the changes, simply answer “no” (or “n”). You will also be asked to confirm the reload which you can do by simply pressing <ENTER>.

Let’s go through the whole process from the beginning:

Router> enable
Router# configure terminal
Router(config)# hostname Miami
Miami(config)# end
Miami# reload

System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]
*Sep  7 03:49:13.411: %SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command.

At this point, the device will reload. Once it has booted back up, you’ll see that the hostname has been reset to “Router”, even though we changed it to “Miami” above.

NOTE: There is usually a better way to undo changes that you have made than by completing reloading the router. You’ll learn these methods in later articles.

Erasing Configurations

Erase everythingSometimes, you’ll want to completely erase a device’s configuration in order to start from scratch. While studying for the CCNA test, you’ll probably do this quite often. Fortunately, Cisco IOS provides us with the erase startup-config command in order to make this process easy.

If you were following along and set the device’s hostname to “Miami” and then saved that change, the router’s hostname will be “Miami” every time it is powered up. First, let’s wipe out the current startup configuration:

Miami> enable
Miami# erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
Erase of nvram: complete

Once again, simply press <ENTER> when asked to confirm. At this point, the startup configuration has been erased from NVRAM. The running configuration, however, still exists in RAM. In order to complete the process and get back to a clean slate, we need to reload the router:

Miami# reload
Proceed with reload? [confirm]

When the router reloads, you’ll find that the changes you made (but didn’t save) are gone and your previous configuration has been restored.

Lab Exercise


In this article, you learned how to permanently save changes to a device’s configuration. You also learned how to revert to your startup configuration as well as completely wipe out the configuration.

By now you should be getting accustomed to working on the command-line. We’ve already covered assigning hostnames and now it’s time to learn about setting passwords on routers and switches.

Image Source

Previous post:

Next post: