Configuration versioning using RANCID

RANCID is an open source software developed to save networking device configuration with versioning. RANCID was especially developed for Cisco device, but can be also used with other vendor.

Installation is simple enough:

yum -y install make gcc expext cvs
wget -q -O- | tar -xz -C /usr/src/
cd /usr/src/rancid-2.3.8/
./configure --prefix=/opt/rancid
make install
chown -R rancid:rancid /opt/rancid/
adduser -M -d /opt/rancid rancid

The software will be installed under /opt/rancid:

  • bin: contains all executables;
  • etc: contains configuration files;
  • share: contains docs and man pages;
  • var: will contain the CVS tree where all configurations will be saved.


The main confutation file is rancid.conf which is self-explanatory. The only one line that should be modified is the following:

LIST_OF_GROUPS="dep1 dep2"

We want to make a group for each department, but any other configuration can be implemented. At this point, as rancid user, let’s create the CVS repository:

su - rancid

A repository for each LIST_OF_GROUPS variable will be created.

Device autentication

Under the rancid home directory the .cloginrc file must be created. This file will contain authentication credential and method needed for login to remote devices:

add method * ssh
add user * backup_user
add password * {backup_password}
add autoenable * 1
add user * admin
add password * {password} {secret}

The first example describes authentication for all devices under domain:

  • authentication will use SSH protocol;
  • the username backup_user has the “enable” privilege.

The second example describes authentication for dep2 devices:

  • authentication will use telnet protocol;
  • the username admin requires “enable” password.

Permissions of .cloginrc should be restricted:

chmod 600 /opt/rancid/.cloginrc
chown rancid:rancid /opt/rancid/.cloginrc


RANCID forwards emails using the local email system. The following aliases should be configured under /etc/aliases also:


After adding the aliases, the configuration must be updated:



For each department devices must be added to router.db under /opt/rancid/var. That file contains device IP/hostname, type and status. Let’s add a Cisco device to the dep1 group:

echo "|cisco|up" >> /opt/rancid/var/dep1/router.db

RANCID will save get the configuration from using authentication info defined in .cloginrc (see before). The router is defined as cisco device and is in up state. The status is important because deleting a device from router.db file will delete all configuration. An inactive device should be marked as “down” if configuration must be retained. Many plugins are available for different vendor/type:

%vendortable = (
    'agm'               => 'agmrancid',
    'alteon'            => 'arancid',
    'arista'            => 'arrancid',
    'avocent'           => 'avorancid',
    'baynet'            => 'brancid',
    'cat5'              => 'cat5rancid',
    'cisco'             => 'rancid',
    'tnt'               => 'tntrancid',
    'zebra'             => 'zrancid'


Authentication is the most critical process; it can be tested:

su - rancid

The authentication sequenze will be shown. A complete debug session can be invocated with the following:

su - rancid
bin/rancid -d

The complete execution for a group can be invoked:

su - rancid
bin/rancid-run dep1

All devices under dep1 group will be saved and logs will be available under /opt/rancid/var/log.


The RANCID process can be automated using cron:

0 */4 * * * /opt/rancid/bin/rancid-run > /dev/null 2>&1
30 * * * * /usr/bin/find /opt/rancid/var/logs -type f -mtime +2 -exec rm {} \;  > /dev/null 2>&1

The previous example will invoke RANCID every four hours, and log will be cleaned.

Web Access

Last step makes configurations availalble using a web browser. There are a lot of CVS Web viewer, in this case CVSWeb will be used:

yum -y install httpd perl-IPC-Run perl-URI rcs
wget -q -O- | tar -xz -C /usr/src/
mkdir -p /usr/local/etc/cvsweb/ /var/www/html/css/
cp -a /usr/src/cvsweb-3.0.6/cvsweb.cgi /var/www/cgi-bin/
cp -a /usr/src/cvsweb-3.0.6/css/cvsweb.css /var/www/html/css/cvsweb.css
cp -a /usr/src/cvsweb-3.0.6/cvsweb.conf /usr/local/etc/cvsweb/
chmod 755 /var/www/cgi-bin/cvsweb.cgi

The cvsweb.conf file must be properly configured:

@CVSrepositories = (
        'local'   => ['Local Repository', '/var/cvs'],
        'rancid'   => ['RANCID Repository', '/opt/rancid/var/CVS'],

RANCID repository will be available using the URL The Web Server configuration should be properly secured.


Posted on 19 Sep 2013 by Andrea.
  • Gmail icon
  • Twitter icon
  • Facebook icon
  • LinkedIN icon
  • Google+ icon