How-to : RANCID installation on openSUSE 11.4 “Celadon”
RANCID is a great automation tool which allows you to collect configuration from network devices and store in repository with version control (CVS or SVN). In this article I will show you how to install RANCID and prepare to work on openSUSE 11.4 with subversion as repository for configs.
Having repository with network devices configuration might be also part of disaster recovery planning as in case of failure it will be easy to pull recent configuration from repository and apply on replacement router or switch.
To demonstrate commands I’m using copy&paste from PuTTY while executing step-by-step what is described in this article.
First of all you need to have openSUSE installed. If you plan to use openSUSE as a server to monitor network devices and servers I would recommend to install operating system in Text only mode (means no GUI, so more resources available for services). Once system is installed login to server using root account and download RANCID from Shrubbery Networks, Inc. (developers of RANCID):
Shrubbery Networks, Inc. – link to RANCID web page
Download link – direct link to RANCID spurce archive
lab-gw-01:~ # wget ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.6.tar.gz asking libproxy about url 'ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.6.tar.gz' libproxy suggest to use 'direct://' --2011-11-29 08:47:00-- ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.6.tar.gz => `rancid-2.3.6.tar.gz' Resolving ftp.shrubbery.net... 220.127.116.11 Connecting to ftp.shrubbery.net|18.104.22.168|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /pub/rancid ... done. ==> SIZE rancid-2.3.6.tar.gz ... 372436 ==> PASV ... done. ==> RETR rancid-2.3.6.tar.gz ... done. Length: 372436 (364K) (unauthoritative) 100%[============================================>] 372,436 42.0K/s in 8.8s 2011-11-29 08:47:22 (41.4 KB/s) - `rancid-2.3.6.tar.gz' saved  lab-gw-01:~ #
Now we can install all additional pieces of software required by RANCID. Zypper might add more packages to installation as a result of dependencies between software components.
lab-gw-01:~ # zypper install expect \ > make \ > autoconf \ > gcc \ > subversion \ > subversion-perl \ > subversion-devel \ > subversion-tools
Now it is time to configure source code of RANCID, compile and install application files.
lab-gw-01:~/rancid-2.3.6 # ./configure --prefix=/ \ > --exec-prefix=/usr \ > --bindir=/usr/bin \ > --sbindir=/usr/sbin \ > --libexecdir=/usr/libexec \ > --sysconfdir=/etc/rancid \ > --sharedstatedir=/var/lib/rancid/com \ > --localstatedir=/var/lib/rancid \ > --libdir=/usr/lib \ > --includedir=/usr/include \ > --oldincludedir=/usr/include \ > --datarootdir=/usr/share \ > --datadir=/usr/share \ > --infodir=/usr/share/info \ > --localedir=/usr/share/locale \ > --mandir=/usr/share/man \ > --docdir=/usr/share/doc/packages/rancid \ > --htmldir=/usr/share/doc/packages/rancid \ > --dvidir=/usr/share/doc/packages/rancid \ > --pdfdir=/usr/share/doc/packages/rancid \ > --psdir=/usr/share/doc/packages/rancid \ > --with-svn=fsfs
RANCID is ready for compilation now.
lab-gw-01:~/rancid-2.3.6 # make Making all in . lab-gw-01:~/rancid-2.3.6 #
Once compiled we can install RANCID
lab-gw-01:~/rancid-2.3.6 # make install Making install in . lab-gw-01:~/rancid-2.3.6 #
Create RANCID user and group
lab-gw-01:~/rancid-2.3.6 # groupadd rancid lab-gw-01:~/rancid-2.3.6 # useradd -g rancid -c "Network backups" -d /etc/rancid rancid
Post install RANCID configuration
lab-gw-01:~/rancid-2.3.6 # cp cloginrc.sample /etc/rancid/.cloginrc lab-gw-01:~/rancid-2.3.6 # lab-gw-01:~/rancid-2.3.6 # chmod 0640 /etc/rancid/.cloginrc lab-gw-01:~/rancid-2.3.6 # chmod 770 /usr/share/rancid lab-gw-01:~/rancid-2.3.6 # chmod 770 /var/lib/rancid lab-gw-01:~/rancid-2.3.6 # lab-gw-01:~/rancid-2.3.6 # chown -R rancid:rancid /usr/share/rancid lab-gw-01:~/rancid-2.3.6 # chown -R rancid:rancid /var/lib/rancid lab-gw-01:~/rancid-2.3.6 # chown -R rancid:rancid /etc/rancid lab-gw-01:~/rancid-2.3.6 # su - rancid rancid@lab-gw-01:~>
Defining and creating RANCID repository
To use RANCID I need to create now repository for configuration files collected from devices. Information about repositories is stored in /etc/rancid/rancid/conf file and there I need to add new repository, which I will name LAB.
To modify RANCID configuration file I need to have text editor. As whole installation is performed on fresh installation of openSUSE I will install text editor first and in my case I will choose nano. Of course if you have any other preffered text editor you can use it. Just all my examples will be nano based.
lab-gw-01:~/rancid-2.3.6 # zypper install nano Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: nano 1 new package to install. Overall download size: 198.0 KiB. After the operation, additional 551.0 KiB will be used. Continue? [y/n/?] (y): y Retrieving package nano-2.2.6-3.1.x86_64 (1/1), 198.0 KiB (551.0 KiB unpacked) Retrieving: nano-2.2.6-3.1.x86_64.rpm [done (377.6 KiB/s)] Installing: nano-2.2.6-3.1 [done] lab-gw-01:~/rancid-2.3.6 #
Now when I have text editor installed can modify rancid.conf and add my repository for network devices configuration.
lab-gw-01:~/rancid-2.3.6 # su - rancid rancid@lab-gw-01:~> nano /etc/rancid/rancid.conf
In rancid.conf file locate section responsible for groups (default section of the config file shown below)
# list of rancid groups #LIST_OF_GROUPS="sl joebobisp" #LIST_OF_GROUPS="$LIST_OF_GROUPS noc billybobisp"
Good practice is to keep original content of the configuration files for different services (at least at the beginning of the adventure, before you will become more comfortable with specific service/application), so I will add line in rancid.conf file with definition of my RANCID group named LAB. After modification section of the configuration file with group definition should look like:
# list of rancid groups #LIST_OF_GROUPS="sl joebobisp" # more groups... #LIST_OF_GROUPS="$LIST_OF_GROUPS noc billybobisp" LIST_OF_GROUPS="LAB"
Once line is added for new RANCID group I save the fine and go beack to shell.
NOTE: Lines with # at the beginning are ignored by the application as # means comment
Also, before I will save config file and create repository I want to make sure that versioning system RANCID will use is set to subversion.
# Location of the CVS/SVN repository. Be careful changing this. CVSROOT=$BASEDIR/SVN; export CVSROOT # # Select which RCS system to use, "cvs" (default) or "svn". Do not change # this after CVSROOT has been created with rancid-cvs. Changing between these # requires manual conversions. RCSSYS=svn; export RCSSYS
It seems that correct versioning system is defined, so I can save rancid.conf and return to shell in order to create initial repository defined in configuration file.
rancid@lab-gw-01:~> rancid-cvs LAB Committed revision 1. Checked out revision 1. A configs Adding configs Committed revision 2. A router.db Adding router.db Transmitting file data . Committed revision 3. rancid@lab-gw-01:~>
Repository has been created. To verify that I can just go to folder where all RANCID groups will be stored and check if folder structure is created there.
rancid@lab-gw-01:~> cd /var/lib/rancid rancid@lab-gw-01:/var/lib/rancid> ls -l total 12 drwxr-x--- 6 rancid rancid 4096 Nov 29 10:53 CVS drwxr-x--- 4 rancid rancid 4096 Nov 29 10:53 LAB drwxr-x--- 2 rancid rancid 4096 Nov 29 10:53 logs rancid@lab-gw-01:/var/lib/rancid>
Now RANCID is installed and ready to go. One thing which has to be done is network devices definition and RANCID can start collecting configurations.