Let's pretend that I'm hosting a very big and popular website. Let's also pretend that I have many web servers spread out all around the world. Each web server containing identical files.

If I make my own DNS daemon, could it give different records out depending on the ISP asking for the records, therefore, giving each user direct access to a web server much closer to them?

  • It's hard to answer this without recommending companies, but commercial services exist that do exactly this - I wouldn't call it a manipulation. Commented Jun 30, 2015 at 16:54
  • Sounds like the answer is "Yes". Also, seems like the DNS protocol is quite simple, so I don't see the need to pay for such a service. But if I did, what terms would I Google? Commented Jun 30, 2015 at 17:04
  • 1
    Check this out: en.wikipedia.org/wiki/Geodns - Do a search for bind geodns, bind geolocation, and bind geoip in Google. I know this can be done, but how most people accomplish this has yet to be discovered.
    – closetnoc
    Commented Jun 30, 2015 at 22:24

4 Answers 4


Yes this is possible provided that your DNS daemon has the capabilities to provide the closest web server IP based on requesting client IP. Not a typical DNS daemon deployment that's for sure.

Found two links on configuring BIND to accomplish what you're looking for:

Many Content Delivery Networks (CDN) such as Akamai have this capability. What makes them even better is they perform health checks on the destination service. This ensures the client will be directed to a service that is available and that will provide the best performance.


If you want to direct users to the closest server to them using only DNS then i would recommend setting up a couple of cheap VPS's you can use to host your own DNS in different geographical locations.

DNS round robin isn't really a great way to do geo location based load balancing because if you have multiple A records with different IP addresses the DNS server will merely alternates the order of the address records each time a name server is queried.

Therefore you could have a DNS server in North America resolve your A record to your web server in North America while having your DNS server in Europe resolve your A record to your web server in Europe. (These locations are just an example, the point is having your DNS servers resolve your A records to your web server that is closest to that specific DNS server)

This is because a client should be using the DNS server that is closest to them, you can read more about how a client chooses the closest/fastest nameserver to use here - https://superuser.com/questions/527116/how-does-my-browser-locate-the-nearest-dns-root-servers

This should give you the outcome you desire while only using DNS servers but there are load balancing commercial services that exist that would be a lot more elegant.


No need to manipulate the DNS protocol. You can simply add multiple A records with different IPs. The DNS server will return the various A records in random order, thus your users will be distributed randomly across the various IP addresses.

  • 1
    This answer does not address the users question- directing traffic to the closest server.
    – closetnoc
    Commented Jun 30, 2015 at 22:18
  • Not quite what I'm after, although that looks like a better solution than using Apache Proxy Balancer to distribute traffic as explained in this article. Commented Jul 1, 2015 at 11:00

Use Round-robin DNS or a load balancer.

  • This leads to randomness, again, not "giving each user direct access to a web server much closer to them". Commented Sep 3, 2015 at 18:36
  • @AndrewLott Geographic load balancing.
    – William
    Commented Sep 3, 2015 at 18:38
  • If that's what you mean, then please update your answer to elaborate. Explaining how to do this will also be much more helpful. Commented Sep 4, 2015 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.