Automated Configuration Backup of Cisco Devices

So we all know backups of servers are pretty important, but what about the network fabric everything runs on?

For most readers of this blog we’ve moved away from ‘dumb’ switches that you can connect to the LAN with no concerns about the underlying setup toward more intelligent switches that now perform port security, VLAN isolation of voice and data, spanning tree tuning and more. Should one of these switches fail could you honestly remember which VLAN each and every device was in, and how much time would it take you to setup the switch passwords, NTP servers, management IP and so on from scratch without any reference point?

Once logged into a switch (or router), you can perform a straight forward one-time backup of your switches (and routers) by issuing the following command and saving the contents to a text file, kept in a safe place should anything go horribly sour.

SwitchName#Show running-config

Now perhaps you don’t want to have to remember to take a backup every time a change is made, or perhaps others also edit the configuration and are less bothered about anything hitting the fan. In this situation you can setup the switch to automatically save the configuration to a TFTP server. The following instructions are for Cisco devices:

1. Download and install SolarWinds’ free FTFP server software
http://www.solarwinds.com/products/freetools/free_tftp_server.aspx
2. On each of your network devices, you’ll want to firstly test that they can see the TFTP server (and you’re about to tinker, so best to back up!) so issue the following:
SwitchName#copy running-config tftp://<ip of your server>/<SwitchName>.cfg
You should see some !!!! meaning it worked. Worth checking the file dropped into the default location on the TFTP server too.
3. To automate this, you’ll need to create a KRON job on the device…
SwitchName#conf terminal
SwitchName(config)#kron policy-list BackupTFTP
SwitchName(config-kron-policy)#cli show run | redirect tftp://<ip of your server>/<SwitchName>.cfg
SwitchName(config-kron-policy)#exit
SwitchName(config)#kron occurrence BackupTFTP at 23:00 Sun recurring
SwitchName(config-kron-occurrence)#policy-list BackupTFTP

NOTE: THIS DOES NOT MEAN YOU DON’T HAVE TO DO A WRITE MEMORY / COPY RUN START AFTER MAKING CHANGES TO A SWITCH. IF YOU FORGET TO DO THAT AND LOSE POWER IT’LL REVERT TO WHENEVER THE LAST TIME THE CONFIG WAS COMMITTED TO MEMORY.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s