Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I have multiple A records for the same DNS name (i.e. example1.com has two A records of 200.1.1.1 and 222.1.1.1) and for example one server is located in Canada and the other is located in Hong Kong, will the visitor's ip address and physical location automatically be used to direct them to the closest physical ip address? If one server goes down, will requests automatically be rerouted to the other server? If this is not the case, what are some good solutions to make this happen? I'm hoping that the "Internet" and all of it's routers and DNS servers are smart enough to at least go to the closest ip address...

share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

The case you describe is called "round-robin DNS". Client PCs will pick a random IP address from the pool that are returned to it. It is not smart like you hoped.

The kind of service you're looking for is a DNS server that does a GeoIP lookup of the incoming request and serves an IP address closest to the requesters location. There are 3rd party DNS providers that support this, I believe.

share|improve this answer
    
Do you have any experience with 3rd parties in this case? Or have you mostly managed this type of thing in house? –  PsychoDad Oct 27 '10 at 21:35
    
@John We're not doing anything of this sort. However, @Ash Palmer below describes how to set it up with ISC Bind. –  sysadmin1138 Oct 27 '10 at 22:22
    
The 3rd party solution looks like it will be the best, thanks! –  PsychoDad Nov 11 '10 at 18:34
add comment

The problems you are trying to solve are separate, but related. Specifically, you are attempting to achieve the following two things:

  1. Load-balancing
  2. High availability

Load-balancing is distributing user requests across different servers. The way that users are distributed across servers can vary. To give but two examples:

  • round-robin - alternate between your two servers for every request
  • least-connections - have your load-balancing device keep track of how many connections each server is handling, and send new requests to the least loaded server

In this case, you want users to be directed to the server 'closest' to where the request is coming from. As mentioned in other answers, various DNS providers offer this service, as do DNS servers such as BIND.

High availability refers to ensuring that if one of your servers is no longer available that users are directed to an alternative. A common way of doing this is through the use of IP anycast; however, in order for this to work, your hosting provider must be willing to accept routing advertisement from you, among other things. See this question for a more in-depth discussion of anycast.

share|improve this answer
    
+1 for understanding the difference between the two. DNS (on its own) is the solution to neither. –  Alnitak Oct 28 '10 at 7:11
add comment

Bind supports GeoIP. The key term your looking for is match-clients

match-clients { country_AR; country_CL; country_BR; };

share|improve this answer
    
+1 nice to know. –  Belmin Fernandez Oct 27 '10 at 23:37
    
I've never used this, but I take it that all I would need is a linux server? Then I just point my domain hosts nameserver entries to this linux server once it's set up the way I want? –  PsychoDad Oct 28 '10 at 22:13
    
To be clear, this only solves the geo-location problem. If a user has been given the IP address of the Hong Kong server and it goes down, they will continue to use that IP address until it expires from their DNS cache. (Which may be hours.) Even then, BIND (as far as I know) has no concept of health checking, so when the user queries again, they will be return the IP address of the (still down) closest server. –  Murali Suriar Oct 29 '10 at 9:30
    
BGP is the true load balancer. –  Ash Palmer Oct 29 '10 at 10:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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