public
Description: Geographic Perl Nameserver
Homepage: http://geo.bitnames.com/
Clone URL: git://github.com/abh/pgeodns.git
abh (author)
Wed Nov 04 10:42:19 -0800 2009
commit  90f618f7750ead08de809dc1296def160025ac07
tree    4c7e18aa55b41af998a95aec941c422290a4bdaa
parent  23ed2ead85fc24484b300408a3caf418aa664d94
name age message
file .gitignore Mon Dec 29 10:12:59 -0800 2008 gitignore [abh]
file CREDITS Mon Aug 27 22:04:34 -0700 2007 - read .json data files (to bulk save/load conf... [abh]
file Changes Wed Nov 04 11:11:34 -0800 2009 Prepare v1.33 [abh]
directory Documentation/ Fri Sep 14 00:01:40 -0700 2007 add some RFCs git-svn-id: https://svn.develoo... [abh]
file LICENSE Mon Mar 22 18:19:14 -0800 2004 add a license better documentation git-svn-i... [abh]
file MANIFEST Thu Oct 29 10:58:50 -0700 2009 Rename and make basic A record test more robust [abh]
file Makefile.PL Fri Feb 13 14:28:01 -0800 2009 Require newer versions of Net::DNS and JSON mod... [abh]
file README Wed Nov 04 10:29:09 -0800 2009 Add basic README/documentation [abh]
directory config/ Mon Aug 27 22:04:34 -0700 2007 - read .json data files (to bulk save/load conf... [abh]
directory lib/ Wed Nov 04 11:11:34 -0800 2009 Prepare v1.33 [abh]
directory monitor/ Thu Mar 05 00:59:33 -0800 2009 another TODO [abh]
file pgeodns.conf Tue Sep 18 23:28:47 -0700 2007 change back to default config that works in the... [abh]
file pgeodns.pl Wed Nov 04 11:11:34 -0800 2009 Prepare v1.33 [abh]
directory poller/ Wed Nov 29 01:54:47 -0800 2006 make the ancient poller work again git-svn-id... [abh]
file sync_config.sh Tue Nov 25 14:34:12 -0800 2008 add example crontab git-svn-id: https://svn.de... [abh]
directory t/ Wed Nov 04 11:11:22 -0800 2009 Make loading a missing config a proper error R... [abh]
README
pgeodns - geo-aware authoriative domain nameserver
--------------------------------------------------

pgeodns is an authoritative DNS server that can give different replies
to each client, taking into account the country of origin of the
client and do weighted responses so some records are returned more
than others.

It's used to give IPs of "nearby" servers among the almost 2000
servers registered in the NTP Pool.  The responses are also weighted
by the available bandwidth for each IP (as configued by the server
admins).

It's also used by apache.org for svn.apache.org to send European users
to their European SVN mirror and North American ones to the US based
server. They are providing their configuration as a minimal example:
https://svn.apache.org/repos/infra/infrastructure/trunk/dns/zones/pgeodns.conf
https://svn.apache.org/repos/infra/infrastructure/trunk/dns/zones/geo.apache.org.json

Installation
------------

   perl Makefile.PL  # will warn if any dependencies are missing
   make 
   make test         # optional
   make install

You'll need the following modules installed, all available from CPAN:
Net::DNS, Geo::IP, List::Util, JSON.  It's optional, but if you
install JSON::XS loading large zone data files will be ever so
slightly faster.

Configuration
-------------

pgeodns needs two configuration files; one simple text file to define
the zones served and some options, and then for each zone a JSON
formatted data file with the zone data.

JSON is relatively easy to read and write for humans, and extremely
easy for computers to use, practically in any language: http://json.org/

The pgeodns.conf file should look like the following.  Only one or
more "base" lines are required.

<snip>
  # global options

  base some.zone.example.com data/some.file.json
  # options for this zone

  # base another.example.com data/some.file.json
  # options for this zone
</snip>

Data file format
----------------

See t/example.com.json for a small example for now.


Command line options
--------------------

* --config=[ configuration file ]

Name of the configuration file to load; defaults to pgeodns.conf in
the current directory.

* --interface=[ ip | host ]

IP or hostname to listen on (for example 192.168.10.10)

* --user=[ username | userid ]

Username or ID to change to after binding to the port.

* --verbose

Provide lots of details for each incoming and outgoing packet.

* --configtest

Load the config and exit.  Exits with 0 as the return value if all is
well.

* --port=[ 53 ]

Specify which port to listen on. Defaults to 53. Only use this in
development or if you are behind a NAT/SNAT device that forwards
queries to a different port.

* --development

This will enable a query to shutdown.$domain to make pgeodns
exit. Obviously not a good idea in production, but can be handy in a
development/testing environment.



Configuration Options
---------------------

The options allowed in the 'base' configuration file are

* ns name.server.tld

Add `name.server.tld` as a nameserver for this zone (or globally).  If
you specify one or more NS'es for a zone, it'll override the global
configuration.  You can also specify the ns records in the JSON data,
but doing it in the configuration gives some flexibility for re-using
the data under different namespaces.

* serial 123

Set the serial number of the zone; generally this is better done in
the JSON data.

* ttl 300

Set the default time-to-live for the zone in seconds.

* include filename

Include another filename.