RANCID provides two types of functions. One of its foundations is that it provides a structure for logging into network devices for the purpose of obtaining configuration files. The second is that it stores versions of the configuration files in CVS.
CVSWeb is a web based tool for reviewing and comparing the files under CVS version control.
[2013/12/30: updated Rancid version references, updated instructions]
Rancid Installation
Obtain the latest version of Rancid, place it in /usr/src, and expand it:
wget ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.8.tar.gz
tar -zxvf rancid-2.3.8tar.gz
cd rancid-2.3.8
Build it:
apt-get install expect
apt-get install cvs
./configure \
--prefix=/usr/local/rancid \
--localstatedir=/var/local/rancid \
--sysconfdir=/etc/rancid \
--bindir=/usr/local/bin \
--sbindir=/usr/local/sbin
make install
In /etc/rancid/rancid.conf, create group based upon the company name:
LIST_OF_GROUPS="example"
in /etc/mail/aliases (the mail package needs to have been installed in order to use this feature), add two aliases to the file based upon the group name created in the previous step:
rancid-example: root
rancid-admin-example: root
Run the command 'newaliases' to update the aliases.
Run the command 'rancid-cvs' to create the cvs
archives. This creates a repository based upon the group name... /var/local/rancid/CVS/example/configs.
Update the device list file /var/local/rancid/example/router.db. Each line has three items, with the three items
being separated with colons
':'. Use the device names as defined in the dns files.
device01:cisco:up
To login to devices via the command line, which is also needed by the crontab jobs following, you need
a .cloginrc file in your home directory. Use the sample provided in the source and update it based upon the examples
shown in the file.
cp /usr/src/rancid-2.3.8/cloginrc.sample ~/.cloginrc
chmod 600 /root/.cloginrc
Turn on the hourly configuration update service by using the 'crontab -e' command and
updating the configuration with:
# run config differ hourly
1 * * * * /usr/local/bin/rancid-run
# clean out config differ logs
50 23 * * * /usr/bin/find /var/local/rancid/logs -type f -mtime +2 -exec rm {} \;
Login to a device is now automated through commands similar to:
clogin device01
CVSWeb Installation
Install the package:
apt-get install cvsweb
Add the following line to '/etc/apache2/sites-available/default':
Alias /cvsweb "/usr/share/cvsweb/"
and restart apache:
/etc/init.d/apache2 restart
In /etc/cvsweb.conf, just after @CVSrepositories and before the 'local' line,
insert the following:
'rancid' => ['Rancid', '/var/local/rancid/CVS'],
Later in the same file, update with the following line:
$cvstreedefault = 'rancid';
View the repository via:
http://localhost/cgi-bin/cvsweb