Using RANCID! How to configure it: 1. Add an alias for the rancid user in /etc/aliases NOC-TLDX> sudo pico /etc/aliases Add these lines: rancid-all: tldadmin rancid-admin-all: tldadmin Save the file, then run: NOC-TLDX> sudo newaliases 2. Install Rancid itself NOC-TLDX> sudo apt-get install rancid-core NOC-TLDX> sudo apt-get install rancid-util NOC-TLDX> sudo apt-get install rancid-cgi NOC-TLDX> sudo apt-get install cvsweb 3. Edit /etc/rancid/rancid.conf NOC-TLDX> sudo pico /etc/rancid/rancid.conf Replace this line #LIST_OF_GROUPS="sl joebobisp" with LIST_OF_GROUPS="all" 4. We'll setup RANCID to monitor your router Reminder, your router is: 192.168.10x.1 username: tldadmin password: tldadmin! enable secret: tldadmin! Change to the rancid user NOC-TLDX> sudo su -s /bin/bash rancid - Check that you ARE the rancid user: NOC-TLDX> id - You should see something similar: uid=115(rancid) gid=123(rancid) groups=123(rancid) 5. Create /var/lib/rancid/.cloginrc rancid@NOC-TLDX> vi /var/lib/rancid/.cloginrc add user 192.168.10x.1 tldadmin add password 192.168.10x.1 tldadmin! tldadmin! (Remember to replace x with 1-8) Save and Quit... rancid@NOC-TLDX> chmod 600 /var/lib/rancid/.cloginrc 6. Initialize the CVS repository for rancid: rancid@NOC-TLDX> /usr/lib/rancid/bin/rancid-cvs - You should see something similar to this: No conflicts created by this import cvs checkout: Updating all Directory /var/lib/rancid/CVS/all/configs added to the repository cvs commit: Examining configs cvs add: scheduling file `router.db' for addition cvs add: use `cvs commit' to add this file permanently /var/lib/rancid/CVS/all/router.db,v <-- router.db initial revision: 1.1 7. Test login to the router rancid@NOC-TLDX> /usr/lib/rancid/bin/clogin 192.168.10x.1 - You should now be logged in to the router, and see something like: TLDX-RTR# - Type 'exit' to logout 8. Edit the router.db file rancid@NOC-TLDX> vi /var/lib/rancid/all/router.db Add: 192.168.10x.1:cisco:up 9. Let's run rancid! rancid@NOC-TLDX> /usr/lib/rancid/bin/rancid-run (Should take a few seconds) 10. Check out the logs: rancid@NOC-TLDX> cd /var/lib/rancid/logs rancid@NOC-TLDX> ls -l ... View the contents of the file: rancid@NOC-TLDX> more all.* You should see something like this at the end of the file... All routers sucessfully completed. cvs diff: Diffing . cvs diff: Diffing configs cvs commit: Examining . cvs commit: Examining configs 11. Look at the configs rancid@NOC-TLDX> cd /var/lib/rancid/all/configs rancid@NOC-TLDX> more 192.168.10x.1 - Don't forget to replace x with your group number - If all went well, you can see the config of the router. 12. Let's change an interface Description on the router rancid@NOC-TLDX> /usr/lib/rancid/bin/clogin 192.168.10x.1 - At the "tldX-rtr#" prompt, enter the command: config terminal - You should see: Enter configuration commands, one per line. End with CNTL/Z. tldX-rtr(config)# TLDX-TRT(config)# interface FastEthernet 0/0 - You should get this prompt: TLDX-RTR(config-if)# - Enter: TLDX-RTR(config-if)# description Gateway to TLDx - Then type CTRL-Z (press Control + the Z key) - You should now have this prompt: TLDX-RTR# - To save the config to memory: TLDX-RTR# write memory - The router should say: Building configuration... [OK] - Type to exit: TLDX-RTR# exit 13. Let's run rancid again: rancid@NOC-TLDX> /usr/lib/rancid/bin/rancid-run Look at the config and logs rancid@NOC-TLDX> ls /var/lib/rancid/logs/ 14. Let's see the differences rancid@NOC-TLDX> cd /var/lib/rancid/all/configs rancid@NOC-TLDX> cvs log 192.168.10x.1 Notice the revisions. Let's view the difference between two versions: rancid@NOC-TLDX> cvs diff -r 1.2 -r 1.3 192.168.10x.1 ... your change should appear in the output... 15. Check your mail rancid@NOC-TLDX> exit You are now back to the 'tldadmin' user NOC-TLDX> mutt see the mails that Rancid has sent: (or run "mutt -f /var/mail/tldadmin") If everything goes as planned, you should be able to read the mails sent by Rancid. (use q or x to quit mutt) 16. Finally, let's make rancid run automatically every 30 minutes from cron NOC-TLDX> sudo crontab -e - Add this line: */30 * * * * /usr/lib/rancid/bin/rancid-run ... then save and quit