1 | Network Management & Monitoring |
---|
2 | |
---|
3 | Using RANCID Part II |
---|
4 | |
---|
5 | Notes: |
---|
6 | ------ |
---|
7 | * Commands preceded with "$" imply that you should execute the command as |
---|
8 | a general user - not as root. |
---|
9 | * Commands preceded with "#" imply that you should be working as root. |
---|
10 | * Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>") |
---|
11 | imply that you are executing commands on remote equipment, or within |
---|
12 | another program. |
---|
13 | |
---|
14 | Exercises |
---|
15 | --------- |
---|
16 | |
---|
17 | 0. Become the RANCID user |
---|
18 | |
---|
19 | - Make sure you are the root user first. If not, then do: |
---|
20 | |
---|
21 | $ sudo bash |
---|
22 | |
---|
23 | - To become the RANCID user do: |
---|
24 | |
---|
25 | # su -s /bin/bash rancid |
---|
26 | |
---|
27 | 1. Note the IP addresses for the routers |
---|
28 | |
---|
29 | 10.10.254.xxx where xxx goes from 1 to 16 |
---|
30 | |
---|
31 | 2. Update /var/lib/rancid/.cloginrc |
---|
32 | |
---|
33 | Change the file to look like this: |
---|
34 | |
---|
35 | $ joe /var/lib/rancid/.cloginrc |
---|
36 | |
---|
37 | add user 10.10.254.* sysadmin |
---|
38 | add password 10.10.254.* menog7 menog7 |
---|
39 | |
---|
40 | (This tells RANCID that all hosts called "10.10.254.*" use the |
---|
41 | same password and user -- no need to add every router by hand! |
---|
42 | The first match in the file wins) |
---|
43 | |
---|
44 | 3. Update the router.db |
---|
45 | |
---|
46 | $ joe /var/lib/rancid/all/router.db |
---|
47 | |
---|
48 | Add some other classroom routers to the file. You should end up with |
---|
49 | something like: |
---|
50 | |
---|
51 | 10.10.5.254:cisco:up |
---|
52 | 10.10.6.254:cisco:up |
---|
53 | 10.10.7.254:cisco:up |
---|
54 | 10.10.8.254:cisco:up |
---|
55 | |
---|
56 | (Note that "cisco" means this is Cisco equipment -- it tells Rancid |
---|
57 | that we are expecting to talk to a Cisco device here. You can also |
---|
58 | talk to Juniper, HP, ...) |
---|
59 | |
---|
60 | 4. Run rancid again: |
---|
61 | |
---|
62 | $ /usr/lib/rancid/bin/rancid-run |
---|
63 | |
---|
64 | (Should take a few seconds) |
---|
65 | |
---|
66 | 5. Check out the logs: |
---|
67 | |
---|
68 | $ cd /var/lib/rancid/logs |
---|
69 | $ ls -l |
---|
70 | |
---|
71 | ... Pick the latest file and view it |
---|
72 | |
---|
73 | $ less all.YYYYMMDD.HHMMSS |
---|
74 | |
---|
75 | 6. Look at the configs |
---|
76 | |
---|
77 | $ cd /var/lib/rancid/all/configs |
---|
78 | $ less 10.10.* |
---|
79 | |
---|
80 | - If all went well, you can see the configs of ALL routers |
---|
81 | |
---|
82 | 7. Change the configuration on the router (change the description on |
---|
83 | an interface, for example) |
---|
84 | |
---|
85 | 8. Run rancid again |
---|
86 | |
---|
87 | $ /usr/lib/rancid/bin/rancid-run |
---|
88 | |
---|
89 | 9. Play with clogin: |
---|
90 | |
---|
91 | $ /usr/lib/rancid/bin/clogin -c "show clock" 10.10.254.x |
---|
92 | |
---|
93 | - What do you notice ? |
---|
94 | |
---|
95 | |
---|
96 | 10. 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 | - Now install CVSweb: |
---|
104 | |
---|
105 | # apt-get install cvsweb |
---|
106 | |
---|
107 | 11. Edit the file /etc/cvsweb/cvsweb.conf |
---|
108 | |
---|
109 | # joe /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 | |
---|
121 | 12. 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://MyMachine/cgi-bin/cvsweb/ |
---|
129 | |
---|
130 | Select the RANCID repository and browse the files under the 'all' |
---|
131 | directory. |
---|