1 | Install, configuring and running DSC on Ubuntu: |
---|
2 | |
---|
3 | NOTES: |
---|
4 | |
---|
5 | DSC is normally installed on multiple collector nodes, that collect |
---|
6 | traffic on the DNS nodes themselves, and a presenter, which receives |
---|
7 | the trace files generated by the collector nodes. |
---|
8 | |
---|
9 | In this exercise, we will be installing the collector and presenter |
---|
10 | on the same host. |
---|
11 | |
---|
12 | Also, we will not be using SSL certificates. |
---|
13 | |
---|
14 | Part I: Presenter Installation |
---|
15 | |
---|
16 | 1. Install Perl dependencies |
---|
17 | |
---|
18 | # perl -v |
---|
19 | |
---|
20 | If it is not installed, you can always get it with apt-get install perl |
---|
21 | |
---|
22 | |
---|
23 | Let's get all the necessary modules for DSC to run: |
---|
24 | |
---|
25 | # perl -MCPAN -e shell |
---|
26 | (Answer questions, etc...) |
---|
27 | |
---|
28 | You should get the following prompt in the end: |
---|
29 | |
---|
30 | cpan[1]> |
---|
31 | |
---|
32 | At the prompt, for each of the following modules, run: |
---|
33 | |
---|
34 | install MODULE_NAME |
---|
35 | |
---|
36 | CGI::Untaint |
---|
37 | CGI |
---|
38 | Digest::MD5 |
---|
39 | File::Flock |
---|
40 | File::Spec |
---|
41 | File::Temp |
---|
42 | Geography::Countries |
---|
43 | Hash::Merge |
---|
44 | IP::Country |
---|
45 | MIME::Base64 |
---|
46 | Math::Calc::Units |
---|
47 | List::Util |
---|
48 | Text::Template |
---|
49 | URI::Escape |
---|
50 | XML::Simple |
---|
51 | |
---|
52 | (Some will aready be part of the base perl install, but they will be |
---|
53 | ignored, so don't worry) |
---|
54 | |
---|
55 | |
---|
56 | 3. Install other dependencies |
---|
57 | |
---|
58 | - To compile DSC modules: |
---|
59 | |
---|
60 | # apt-get install gcc |
---|
61 | # apt-get install make |
---|
62 | |
---|
63 | - Additional software required: |
---|
64 | |
---|
65 | # apt-get install apache2 |
---|
66 | # apt-get install ploticus |
---|
67 | |
---|
68 | 4. Fetch the latest DSC distribution |
---|
69 | (Always at http://dns.measurement-factory.com/tools/dsc/download/) |
---|
70 | |
---|
71 | # wget http://dns.measurement-factory.com/tools/dsc/download/dsc-200912101623.tar.gz |
---|
72 | |
---|
73 | Extract it: |
---|
74 | |
---|
75 | # tar xfz dsc-200912101623.tar.gz |
---|
76 | # cd dsc-200912101623 |
---|
77 | |
---|
78 | |
---|
79 | 5. Build the presenter, and install it |
---|
80 | |
---|
81 | # cd presenter |
---|
82 | # make |
---|
83 | |
---|
84 | [there should be no errors] |
---|
85 | |
---|
86 | # mkdir /usr/local/dsc |
---|
87 | # make install |
---|
88 | |
---|
89 | |
---|
90 | 6. Make symlinks |
---|
91 | |
---|
92 | # cd /usr/lib/cgi-bin |
---|
93 | # ln -s /usr/local/dsc/libexec/put-file.pl |
---|
94 | # ln -s /usr/local/dsc/libexec/dsc-grapher.pl |
---|
95 | # cd /var/www |
---|
96 | # ln -s /usr/local/dsc/share/html dsc |
---|
97 | |
---|
98 | 7. Add a 'dsc' user |
---|
99 | |
---|
100 | # useradd dsc -d /usr/local/dsc -c "DSC" |
---|
101 | # chown dsc /usr/local/dsc |
---|
102 | |
---|
103 | 8. Create directories where data will be copied: |
---|
104 | |
---|
105 | # mkdir -p /usr/local/dsc/data/aroc-dns/localhost |
---|
106 | # chown -R dsc /usr/local/dsc/data/aroc-dns |
---|
107 | |
---|
108 | 8. Set permissions on various data dirs |
---|
109 | |
---|
110 | # chgrp nogroup /usr/local/dsc/data/ |
---|
111 | # chmod 2775 /usr/local/dsc/data/ |
---|
112 | # chgrp www-data /usr/local/dsc/var/log/ |
---|
113 | # chgrp www-data /usr/local/dsc/cache/ |
---|
114 | |
---|
115 | 9. Create a crontab for the cleanup jobs: |
---|
116 | |
---|
117 | # crontab -e |
---|
118 | |
---|
119 | # Presenter |
---|
120 | * * * * * /usr/local/dsc/libexec/refile-and-grok.sh |
---|
121 | @midnight find /usr/local/dsc/data/ | /usr/local/dsc/libexec/remove-xmls.pl 7 |
---|
122 | |
---|
123 | (save and quit) |
---|
124 | |
---|
125 | |
---|
126 | Part II: Collector Installation |
---|
127 | |
---|
128 | 1. Go back to the DSC distribution source directory |
---|
129 | |
---|
130 | # cd .../dsc-200912101623 |
---|
131 | # collector |
---|
132 | # make |
---|
133 | # make install |
---|
134 | |
---|
135 | 2. Create upload directories |
---|
136 | |
---|
137 | # mkdir -p /usr/local/dsc/run/localhost/upload/aroc |
---|
138 | |
---|
139 | (This means that we will have XML files in the localhost directory, |
---|
140 | and they will be moved to the upload directory 'aroc'. |
---|
141 | |
---|
142 | These files will be moved by the "upload-prep.sh" cron job: |
---|
143 | |
---|
144 | # crontab -e |
---|
145 | |
---|
146 | # Collector |
---|
147 | * * * * * /usr/local/dsc/libexec/upload-prep.sh |
---|
148 | |
---|
149 | |
---|
150 | 3. Let's add cron jobs to "upload" the files to the presenter |
---|
151 | |
---|
152 | In reality, this is happening on the same machine, but we set up the |
---|
153 | system as if we were installing using a separate collector and presenter: |
---|
154 | |
---|
155 | # crontab -e |
---|
156 | |
---|
157 | * * * * * /usr/local/dsc/libexec/upload-rsync.sh localhost aroc dsc@localhost:/usr/local/dsc/data/aroc-dns/localhost |
---|
158 | |
---|
159 | 4. Generate a key for the root user, used to copy files to the data |
---|
160 | directories |
---|
161 | |
---|
162 | # ssh-keygen -t dsa |
---|
163 | |
---|
164 | (don't set any passphrase) |
---|
165 | |
---|
166 | Copy the /root/ssh/id_dsa.pub to the authorized_keys directory of the DSC |
---|
167 | user: |
---|
168 | |
---|
169 | # mkdir /usr/local/dsc/.ssh |
---|
170 | # cp /root/ssh/id_dsa.pub /usr/local/dsc/.ssh/authorized_keys |
---|
171 | # chown -R dsc /usr/local/dsc/.ssh |
---|
172 | |
---|
173 | |
---|
174 | |
---|
175 | Part III: Configuring and running the collector |
---|
176 | |
---|
177 | 1. Configuration |
---|
178 | |
---|
179 | # cd /usr/local/dsc/etc |
---|
180 | # cp dsc.conf.sample dsc.conf |
---|
181 | |
---|
182 | Edit the file, and set the variables below as follows: |
---|
183 | |
---|
184 | |
---|
185 | local_address ip_of_your_server; |
---|
186 | |
---|
187 | run_dir "/usr/local/dsc/run/localhost"; |
---|
188 | |
---|
189 | interface eth0; |
---|
190 | |
---|
191 | |
---|
192 | ... the rest of the values are good defaults. |
---|
193 | |
---|
194 | 2. Running |
---|
195 | |
---|
196 | # /usr/local/dsc/bin/dsc -d -f /usr/local/dsc/etc/dsc.conf |
---|
197 | |
---|
198 | XXX: We have a problem. dsc crashes on Linux when running normally, |
---|
199 | i.e.: without the -d flag. Bug report will be sent to Duane. |
---|
200 | |
---|
201 | As a result, with -d, it only runs once... |
---|
202 | |
---|
203 | |
---|
204 | Part IV: Configure and use the graph viewer |
---|
205 | |
---|
206 | |
---|
207 | # cp dsc-grapher.cfg.sample dsc-grapher.cfg |
---|
208 | |
---|
209 | Edit the file, and make the following changes: |
---|
210 | |
---|
211 | - Remove these two lines: |
---|
212 | |
---|
213 | server f-root pao1 sfo2 |
---|
214 | server k-root A=k1.A,k2.A B=k1.B,k2.B C=k1.C,k2.C |
---|
215 | |
---|
216 | - Add this line instead: |
---|
217 | |
---|
218 | server aroc-dns localhost |
---|
219 | |
---|
220 | - Change the line |
---|
221 | |
---|
222 | valid_domains f-root all_tlds |
---|
223 | |
---|
224 | to |
---|
225 | |
---|
226 | valid_domains aroc-dns all_tlds |
---|
227 | |
---|
228 | |
---|
229 | |
---|
230 | That's it! |
---|
231 | |
---|
232 | You should be able to start observing the graphs at: |
---|
233 | |
---|
234 | http://yourhost/cgi-bin/dsc-grapher.p |
---|
235 | |
---|
236 | |
---|
237 | TODO: test upload-rsync.sh, make sure that the copying is taking place |
---|
238 | setup a bind nameserver, that receives queries |
---|
239 | |
---|
240 | |
---|
241 | |
---|