Cisco: Auto Backup Configuration Using “Configuration Archive”
- Do you have a change management system in place?
- How often do make changes in router/switch configuration?
- What if you router/switch blown up today?
- Will you be able to recover the previous configuration?
- Oh..you forgot to backup?
- Can you figure out exactly what you did and try to put it back the way it was?
Cisco IOS 12.3 introduced the Cisco IOS archive and archive config commands. A very detailed and comprehensive information is available at this Cisco link “Archiving Configurations and Managing them using Archive Management”
- Cisco IOS archive command can help you automatically save configuration after every change.
- This command can also show you the difference between any two configurations saved.
- These archives can also be created manually as per requirement.
- This command can also be used to automatically log all commands entered by any user.
- This command was introduced with IOS 12.3(4)T. Later it was integrated into IOS Release 12.2(25)S.
Router(config)# archive
Router(config-archive)#?
Archive configuration commands:
- default – Set a command to its defaults
- exit – Exit from archive configuration mode
- log – Logging commands
- maximum – maximum number of backup copies
- no – Negate a command or set its defaults
- path – path for backups
- time-period – Period of time in minutes to automatically archive the running- config
- write-memory – Enable automatic backup generation during write memory
- ip ftp username ftp-username
- ip ftp password ftp-password
- archive
- path ftp://202.163.x.x/routerconfig/$h
- write-memory
- time-period 21600
Router #show archive
The next archive file will be named ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-14
Archive # Name
0
1 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-1
2 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-2
3 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-3
4 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-4
5 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-5
6 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-6
7 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-7
8 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-8
9 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-9
10 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-10
11 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-11
12 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-12
13 ftp://202.163.x.x/routerconfig/asw01-cc-syb-8flr-13 <- Most Recent
I can also compare the differences between two archived configurations or the running config and an archived config, using the show archive config differences or incremental-diffs, like this:
Router# show archive config ?
differences Display the differences between two config files
incremental-diffs Display lines in config file which will be added to running-config
As these archived configurations are just text files in the flash memory (if stored locally, but in our example we have given ftp path to store the backup), you can copy them back to the startup or running config anytime you want. Besides viewing them with the show archive command, you can view them with the dir flash command if stored locally and use the files in following commands otherwise have to give path to ftp:
show archive config differencees [file1 [file2]]
or
show archive config incremental-diffs [file]
The archive command is a powerful tool that I recommend to Cisco admins to be implemented on all routers. You can do both local backups of configurations as well as remote backups.