1 | % Network Management & Monitoring |
---|
2 | % |
---|
3 | %Using RANCID |
---|
4 | |
---|
5 | # Introduction |
---|
6 | |
---|
7 | ## Goals |
---|
8 | |
---|
9 | * Gain experience with RANCID |
---|
10 | |
---|
11 | ## Notes |
---|
12 | |
---|
13 | * Commands preceded with "$" imply that you should execute the command as |
---|
14 | a general user - not as root. |
---|
15 | * Commands preceded with "#" imply that you should be working as root. |
---|
16 | * Commands with more specific command lines (e.g. "rtrX>" or "mysql>") |
---|
17 | imply that you are executing commands on remote equipment, or within |
---|
18 | another program. |
---|
19 | |
---|
20 | # Exercises |
---|
21 | |
---|
22 | |
---|
23 | # 1. Connect to your PC using ssh |
---|
24 | |
---|
25 | # 2. Become root, and install the Subversion Version Control System: |
---|
26 | |
---|
27 | In addition to Subversion we will specify to install telnet and the mutt |
---|
28 | email client. Both these package may already be installed from prior |
---|
29 | exercises. If so, don't worry - the apt-get command will not reinstall |
---|
30 | them. |
---|
31 | |
---|
32 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
33 | $ sudo -s |
---|
34 | # apt-get install subversion telnet mutt |
---|
35 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
36 | |
---|
37 | # 3. Install Rancid itself |
---|
38 | |
---|
39 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
40 | # apt-get install rancid |
---|
41 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
42 | |
---|
43 | - It will prompt with a warning - Select <OK> and press ENTER to continue. |
---|
44 | - It will give you another warning about making a backup copy of your |
---|
45 | rancid data. We have no data, so select <YES> and press ENTER to continue. |
---|
46 | |
---|
47 | # 4. Add an alias for the rancid user in /etc/aliases file |
---|
48 | |
---|
49 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
50 | # editor /etc/aliases |
---|
51 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
52 | |
---|
53 | |
---|
54 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
55 | rancid-all: sysadm |
---|
56 | rancid-admin-all: sysadm |
---|
57 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
58 | |
---|
59 | Save the file, then run: |
---|
60 | |
---|
61 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
62 | # newaliases |
---|
63 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
64 | |
---|
65 | # 5. Edit /etc/rancid/rancid.conf |
---|
66 | |
---|
67 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
68 | # editor /etc/rancid/rancid.conf |
---|
69 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
70 | |
---|
71 | Find this line in rancid.conf: |
---|
72 | |
---|
73 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
74 | #LIST_OF_GROUPS="sl joebobisp" |
---|
75 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
76 | |
---|
77 | And, underneath it add the following line: |
---|
78 | |
---|
79 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
80 | LIST_OF_GROUPS="all" |
---|
81 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
82 | |
---|
83 | (with no '#' at the front of line, and aligned to the left) |
---|
84 | |
---|
85 | We want to use Subversion for our Version Control System, and not CVS, so find the |
---|
86 | line with the parameter RCSSYS: |
---|
87 | |
---|
88 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
89 | RCSSYS=cvs; export RCSSYS |
---|
90 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
91 | |
---|
92 | And, change it to: |
---|
93 | |
---|
94 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
95 | RCSSYS=svn; export RCSSYS |
---|
96 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
97 | |
---|
98 | and the line with CVSROOT: |
---|
99 | |
---|
100 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
101 | CVSROOT=$BASEDIR/CVS; export CVSROOT |
---|
102 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
103 | |
---|
104 | And, change it to: |
---|
105 | |
---|
106 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
107 | CVSROOT=$BASEDIR/svn; export CVSROOT |
---|
108 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
109 | |
---|
110 | Note the lowercase "svn". Now exit and save the file. |
---|
111 | |
---|
112 | |
---|
113 | # 6. Change to the rancid user |
---|
114 | |
---|
115 | |
---|
116 | # CRITICAL! CRITICAL! CRITICAL! |
---|
117 | # CRITICAL! CRITICAL! CRITICAL! |
---|
118 | # CRITICAL! CRITICAL! CRITICAL! |
---|
119 | |
---|
120 | Pay very close attention to what userid you are using during the rest of these exercises. |
---|
121 | If you are not sure simply type "id" on the command line at any time. |
---|
122 | |
---|
123 | From a root prompt ("#"), switch identity to become the 'rancid' user: |
---|
124 | |
---|
125 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
126 | # su -s /bin/bash rancid |
---|
127 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
128 | |
---|
129 | Check that you ARE the rancid user: |
---|
130 | |
---|
131 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
132 | $ id |
---|
133 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
134 | |
---|
135 | You should see something similar (numbers may be different): |
---|
136 | |
---|
137 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
138 | uid=104(rancid) gid=109(rancid) groups=109(rancid) |
---|
139 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
140 | |
---|
141 | |
---|
142 | # IF YOU ARE NOT USER RANCID NOW, do NOT continue |
---|
143 | |
---|
144 | |
---|
145 | # 7. Create /var/lib/rancid/.cloginrc |
---|
146 | |
---|
147 | |
---|
148 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
149 | $ editor /var/lib/rancid/.cloginrc |
---|
150 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
151 | |
---|
152 | Add the following two lines to the file: |
---|
153 | |
---|
154 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
155 | add user *.ws.nsrc.org cisco |
---|
156 | add password *.ws.nsrc.org nsrc+ws nsrc+ws |
---|
157 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
158 | |
---|
159 | (The first 'cisco' is the username, the first and second 'nsrc+ws' are the |
---|
160 | password and enable password used to login to your router. The star in the name |
---|
161 | means that it will try to use this username and password for all routers |
---|
162 | whose names end .ws.nsrc.org) |
---|
163 | |
---|
164 | (Note: it is also allowed to use IP addresses, and one could also write: |
---|
165 | |
---|
166 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
167 | add user 10.10.* cisco |
---|
168 | add password 10.10.* nsrc+ws nsrc+ws) |
---|
169 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
170 | |
---|
171 | Exit and save the file. |
---|
172 | |
---|
173 | Now protect this file so that it cannot be read by other users: |
---|
174 | |
---|
175 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
176 | $ chmod 600 /var/lib/rancid/.cloginrc |
---|
177 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
178 | |
---|
179 | |
---|
180 | #8. Test login to the router of your group |
---|
181 | |
---|
182 | Login to your router with clogin. You might have to type yes to the first warning, but |
---|
183 | should not need to enter a password, this should be automatic. |
---|
184 | |
---|
185 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
186 | $ /var/lib/rancid/bin/clogin rtrX.ws.nsrc.org |
---|
187 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
188 | |
---|
189 | (replace X with your group number. So, group 1 is rtr1.ws.nsrc.org) |
---|
190 | |
---|
191 | You should get something like: |
---|
192 | |
---|
193 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
194 | spawn ssh -c 3des -x -l cisco rtrX.ws.nsrc.org |
---|
195 | The authenticity of host 'rtrX.ws.nsrc.org (10.10.X.254)' can't be established. |
---|
196 | RSA key fingerprint is 73:f3:f0:e8:78:ab:49:1c:d9:5d:49:01:a4:e1:2a:83. |
---|
197 | Are you sure you want to continue connecting (yes/no)? |
---|
198 | Host rtrX.ws.nsrc.org added to the list of known hosts. |
---|
199 | yes |
---|
200 | Warning: Permanently added 'rtrX.ws.nsrc.org' (RSA) to the list of known hosts. |
---|
201 | Password: |
---|
202 | |
---|
203 | rtrX>enable |
---|
204 | Password: |
---|
205 | rtrX# |
---|
206 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
207 | |
---|
208 | Exit the from the router login: |
---|
209 | |
---|
210 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
211 | rtrX#exit |
---|
212 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
213 | |
---|
214 | |
---|
215 | # 9. Initialize the SVN repository for rancid: |
---|
216 | |
---|
217 | Make sure you are the rancid user before doing this: |
---|
218 | |
---|
219 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
220 | $ id |
---|
221 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
222 | |
---|
223 | If you do not see something like |
---|
224 | |
---|
225 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
226 | uid=108(rancid) gid=113(rancid) groups=113(rancid)" |
---|
227 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
228 | |
---|
229 | then DO NOT CONTINUE until you have become the rancid user. See exercise 6 for |
---|
230 | details. |
---|
231 | |
---|
232 | Now initialize the Version Control repository (it will use Subversion): |
---|
233 | |
---|
234 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
235 | $ /usr/lib/rancid/bin/rancid-cvs |
---|
236 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
237 | |
---|
238 | You should see something similar to this: |
---|
239 | |
---|
240 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
241 | Committed revision 1. |
---|
242 | Checked out revision 1. |
---|
243 | At revision 1. |
---|
244 | A configs |
---|
245 | Adding configs |
---|
246 | |
---|
247 | Committed revision 2. |
---|
248 | A router.db |
---|
249 | Adding router.db |
---|
250 | Transmitting file data . |
---|
251 | Committed revision 3. |
---|
252 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
253 | |
---|
254 | # Do this ONLY if you have problems |
---|
255 | |
---|
256 | If this does not work, then either you are missing the subversion package, or |
---|
257 | something was not properly configured during the previous steps. You should verify |
---|
258 | that subversion is installed and then before running the rancid-cvs command again |
---|
259 | do the following: |
---|
260 | |
---|
261 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
262 | $ exit |
---|
263 | # apt-get install subversion |
---|
264 | # su -s /bin/bash rancid |
---|
265 | $ cd /var/lib/rancid |
---|
266 | $ rm -rf all |
---|
267 | $ rm -rf svn |
---|
268 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
269 | |
---|
270 | Now try running the rancid-cvs command again: |
---|
271 | |
---|
272 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
273 | $ /usr/lib/rancid/bin/rancid-cvs |
---|
274 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
275 | |
---|
276 | ***************************************************** |
---|
277 | |
---|
278 | # 10. Create the router.db file |
---|
279 | |
---|
280 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
281 | $ editor /var/lib/rancid/all/router.db |
---|
282 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
283 | |
---|
284 | Add this line: |
---|
285 | |
---|
286 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
287 | rtrX.ws.nsrc.org:cisco:up |
---|
288 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
289 | |
---|
290 | (remember to replace X as appropriate) |
---|
291 | |
---|
292 | Exit and save the file. |
---|
293 | |
---|
294 | # 11. Let's run rancid! |
---|
295 | |
---|
296 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
297 | $ /usr/lib/rancid/bin/rancid-run |
---|
298 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
299 | |
---|
300 | This will take a few moments so be patient. |
---|
301 | |
---|
302 | Run it again, since the first time it might not commit correctly: |
---|
303 | |
---|
304 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
305 | $ /usr/lib/rancid/bin/rancid-run |
---|
306 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
307 | |
---|
308 | # 12. Check the rancid log files: |
---|
309 | |
---|
310 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
311 | $ cd /var/lib/rancid/logs |
---|
312 | $ ls -l |
---|
313 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
314 | |
---|
315 | ... View the contents of the file(s): |
---|
316 | |
---|
317 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
318 | $ less all.* |
---|
319 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
320 | |
---|
321 | NOTE! Using "less" - to see the next file press ":n". To see the Previous |
---|
322 | file press ":p". To exit from less press "q". |
---|
323 | |
---|
324 | # 13. Look at the configs |
---|
325 | |
---|
326 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
327 | $ cd /var/lib/rancid/all/configs |
---|
328 | $ less rtrX.ws.nsrc.org |
---|
329 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
330 | |
---|
331 | Where you should replace "X" with your group number. |
---|
332 | |
---|
333 | If all went well, you can see the config of the router. |
---|
334 | |
---|
335 | # 14. Let's change an interface Description on the router |
---|
336 | |
---|
337 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
338 | $ /usr/lib/rancid/bin/clogin rtrX.ws.nsrc.org |
---|
339 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
340 | |
---|
341 | Where you should replace "X" with your group number. |
---|
342 | |
---|
343 | At the "rtrX#" prompt, enter the command: |
---|
344 | |
---|
345 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
346 | rtrX# conf term |
---|
347 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
348 | |
---|
349 | You should see: |
---|
350 | |
---|
351 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
352 | Enter configuration commands, one per line. End with CNTL/Z. |
---|
353 | rtrX(config)# |
---|
354 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
355 | |
---|
356 | Enter: |
---|
357 | |
---|
358 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
359 | rtrX(config)# interface LoopbackXX (replace XX with your PC no) |
---|
360 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
361 | |
---|
362 | You should get this prompt: |
---|
363 | |
---|
364 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
365 | rtrX(config-if)# |
---|
366 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
367 | |
---|
368 | Enter: |
---|
369 | |
---|
370 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
371 | rtr2(config-if)# description <put your name here> |
---|
372 | rtr2(config-if)# end |
---|
373 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
374 | |
---|
375 | You should now have this prompt: |
---|
376 | |
---|
377 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
378 | rtrX# |
---|
379 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
380 | |
---|
381 | To save the config to memory: |
---|
382 | |
---|
383 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
384 | rtrX# write memory |
---|
385 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
386 | |
---|
387 | You should see: |
---|
388 | |
---|
389 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
390 | Building configuration... |
---|
391 | [OK] |
---|
392 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
393 | |
---|
394 | To exit type: |
---|
395 | |
---|
396 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
397 | rtrX# exit |
---|
398 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
399 | |
---|
400 | Now you should be back at your rancid user prompt on your system: |
---|
401 | |
---|
402 | |
---|
403 | # 15. Let's run rancid again: |
---|
404 | |
---|
405 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
406 | $ /usr/lib/rancid/bin/rancid-run |
---|
407 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
408 | |
---|
409 | Look at the ranicd logs |
---|
410 | |
---|
411 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
412 | $ ls /var/lib/rancid/logs/ |
---|
413 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
414 | |
---|
415 | You should see the latest rancid execution as a new log file with the date |
---|
416 | and time in the name. |
---|
417 | |
---|
418 | # 16. Let's see the differences |
---|
419 | |
---|
420 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
421 | $ cd /var/lib/rancid/all/configs |
---|
422 | $ ls -l |
---|
423 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
424 | |
---|
425 | You should see the router config file for your group: |
---|
426 | |
---|
427 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
428 | $ svn log rtrX.ws.nsrc.org |
---|
429 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
430 | |
---|
431 | (where X is the number of your router) |
---|
432 | |
---|
433 | Notice the revisions. Let's view the difference between two versions: |
---|
434 | |
---|
435 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
436 | $ svn diff -r 5:7 rtrX.ws.nsrc.org | less |
---|
437 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
438 | |
---|
439 | ... can you find your changes? |
---|
440 | |
---|
441 | Notice that svn is the Subversion Version Control system command line |
---|
442 | tool for viewing Subversion repositories of information. If you type: |
---|
443 | |
---|
444 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
445 | $ ls -lah |
---|
446 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
447 | |
---|
448 | You will see a hidden directory called ".svn" - this actually contains all the |
---|
449 | information about the changes between router configurations from each time you |
---|
450 | run rancid using /usr/lib/rancid/bin/rancid-run. |
---|
451 | |
---|
452 | Whatever you do, don't edit or touch the .svn directory by hand! |
---|
453 | |
---|
454 | |
---|
455 | # 17. Check your mail |
---|
456 | |
---|
457 | Now we will exit from the rancid user shell and the root user shell to go |
---|
458 | back to being the "sysadm" user. Then we'll use the "mutt" email client to |
---|
459 | see if rancid has been sending emails to the sysadm user. |
---|
460 | |
---|
461 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
462 | $ exit (takes your from rancid to root user) |
---|
463 | # exit (take you from root to sysadm user) |
---|
464 | $ id |
---|
465 | ... check that you are now the 'sysadm' user again; |
---|
466 | |
---|
467 | ... if not, log out and in again as sysadm to your virtual host |
---|
468 | |
---|
469 | $ mutt |
---|
470 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
471 | |
---|
472 | (When asked to create the Mail directory, say Yes) |
---|
473 | |
---|
474 | If everything goes as planned, you should be able to read the mails |
---|
475 | sent by Rancid. You can select an email sent by "rancid@pcX.ws.nsrc.org" |
---|
476 | and see what it looks like. |
---|
477 | |
---|
478 | Notice that it is your router description and any differences from the last |
---|
479 | time it was obtained using the rancid-run command. |
---|
480 | |
---|
481 | Now exit from mutt. |
---|
482 | |
---|
483 | (use 'q' return to mail index, and 'q' again to quit mutt) |
---|
484 | |
---|
485 | # 18. Let's make rancid run automatically every 30 minutes from using cron |
---|
486 | |
---|
487 | cron is a system available in Linux to automate the running of jobs. First we |
---|
488 | need to become the root user again: |
---|
489 | |
---|
490 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
491 | $ sudo -s |
---|
492 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
493 | |
---|
494 | Now we will create a new job to run for the rancid user: |
---|
495 | |
---|
496 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
497 | # crontab -e -u rancid |
---|
498 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
499 | |
---|
500 | It will ask you for your favorite editor. Select whichever editor you have been |
---|
501 | using in class. |
---|
502 | |
---|
503 | Add this line at the bottom of the file (COPY and PASTE): |
---|
504 | |
---|
505 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
506 | */30 * * * * /usr/lib/rancid/bin/rancid-run |
---|
507 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
508 | |
---|
509 | ... then save and quit from the file. |
---|
510 | |
---|
511 | That's it. The command "rancid-run" will execute automatically from now on every |
---|
512 | 30 minutes all the time (every day, week and month). |
---|
513 | |
---|
514 | |
---|
515 | # 19. Now add all the other routers |
---|
516 | |
---|
517 | Note the hostnames for the routers |
---|
518 | |
---|
519 | rtrX.ws.nsrc.org where X goes from 1 to 9 |
---|
520 | |
---|
521 | If you have less routers in your class, then only include the actual, available |
---|
522 | routers. |
---|
523 | |
---|
524 | Become the rancid user and update the router.db file: |
---|
525 | |
---|
526 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
527 | # su -s /bin/bash rancid |
---|
528 | $ editor /var/lib/rancid/all/router.db |
---|
529 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
530 | |
---|
531 | Add the other classroom routers to the file. You should end up with |
---|
532 | something like (COPY and PASTE): |
---|
533 | |
---|
534 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
535 | rtr1.ws.nsrc.org:cisco:up |
---|
536 | rtr2.ws.nsrc.org:cisco:up |
---|
537 | rtr3.ws.nsrc.org:cisco:up |
---|
538 | rtr4.ws.nsrc.org:cisco:up |
---|
539 | rtr5.ws.nsrc.org:cisco:up |
---|
540 | rtr6.ws.nsrc.org:cisco:up |
---|
541 | rtr7.ws.nsrc.org:cisco:up |
---|
542 | rtr8.ws.nsrc.org:cisco:up |
---|
543 | rtr9.ws.nsrc.org:cisco:up |
---|
544 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
545 | |
---|
546 | (Note that "cisco" means this is Cisco equipment -- it tells Rancid |
---|
547 | that we are expecting to talk to a Cisco device here. You can also |
---|
548 | talk to Juniper, HP, ...). |
---|
549 | |
---|
550 | Be sure the entries are aligned to the left of the file. |
---|
551 | |
---|
552 | # 20. Run rancid again: |
---|
553 | |
---|
554 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
555 | $ /usr/lib/rancid/bin/rancid-run |
---|
556 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
557 | |
---|
558 | This should take a minute or more now, be patient. |
---|
559 | |
---|
560 | # 21. Check out the logs: |
---|
561 | |
---|
562 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
563 | $ cd /var/lib/rancid/logs |
---|
564 | $ ls -l |
---|
565 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
566 | |
---|
567 | ... Pick the latest file and view it |
---|
568 | |
---|
569 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
570 | $ less all.YYYYMMDD.HHMMSS |
---|
571 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
572 | |
---|
573 | This should be the last file listed in the output from "ls -l" |
---|
574 | |
---|
575 | You should notice a bunch of statements indicating that routers have been |
---|
576 | added to the Subversion version control repository, and much more. |
---|
577 | |
---|
578 | # 22. Look at the configs |
---|
579 | |
---|
580 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
581 | $ cd /var/lib/rancid/all/configs |
---|
582 | $ more *.ws.nsrc.org |
---|
583 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
584 | |
---|
585 | Press the SPACE bar to continue through each file. Or, you could do: |
---|
586 | |
---|
587 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
588 | $ less *.ws.nsrc.org |
---|
589 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
590 | |
---|
591 | And press the SPACE bar to scroll through each file and then press ":n" to |
---|
592 | view the next file. Remember, in both cases you can press "q" to quit at |
---|
593 | any time. |
---|
594 | |
---|
595 | If all went well, you can see the configs of ALL routers |
---|
596 | |
---|
597 | # 23. Run RANCID again just in case someone changed some configuration on the router |
---|
598 | |
---|
599 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
600 | $ /usr/lib/rancid/bin/rancid-run |
---|
601 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
602 | |
---|
603 | This could take a few moments, so be patient.... |
---|
604 | |
---|
605 | |
---|
606 | # 24. Play with clogin: |
---|
607 | |
---|
608 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
609 | $ /usr/lib/rancid/bin/clogin -c "show clock" rtrX.ws.nsrc.org |
---|
610 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
611 | |
---|
612 | Where "X" is the number of your group. |
---|
613 | |
---|
614 | What do you notice ? |
---|
615 | |
---|
616 | Even better, we can show the power of using a simple script to make changes |
---|
617 | to multiple devices quickly: |
---|
618 | |
---|
619 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
620 | $ editor /tmp/newuser |
---|
621 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
622 | |
---|
623 | ... in this file, add the following commands (COPY and PASTE): |
---|
624 | |
---|
625 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
626 | configure terminal |
---|
627 | username NewUser secret 0 NewPassword |
---|
628 | exit |
---|
629 | write |
---|
630 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
631 | |
---|
632 | Save the file, exit, and run the following commands from the command line: |
---|
633 | |
---|
634 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
635 | $ for r in 1 2 3 4 |
---|
636 | |
---|
637 | Your prompt will now change to be ">". Continue by typing: |
---|
638 | |
---|
639 | > do |
---|
640 | > /var/lib/rancid/bin/clogin -x /tmp/newuser rtr$r.ws.nsrc.org |
---|
641 | > done |
---|
642 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
643 | |
---|
644 | Now your prompt will go back to "$" and rancid clogin command will run and |
---|
645 | execute the commands you just typed above on routers rtr1, rtr2, rtr3 and |
---|
646 | rtr4. This is simple shell scripting in Linux, but it's very powerful. |
---|
647 | |
---|
648 | Q. How would you verify that this has executed correctly ? Hint: "show run | inc" |
---|
649 | |
---|
650 | A. Connect to rtr1, rtr2, rtr3 and rtr4. Type "enable" and then type |
---|
651 | "show run | inc username" to verify that the NewUser username now exists. |
---|
652 | Type exit to leave each router. Naturally you could automate this like we just |
---|
653 | did above. |
---|
654 | |
---|
655 | |
---|
656 | # 25. Add the RANCID SVN (Subversion) repository in to WebSVN |
---|
657 | |
---|
658 | If you are still logged in as user rancid, get back to root. Remember you can type |
---|
659 | "id" to check what userid you are. |
---|
660 | |
---|
661 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
662 | $ exit |
---|
663 | # |
---|
664 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
665 | |
---|
666 | Install WebSVN: |
---|
667 | |
---|
668 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
669 | # apt-get install websvn |
---|
670 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
671 | |
---|
672 | * Select <Yes> to the question if you want to configure WebSVN now and press ENTER |
---|
673 | * Select <Ok> for the next question about supporting various web servers and press |
---|
674 | ENTER |
---|
675 | * When asked for the "svn parent repositories" change the path to be: |
---|
676 | |
---|
677 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
678 | /var/lib/rancid/svn |
---|
679 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
680 | |
---|
681 | Select <Ok> and press ENTER. Do the same when asked about "svn repositories" on |
---|
682 | the next screen. That is, use the path: |
---|
683 | |
---|
684 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
685 | /var/lib/rancid/svn |
---|
686 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
687 | |
---|
688 | and not what is shown by default. Select <Ok> and press ENTER. |
---|
689 | |
---|
690 | Select <Ok> for the next screen talking about permissions and press ENTER. |
---|
691 | |
---|
692 | # 26. Fix permissions. The web server must be able to read the SVN (Subversion) folder |
---|
693 | |
---|
694 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
695 | # chgrp -R www-data /var/lib/rancid/svn |
---|
696 | # chmod g+w -R /var/lib/rancid/svn |
---|
697 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
698 | |
---|
699 | |
---|
700 | # 27. Browse the rancid files from your Web browser! |
---|
701 | |
---|
702 | http://pcX.ws.nsrc.org/websvn |
---|
703 | |
---|
704 | Browse the files under the 'all/configs' directory. |
---|
705 | You can see all your router configuration files here. |
---|
706 | |
---|
707 | |
---|
708 | # 28. Review revisions |
---|
709 | |
---|
710 | WebSVN lets you see easily the changes between versions. |
---|
711 | |
---|
712 | * Browse to http://pcX.ws.nsrc.org/websvn again, go to all, configs. |
---|
713 | * Click on your router file (rtrX.ws.nsrc.org) name. You will get a new screen |
---|
714 | * Click "Compare with Previous" at the top of the screen. |
---|
715 | * You should now see the latest changes highlighted. |
---|
716 | * Click on "REPOS 1" to back to the main WebSVN page: |
---|
717 | * Click on "all/" under "Path" |
---|
718 | * Click on "configs/" |
---|
719 | * Select two of the routers that are next to each other. I.E. rtr1 and rtr2, rtr3 and |
---|
720 | rtr4. |
---|
721 | * Click on Compare Paths |
---|
722 | |
---|
723 | This will show you the differences between two separate router configurations. |
---|
724 | |
---|
725 | WebSVN is a convenient way to quickly see differences via a GUI between mulitple |
---|
726 | configuration files. Note, this is a potential security hole so you should limit |
---|
727 | access to the URL http://host/websvn using passwords (and SSL) or appropriate |
---|
728 | access control lists. |
---|