Tuesday, 18 March 2014

Cisco Archive Command and Associated Features:

Introduction:


The cisco archive feature is a cheap way to automatically maintain copies of your router configuration files.  You can make automatic backup copies at specified intervals to a variety of locations such as local flash memory or a remote FTP server.   This lab will focus on backing up to an FTP server.

Requirements:

1 x Cisco 2960-s (any device that supports the cisco archive features will do)
1 x Machine with an FTP server set up and a username and password configured.  This lab utilises filezilla ftp server available from https://filezilla-project.org/


If you want to set up a windows 2012 FTP server for this purpose here is a guide I found:
https://social.technet.microsoft.com/wiki/contents/articles/12364.windows-server-2012-ftp-installation.aspx

Assumptions:

1.       Server has an OS preconfigured with an IP Address that can reach the cisco device and vice versa.

Diagram:




Step 1 - test reach-ability:

Make a quick ping to the server from the switch to ensure you have two-way reachability.




Step 2 – Your FTP Server should be configured as follows:

1.       Listen on Port 21
2.       Create a username and password of
a.       Username=Cisco
b.      Password=password
3.       Read and write privelages on the ftp directory

Step 3- Create an FTP username and password pair on your device

Enter the following commands:
Switch(config)#ip ftp username Cisco
Switch(config)#ip ftp password password

Step 4 – Set up the archiving of your configuration using the archive command:

Enter the following commands:
Switch(config)#archive
Switch(config-archive)#path ftp://172.16.49.89/test-config
Switch(config-archive)#write-memory

Step 5 – Testing your archive configuration

A quick test on your archive configuration can be performed by initiating a manual archive by issuing the command below which should echo a successful write result:
Switch#archive config
Writing test-config-Mar--1-00-06-40-4
Troubleshooting tip:  if this doesn’t occur or you see the following logging output: %ARCHIVE_CONFIG-4-ARCHIVE_SKIPPED: Archive of router configuration was skipped due to a previous initiation.
The cure is to reboot your device, now obviously on a production device this may not be possible, I have searched for other solutions and so far I haven’t found any.  If you have a good explanation of why this occurs or a no reboot cure let me know!

SOLVED:  Thankyou to the poster below who noted that issuing the no archive command and then re-issuing the archive command will solve it!

Step 5 – Some Options

You can set the maximum number of backups to keep, the behaviour of this command means the oldest backup will be overwritten by the latest once your maximum limit has been reached.  Unfortunately this doesn’t work when backing up to a network location only when backing up to a local flash device.
Switch(config-archive)#maximum [maximum number 1 – 14]
In order to set when you backup you use the time-period command and specify the number of minutes between backups.  For example: if you wished to back up once a day you would issue the following command with 1440 minutes (60 x 24).
Switch(config-archive)#time-period [time in minutes between each backup]

Step 7 – Exploring associated show commands:

The most useful show command utilised with the archive function is the obviously titled “show archive” which will give you the following information:
·         The maximum number of archives allowed
·         Archive location
·         Time and date the archive was configured
·         The most recent archive created




Step 8 – Using the configure replace command with the archive function:

One of the advantages of the archive command is to enable you to rollback to a previous archive configuration without interrupting the operation of the device.  The following example demonstrates this:
Issue the following command:
Switch(config)#interface gigabitEthernet 1/0/1
Switch(config-if)#description TEST FOR ROLLBACK
You have now changed the running config, now we will rollback to a previous configuration that will remove this change!
TIP! Issue a show archive command first and you can copy and paste the ftp location and filename from the output to paste into the configure replace command.
Issue the following command:
Switch#configure replace ftp://172.16.49.89/test-config-Mar--1-00-17-28-15
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [no]: y
Loading test-config-Mar--1-00-17-28-15 !
[OK - 15536/4096 bytes]

*Mar  1 00:34:12: Rollback:Acquired Configuration lock.
The rollback configlet from the last pass is listed below:
********
!
!List of Commands:
no end
archive
 time-period 1
interface GigabitEthernet1/0/1
 description vlan 25 ports
line con 0
 login authentication con
end
********


Rollback aborted after 5 passes

As you can see it successfully removed the interface description from port gigabitethernet 1/0/1
Windows FTP Alternative:

If you want to set up a windows 2012 FTP server for this purpose here is a guide I found:
https://social.technet.microsoft.com/wiki/contents/articles/12364.windows-server-2012-ftp-installation.aspx

2 comments:

  1. relating to the error %ARCHIVE_CONFIG-4-ARCHIVE_SKIPPED: Archive of router configuration was skipped due to a previous initiation:

    I solved this without reboot (Cisco 2960) by issuing command "no archive" and then configure archive again:
    conf term
    no archive
    archive
    path ftp://192.168.1.1/$h_$t.txt
    write-memory
    end

    regards
    Franz

    ReplyDelete
  2. Same here. No archive and reconfiguring archive solved the problem. Thank you both for posting.

    ReplyDelete