Network Management & Monitoring Using RANCID Part II Notes: ------ * Commands preceded with "$" imply that you should execute the command as a general user - not as root. * Commands preceded with "#" imply that you should be working as root. * Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>") imply that you are executing commands on remote equipment, or within another program. Exercises --------- 0. Become the RANCID user - Make sure you are the root user first. If not, then do: $ sudo bash - To become the RANCID user do: # su -s /bin/bash rancid 1. Note the IP addresses for the routers 10.10.254.xxx where xxx goes from 1 to 16 2. Update /var/lib/rancid/.cloginrc Change the file to look like this: $ joe /var/lib/rancid/.cloginrc add user 10.10.254.* sysadmin add password 10.10.254.* menog7 menog7 (This tells RANCID that all hosts called "10.10.254.*" use the same password and user -- no need to add every router by hand! The first match in the file wins) 3. Update the router.db $ joe /var/lib/rancid/all/router.db Add some other classroom routers to the file. You should end up with something like: 10.10.5.254:cisco:up 10.10.6.254:cisco:up 10.10.7.254:cisco:up 10.10.8.254:cisco:up (Note that "cisco" means this is Cisco equipment -- it tells Rancid that we are expecting to talk to a Cisco device here. You can also talk to Juniper, HP, ...) 4. Run rancid again: $ /usr/lib/rancid/bin/rancid-run (Should take a few seconds) 5. Check out the logs: $ cd /var/lib/rancid/logs $ ls -l ... Pick the latest file and view it $ less all.YYYYMMDD.HHMMSS 6. Look at the configs $ cd /var/lib/rancid/all/configs $ less 10.10.* - If all went well, you can see the configs of ALL routers 7. Change the configuration on the router (change the description on an interface, for example) 8. Run rancid again $ /usr/lib/rancid/bin/rancid-run 9. Play with clogin: $ /usr/lib/rancid/bin/clogin -c "show clock" 10.10.254.x - What do you notice ? 10. Add the RANCID CVS repository in to CVSweb - if you are still logged in as user rancid, get back to root $ exit # - Now install CVSweb: # apt-get install cvsweb 11. Edit the file /etc/cvsweb/cvsweb.conf # joe /etc/cvsweb/cvsweb.conf - Below the line 'local' => ['Local Repository', '/var/lib/cvs'], add 'rancid' => ['Rancid Repository', '/var/lib/rancid/CVS'], - Save and exit 12. Fix a link: # cd /var/www # ln -s /usr/share/cvsweb . - Open a web browser to the link: http://MyMachine/cgi-bin/cvsweb/ Select the RANCID repository and browse the files under the 'all' directory.