How can I use DNS to return a geographically local IP address?

Solution 1:

You might have some luck with the "Subnet Prioritization" functionality in the Microsoft DNS server. Whether or not it will help you will depend on how your subnets are addressed and how your geographically "local" servers are addressed. This feature is enabled by default in Windows Server 2003 and 2008.

I'd recommend reading up on that feature. Have a look at http://technet.microsoft.com/en-us/library/dd197495(WS.10).aspx under the "Subnet prioritization" heading.

The "view" functionality in BIND would probably do what you want, too, but then you're talking about deploying a parallel DNS infrastructure and a lot of configuration.

If you have control of the web-based application you could do something off-the-wall like embed some Javascript to "detect" the user's location and redirect them on the client side. It's a bit bush-league, but it might do what you need.

Solution 2:

I've had this question asked a couple of times here at work, although it never got to implementation, so this is pure theory on my part.

The best solution (hack?) I could come up with would be to have a common dns sub domain that isn't replicated. Then just put the local servers in that setup. So you would have something like this:

NA DNS Servers
service.domain.local
web01.service.domain.local -> 10.10.10.200

EU DNS Servers
service.domain.local
web01.service.domain.local -> 10.200.200.200

So the clients connecting to web01.service.domain.local would pickup the service's local IP off thier default dns servers. You can have them replicate inside the EU and NA but don't have the zone replicate between the EU and NA.


Solution 3:

As a previous answer states, BIND's Views look like what you want. It allows a name server to present different configurations of the same name server to groups of clients which you define.

The groups can be defined via individual IP addresses or prefixes (like 10.10.1.192/26). Hopefully, your EU and American hosts can be distinguished this way.

Nice side benefit: your two servers can be (almost) identically configured, BIND-wise, and thus can act as each other's failover.

A good way to think of Views is that it is a DNS server's version of virtualization. Sort of.

BIND can be obtained at www.isc.org for free.