CCNA: Chapter 3-7 Saving, Erasing, Restoring and Backing up Configuration & IOS File

10. September 2016 Cisco, Study Guides 0
CCNA: Chapter 3-7 Saving, Erasing, Restoring and Backing up Configuration & IOS File

Saving, Erasing, Restoring and Backing up Configuration

As you already know, any change to the configuration is made to the running-config, which is different from the startup-config that is loaded at the boot up. What this means is that if you do not save the running-config to the NVRAM as startup-config, all changes will be lost on reboot!

To save the running-configuration to NVRAM, you can use the copy command in the privileged exec mode. The copy command expects two parameters – the source and the destination. In this case, the source is the running-config and the destination is the startup-config, so the command that you will need to use is copy running-config startup-config as shown below:



Now consider a situation where you made changes to the running-config but want to discard them. Remember that changes to the running-config are immediate. So either you can negate all changes one by one or simply copy the startup config to running-config using the copycommand. This time, simply reverse the source and destination as shown below:

Destination filename [running-config]?

1172 bytes copied in 0.972 secs (1206 bytes/sec)

Apart from copying the config between running and startup, you can also copy the config to a TFTP server in the network for backup purpose. You need to backup the config so that you have a copy to use in case the router crashes and you need to replace it. You can again use the copy command by replacing the destination with tftp: as shown below:

Notice in the example above that after the command, you are prompted for the IP address of the TFTP server and the file name. You can press enter to use the default file name or provide a different one.

Similarly, you can copy the config from a TFTP server to the running-config by reversing the above command as shown below:

If you want to clear the configuration and start afresh, you can erase the startup-config and reload the router. To erase the startup-config, use the erase startup-config command in the privilege exec mode as shown below:

To reboot the device, use the reload command in the privilege exec mode as shown below:

System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]y

If the configuration is not saved, the router will prompt you to save the configuration when you enter the reload command. Type no and press enter to not save the configuration and reload with an empty NVRAM. When the devices comes up, there will be no configuration on it and you can start over.

Working with IOS files and IOS File System (IFS)

Similar to how the configuration can be copied around, the IOS file that is used by devices can be backed up or restored or simply changed using the copy command. Remember that IOS file is saved in the flash memory. To copy the file currently used by the router to a TFTP server, use the copy flash: tftp: command as shown below:

To copy an image from the TFTP server to the flash memory, reverse the above command as shown below:

Notice the error in the above output? It shows that the file was not copied because there is no space left in the flash memory. So before copying the new file, you will need to free up some space. You can check the contents of the flash memory using the dir command in the privileged exec mode as shown below:

Directory of flash:/

1  -rw-    23348556  Feb 23 1907 16:27:44 +00:00  c1841-advipservicesk9-mz.124-25e.bin

To free up some space you can delete some the existing files using the delete command.  Since there is only a single file in the flash currently, it has to be deleted as shown below:

Now that you have free space, try the copy command again:

Address or name of remote host [192.168.26.121]? 192.168.1.40
Source filename [c1841-entbase-mz.124-24.T5.bin]?
Destination filename [c1841-entbase-mz.124-24.T5.bin]?
Accessing tftp://192.168.1.40/c1841-entbase-mz.124-24.T5.bin…
Loading c1841-entbase-mz.124-24.T5.bin from 192.168.1.40 (via FastEthernet0/0): !!!!!!!!!!!!!!
[OK – 28532596 bytes]

28532596 bytes copied in 211.228 secs (135080 bytes/sec)

The two commands that you used above, dir and delete are examples of commands that are used to manage the IOS File System (IFS). Evencopy is similarly a command to manage the IFS. There are various other commands that can be used to manage the IFS. Some of them are discussed below:

  • show file – This command will give you few details such as file type and size about any file in the IFS. An example is shown below:
  • erase – This command as you already know, can be used to delete the contents of the NVRAM.
  • format – This command is used to erase ALL contents of the flash.
  • mkdir –  This command is used to create a sub-directory in the IFS. An example is shown below:

Create directory filename [test]?
Created dir flash:test

myRouter#dir
Directory of flash:/

1  -rw-    21177448   Sep 7 2011 00:12:50 +00:00  c1841-advsecurityk9-mz.124-23.bin
2  drw-           0  Jan 21 2012 14:09:34 +00:00  test

31936512 bytes total (10752000 bytes free)

  • cd – This command is used to move to a sub-directory or move back to parent directory on IFS. For example, cd test will take you inside the sub-directory created above.
  • pwd – This command can be used to find the name of directory you are currently in. An example is shown below:
  • rmdir – This command can be used to delete a directory.
  • copy – Similar to how you copied an IOS file to the flash (IFS), you can copy any file to IFS. For example, you can copy the running-config to the IFS as shown below:

Destination filename [backup.conf]?

2647 bytes copied in 1.516 secs (1746 bytes/sec)

myRouter#dir
Directory of flash:/

1  -rw-    21177448   Sep 7 2011 00:12:50 +00:00  c1841-advsecurityk9-mz.124-23.bin
2  drw-           0  Jan 21 2012 14:09:34 +00:00  test
3  -rw-        2647  Jan 21 2012 14:13:00 +00:00  backup.conf

  • more – This command can be used to read the contents of a text file that exists on the IFS. For example, you can read the contents of the backup.conf file created in the previous step as shown below:

In case you have enough free space in the flash memory, you can have multiple IOS files there. By default, the first file that the system encounters is used for booting. You can specify the IOS file that want the system to load to boot up, using the boot system command in the global configuration mode as shown below:


Leave a Reply

Your email address will not be published. Required fields are marked *