How to Manage your Cisco Device Configuration File

A Cisco router has its own operating system which is called the Internetwork Operating System (IOS). Cisco routers use flash memory, rather than disks for storing information. Flash storage is similar to Random Access Memory (RAM) but it doesn’t need power to retain information. It is therefore called non-volatile memory. And, unlike Read Only Memory (ROM), you can erase and rewrite flash easily.

There are at least two main pieces of non-volatile storage in a Cisco router. The router’s configuration information is stored in a device called the Non-Volatile RAM (NVRAM), and the IOS images are stored in a device called the flash.

There are two important configuration files on any router. There is the configuration file that describes the current running state of the router, which is called the running-config. Then, there is the configuration file that the router uses to boot, which is called the startup-config. Only the startup-config is stored in NVRAM, so it is important to periodically check that the version of the configuration in the NVRAM is synchronized with the version that the router is currently running.

You can synchronize the two configuration files by simply copying the running-config onto the startup-config file:

DEVICE#copy running-config startup-config


Saving Router Configuration to Server

It is very important to take regular backups of your router configuration files and keeping copies of these files in a safe place. Anybody who has had to reconstruct a complex router configuration file from memory can tell you how difficult and stressful this task is! But, if you have a backup of the last working configuration file, you can usually get a router working again within minutes of fixing any hardware problems.

This example shows how to use TFTP to upload a copy of the router’s active configuration to a remote server:

Freebsd% touch /tftpboot/router1-confg
Freebsd% chmod 666 /tftpboot/router1-confg
Freebsd% telnet Router1
Connected to Router1.
Escape character is '^]'.

User Access Verification


Router1#copy running-config tftp://172.2
Address or name of remote host []?
Destination filename [router1-confg]?
9640 bytes copied in 3.956 secs (2437 bytes/sec)


Booting the Router Using a Remote Configuration File

By default, when the router reloads, it will read the configuration information from a file in its NVRAM. Cisco commonly refers to this file as the startup configuration file. However, you can configure the router to load all or part of its configuration from a remote server via TFTP.

The following set of commands allows you to automatically load a configuration file located on a remote TFTP server when the router boots:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#service config
Router1(config)#boot network tftp Network
Router1(config)#boot host tftp Router8


Storing Configuration Files Larger than NVRAM

Cisco generally ships its routers with more than enough NVRAM to store an average configuration file. However, there are times when configuration files exceed the available NVRAM. For instance, some routers contain large access lists that are hundreds of lines in length. When configuration files grow beyond the finite amount of NVRAM you will begin to have problems.

The first sign of serious problems with an overly large configuration file is usually when the router refuses to save its configuration because of size. This is a dangerous situation because the router can no longer keep a copy of the whole running-configuration file in its NVRAM storage, and it is difficult to predict how much of your configuration will be lost if you were to reload the router.

You can compress your router’s configuration file before saving it to NVRAM to allow you to save more configuration information. The command service compress-config will compress the configuration information when the router saves the file, and uncompress it when it is required:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#service compress-config

Turning on compression roughly doubles the size of the configuration file you can store. You must put the command service compress-config into the configuration with a configure terminal. Then, for this command to take effect, you need to copy the running configuration file to NVRAM:

Router1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
Compressed configuration from 9664 bytes to 4903 bytes[OK]


Clearing the Startup Configuration

Before you redeploy an old router that you have previously used for another purpose, it is a good idea to completely erase the old configuration. This ensures that the router starts with a clean configuration.

You can delete the current startup configuration files and return the router to its factory default settings with the erase nvram: command:

Router1#erase nvram:
Erasing the nvram filesystem will remove all files! Continue? [confirm]

Erase of nvram: complete

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

You can also achieve the same result with the erase startup-config command:

Router1#erase startup-config
Erasing the nvram filesystem will remove all files! Continue? [confirm]

Erase of nvram: complete
Proceed with reload? [confirm]


Loading a New IOS Image

Common reasons for upgrading the IOS include new features, bug fixes, and security vulnerabilities. Before you attempt to upgrade your IOS, you should save a backup copy of your current IOS to your TFTP server.

You should always start by analyzing how much free space is available in your router’s flash to ensure that there is enough room to load the new IOS image. If there isn’t enough, then you may have to erase existing image(s) from flash—as we did in our example. In some cases, you may not have enough flash to load the new image at all.

Router1#show flash

System flash directory:
File Length Name/status
1 11135588 c2600-ik9o3s-mz.122-12a.bin
[11135652 bytes used, 5117276 available, 16252928 total]
16384K bytes of processor board System flash (Read/Write)


The copy tftp command allows you to use TFTP to download a new IOS version into the router’s Flash memory:

Router1#copy tftp://
.122-12a.bin flash:
Destination filename [c2600-ik9o3s-mz.122-12a.bin]?
Accessing tftp://…
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]

Erasing device… eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee …
Erase of flash: complete
Loading c2600-ik9o3s-mz.122-12a.bin from (via FastEthernet0/0.1):
[OK – 11135588 bytes]

Verifying checksum… OK (0xE643)
11135588 bytes copied in 82.236 secs (135410 bytes/sec)
Router1# reload
Proceed with reload? [confirm]