When you make changes to a router’s configuration by using configure terminal, you are actually changing the settings stored in RAM – the running configuration. To save these settings to NVRAM, you copy them to the startup configuration, overwriting what was stored there previously. Remember that the copy commands need to be issued from privileged EXEC mode. The example below saves the running configuration settings to the startup configuration.
cisco2501#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
You can also enter copy run star to achieve the same goal. If you reverse the command, you are copying the contents of the startup configuration into RAM, replacing the current running configuration.
cisco2501#copy star run
You aren’t limited to moving configurations between RAM and NVRAM alone – in fact, you can also save both to a TFTP server. But why would you do this? Mainly to have a backup copy of the files, just in case. For example, it’s always a good idea to copy the startup configuration to a TFTP server prior to changing the configuration of a router. That way, if you mess something up, you can always just restore an old configuration file.
Any TFTP server software can be used. After installing it on your laptop or a network server, you will ultimately reference it by its associated IP address.
To save the startup or running configuration to a TFTP server, enter the commands copy star tftp or copy run tftp respectively. The example below shows the running configuration being saved to a TFTP server.
cisco2501#copy run tftp
Address or name of remote host []? 192.168.1.21
Destination filename [running-config]?
!!
1136 bytes copied in 5.100 secs (227 bytes/sec)
Notice that the command asked us to specify the location of the TFTP server (the address of the remote host). In larger environments, consider using a destination filename that uniquely identifies the router that the file is associated with. In this case, I simply chose the default name, running-config.
Going a step further, you can also restore a configuration file to the router from a TFTP server.
cisco2501#copy tftp run
Address or name of remote host []? 192.168.1.21
Source filename []? running-config
Destination filename [running-config]?
Accessing tftp://192.168.1.21/running-config...
Loading running-config from 192.168.1.21 (via Ethernet0): !
[OK - 1136/2048 bytes]
1136 bytes copied in 5.572 secs (227 bytes/sec)
This time, we entered the command copy tftp run, since we wanted to copy the running configuration file from the TFTP server to the running configuration of the router. We also had to specify the IP address of the TFTP server, and the name of the file to restore.
One last note as far as the configuration files are concerned. During your studies (and in real life) there will be times when you just want to kill the entire configuration of the router, reboot, and start from scratch. This is easy enough to accomplish. In fact, it only takes one command. Effectively, what you want to do is erase the startup configuration stored in NVRAM. If you do this and reboot the router, it’s just like starting anew – when the router does reboot, you’ll be presented with the System Configuration Dialog. While practicing for your exams, it is definitely in your best interest to go through the router configuration process many times, or until you feel completely comfortable with it. To erase the startup configuration, use the erase startup-config command.
cisco2501#erase startup-config
Erasing the nvram filesystem will remove all files! Continue? [confirm][OK]
Erase of nvram: complete
It’s always a good idea to backup your startup configuration to a TFTP server before issuing this command, just in case you want to return to where you were previously.