How Geo DNS Works and Why It Makes Your Site Feel Faster
When you visit a major website from Tokyo and your friend visits the same site from New York and you both get fast response times, that is often geo DNS at work. Geographic DNS routing is one of the fundamental techniques behind globally fast websites, and understanding how it works helps you make better decisions about your own infrastructure.
The Core Problem: Speed of Light
Data travels through fibre optic cables at roughly two-thirds the speed of light. That sounds fast until you do the maths. A round trip between Tokyo and New York is approximately 20,000 kilometres. At the speed of light that takes about 67 milliseconds. Through actual fibre routing, with real switching overhead and routing hops, a typical latency between those two cities is 150 to 200 milliseconds.
For a modern web page that might make dozens of requests before it finishes loading, each of those requests adds latency. If all your servers are in one data centre and your users are distributed globally, users on the other side of the world experience a consistently degraded experience compared to users who are nearby.
What Geo DNS Does
Geo DNS, also called geographic DNS routing or latency-based routing, returns different DNS answers to queries depending on the geographic location of the person or resolver making the query. Instead of every query for app.example.com resolving to the same IP address, a user in London might get a European server IP while a user in Singapore gets an Asia-Pacific server IP.
The routing decision is made at the authoritative DNS server level. When a query comes in, the authoritative server looks up the source IP address of the recursive resolver that sent the query, determines its approximate geographic location, and returns the IP address of the nearest or best-performing server for that region.
How the Geolocation Works
The authoritative DNS server doing the routing maintains a geolocation database that maps IP address ranges to countries, regions, and sometimes cities. These databases are maintained by companies like MaxMind and are updated regularly as IP allocation changes.
The accuracy is generally good at the country level and reasonable at the regional level, but it is not perfect. IP address blocks do not always map cleanly to geographic locations. A CDN or ISP might aggregate traffic from a wide area through a single exit point, making all that traffic appear to come from the same location. Some users use VPNs that make them appear to be in a different country entirely.
EDNS Client Subnet
The traditional geo DNS approach has a limitation: it sees only the IP address of the recursive resolver, not the actual end user. If many users in different countries all use the same large public resolver like 8.8.8.8 (Google) or 1.1.1.1 (Cloudflare), the authoritative server sees those requests as coming from the location of the resolver, not the actual user.
EDNS Client Subnet (ECS) addresses this by optionally including a portion of the end user IP address in the DNS query. The resolver passes along a prefix of the user IP to the authoritative server, which can then make a more accurate routing decision based on where the actual user is, not just where the resolver is. Major public resolvers and CDN authoritative servers generally support ECS.
Geo DNS vs Anycast
Geo DNS and anycast are both techniques for routing users to nearby infrastructure, but they work differently. With anycast, the same IP address is announced from multiple locations on the internet simultaneously. Routing protocols naturally direct traffic to the topologically nearest announcement. The user and the DNS infrastructure do not need to know anything special.
Geo DNS works at the application layer by returning different IP addresses. It requires the authoritative DNS server to make routing decisions based on location data. Geo DNS offers more control over routing logic but has the limitation that DNS caching means changes take time to propagate and users are not automatically rerouted in real time if a server goes down.
Practical Implementation
Most major DNS providers offer geographic routing as a feature. Route 53 from AWS calls it Geolocation Routing. Cloudflare offers load balancing with geographic steering. NS1, Dyn, and others offer similar capabilities. You define routing policies: users from Europe go to this IP, users from Asia go to that IP, and everyone else gets a default.
Combined with health checks that automatically remove unhealthy endpoints from rotation, geo DNS becomes a powerful tool for both performance and availability. If your European server goes down, the health check fails, and traffic automatically diverts to another region while the issue is resolved.