That DNS
GeoDNS Plugin
- Working
- Example
Working
The plugin is actually implementing the dns.ResponseWriter
to modify the response
from other plugins, like File. The plugin implementation has different approach for different queries.
Non-A and Non-AAAA Record
Whenever a query contains anything other than A or AAAA it is simply ignored, to avoid any configuration changes the plugin will transparently resolve records that are like CNAME, MX, etc.
Single IP A or AAAA record
Similar to other records, if there's no choice in A or AAAA records they are also transparently passed along to avoid latency.
Multiple IP A or AAAA records - Same Continent
With current implementation the IP A-records or AAAA-records are checked for distance and continent with the client IP. If the client IP has same continent as some of the records all those records are responded.
Multiple IP A or AAAA records - Distance
With current implementation the IP A-records or AAAA-records are checked for distance and continent with the client IP. If the client IP continent has does not match with any of the records, it will do a distance match and respond with the nearest ones. Removing the outliers by filtering the mean distance.
Example
Let's try to resolve the Record for test1.sub.thatwebsite.xyz
from two different locations, AS and EU.
$ dig @ns1.thatdns.xyz +noall +answer test1.sub.thatwebsite.xyz
Let's break the command.
- dig is a command line DNS Lookup Utility
@ns1.thatdns.xyz
is the DNS we are querying to.@
allows us to specify which server to query it to.+noall +answer
just gives answer as output.test1.sub.thatwebsite.xyz
is the record which we are trying to query.
Now expected answer will be with two IPs - "172.104.160.xxx" (Singapore) and "172.105.64.xxx" (Germany).
Following are the scenarios:
- Client 1 (India)
test1.sub.thatwebsite.xyz. 3600 IN A 172.104.160.0
Same Continent IP exists
test1.sub.thatwebsite.xyz. 3600 IN A 172.105.64.0
Same Continent IP exists
test1.sub.thatwebsite.xyz. 3600 IN A 172.104.160.0
Nearest IP
test1.sub.thatwebsite.xyz. 3600 IN A 172.105.64.0
Nearest IP