The operation of networking equipment mostly relies on two important files: the internetwork operating system (IOS) and the configuration. The former file is just like the Windows operating system for your computer. It hides the complexities of hardware from the user, manages the hardware resources, handles I/O operations, etc. The latter is a set of instructions telling IOS which features should be enabled providing numerous mandatory and optional parameters. It is absolutely imperative that you create copies of those two critical files.
In this article , as part of IOS CLI speed tips, I would like to elaborate on a few file backup techniques. I have seen these as recurring questions/answers on the Internet’s discussion groups. They are Cisco best practices when it comes to file management. Here are the next five IOS tips:
* Copy IOS using TFTP and FTP (recommended) servers.
* Copy configuration using terminal software logging capability.
* Copy configuration to and from a TFTP/FTP/RCP server.
* Flash memory configuration archive.
* Configuration replacement.
Copy IOS using TFTP and FTP (recommended) servers.
If you want to back up your IOS, Cisco training often mentions trivial file transfer protocol (TFTP) as the backup server. However, this server is only suitable for small file transfers, such as configurations or small IOS files. It is not the best solution to create a copy of larger files. In recent years, Cisco has made large improvements in their IOS and, as a result of that, the size of the file is as small as it was 10 years ago. In order to create a backup copy of these, I would recommend is using a more reliable server, such as an FTP one. There are three major reasons for doing so:
1. A TFTP server uses UDP as the transport protocol. It is an unreliable and connectionless protocol. FTP uses TCP protocol, which is reliable (it can retransmit what is not properly delivered and it establishes the communication with the server before it starts transmitting data).
2. A TFTP server does not use any credential for the access (such as username and password). All the user needs to know is the exact address of the server, the path to a file, and its name to be able to access the file. FTP provides the authentication phase before a file can be accessed.
3. TFTP servers are not the most reliable ones. I have tried numerous solutions and many of them tended to crash unexpectedly in the middle of the transmissions. The ones that I have found relatively stable and free are Linux-based, with the exception of the Solarwinds TFTP server, written for MS Windows.
Let’s see how you can make a backup of our IOS file using both solutions.
First, let’s try to copy IOS onto a TFTP server with the address of 10.1.1.100. In order to do that, you first need to know the name of the IOS file in the flash. In the privilege mode you use “show flash“ command in order to learn the name of IOS file (it is case sensitive). Take a look at the example presented in the picture below:
Pic. 1 – Content of Flash Memory.
The first file is usually the IOS image. In my output it is the file named:
In order to copy IOS to a TFTP server (less recommended), you would need to perform few checks:
1. Ping the server to see if your device can reach it.
2. Ensure that the TFTP service is started.
3. Check if the server has enough disk space to store the image (here, the image is around 67MB in size)
If all are true, begin the file transfer using the following command in the privileged mode:
copy flash:filename tftp:
The system is going to ask you about the address of your TFTP server (in my example: 10.1.1.100) and the name of the file you want to store on the server. An example of this is depicted below (Pic. 2).
Pic. 2 – Copy IOS onto TFTP server.
All you have to do is to hit ENTER to accept it. The transfer will begin momentarily.
However, a much better option is to use FTP server as the destination for IOS file. This requires some additional configurations. The mandatory steps are as follows (these need to be added in the global configuration mode):
Configure a username for FTP server authentication (here: username is “admin“):
ip ftp username admin
Configure a password for FTP server authentication (here the password is “S3cr3t“):
ip ftp password S3cre3t
Then the copy operation can be done using the command below and answering the questions presented in Pic. 2.
copy flash:your_IOS_file_name tftp:
Do not forget to create the account on the FTP server that you have used in your IOS configuration. Also make sure that the username has read/write permissions on the server!
If you wanted to do the opposite, copy a file from a TFTP or an FTP server, guess what would be the command to use? In case of copying a file from TFTP server to FLASH:
copy tftp:here_file_name flash:
The command syntax is:
The “url“ can be flash:, tftp:, nvram:
ftp: etc. In order to learn the details Google for “Cisco IOS file system.“
Copy configuration using the terminal software logging capability.
There are situations in which you cannot resolve some network-related problems by yourself. Most companies provide technical support to address those types of complex issues. This could be a Cisco partner company that sold the equipment or a Cisco technical assistance center (TAC). Either way, engineers who help resolve problems will require the running configuration of one or more of our devices.
One way is to quickly create a copy of the running configuration is to use the “show run“ command in the privileged mode and copy the displayed output into a text editor.
The problem with this method is that IOS displays only 24 lines (paging) at a time. The keyword “more“ shows as soon as the terminal line reaches the page line limit. This makes the copy operation a bit cumbersome. Also, another problem is the difficulty of highlighting the whole configuration without any omissions while pasting it into a text editor. Both problems can be easily solved!
First, ensure that your terminal software (CRT, TeraTerm, Putty, etc.) has the capability to log into a file whatever is displayed in the terminal window. Most people use Putty terminal since it is free and reliable and it does the job. I am going to show you how it is done using this free tool. If you use different terminal software, please refer to the appropriate documentation.
First you should disable the IOS output paging by using the following command in the privileged mode:
terminal length 0
Pic. 3 – Disable Output Paging.
Then, in your terminal software, enable logging to the file. Using Putty I am going to create a file on the desktop called: R1-running-config.txt. By clicking the left-hand side corner of Putty’s window, I access the option: “change settings.“ From there I choose: “Logging“ under “Session.“ And then I pick the “All session output“ and in the “Log file name“ I browse to my computer’s desktop to name the file (here R1-config.txt).
Pic. 4 – Putty Session Logging.
All that remains to be done is for you to issue:
and the content will be copied to the file you have chosen.
Ones you have finished logging, you should disable this feature in your terminal software (“Session logging: none“) and bring the paging back in IOS by typing:
terminal no length
It will restore the previous 24-line paging. Alternatively, you can disconnect from the terminal.
Copy configuration to and from a TFTP/RCP/FTP server.
If you read tip 11, there will be no surprises as to what the commands below really do. Assuming that we have those three server running (for instance, the address will be 10.1.1.100) and they are reachable, let’s configure each option.
Copying configuration to and from TFTP server.
This option is the easiest to accomplish. You can send either the running-configuration or startup-configuration (copy running-config, or copy startup-config respectively). The command syntax is
R1#copy running-config tftp:
The above statement will copy the running configuration (“running-config“ is an alias and not real url) of the device onto the TFTP server. Do not forget to answer the system’s questions (host name or IP address and the name of the file you want to store on the server) when prompted for those.
If you want to copy the configuration from the TFTP server to a running-config, you would use the following command (here: run is abbreviation of running-config):
R1#copy tftp: run
You can also use the following command. Try to guess what it will do:
R1#copy tftp://10.1.1.100/my-files/r1-config1.txt system:startup-config
If you think it is going to copy the r1-config1.txt file into running-config, you are right. The TFTP server’s IP address here is 10.1.1.100 and the folder where the ‘r1-config1.txt’ file is stored is in the
“my-files“ folder of the main TFTP server folder.
There is one thing you need to be aware of, though. If you copy running-configuration onto some external device (tftp, ftp, rcp, nvram etc.), the exact copy of your configuration will be stored there. The converse is NOT true, though. Copying the configuration from the external device into RAM memory (system:) will merge the current, running-configuration with the file being downloaded. There is a way around that which I am going to show you in tip 15.
Copying configuration to and from RCP server
Remote copy protocol (RCP) is an old Unix/Linux admin alternative to TFTP. In order to enable RCP support, you must define the user’s name that is used on the RCP server to authenticate incoming file transfer:
R1(config)#ip rcmd remote-username admin
where “admin“ is the account name used on the RCP server. As for the command to copy your configuration to RCP server, it is the following statement:
R1#copy run rcp:
If you want to copy the configuration from the RCP server (10.1.1.100/my-files/r1-config1.txt) into the startup-config (nvram:), here are two alternatives:
R1#copy rcp://firstname.lastname@example.org/my-files/r1-config.txt nvram:startup-config
or just type in the following and provide information about server’s address and file location when prompted:
R1#copy rcp: nvram:startup-config
R1#copy rcp: startup-config
Copying configuration to and from FTP server
FTP server will require two extra parameters to work: an account on the server with a password (read/write permissions are required on all types of servers).
The Cisco IOS mandatory commands will be to define the username and password matching the account on the FTP server. An example of configuring the username and password for FTP transfer below (username “admin“ password “S3cre3t“):
R1(config)#ip ftp username admin
R1(config)#ip ftp password S3cr3t
Copying the file is the same as with TFTP with the exception of the destination url:
R1# copy running-config ftp:
The easy way to download the configuration from the FTP server into nvram could look like this:
R2#copy tftp: startup-config
Flash memory configuration archive.
An extremely useful option that IOS has is the configuration archive. It allows you to create an archive where you will store up to 10 last configs (you can change this number using the “maximum“ keyword in the archive config mode), rollback configuration manually or using time specified. All available parameters are beyond the scope of this short article. But let me show you few basics just to get you started.
A configuration archive will be stored in the flash memory by default (make sure you have room there). In order to enable this feature, you must at least create the path in the flash memory where your configuration archived will be stored. Here’s how you do it:
Pic. 5 – Archive Basic Configurations
Now, the archive folder (my_files) has been created in the flash memory. In order to archive the configuration file, type in the following command in the privileged mode:
Here’s what has happened:
Pic. 6 – Archive Content.
System will keep up to 10 files in the archive (on this router it can go up to 14 files).
The next file archived will be: flash:my_files-<timestamp.>-1.
Let’s modify my configuration by adding the description of the interface and creating a new file in the archive:
R1#(config-if)#description === LAN CONNECTION ===
Pic. 7 – Archive Content Modified
Now there are two files in the archive. The left arrow shows the most recent one.
Most CCNA candidates do not know that there is a nice option which allows replacing the configuration in the RAM memory (running-configuration) using some external file. Let me demonstrate this, using our newly created archive file.
Current configuration has the description on the Fa0/0 interface. Our previous version archived with the name:
Flash:my_filesJun—6-12-26.371-0 has no description on this interface.
Pic. 8 – Current Configuration of Fa0/0 Interface.
Now, let’s replace this running-configuration with the one from the archive:
Pic. 9 – Configuration replaced.
I hope you have found this article informative.