Could a name server resolve IP addresses dynamically based on some strategy

domain-name-systemnetworking

We have registered some name servers for DNS resolving for our website which is deployed in several data centers.

Our current strategy of DNS resolve is that based on the different client IP addresses, the name server will return different IP addresses for the same domain. For example, if the client IP address is from North America, the name server will return an IP address which is the IP address of our North America data center.

But the client IP address sometimes is not the real IP address of the users. It may be an IP address of DNS which belongs to an ISP or a proxy server. On the other hand, if one of our data centers is down, we want our name server exclude that IP address which belongs to the crashed data center. So we hope that we can get a more dynamic strategy for our DNS resolve. Is there a solution for that?

Best Answer

It sounds like you want anycast. That is the type of thing that sites like Google use. You have a single address (resolved by DNS) for all your web sites, and you let the Internet routing protocol (BGP) direct the users to the nearest (by the routing protocol) site. If a site goes down, the next closest site is placed in the Internet routing table automatically by BGP.

The classic example is 8.8.8.8 for DNS. It resolves to different locations around the globe, and if one location goes down, then it goes to the next closest location.

The answer is not DNS, it is routing.