cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5815
Views
8
Helpful
11
Replies

Automatic backup of routers' config using to EEM or Kron

sanketpatel
Level 1
Level 1

Hello All,

We are planning to automatic backup of startup-config or running-config for all routers and switches' using TFTP or FTP.

Can anybody provide me EEM configuration or any script so I can take automatic backup at regular interval?

Thanks,

11 Replies 11

thiru.vel10
Level 1
Level 1

Cisco has providing one tools for Managing the router configuration .

Tool name : Cisco works

http://cisco.com/en/US/products/sw/cscowork/ps2408/prod_brochure09186a00801c0a43.html

How about this: RANCID and it is FREE. You

can get the whole thing up and running

in 10 minutes on a gentoo linux box.

CCIE Security

Joe Clarke
Cisco Employee
Cisco Employee

In addition to EEM, IOS also has a built-in config archive feature. You can archive configuration diffs to flash, or to an external server. Config archive provides the ability to look at differences between configuration changes, as well as rollback changes (even timed rollback). See http://www.cisco.com/en/US/docs/ios/12_2/configfun/configuration/guide/fcf007.html for more on the built-in IOS configuration management features.

As for an EEM policy to do automatic config archives, I did this for a Networkers session I gave a few years back. It uses the EEM timer event detector to copy the config to an FTP server at a specified interval (much like the way config archive works in IOS). It requires a few environment variables to be set first:

cc_cron_entry : Cron entry for when to run the policy (works just like UNIX cron)

cc_ftp_server : FTP server to which configs will be copied

cc_ftp_path : Path on aformentioned FTP server

cc_ftp_user : (optional) FTP username (defaults to anonymous)

cc_ftp_pass : (optional) FTP password (defaults to pass)

See http://www.cisco.com/en/US/docs/ios/12_4t/netmgmt/configuration/guide/t_eemo.html for more on configuring and using EEM.

Just wondering if can replace environment variables with predefined FTP configuration. For example:

router(config)#ip host FTPServer a.b.c.d

router(config)#ip ftp username USERNAME

router(config)#ip ftp password PASSWORD

in this case ftp client password will be encrypted

so the command line in the script would look like "copy runn ftp://FTPServer/router1/${dest_fname}"

would it work?

Yes, this should work since the copy command goes through the same parser code as when it is run manually from the command line.

Hey Joe,

 

I went over the attached script, can you make the script run like once in every 24 hours without shelling to the device and exec it manually? 

jcoke
Level 3
Level 3

Ivan Pepelnjak has a terrific series of articles on config management:

Keep Track of Router Configurations with Configuration Archive

http://www.nil.com/ipcorner/RouterConfigArch/

Router Configuration Management … Too Good to be True?

http://www.nil.com/ipcorner/RouterConfigMgmt/

If you're looking for an affordable config management solution, Adventnet's DeviceExpert product has been working well for us.

I have tried Ivan's EEM script, but unable to action the cli command "archive config".

event manager applet ArchiveModifiedConfig

event counter name "ConfigCounter" entry-val 1 entry-op eq exit-val 1 exit-op gt

action 1.0 cli command "archive config"

action 2.0 syslog msg "Modified configuration archived"

action 1.0 does not invoke, but i do see a syslog message which is 2.0

just wondering if you have tried it.

The first command needs to be enable:

event manager applet ArchiveModifiedConfig

event counter name "ConfigCounter" entry-val 1 entry-op eq exit-val 1 exit-op gt

action 1.0 cli command "enable"

action 2.0 cli command "archive config"

action 3.0 syslog msg "Modified configuration archived"

thanks. it worked.

can we do or capture some diffs in an automated way, i know we can do that manually.

You can use the show archive config differences command to diff any two files right on the device. You can then pipe this output to a file.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco