GeoDNS
DNS that returns different IP addresses based on the geographic location of the requester. Routes users to the nearest data center for lower latency.
What is GeoDNS?
In short
GeoDNS is a DNS configuration that answers the same domain name with different IP addresses depending on where the request comes from, so a user in Frankfurt gets the IP of a European server while a user in Tokyo gets an Asian one. It is used to send each visitor to the closest or most appropriate data center, cutting latency and spreading load across regions.
What GeoDNS actually is
When you type a domain into a browser, your computer asks a DNS resolver for the IP address behind that name. Ordinary DNS gives every caller the same answer. GeoDNS changes the answer based on who is asking, specifically based on their approximate physical location.
The authoritative DNS server looks at the source IP of the incoming query, maps it to a country or region, and returns a record from a pool that matches that region. So example.com might resolve to 203.0.113.10 (a server in Virginia) for a request from the United States, and to 198.51.100.20 (a server in Singapore) for a request from Indonesia.
GeoDNS is a routing decision made at name-resolution time, before any actual connection to your servers happens. It does not move data or proxy traffic. It only hands out a different address so the user connects directly to a server that is close to them.
How it works under the hood
The key input is the client IP seen by the authoritative server. In most cases that is the IP of the user's recursive resolver (for example their ISP or a public resolver like 8.8.8.8), not the user's own device. The DNS server matches that IP against a geolocation database such as MaxMind GeoIP2 to guess a location, then picks the closest configured pool of records.
Because the resolver IP is used, accuracy depends on the user querying a nearby resolver. If someone in India uses a resolver hosted in the US, GeoDNS may route them to a US server. The EDNS Client Subnet extension (ECS, RFC 7871) fixes much of this by letting the resolver forward a truncated version of the real client subnet, so the authoritative server sees roughly where the user is.
TTL matters a lot. A short TTL such as 30 to 60 seconds lets you reroute users quickly during a regional outage, but it increases DNS query volume. A long TTL means clients cache the regional IP for hours and ignore later geo decisions until the cache expires.
Many GeoDNS systems also fold in health checks. If the closest region is failing its health check, the resolver returns the next-best region instead, which turns GeoDNS into a basic global failover mechanism rather than pure proximity routing.
When to use it and the trade-offs
Reach for GeoDNS when you run servers in more than one region and want each user to hit the nearest one for lower latency, or when you need data residency, so European users land on EU infrastructure for GDPR reasons. It is also a cheap way to do active-active multi-region failover at the DNS layer.
The big limitation is granularity. Geolocation by resolver IP is approximate, you cannot route on real client load, and DNS caching means routing decisions are sticky for at least one TTL. GeoDNS also cannot react within a single connection, since the decision is already made by the time the TCP handshake starts.
For latency-sensitive global traffic, Anycast often beats or complements GeoDNS. With Anycast the same IP is announced from many locations and the network routes the user to the nearest one, with no dependence on geolocation databases or DNS caching. A common production pattern is GeoDNS for coarse regional steering plus Anycast inside each region for fine-grained edge selection.
A concrete example
Suppose you run a SaaS app with clusters in us-east-1 (Virginia), eu-west-1 (Ireland), and ap-south-1 (Mumbai). You configure GeoDNS on app.example.com with three pools, one per region, and attach an HTTP health check to each.
A user in Pune queries DNS. Their ISP resolver, located in India, hits your authoritative DNS. The geo lookup maps the resolver IP to India, so the server returns the Mumbai cluster IP. The user connects to a server roughly 150 km away instead of one across an ocean, and round-trip latency drops from around 250 ms to under 30 ms.
Now the Mumbai cluster fails its health check. On the next DNS query the resolver returns the Ireland IP instead. Indian users see slower responses for a short window but the app stays up. Once Mumbai recovers and passes health checks again, GeoDNS resumes sending Indian traffic there.
Where it is used in production
Amazon Route 53
Offers geolocation and latency-based routing policies that return region-specific records, the managed GeoDNS most AWS multi-region apps use.
Cloudflare
Combines GeoDNS-style geo steering with Anycast so DNS answers and the network path both point users to the nearest edge.
NS1 (IBM)
A dedicated managed DNS provider whose Filter Chain engine does geo, latency, and real-time traffic steering for large content and SaaS platforms.
Netflix
Steers viewers toward nearby Open Connect appliances and regional endpoints using DNS-based geo and latency routing on top of AWS.
Frequently asked questions
- What is the difference between GeoDNS and Anycast?
- GeoDNS hands out different IP addresses based on the requester's location, so the routing decision happens at DNS resolution time and depends on geolocation data plus DNS caching. Anycast announces a single IP from many locations and lets the network route the user to the nearest one at the BGP layer, with no DNS-level geo logic. They are often used together: GeoDNS for coarse region selection and Anycast for edge selection within a region.
- Why does GeoDNS sometimes send a user to the wrong region?
- In classic DNS the authoritative server only sees the IP of the user's recursive resolver, not the user's device. If someone uses a distant public resolver, GeoDNS geolocates that resolver instead of the user. The EDNS Client Subnet extension (RFC 7871) reduces this by passing a truncated client subnet to the authoritative server, giving a much better location estimate.
- Does GeoDNS provide load balancing?
- Only at a coarse, regional level. It splits traffic by geography and, with health checks, can fail over to another region, but it cannot see real-time server load or balance within a region. For per-request balancing you still need a load balancer (such as an Application Load Balancer or NGINX) behind the regional IP that GeoDNS returns.
- What TTL should I use for GeoDNS records?
- A short TTL of 30 to 60 seconds lets you reroute users quickly during a regional outage at the cost of more DNS queries. A longer TTL of several minutes or more reduces query load but makes routing decisions sticky, since clients cache the regional IP and ignore newer geo or health changes until the cache expires.
- Is GeoDNS enough for global failover on its own?
- It helps but is not bulletproof. Combined with health checks it will stop handing out the IP of a failed region, but clients that already cached that IP keep using it until the TTL expires, and connection-level failures are not detected by DNS. For fast, reliable failover most teams pair GeoDNS with short TTLs, Anycast, and client-side retry logic.
Learn GeoDNS hands-on
This page explains the idea. The full lesson lets you step through the ring as servers join and leave, read the implementation, and check yourself with a quiz. It is one of 760+ lessons in the System Design Masterclass, from your first API call to distributed consensus. Eleven Foundation lessons are free, no signup. Lifetime access is ₹499 in India or $7.99 worldwide, one payment, no subscription.
See also
Related glossary terms you might want to look up next.
DNS
The phonebook of the internet. Translates human-readable domain names (google.com) into IP addresses that computers understand.
Global Load Balancer
A load balancer that routes users to the nearest data center or region based on geography, latency, or health. DNS-based (Route 53, Cloudflare) or anycast-based.
CDN
A network of servers distributed globally that caches content close to users. Netflix uses CDNs to stream video from servers near you, not from one central location.
Proxy
An intermediary server that sits between the client and the destination server. Forward proxies act on behalf of clients; reverse proxies act on behalf of servers.
Reverse Proxy
A server that sits in front of your backend servers and forwards client requests to them. Handles SSL termination, caching, and load balancing.
DNS Record Types
Different types of DNS records map domains to resources: A records point to IPs, CNAME aliases one domain to another, MX routes email, TXT stores verification data.