Pelicanux

Just A Few Random Words

Backup Switches and Routers Configurations With Rancid

Once again, a post written too fast, because it’s quite difficult to find the time required to provide a valuable and interesting post. Once again, I promise to come back on this one, and go deeper in the details instead of just giving a insipide cookbook. So, let’s explain how one can backup switches and routers configurations without too much pain.

Rancid

The idea is to backup and version your configuration. rancid and subversion (or better git) are provided by most Linux distributions.

In rancid.conf

1
2
3
4
LIST_OF_GROUPS="internet"
CVSROOT=$BASEDIR/SVN; export CVSROOT
RCSSYS=svn; export RCSSYS
FILTER_PWDS=ALL; export FILTER_PWDS

Rancid will send mail with the diff when the configuration changes. Add these lines into /etc/aliases (and do not forget to run newaliases afterward):

1
2
rancid-admin-internet: mail
rancid-internet: mail

Now, launch

1
su  rancid -c /usr/lib/rancid/bin/rancid-cvs

The routers/switches/devices configuration is done in /var/lib/rancid/internet/router.db

1
switch_name:cisco:up

Into /var/lib/rancid/.cloginrc

1
2
3
add method   switch ssh
add user     switch rancid
add password switch password enable_pwd

And create a crontab for rancid:

1
0 * * * * /usr/bin/rancid-run

WebSVN

Here is a nice web interface to compare the changes of the configuration: Install package websvn and enter /var/lib/rancid/SVN/ for the repository path. Rancid user should be included in group www-data.

Go to https://{Your_Server}/websvn