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.

I've read How can I send visitors to the closest server using DNS? post, but there's still some thing, on a practical level that I don't understand.

Say I have two servers. One in NY another in Paris. Both of them have different IP adresses 1.1.1.1, and 1.1.1.2 which were assigned to them by the ISP (or hosting companies)

Which steps do I need to follow so that people in Europe, when they type http://blabla.com:8080 will be translated to the IP of the nearest server with respect to the client?

My final goal is to increase the speed of a TCP-Socket application I've written, by directing users to the nearest server.

UPDATE: Thank guys for the answers. I guess there's a lot more for me to learn :\ before I can actually achieve this.

share|improve this question
1  
What you're looking for is commonly called GeoDNS. Some less commonly used DNS server have their own "unique" names for the technology. –  Chris S Mar 21 '13 at 0:00

3 Answers 3

up vote 4 down vote accepted

Amazon AWS's Route53 is a reliable and well priced global load balancer which utilizes anycast. This is by far the simplest route.

If you want to set up anycast DNS yourself you would need to obtain an IP address and have multiple datacentre locations advertise this IP address in their BGP. Typically people purchase IP address ranges from their relevant authority however I have seen some datacentres that are willing to lease people IP addresses and allow them to advertise them from other datacentres.

The typical set up is that each server has both its own unique IP address and an anycast address. For example:

London has 1.1.1.1 and 3.3.3.3 NY has 1.1.1.2 and 3.3.3.3

A DNS server runs on each server listening on 3.3.3.3 and issues the unique IP for that server.

Remember that anycast is at the IP layer and thus below transport technologies such as TCP. As such, any transport that tracks state (e.g. TCP) is not suitable for anycast. DNS is (usually) UDP and is used as a method of distributing clients to their closest server to make a TCP connection.

share|improve this answer

You need to use a service that will base the DNS response on their location. Either outsourced to a DNS company or built yourself. I think the technology you are really looking for is Global Server Load Balancing (GSLB), not AnyCast.

Most DNS companies offer this as a service.

PowerDNS seems to be a popular solution for DIY GSLB: http://www.powerdns.com/auth.html

share|improve this answer

If you have only two servers, one in North America, and another in Europe, then you could decide to run both your TCP-socket app and your DNS yourself.

With DNS, you could use something like the Split-Horizon DNS approach, which could either be achieved through integrated functionality of your DNS server, or through a firewall that would redirect different IP-address ranges to different running instances of your server (you could run two different copies of the server on your local machine, which will listen at different local IP-addresses).

Having only one NA and one EU host, you could probably get expected results in ≈90% of cases by replying to DNS requests from RIPE and AfriNIC IP-addresses with an A record of your host in Europe, and requests from the IP-addresses from the /8 blocks administered by ARIN, APNIC, LACNIC and the rest of the /8 address space with an A record of your server in North America. This will have some wrong results in certain situations (some /8 blocks are shared between Europe and North America, some address space is anycast etc), but the worst that would happen is a little bit of extra latency to the affected party, so, it shouldn't be a big deal.

(And, yes, there should be a way to make these things easier, but, so far, it seems like there is none.)

share|improve this answer

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.