Rancid currently supports Cisco routers, Juniper routers, Catalystswitches, Foundry switches, Redback NASs, ADC EZT3 muxes, MRTd (andthus likely IRRd), Alteon switches, and HP Procurve switches and ahost of others.
Note: you should config postfix mail running correctly first.
Linux Platform: CentOS 6.5 x86
1. yum -y install gcc expect cvs telnet openssh-clients mailx
vi /etc/hosts
192.168.1.11 router1
2.groupadd netadm
useradd -g netadm -c "Networking Backups" -d /usr/local/rancid rancid
3.mkdir /usr/local/rancid/tar
cd /usr/local/rancid/tar
wget ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.8.tar.gz
tar xzf rancid-2.3.8.tar.gz
4. cd rancid-2.3.8
./configure --prefix=/usr/local/rancid/
make install
cp cloginrc.sample /usr/local/rancid/.cloginrc
chmod 0640 /usr/local/rancid/.cloginrc
chown -R rancid:netadm /usr/local/rancid/
chmod 770 /usr/local/rancid/
5.vi /usr/local/rancid/etc/rancid.conf
add following items:
# LIST_OF_GROUPS="networking" FILTER_PWDS=NO; export FILTER_PWDS NOCOMMSTR=NO; export NOCOMMSTR
6. for CentOS 6 using postfix
vi /etc/aliases
# Rancid email addresses
# The "networking" Rancid group will need to have groups named rancid-admin-networking and rancid-networking
rancid-admin-networking: root
rancid-networking: root
postalias hash:/etc/aliases
service postfix restart
7. su - rancid
/usr/local/rancid/bin/rancid-cvs networking #must append this networking group name
cp /usr/local/rancid/tar/rancid-2.3.8/README .
8. create an crontab for rancid user
crontab -e # # Rancid user's crontab file # # Run config differ on Sunday 00 22 * * 0 /usr/local/rancid/bin/rancid-run # Clean out config differ logs 50 23 * * * /usr/bin/find /usr/local/rancid/var/logs -type f -mtime +2 -exec rm {} \;
service crond restart
9. vi /usr/local/rancid/var/networking/router.db
# dns-name-or-ip-address:device-type:status
router1:cisco:up
# for rancid 3.0, using below format
# router1;cisco;up
10. vi /usr/local/rancid/.cloginrc
# Note: The first match for a hostname takes precedence.
# test linux server for router1
#add user * {cisco}
add user router1 {cisco}
#add password * {cisco} {cisco}
add password router1 {cisco} {cisco}
11. testing for router1
/usr/local/rancid/bin/clogin router1
12. testing for all devices
/usr/local/rancid/bin/rancid-run
13. checking logging
ls /usr/local/rancid/var/logs
14. checking network devices configuration here
ls /usr/local/rancid/var/networking/configs/
it's done
转载于:https://blog.51cto.com/hj192837/1343267