root/trunk/pdns/modules/geobackend/README

Revision 236, 29.3 KB (checked in by ahu, 9 years ago)

initial load

  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
Line 
1PowerDNS geobackend setup notes
2===============================
3
4These are the steps I went through to set up geobackend for PowerDNS on FreeBSD
5-STABLE.  By the time you read this maybe geobackend is part of the PowerDNS
6main CVS so perhaps not much of this will apply.  In that case you should skip
7further down to the configuration part.
8
9Before I carry on I should probably point out that if you don't know how DNS
10works much, or if you have never installed PowerDNS ever before, then you
11probably won't understand any of this.  In that case you should probably go and
12do some reading/practicing before trying to set this up for yourself.  As a
13minimum of DNS knowledge I would say you need to understand:
14
15- Basically how DNS servers answer queries
16
17- What common DNS terms like "CNAME" "RR" and "SOA" mean
18
19- How to use diagnostic utilities such as "dig" to test your setup.
20
21So, how this should work on Linux or any general Unix system.  This didn't work
22for me so I ended up having to do it another way, but anyhow..
23
241. Download PowerDNS source from http://www.powerdns.com/downloads/index.php -
25   you want the GPL sources.
26
272. Edit configure.in in the main directory so that where it has the list of
28   backends at the bottom, you add:
29
30   modules/geobackend/Makefile
31
323. $ cd modules
33
34   and get the geobackend:
35
36   $ cvs -d :pserver:anon@cvs.blitzed.org:/data/cvs login
37   (press <return> at password prompt)
38   $ cvs -d :pserver:anon@cvs.blitzed.org:/data/cvs co -d geobackend geo-dns
39   
40   $ cd ..
41
42   to return to top of build directory.
43
444. Regenerate the autotools with:
45
46   $ aclocal
47   $ autoheader
48   $ automake --add-missing --copy --foreign
49   $ autoconf
50
515. Do a ./configure with the flags you normally would use, but also
52   --with-dynmodules="geo"
53
546. Install PowerDNS as normal for how you would normally use it.
55
56This did not work for me on FreeBSD: no matter what combination of autoconf,
57automake, libtool was installed I would always get one error or another at the
58stage where I was running those commands.  So, after a few hours of messing
59around I decided to just compile the geobackend outside of the PowerDNS source
60tree.  Probably if/when geobackend is made part of PowerDNS, this will "just
61work", but in the meantime here's what I did:
62
631. Install PowerDNS from the port /usr/ports/dns/powerdns as normal.  Do not do
64   a "make clean" yet though!  Make sure your PowerDNS works as you'd expect
65   without any of this geobackend stuff before going further.
66
672. Somewhere else, get the source of our geobackend as above in step 3.
68
693. Compile geobackend:
70
71   $ c++ -I/usr/ports/dns/powerdns/work/pdns-2.9.15 -O2 -Wall -c geobackend.cc
72   $ c++ -I/usr/ports/dns/powerdns/work/pdns-2.9.15 -O2 -Wall -c ippreftree.cc
73   $ c++ ippreftree.o geobackend.o -Wl,-soname -Wl,libgeobackend.so.0 -shared -o libgeobackend.so
74
75   All of those should compile and link without error.
76
774. Now you need to copy that shared library to the system library directory, as
78   root:
79
80   # cp libgeobackend.so /usr/local/lib/
81
82Now whichever way you managed to get libgeobackend.so compiled, you are now
83ready to configure PowerDNS.  This is what Blitzed's configuration looks like
84right now (but this is very much an experiment so things are bound to get out
85of date quickly).
86
87By the way, I could not find a SysV-style startup script installed by the
88FreeBSD port so I had to copy one from debian and put it in
89/usr/local/etc/rc.d/pdns.sh.  You can get that file here:
90http://nubian.blitzed.org/pdns.sh
91
92And another thing is that the FreeBSD port doesn't add any new users for
93PowerDNS's use.  You probably don't want to run it as root even without our
94code in it!  So be sure to add some sensible user and group like "pdns".
95
96PowerDNS Configuration
97======================
98
99Here is the relevant parts of my /usr/local/etc/pdns.conf file as running on
100FreeBSD -STABLE:
101
102# -------------------------------------------------------------------------
103
104# To make it run as user@group pdns:pdns instead of root:root
105setgid=pdns
106setuid=pdns
107
108# These totally disable query+packet caching for all zones.  This is necessary
109# because otherwise when the exact same question is asked twice in a short
110# period of time (by default, 10 seconds), the same response will be given
111# without any backends getting involved.
112#
113# This is bad for geobackend because obviously every question can potentially
114# require a new answer based only on the IP of the user's nameserver.  Now, it
115# should be noted that if you have other zones in PowerDNS then they will have
116# their query cache disabled as well.  That's not ideal, so you probably want
117# to run a separate instance of PowerDNS just for geobackend.  Maybe one day
118# there will be config options to set per-zone query caching time or something.
119query-cache-ttl=0
120cache-ttl=0
121
122# Log a lot of stuff.  Logging is slow.  We will disable this when we are happy
123# things are working. :)
124loglevel=7
125
126# But these logs are not interesting at the moment
127log-dns-details=no
128
129# This disables wildcards which is more efficient.  geobackend doesn't use
130# them, so if none of your backends need them, set this, otherwise comment it
131# out.
132wildcards=no
133
134# The geobackend
135launch=geo
136
137# The zone that your geo-balanced RR is inside of.  The whole zone has to be
138# delegated to the PowerDNS backend, so you will generally want to make up some
139# subzone of your main zone.  We chose "geo.blitzed.org".
140#
141geo-zone=geo.blitzed.org
142
143# The only parts of the SOA for "geo.blitzed.org" that apply here are the
144# master server name and the contact address.
145geo-soa-values=ns0.blitzed.org,hostmaster@blitzed.org
146
147# List of NS records of the PowerDNS servers that are authoritative for your
148# GLB zone.
149geo-ns-records=ns0.blitzed.org,ns1.blitzed.org
150
151# The TTL of the CNAME records that geobackend will return.  Since the same
152# resolver will always get the same CNAME (apart from if the director-map
153# changes) it is safe to return a reasonable TTL, so if you leave this
154# commented then a sane default will be chosen.
155#geo-ttl=3600
156
157# The TTL of the NS records that will be returned.  Leave this commented if you
158# don't understand.
159#geo-ns-ttl=86400
160
161# This is the real guts of the data that drives this backend.  This is a DNS
162# zone file for RBLDNSD, a nameserver specialised for running large DNS zones
163# typical of DNSBLs and such.  We choose it for our data because it is easier
164# to parse than the BIND-format one.
165#
166# Anyway, it comes from http://countries.nerd.dk/more.html - there are details
167# there for how to rsync your own copy.  You'll want to do that regularly,
168# every couple of days maybe.  We believe the nerd.dk guys take the netblock
169# info from Regional Internet Registries (RIRs) like RIPE, ARIN, APNIC.  From
170# that they build a big zonefile of IP/prefixlen -> ISO-country-code mappings.
171geo-ip-map-zonefile=/usr/local/etc/zz.countries.nerd.dk.rbldnsd
172
173# And finally this last directive tells the geobackend where to find the map
174# files that say a) which RR to answer for, and b) what actual resource record
175# to return for each ISO country code.  The setting here is a comma-separated
176# list of paths, each of which may either be a single map file or a directory
177# that will contain map files.  If you are only ever going to serve one RR then
178# a single file is probably better, but if you're going to serve many then a
179# directory would probably be better.  The rest of this documentation will
180# assume you chose a directory.
181geo-maps=/usr/local/etc/geo-maps
182
183# -------------------------------------------------------------------------
184
185Map configuration
186=================
187
188Above you defined a directory which should contain one file for each RR you are
189going to serve.  This section describes the format for those files.
190
191There is a perl script in the geo-dns module
192(http://cvs.blitzed.org/geo-dns/iso2region.pl) which will print out a useful
193template for starting with.  There are just two lines you MUST add for your own
194setup.  The one that Blitzed is using is here:
195http://nubian.blitzed.org/irc.geo.blitzed.org
196
197The first line you must add is the $RECORD line.  This tells the geobackend
198which RR within the geo-zone the file is for, so for example the file above
199gives:
200
201        $RECORD irc
202
203meaning it is for irc.geo.blitzed.org.
204
205The second line that must be present is the $ORIGIN line:
206
207        $ORIGIN iso.blitzed.org.
208
209The rest of this file is a list of mappings of ISO country to RR, and the
210$ORIGIN line tells the geobackend how to qualify the RRs.  Any relative RR with
211be qualified by adding a dot and then this $ORIGIN string onto it.  So all the
212relative RRs that follow are actually in the "iso.blitzed.org." zone.  If you want to refer to an RR outside the $ORIGIN, put a trailing dot.
213
214The final mandatory line is the 0 mapping:
215
216        0 pool.blitzed.org.
217
218This is the "default" mapping.  It's possible that you will get a query from an
219IP that is not represented in the nerd.dk zone.  Maybe it is a new allocation
220by a RIR, or maybe something unexpected happened like you got a query from IPv6
221or from an RFC1918 address.  Or, there could be some error elsewhere in the
222geobackend that makes it want to give up.  In any of these cases it needs to
223return a CNAME to a useful default.
224 
225The default chosen for blitzed is "pool.blitzed.org." (note the trailing dot
226puts it outside the $ORIGIN!).  At the moment, pool.blitzed.org is a
227round-robin of A records of all our connected servers, but the best way to
228handle it is under debate.  Since it is in one of our regular zone files we
229can change it later how we want.
230
231The entire rest of the file is optional, and takes the format of an ISO country
232code (number) and an RR to map it to.  iso2region.pl will have helpfully added
233comments with the country name so you can see what is what:
234
235        # Belgium
236        56 eu
237
238Lines starting with # are comments.  That's mainly so you can tell what the ISO
239code corresponds to, and maybe later when you are tweaking where all these
240countries will go to you can add some documentation for why you did it.
241
242The "56" is the ISO country code (see
243http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html)
244for Belgium.  The "eu" tells the geobackend that if a query for
245irc.geo.blitzed.org should come in from someone in Belgium, then it should
246respond with a CNAME for "eu.iso.blitzed.org".  That's it.  That is the RR that
247gets sent back.  Every other line in this file is the same, just code->RR maps.
248
249At this point you might be wondering when the user gets the actual IP address
250sent to them.  The answer is that we have chosen to make our geobackend only
251respond with CNAMEs to other RRs that are assumed to be hosted elsewhere in
252DNS.  Our main blitzed.org zone is hosted in bind servers like it has been for
253years.  In that zone we have entries for every one of the RRs that appears on
254the right hand side in the director-map.  A list of those RRs is as follows:
255
256an.iso.blitzed.org.
257af.iso.blitzed.org.
258as.iso.blitzed.org.
259eu.iso.blitzed.org.
260na.iso.blitzed.org.
261oc.iso.blitzed.org.
262sa.iso.blitzed.org.
263
264These correspond to the ISO names for the regions/continents (Antarctica,
265Africa, Asia, Europe, North America, Oceania, South America) and are
266represented in our DNS at the moment by either a list of A records of servers
267"near" there, or else a CNAME to a "nearby" region.  For example we have no
268servers in Antarctica or Asia.  We just CNAME those to "na.iso.blitzed.org." to
269send those users to North American servers instead.  Doing it this way is just
270our first attempt, we are still experimenting and might decide to do it
271different.  All you need to know is that the geobackend gives the CNAMEs you
272tell it to give, it's your business what those CNAMEs are and what they end up
273resolving to.
274
275DNS configuration
276=================
277
278Time to configure the things that go into your existing DNS setup:
279
2801. The geographically load-balanced zone needs to be delegated to your PowerDNS
281   servers.  For Blitzed we chose "geo.blitzed.org.", so:
282
283   geo          NS      ns0.blitzed.org.
284   geo          NS      ns1.blitzed.org.
285   geo          NS      ns2.blitzed.org.
286
2872. The lists of servers that correspond to each CNAME that your director-map
288   can possibly come up with.  The above configuration can only answer one of:
289
290   pool.blitzed.org.
291   an.iso.blitzed.org.
292   af.iso.blitzed.org.
293   as.iso.blitzed.org.
294   eu.iso.blitzed.org.
295   na.iso.blitzed.org.
296   oc.iso.blitzed.org.
297   sa.iso.blitzed.org.
298
299   We have no servers in Antarctica so we just send that to North America:
300
301   an.iso       CNAME   na.iso.blitzed.org.
302
303   Other regions that actually have servers light look like:
304
305   na.iso       A       1.2.3.4 ; Some server in North America
306   na.iso       A       2.3.4.1 ; Some other server in North America
307
3083. Eventually you probably will want to use a more friendly name than something
309   like "irc.geo.blitzed.org.".  At that point you could just do the equivalent
310   of:
311
312   irc  CNAME   irc.geo.blitzed.org.
313
314   BEAR IN MIND THAT THERE MIGHT BE BUGS IN THIS BACKEND AND IF YOU DO THIS TO
315   YOUR MAIN POOL AND IT STOPS RESPONDING, SENDS YOUR USERS TO THE WRONG SERVERS,
316   OR EVEN TO THE WRONG NETWORKS, OR ANYTHING ELSE UNFORTUNATE HAPPENS AT ALL,
317   THEN THAT'S JUST TOUGH LUCK AS THIS CODE COMES WITH NO WARRANTY, GUARANTEE
318   OR ASSURANCE OF ANY KIND!
319
320Testing
321=======
322 
323OK!  If you're still awake after all that, it is ready to test.
324
325By the way, at the moment some of the logging from the geobackend is a severity
326"debug" (facility "daemon" if using FreeBSD port).  The default FreeBSD -STABLE
327install does not log daemon.debug to any file.  If you don't add daemon.debug
328to your /etc/syslog.conf then you might not see some of the logs I shall talk
329about later.  Most logging will be removed or made optional anyway as it slows
330things down.
331
332- Start PowerDNS
333
334  # /usr/local/etc/rc.d/pdns.sh start
335
336- Check your logs!  You should see something like this:
337
338  Feb 26 16:07:45 nubian pdns[4661]: PowerDNS 2.9.15 (C) 2001-2004 PowerDNS.COM BV (Feb  9 2004, 23:40:35) starting up
339  Feb 26 16:07:45 nubian pdns[4661]: PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2.
340  Feb 26 16:07:45 nubian pdns[4661]: Set effective group id to 1023
341  Feb 26 16:07:45 nubian pdns[4661]: Set effective user id to 1023
342  Feb 26 16:07:45 nubian pdns[4661]: Creating backend connection for TCP
343  Feb 26 16:07:45 nubian pdns[4661]: [geobackend] Parsing IP map zonefile
344  Feb 26 16:07:47 nubian pdns[4661]: [geobackend] Finished parsing IP map zonefile: added 53072 prefixes, stored in 132525 nodes using 1590300 bytes of memory
345  Feb 26 16:07:47 nubian pdns[4661]: [geobackend] Parsing director map /usr/local/etc/geo-maps/irc.geo.blitzed.org
346  Feb 26 16:07:47 nubian pdns[4661]: [geobackend] Finished parsing 2 director map files, 0 failures
347  Feb 26 16:07:47 nubian pdns[4661]: About to create 3 backend threads
348  Feb 26 16:07:47 nubian pdns[4661]: Done launching threads, ready to distribute questions
349
350  As long as there were no errors, the server is ready, geobackend is probably
351  working.  You should now test with a suitable diagnostic tool:
352
353  $ dig irc.geo.blitzed.org.
354
355  ; <<>> DiG 9.2.2 <<>> irc.geo.blitzed.org.
356  ;; global options:  printcmd
357  ;; Got answer:
358  ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59602
359  ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 5, ADDITIONAL: 5
360
361  ;; QUESTION SECTION:
362  ;irc.geo.blitzed.org.           IN      A
363
364  ;; ANSWER SECTION:
365  irc.geo.blitzed.org.    0       IN      CNAME   eu.iso.blitzed.org.
366  eu.iso.blitzed.org.     1       IN      A       195.92.253.3
367  eu.iso.blitzed.org.     1       IN      A       213.193.225.252
368  eu.iso.blitzed.org.     1       IN      A       62.80.124.155
369  eu.iso.blitzed.org.     1       IN      A       80.196.158.72
370  eu.iso.blitzed.org.     1       IN      A       195.22.74.199
371
372  ;; AUTHORITY SECTION:
373  blitzed.org.            3600    IN      NS      sou.nameserver.net.
374  blitzed.org.            3600    IN      NS      bos.nameserver.net.
375  blitzed.org.            3600    IN      NS      iad.nameserver.net.
376  blitzed.org.            3600    IN      NS      phl.nameserver.net.
377  blitzed.org.            3600    IN      NS      sjc.nameserver.net.
378
379  ;; ADDITIONAL SECTION:
380  bos.nameserver.net.     43200   IN      A       203.20.52.5
381  iad.nameserver.net.     43200   IN      A       192.148.252.171
382  phl.nameserver.net.     7200    IN      A       203.56.139.102
383  sjc.nameserver.net.     43200   IN      A       205.158.174.201
384  sou.nameserver.net.     34825   IN      A       194.196.163.7
385
386  ;; Query time: 389 msec
387  ;; SERVER: 192.168.0.5#53(192.168.0.5)
388  ;; WHEN: Tue Feb 10 03:10:14 2004
389  ;; MSG SIZE  rcvd: 322
390
391  What does this show?  Well first of all it tells us that we looked for the A
392  record of "irc.geo.blitzed.org." (A records are the default RR for dig).
393  What we actually got back was a CNAME to "eu.iso.blitzed.org."  At that point
394  the work of geobackend and our PowerDNS server as a whole is done.  All it is
395  designed to do is return a CNAME based on the location of the server doing
396  the query.  The server I did that from is in UK, so a response of
397  "eu.iso.blitzed.org." is correct.
398
399  The rest of the data comes from the normal BIND9 nameservers that are
400  authoritative for the "blitzed.org." zone, in this case a list of A records
401  corresponding to our EU servers.  Finally the list of authoritative servers
402  for "blitzed.org." is given, those same BIND9 boxes.
403
404  Meanwhile in the syslog of nubian, we have:
405
406  Feb 10 03:07:02 nubian pdns[32106]: [geobackend] Serving irc.geo.blitzed.org CNAME eu.iso.blitzed.org to 82.195.224.5 (756)
407
408  Here you can see that 82.195.224.5 asked for "irc.geo.blitzed.org." and was
409  served the mapping for ISO code 756: "eu.iso.blitzed.org.".  This log notice
410  will be useful for debugging and refining the director-map by hand, but
411  later it will probably be removed or made optional.
412
413Ongoing maintenance
414===================
415
416New IPs are regularly allocated, also there may end up being corrections to the
417nerd.dk zones, so you should arrange to rsync this file every so often.  I'm
418guessing once a week would be adequate.  You may not be satisfied with your
419first try at the director-map either, so from time to time you may make
420changes.  You might also add more map files to your geo-maps directory.
421Anytime those changes happen you will need to tell the geobackend to reread
422them.  At the moment the best way to do this is:
423
424# pdns_control rediscover
425
426Feb 26 16:10:57 nubian pdns[4661]: Rediscovery was requested
427Feb 26 16:10:57 nubian pdns[4661]: [geobackend] Parsing IP map zonefile
428Feb 26 16:10:58 nubian pdns[4661]: [geobackend] Finished parsing IP map zonefile: added 53072 prefixes, stored in 132525 nodes using 1590300 bytes of memory
429Feb 26 16:10:58 nubian pdns[4661]: [geobackend] Parsing director map /usr/local/etc/geo-maps/irc.geo.blitzed.org
430Feb 26 16:10:58 nubian pdns[4661]: [geobackend] Parsing director map /usr/local/etc/geo-maps/irc.strugglers.net
431Feb 26 16:10:58 nubian pdns[4661]: [geobackend] Finished parsing 2 director map files, 0 failures
432
433About recursive nameservers
434===========================
435
436There is a small but potentially confusing gotcha in all this regarding
437recursive nameservers.
438
439Normally the authoritative nameservers for your regular domain will not allow
440recursion, that is, they will return data only for the domains they are
441authoritative for, returning pointers to nameservers for everything else.
442
443Here's an example of an authoritative server for blitzed.org that does not
444allow recursion:
445
446$ dig www.bbc.co.uk @sou.nameserver.net
447
448; <<>> DiG 9.2.3 <<>> www.bbc.co.uk @sou.nameserver.net
449;; global options:  printcmd
450;; Got answer:
451;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38059
452;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 7, ADDITIONAL: 0
453
454;; QUESTION SECTION:
455;www.bbc.co.uk.                 IN      A
456
457;; AUTHORITY SECTION:
458uk.                     166680  IN      NS      NS1.NIC.uk.
459uk.                     166680  IN      NS      NS2.NIC.uk.
460uk.                     166680  IN      NS      NS3.NIC.uk.
461uk.                     166680  IN      NS      NS4.NIC.uk.
462uk.                     166680  IN      NS      NS5.NIC.uk.
463uk.                     166680  IN      NS      NSA.NIC.uk.
464uk.                     166680  IN      NS      NSB.NIC.uk.
465
466;; Query time: 56 msec
467;; SERVER: 194.196.163.7#53(sou.nameserver.net)
468;; WHEN: Mon Feb 23 02:22:16 2004
469;; MSG SIZE  rcvd: 161
470
471Note in the flags part the "rd", which means "recursion desired".  Since this
472server does not offer recursion to me, all it does is pass back the hostname of
473the nameservers that can further answer my question (in this case the list of
474nic.uk servers).  My own resolver would then carry on asking questions, which
475is how it should be.
476
477Look what happens if I pick a server that does allow recursion:
478
479$ dig www.bbc.co.uk @bos.nameserver.net
480
481; <<>> DiG 9.2.3 <<>> www.bbc.co.uk @bos.nameserver.net
482;; global options:  printcmd
483;; Got answer:
484;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51313
485;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 2
486
487;; QUESTION SECTION:
488;www.bbc.co.uk.                 IN      A
489
490;; ANSWER SECTION:
491www.bbc.co.uk.          899     IN      CNAME   www.bbc.net.uk.
492www.bbc.net.uk.         300     IN      A       212.58.240.121
493
494;; AUTHORITY SECTION:
495bbc.net.uk.             148544  IN      NS      ns0.thny.bbc.co.uk.
496bbc.net.uk.             148544  IN      NS      ns0.thdo.bbc.co.uk.
497
498;; ADDITIONAL SECTION:
499ns0.thny.bbc.co.uk.     62144   IN      A       38.160.150.20
500ns0.thdo.bbc.co.uk.     62144   IN      A       212.58.224.20
501
502;; Query time: 321 msec
503;; SERVER: 203.20.52.5#53(bos.nameserver.net)
504;; WHEN: Mon Feb 23 02:27:14 2004
505;; MSG SIZE  rcvd: 164
506
507Note the extra flag that appeared, "ra".  This is "recursion available", and
508the server true to its word has gone and got the information for us.
509
510Normally this probably would not be noticeable.  In most cases it does not
511matter if your own resolver does the work or if some other server does.  This
512geo-dns project is based totally on the IP address of the server that asks the
513question, however, so for this application it is critical.
514
515As far as geo-dns is concerned, you cannot have any nameserver that allows
516recursion be authoritative for your main domain.  If you do, then any query
517which hits this server will cause it to go out and get the answer itself.  It
518will hand back answers that are based on its own location, instead of the
519location of the client.  After wondering why too many people were getting
520answers based on the location of bos.nameserver.net instead of their own
521location, we finally worked out it had recursion enabled.  This note is to save
522you the same hassle.
523
524It is generally recommended anyway that nameservers which are meant to be
525authoritative for domains do not have recursion enabled
526(http://www.isc.org/pubs/tn/isc-tn-2002-2.txt), but in this case it is an
527absolute requirement if you wish to get any sensible results.  Check they are
528not allowing recursion by use of dig as above before setting up this backend.
529
530(The specific example of bos.nameserver.net has since been fixed (had recursion
531disabled) so you will not be able to repeat this example)
532
533Hosting multiple domains
534========================
535
536You may have noticed that all of the instructions so far have talked only of
537the single example domain, geo.blitzed.org, and may be wondering how to serve
538multiple zones.  The answer is, you don't need to.  The only thing you want to
539serve is individual RRs, and this geobackend does allow you to serve multiple
540of these just by adding files to the geo-maps directory.
541
542So, assume you now want to apply geo-dns to the RR irc.strugglers.net,  You might
543add a new director map to your geo-maps directory named "irc.strugglers.net"
544(name doesn't matter, just an example).  Inside this file you would have
545something like:
546
547        $RECORD irc.strugglers.net
548        $ORIGIN iso.strugglers.net.
549        0 bar.example.com.
550        # List of code->RR maps follow, unqualified RRs are inside
551        # iso.strugglers.net
552
553Once you now do a "pdns_control rediscover", your geobackend will be configured
554to answer for irc.strugglers.net.geo.blitzed.org.  Now the people who run
555strugglers.net's dns just need to add a handy CNAME in their example.com zone
556file:
557
558irc     CNAME   irc.strugglers.net.geo.blitzed.org.
559
560You can check it will work before they add the CNAME:
561
562        $ dig +norecurse irc.strugglers.net.geo.blitzed.org. @ns0.blitzed.org
563
564        ; <<>> DiG 9.2.3 <<>> +norecurse irc.strugglers.net.geo.blitzed.org. @ns0.blitzed.org
565        ;; global options:  printcmd
566        ;; Got answer:
567        ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3592
568        ;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
569
570        ;; QUESTION SECTION:
571        ;irc.strugglers.net.geo.blitzed.org. IN A
572
573        ;; ANSWER SECTION:
574        irc.strugglers.net.geo.blitzed.org. 3600 IN CNAME eu.iso.blitzed.org.
575
576        ;; Query time: 234 msec
577        ;; SERVER: 82.195.234.5#53(ns0.blitzed.org)
578        ;; WHEN: Thu Feb 26 15:45:36 2004
579        ;; MSG SIZE  rcvd: 73
580
581so that is how you can geo-dnsify RRs in multiple zones.
582
583Other questions, corrections, etc.?
584===================================
585
586Please subscribe to our "geo" list from http://lists.blitzed.org/listinfo/geo
587and tell us about it.  Tell us about how you use this stuff too, we're
588interested in people's experiences.
589
590All this is too much for you?
591=============================
592
593We're still beta-testing this ourselves.  As long as it doesn't place too much
594load on our servers we are open to the idea of doing the PowerDNS part of this
595for you as well.  We're not ready to do that yet; it will require more
596development and specification of how you would provide your own director-maps
597etc..  If you are interested then please subscribe to the geo list and help us
598work out the details.
599
600FAQ
601===
602
603Q1. My IRC network is based mostly in one country (e.g. Australia, Brazil, ...)
604    so all my users are from one ISO code and this isn't so useful to me, what
605    can I do?
606
607A1. Well, one of the assumptions made during the design of this backend is that
608    latency and geographical distance doesn't have a good relationship at small
609    scales, even within North America or Europe it probably does not *always*
610    follow that short distance == low latency.
611
612    To improve things further I think you will need to do actual measurements.
613    Or you could look at the amount of hops in the AS path from your client to
614    each of your servers.  Maybe you can come up with more ideas, if so we'd
615    like to hear.
616
617    However, if you are able to get more detailed geographic info from
618    somewhere then you could still feed it into this backend, you'd just have
619    to give up on the ISO country code model.  I can really only see this
620    working for very big countries like Australia and North America.
621
622    Remember also that your servers probably are not 100% reliable!  Say you
623    have 2 US servers; one in California and one in New York.  You find some
624    way to split the US up into two halves with one half going to California
625    and one to New York.  Now suppose the New York server dies.  Half your US
626    users are still being directed there because that's the nearest one!  Worse
627    still, those users probably think that what they are connecting to is a
628    *random* server, yet every single time they get will directed to a dead
629    server.  They may conclude your entire network is dead.
630
631    You would be better advised IMHO to just have one US pool with both servers
632    in.  If either dies, the irc clients will make a few more attempts and get
633    the other.  It might add a few more ms to the RTT, but it's better than not
634    being able to get on at all, and it's better than ending up on a non-US
635    server.  Maybe one day we'll do a high-availability backend too, though. :)
636
637
638Q2. Why is this tied to IRC?  Can I use it for other things?
639
640A2. Yes!  The code itself is not restricted in usefulness to only IRC, it's
641    just that IRC is a good example of a situation where you have a service
642    that is commonly split across many widely-separated servers, lots of widely
643    spread clients, and a serious lack of money for "real" solutions.
644
645    It wouldn't be any harder to use it for things like HTTP or many other
646    protocols.
647
648
649Q3. I don't want to run PowerDNS, will you make a custom backend for BIND9?
650
651A3. Probably not unless you're willing to pay or induce us in other ways!
652    PowerDNS is fun, you should try it, maybe you can make it work with only
653    one IP address by use of a forward zone in BIND and putting PowerDNS on a
654    strange port.
655
656
657Q4. I have some ideas for other metrics you could use instead of origin
658    country, like server load or user count, or ... will you implement that
659    too?
660
661A4: In another backend maybe.  Tell us about your ideas, if you can make them
662    sound interesting and useful then maybe we will.
663
664Q5. I serve lots of RRs out of my geobackend and with lots of nameservers I
665    find it hard to keep my geo-maps in sync between them all.  Any hints?
666
667A5. At the moment we use rsync like this:
668
669    07 04 * * 0     pdns    rsync -t rsync://calzone.hestdesign.com/countries/zz.countries.nerd.dk.rbldnsd /usr/local/etc/powerdns/zz.countries.nerd.dk.rbldnsd && /usr/local/bin/pdns_control rediscover > /dev/null
670    */15 * * * *    pdns    NR=$(rsync -rt --delete --stats rsync://rsync.blitzed.org/geo/ /usr/local/etc/powerdns/directormaps | awk '/Number of files transferred/ { print $5 }'); [ $NR != "0" ] && /usr/local/bin/pdns_control rediscover > /dev/null
671
672    Which will take care of getting a new nerd.dk zone weekly and will sync the
673    geo-maps every 15 minutes, doing a rediscover if files were transferred.
674
675Contact
676=======
677
678Author: Andy Smith <grifferz@blitzed.org> but please direct any questions to
679the geo list thanks!
680
681http://lists.blitzed.org/listinfo/geo
682
Note: See TracBrowser for help on using the browser.