Pre-requisites
You must have and use the EPEL repositories. Note that at the time this post was made, the current version was version 3.1[3]. However, the version available via EPEL was only 2.3.6.
Installation
- yum -y update
- yum -y upgrade
- yum -y install rancid
Configuration
- Edit the /etc/rancid/rancid.conf file to create a list of groups for your devices to change the LIST_OF_GROUPS variable e.g., LIST_OF_GROUPS="routers switches", change the CVSROOT if you are using SVN i.e., CVSROOT=$BASEDIR/SVN; export CVSROOT and change the RCS system if changing to SVN i.e., RCSSYS=svn; export RCSSYS
- vi /etc/rancid/rancid.conf
- Create e-mail aliases for the groups, note that the names should match. Edit the /etc/aliases file. Ensure that the newaliases command is execute after the file has been modified
- vi /etc/aliases
- newaliases
- The rancid group and users should already be created. The home directory for the rancid user corresponds with the BASEDIR in the configuration file viz. /var/rancid. Generate the svn repository for the configuration, group directories, and the log directories by running the rancid-cvs script
- /usr/bin/rancid-cvs
- Add devices to each group to specify their IP address, the make or type, and their status i.e., up or down. Edit the router.db file in each group directory. e.g., c7206-core-router:cisco:up
- vi /var/rancid/routers/router.db
- Next the login credentials for each node is to be specified in the .cloginrc. Copy the file from the sample documentation, and edit the file to provide the login credentials. I prefer to explicitly set the node address, and user
- cp /usr/share/doc/rancid-2.3.6/cloginrc.sample /var/rancid/.cloginrc
- vi /var/rancid/.cloginrc
- chmod 600 .cloginrc
- Configure a user using TACACS or on your Cisco device to only have privilege to view the config
- username rancid privilege 3 secret <SECRET>
- privilege exec level 3 show start-config
- Change ownership of all files and directories in the rancid users home directory to the rancud group and user
- chown -R rancid:rancid /var/rancid
- Test the clogin as the rancid user
- su - rancid
- /usr/libexec/rancid/clogin c7206-core-router
- If all goes well, run rancid manually for the first time. This will generate config files for each define in the group in the config directory
- /usr/bin/rancid-run
- Schedule rancid and the cleanup by setting up cron jobs as the rancid user, crontab -e
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat) /...
# shedule to run rancid every 15 minute
*/15 * * * * /usr/bin/rancid-run
# schedule to remove rancid log files over 2 days old at 8am
0 8 * * * /bin/find /var/rancid/logs -type f -mtime +2 -exec rm {} \;
References
- http://www.shrubbery.net/rancid/
- http://www.shrubbery.net/rancid/RhysEvans_overview_0.3.pdf
- ftp://ftp.shrubbery.net/pub/rancid/
- http://networklore.com/rancid-getting-started/
- http://fakrul.wordpress.com/2013/11/20/rancid-websvn-centos-howto/