How to use archive command to save configuration
In a large/critical network, it is fundamental backup the Cisco configuration for two reasons:
- Rollback configuration
- Restore configuration in case of a broken router
There are two ways to backup: manually (using write command each time that you would save running configuration) or automatically (using software like Ciscoworks, HP OpenView, … ).
In this tutorial, I would explain a different method to backup configuration: the archive command.
Introduced into Cisco IOS Release 12.3(4)T, the archive command permits to save a copy of the current running configuration to different path: ftp, http, https, rcp, scp, tftp servers. Moreover the archive command has other features, but in this article I would use only two of these:
- time-period: it sets the time increment for automatically saving an archive file of the current running configuration in the Cisco IOS configuration archive.
- write-memory: it enable automatic backup generation during write memory; for instance, when I use the ‘write’ command the archive command will be invoked automatically.
Example: Implement and test archive command
Suppose to have a network (192.168.217.0/24) with an FTP-Server (.1). It is required to save the running configuration to the FTP-Server each day (1440 minutes). The FTP-Server has an FTP account with username: cisco and password: lab.
First of all, it is required access to the archive configuration mode:
Now it is possible define the destination path. In this example, I use the FTP protocol to send the running configuration; the name ‘$h’ instructs the system to use the router hostname when naming the archived configuration (in this case $h is equal to Ciscozine).
To instruct the router to save the configuration each day (1440 minutes) and to enable automatic backup generation when write memory command is typed, use:
Ciscozine(config-archive)#time-period 1440 Ciscozine(config-archive)#write-memory
To see how many configurations are been saved use the command ‘show archive’:
Ciscozine#sh archive The next archive file will be named ftp://cisco:firstname.lastname@example.org/Ciscozine-17 Archive # Name 0 ftp://cisco:email@example.com/Ciscozine-15 1 ftp://cisco:firstname.lastname@example.org/Ciscozine-16 <- Most Recent 2 ftp://cisco:email@example.com/Ciscozine-2 3 ftp://cisco:firstname.lastname@example.org/Ciscozine-3 4 ftp://cisco:email@example.com/Ciscozine-4 5 ftp://cisco:firstname.lastname@example.org/Ciscozine-5 6 ftp://cisco:email@example.com/Ciscozine-6 7 ftp://cisco:firstname.lastname@example.org/Ciscozine-7 8 ftp://cisco:email@example.com/Ciscozine-8 9 ftp://cisco:firstname.lastname@example.org/Ciscozine-9 10 ftp://cisco:email@example.com/Ciscozine-10 11 ftp://cisco:firstname.lastname@example.org/Ciscozine-11 12 ftp://cisco:email@example.com/Ciscozine-12 13 ftp://cisco:firstname.lastname@example.org/Ciscozine-13 14 ftp://cisco:email@example.com/Ciscozine-14 Ciscozine#
To display the differences between two config files use the ‘show archive config differences’; for instance, to find the differences between the startup-config and the ‘Ciscozine-8’ file, type:
NEW-CISCOZINE#show archive config differences nvram:startup-config ftp://cisco:firstname.lastname@example.org/Ciscozine-8 Loading Ciscozine-8 ! [OK - 717/4096 bytes] Contextual Config Diffs: +hostname Ciscozine -hostname NEW-CISCOZINE NEW-CISCOZINE#
As you can see, there are two differences: the hostname saved in the startup-configuration file (NEW-CISCOZINE) is different from the Ciscozine-8 file (Ciscozine).
Remember: If the router is reloaded, the system will restart to save the configuration with the counter equal to one (for example Ciscozine-1). So the previous configurations will be overwritten!
Enter your email address to receive notifications of new posts.