Agenda: exercises-rancid-2.txt

File exercises-rancid-2.txt, 3.7 KB (added by b.candler, 8 years ago)
Line 
1Network Management & Monitoring
2
3Using RANCID Part II
4====================
5
6Notes:
7------
8* Commands preceded with "$" imply that you should execute the command as
9  a general user - not as root.
10* Commands preceded with "#" imply that you should be working as root.
11* Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>")
12  imply that you are executing commands on remote equipment, or within
13  another program.
14
15Exercises
16---------
17
181. Become the RANCID user
19
20    Make sure you are the root user first. If not, then do:
21       
22        $ sudo bash
23       
24    To become the RANCID user do:
25
26        # su -s /bin/bash rancid
27
282. Note the IP addresses for the routers
29
30        10.10.254.xxx  where xxx goes from 1 to 26
31
323. Update /var/lib/rancid/.cloginrc
33
34    Change the file to look like this:
35
36        $ editor /var/lib/rancid/.cloginrc
37
38        add user 10.10.254.* sysadmin
39        add password 10.10.254.* pass enable_pass
40
41    (This tells RANCID that all hosts called "10.10.254.*" use the
42    same password and user -- no need to add every router by hand!
43    The first match in the file wins)
44
454. Update the router.db
46
47        $ editor /var/lib/rancid/all/router.db
48
49    Add some other classroom routers to the file. You should end up with
50    something like:
51
52        10.10.254.5:cisco:up
53        10.10.254.6:cisco:up
54        10.10.254.7:cisco:up
55        10.10.254.8:cisco:up
56
57    (Note that "cisco" means this is Cisco equipment -- it tells Rancid
58    that we are expecting to talk to a Cisco device here.  You can also
59    talk to Juniper, HP, ...)
60
615. Run rancid again:
62
63        $ /usr/lib/rancid/bin/rancid-run
64
65    (Should take a few seconds)
66
676. Check out the logs:
68
69        $ cd /var/lib/rancid/logs
70        $ ls -l
71
72    ... Pick the latest file and view it
73
74        $ less all.YYYYMMDD.HHMMSS
75
767. Look at the configs
77
78        $ cd /var/lib/rancid/all/configs
79        $ less 10.10.*
80
81    If all went well, you can see the configs of ALL routers
82
838. Change the configuration on the router (change the description on
84    an interface, for example)
85
869. Run rancid again
87
88        $ /usr/lib/rancid/bin/rancid-run
89
9010. Play with clogin:
91
92        $  /usr/lib/rancid/bin/clogin -c "show clock" 10.10.254.x
93
94    What do you notice ?
95
9611. Add the RANCID CVS repository in to CVSweb
97
98    If you are still logged in as user rancid, get back to root
99
100        $ exit
101        #
102
103    Install CVSweb:
104
105        # apt-get install cvsweb
106
10712. Edit the file /etc/cvsweb/cvsweb.conf
108
109        # editor /etc/cvsweb/cvsweb.conf
110
111    Below the line
112
113        'local'   => ['Local Repository', '/var/lib/cvs'],
114
115    add
116
117        'rancid'   => ['Rancid Repository', '/var/lib/rancid/CVS'],
118
119    Save and exit
120
12113. Fix a link:
122
123        # cd /var/www
124        # ln -s /usr/share/cvsweb .
125       
126    Open a web browser to the link:
127
128        http://pcXXX/cgi-bin/cvsweb/
129
130    Select the RANCID repository and browse the files under the 'all'
131    directory.
132
133------------------------------------------------------------------------
134
135Rancid looking glass
136--------------------
137
138Rancid can also provide a web interface for support staff to perform
139limited queries on routers, without letting them know the passwords.
140
141To use it, install the `rancid-cgi` package, and point your web browser at
142http://pcXXX/cgi-bin/lg/lgform.cgi
143
144You need to copy your routers.db to `/etc/rancid/routers.db` and
145your .clogin file to `/var/www/.clogin`, and make them readable only to the
146`www-data` user. Beware that if there are other CGIs running on your Apache
147server, they will be able to read these passwords.
148
149Configuration file is `/etc/rancid/lg.conf`. Additional info is in
150`man lg_intro` and files in the directory `/usr/share/doc/rancid-cgi`,
151especially `README.lg`