Ask HN: How can the google.com domain point to different IPs based on location?
Don't "A" DNS records point to a single IP address? * A big company (for example, Google) has DNS POP servers all over the place. * The authoritative upstream DNS server(s) can give region-specific DNS replies depending on the GeoIP of who's asking. This makes it possible to direct traffic to geographically proximate IP addresses, and spread these results to an ISPs particularly DNS server for a given area. * Multiple IPs can come back from a single DNS A record lookup. It's then up to the client to select which IP they want to connect to. * BGP routing may be used to route traffic destined for the same IP address (e.g. 1.1.1.1) to different physical locations. Further reading: https://networkengineering.stackexchange.com/questions/48125... Additionally who "owns" an IP is public knowledge. So Google could serve different addresses based on from who owns the address the request comes form. Specially if they are peering(exchanging traffic on equal basis) with ISPs in certain locations, they could give addresses that are closest to this point of peering. Namely some room with big routers and many service providers. How can one set up region-specific DNS replies? is it exclusive to large companies? Many open source DNS servers support region specific responses based upon group or edns subnet info. The venerable bind which is available on almost all systems supports it. There are some such as gdnsd which are purpose specific for this use case. In addition many managed DNS providers support geo based DNS replies. All you need is a properly configured authoritative domain DNS server with the appropriate logic to inspect client GeoIP details and spit out the appropriate result. Anyone who wants to bother creating, setting up, and operating/ / maintaining such a system can do it. If you host your DNS via route53 (that's the DNS product provided by AWS) you can do this trivially. Other DNS providers such as Dyn, EasyDNS, and similar will let you do it. Google "geo dns" for examples and to get started. The concept you want to understand is Global Server Load Balancing (GSLB). You can get a taste by perusing through Route53's DNS routing policies. https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ro... As for A records... A records are an indirect reference, specifically a domain name is an indirect reference for an IP address. A DNS server is responsible for providing an IP address when asked to de-reference a domain name when it receives an A record request. You are probably used to seeing a DNS server that uses a simple text file basically as a database, but there is no reason the DNS server couldn't pull the sender IP out of the UDP packet it receives and then query a mysql server with a table of {sender_ip, domain_to_look_up, a_record_response} to choose the right response. Said more simply: A DNS server can do anything it likes so long as it sends back a well formed A record response. Sometimes if you want to block a website, you can do DNS blackholing. That means you resolve a domain you don't like to 127.0.0.1. If someone were to request evil.com, you could make it so people who use your DNS server think it's at 127.0.0.1 while everyone else who doesn't use your webserver sees it at it's proper internet wide ip address.