Connecting the world…

auto

Auto Backup Configurations

Till recently I didn’t have a decent way to backup configurations from routers and switches without using some kind of management tool, like Cacti or Nagios. I wanted to automatically backup configurations by only using a TFTP or FTP server on a network.

I started looking and found the solution by using the archive and kron configurations. I decided to look for methods to backup configurations when one of the following occurrences happen:

  1. Somebody enters the save running-config to startup-config command (write memory);
  2. A certain time of day threshold is reached;

The following example configuration shows both occurrences.

archive
path tftp://192.168.1.100/C2960-01/$h
write-memory

!

kron occurrence SCHEDULE-TO-BACKUP-CONFIG at 20:00 recurring
policy-list BACKUP-CONFIG
!
kron policy-list BACKUP-CONFIG
cli write memory

The configuration above copies the configuration to TFTP server 192.168.1.100 at 20:00h every day. The configuration is also copied to the TFTP server after issuing a write memory. The syntax of the file name on the TFTP server is hostname-seq.number (e.q. SWITCH01-1, the following file would be SWITCH01-2).

I used it several times now and it works great. I use Tftpd32 as TFTP server on Windows, because it is freeware and can be configured as service.