1 | Advanced Registry Operations Curriculum |
---|
2 | Using RANCID Part II |
---|
3 | |
---|
4 | Notes: |
---|
5 | ------ |
---|
6 | * Commands preceded with "$" imply that you should execute the command as |
---|
7 | a general user - not as root. |
---|
8 | * Commands preceded with "#" imply that you should be working as root. |
---|
9 | * Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>") |
---|
10 | imply that you are executing commands on remote equipment, or within |
---|
11 | another program. |
---|
12 | |
---|
13 | Exercises |
---|
14 | --------- |
---|
15 | |
---|
16 | 0. Become the RANCID user |
---|
17 | |
---|
18 | - Make sure you are the root user first. If not, then do: |
---|
19 | |
---|
20 | $ su - |
---|
21 | |
---|
22 | - To become the RANCID user do: |
---|
23 | |
---|
24 | # su -s /bin/bash rancid |
---|
25 | |
---|
26 | 1. Note the IP addresses for the routers |
---|
27 | |
---|
28 | 192.168.5.129 for group 1 or 192.168.5.161 for group 2 |
---|
29 | |
---|
30 | 2. Update /var/lib/rancid/.cloginrc |
---|
31 | |
---|
32 | Change the file to look like this: |
---|
33 | |
---|
34 | $ vi /var/lib/rancid/.cloginrc |
---|
35 | |
---|
36 | add user 192.168.5.* admin |
---|
37 | add password 192.168.5.* GTcctld! GTcctld! |
---|
38 | |
---|
39 | (This tells RANCID that all hosts called "192.168.5.*" use the |
---|
40 | same password and user -- no need to add every router by hand!) |
---|
41 | |
---|
42 | 3. Update the router.db |
---|
43 | |
---|
44 | $ vi /var/lib/rancid/all/router.db |
---|
45 | |
---|
46 | Add our other classroom router to the file. You should end up with: |
---|
47 | |
---|
48 | 192.168.5.129:cisco:up |
---|
49 | 192.168.5.161:cisco:up |
---|
50 | |
---|
51 | (Note that "cisco" means this is Cisco equipment -- it tells Rancid |
---|
52 | that we are expecting to talk to a Cisco device here. You can also |
---|
53 | talk to Juniper, HP, ...) |
---|
54 | |
---|
55 | 4. Run rancid again: |
---|
56 | |
---|
57 | $ /usr/lib/rancid/bin/rancid-run |
---|
58 | |
---|
59 | (Should take a few seconds) |
---|
60 | |
---|
61 | 5. Check out the logs: |
---|
62 | |
---|
63 | $ cd /var/lib/rancid/logs |
---|
64 | $ ls -l |
---|
65 | |
---|
66 | ... View the contents of the file: |
---|
67 | |
---|
68 | $ more all.* |
---|
69 | |
---|
70 | 6. Look at the configs |
---|
71 | |
---|
72 | $ cd /var/lib/rancid/all/configs |
---|
73 | $ more 192.168.5.1* |
---|
74 | |
---|
75 | - If all went well, you can see the configs of ALL routers |
---|
76 | |
---|
77 | 7. Change the configuration on the router (change the description on |
---|
78 | an interface, for example) |
---|
79 | |
---|
80 | 8. Run rancid again |
---|
81 | |
---|
82 | $ /usr/lib/rancid/bin/rancid-run |
---|
83 | |
---|
84 | 9. Play with clogin: |
---|
85 | |
---|
86 | $ /usr/lib/rancid/bin/clogin -c "show clock" 192.168.5.129 192.168.5.161 |
---|
87 | |
---|
88 | - What do you notice ? |
---|
89 | |
---|
90 | |
---|
91 | 10. Add the RANCID CVS repository in to CVSweb |
---|
92 | |
---|
93 | - First we install CVSweb: |
---|
94 | |
---|
95 | # apt-get install cvsweb |
---|
96 | |
---|
97 | 11. Edit the file /etc/cvsweb/cvsweb.conf |
---|
98 | |
---|
99 | # vi /etc/cvsweb/cvsweb.conf |
---|
100 | |
---|
101 | - Change the line: |
---|
102 | |
---|
103 | 'local' => ['Local Repository', '/var/lib/cvs'], |
---|
104 | |
---|
105 | to |
---|
106 | |
---|
107 | 'nagios3' => ['AROC Nagios', '/home/sysadmin/cvs'], |
---|
108 | |
---|
109 | - Save and exit |
---|
110 | |
---|
111 | 12. Fix a link: |
---|
112 | |
---|
113 | # cd /var/www |
---|
114 | # ln -s /usr/share/cvsweb . |
---|
115 | |
---|
116 | - Edit the file /etc/cvsweb/cvsweb.conf: |
---|
117 | |
---|
118 | # vi /etc/cvsweb/cvsweb.conf |
---|
119 | |
---|
120 | - Either above or below the line: |
---|
121 | |
---|
122 | 'nagios3' => ['AROC Nagios', '/home/tldadmin/cvs'], |
---|
123 | |
---|
124 | add a new line that reads: |
---|
125 | |
---|
126 | 'rancid' => ['Rancid Repository', '/var/lib/rancid/CVS'], |
---|
127 | |
---|
128 | - Save and exit |
---|
129 | |
---|
130 | - Open a web browser to the link: |
---|
131 | |
---|
132 | http://MyMachine/cgi-bin/cvsweb/ |
---|
133 | |
---|
134 | and select between the RANCID and the AROC Nagios3 configuration files CVS |
---|
135 | repositories in the CVS Root drop-down list. |
---|