Single IP address assigned to multiple servers

dns-hostingdomain-name-systemrouting

How could one IP be assigned for multiple Domain Name Servers?

For example, Google has a IPv4 8.8.8.8 with many DNS having the same address.
When I make a domain lookup request to their DNS, based on my geo-location, the request will be rerouted to a Google DNS's location that is the nearest to mine.

Best Answer

The relevant technology is called anycast routing.
Anycast essentially makes clever use of the inherent behavior of the BGP routing protocol. A network prefix which contains the relevant address(es) is advertised from multiple places. The other BGP routers out there on the Internet are used to seeing multiple paths to the same destination and selecting the shortest (in terms of AS hops) path. In this case, however, it just so happens that the multiple paths to this "one" destination actually happen to end in different places on the network.

Worth noting, it's not operating based on geographic proximity but rather proximity in terms of number of autonomous systems (entities, such as ISPs, doing BGP routing) on the network path to the network. Often this somewhat correlates to geographic proximity, but not necessarily.

Also worth noting, when the availability of routes in the BGP table will inevitably change over time it is entirely possible that what is the "closest" anycast destination changes, possibly mid-session. This happening will obviously break any protocol which maintains state (including anything based on TCP) when it happens. DNS is an example of a protocol that is particularly well-suited (primarily using UDP, just answering the one thing it received in the current query), but anything that doesn't have very long-lived connections can work well enough (CDNs are known to do HTTP/HTTPS, which is obviously a little bit of a gamble).

Related Topic