Tuesday, February 7, 2012

How to install PgeoDNS [ GEODNS ]

There was a problem since the early begin of the internet how to reach to clostest servers from any area. Some one can point out "anycast" as a solution. Most of IPV4 implemetations any case is used as advertising same BGP prefixes from different locations of the world and it store in the global BGP table with different metrics. When a packt comes to a particular destination according to the BGP metric packet is sent to the clostes destination. But this method is not easy to implement because you need to have your own public ip range.

Another solution is you can do DNS load balancing where you configure two "A" type records to same domain name, but it does not gurentee alwas some client will get the clostest server ip resolved by DNS. To overcome all these issues there has been geographic aware DNS servers have been introduced. These DNS servers can resolve your domain and give you the closetest server ip address to the user. Basically these DNS servers looks into source ip address and gives reply the DNS query by matching with his internal databases. maxming [1] is a one of these country ip database provider. PGeoDNS uses pgeoIP perl module for these purpose.

[1] http://www.maxmind.com/

Following is how to install PGeoDNS.

you have to download following perl libraries from CPAN. Note[ Following versions worked for me.

Geo-IP-1.40
IO-Socket-INET6-2.69
JSON-2.53
JSON-XS-2.32
Net-DNS-0.67
Scalar-List-Utils-1.23
Socket6-0.23


and also PgeoDNS

pgeodns-1.40


Now its required to install each perl modules including PgeoDNS one by one as following

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


You have to add a new user to execute the PgeoDNS. Add a new user as following

adduser pgeodns

The Zone configurations need to be configure as JSON notations. Sample config files can be download from apache infra site and it will give you idea about how the configurations shoud be.

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


You can start the service with following command as root.

pgeodns --config=pgeodns.conf --interface=192.168.1.2 --user=pgeodns  --verbose

Check the DNS queries as following.

dig a svn.geo.apache.org @192.168.1.2

No comments:

Post a Comment