All posts

GeoDNS vs Anycast for a Small Site on Two VPS

GeoDNS routes traffic by resolver location using DNS. Anycast for your app servers needs an ASN and BGP. Here's how to choose when you have two VPS in different regions.

Written by NodeRings Inc.

NodeRings Inc. writes these notes. The company runs the marketplace and the agent that stays on the provider’s side of the hypervisor.

You have a web app running on a VM in Amsterdam and another in Dallas. Same code, different data centers. Someone in Germany hits your site. Where does their request land?

GeoDNS changes the IP address the nameserver returns based on where the query came from. Amsterdam for Europe, Dallas for North America. The routing decision happens in DNS before the connection starts.

Anycast assigns the same IP to both locations and lets BGP pick which server accepts the connection based on network proximity. The routing decision happens in the network layer.

The names sound similar. The mechanics are different. GeoDNS is a DNS feature you configure with a provider. Anycast for your own application servers is a BGP project that needs an Autonomous System Number, IP allocations, and cooperation from every host you use.

Two parallel diagrams. GeoDNS shows a nameserver returning different IPs for Amsterdam and Dallas based on the query source. Anycast shows both servers advertising the same IP, with BGP routing the packet to the nearest one.
GeoDNS varies the DNS answer. Anycast varies the network path. Both can send a German visitor to Amsterdam and an American visitor to Dallas.

GeoDNS for a small site

GeoDNS is a hosted DNS feature. You set rules on your zone. Europe gets this IP, North America gets that one. The nameserver looks at where the query came from and answers with the matching address.

The source address on the DNS query is the recursive resolver, not the end user. Someone using 8.8.8.8 appears to be wherever Google's resolver site is. Someone using their ISP's resolver appears to be near that ISP's resolver. EDNS Client Subnet can carry a /24 prefix of the actual client address, but only when the resolver includes it. Cloudflare's 1.1.1.1 does not. Google Public DNS does.

You publish www.example.com as a geo record. Amsterdam is 203.0.113.10. Dallas is 198.51.100.10. A query from Europe gets the Amsterdam address. A query from North America gets Dallas. The TTL on geo records is usually 30 to 60 seconds, short enough that a failover or a routing change spreads in a minute.

The decision is coarse. Country, region, sometimes state or province. A resolver in Frankfurt and a resolver in Athens both match Europe, so both get Amsterdam even when Athens is closer to your Middle East region. The table you configure defines the granularity. Leave a gap in the rules and the query falls through to the default.

NodeRings includes GeoDNS with every account. The hosted zone sits on two anycast nameservers, ans1.nrings.io and ans2.nrings.io. GeoDNS rules apply to A, AAAA, CNAME, NAPTR, and SRV records. You pick continents, countries, or regions from a dropdown. No code, no routing protocol.

The choice happens in DNS. The connection itself is ordinary unicast. Amsterdam's IP is Amsterdam's IP. Dallas's IP is Dallas's. The browser connects to whichever one it was told to use, and that depends on where the DNS query appeared to originate.

Anycast for your own app servers

Anycast means the same IP announced from multiple places, and BGP picks which one accepts the packet. Cloudflare, Google, and other large operators use anycast for their infrastructure. 1.1.1.1 is anycast. 8.8.8.8 is anycast. The same address lives in dozens of cities, and your packet reaches whichever site is closest in the routing table.

That is anycast for the DNS resolver or the CDN. Doing the same thing for your own application running on two VPS is a different problem. You need an Autonomous System Number, a Provider Independent IP allocation, and BGP sessions with upstream networks that allow customer announcements.

An ASN is an identifier for your network. You apply to your Regional Internet Registry. RIPE NCC charges EUR 50 per year after a one-time EUR 2,000 membership setup. ARIN charges USD 500 per year for small assignments. Those fees are from the registries' published fee schedules.

Provider Independent IPv4 space, the kind you can announce yourself, comes in blocks. The smallest routable prefix widely accepted in the global table is a /24, which is 256 addresses. Some networks filter smaller announcements to control routing table growth. IPv6 is more forgiving: a /48 is commonly accepted for PI allocations. You have to justify the allocation to the RIR, pay annual fees, and ensure the addresses remain routed and registered.

Then you configure BGP sessions with your upstream providers. VPS hosts that offer BGP peering let you announce your prefix through their network. Not every host does. The ones that do may charge for the session, limit the number of prefixes you can announce, or require a minimum contract size. Hetzner allows BGP on dedicated servers but not on cloud VPS. Vultr offers BGP on some plans. OVH supports it on certain dedicated and VPS products.

The BGP default or full table post covers the memory and configuration cost of importing routes. Announcing your own prefix is the export side. BIRD or FRR handles the protocol. The session stays up, and your /24 propagates through the internet. Both your Amsterdam VM and your Dallas VM announce the same prefix. BGP's path selection picks the shorter AS path, the lower MED, or whichever tiebreaker applies. A packet from Germany usually reaches Amsterdam because fewer hops separate them.

Failover happens in the routing layer. If Amsterdam goes offline and stops announcing the prefix, BGP withdraws the route. Traffic shifts to Dallas automatically, in seconds to minutes depending on BGP timers and convergence. No DNS change, no cache expiry wait. The same IP is now served from a different location.

The cost and effort are significant. Getting the ASN, the PI space, configuring the sessions, monitoring BGP health, and ensuring both sites announce consistently. For two VPS, the operational weight often exceeds the benefit unless you need that single global IP or sub-minute failover without DNS involvement.

Anycast requirements diagram showing ASN from RIR, /24 IPv4 or /48 IPv6 allocation, BGP sessions to upstream networks, and both VPS announcing the same prefix.
Anycast for your own servers requires an ASN, routable IP space, and BGP sessions with every upstream. VPS providers must support customer announcements.

Anycast DNS nameservers versus anycast for your app

The confusion comes from the term appearing in two contexts. Anycast DNS is the nameserver infrastructure your DNS provider operates. NodeRings' ans1.nrings.io and ans2.nrings.io are anycast. Cloudflare's authoritative nameservers are anycast. Google Public DNS at 8.8.8.8 is anycast.

That means the DNS lookup itself is fast and resilient. The query reaches a nearby nameserver site. But the IP address the nameserver returns for your application is whatever you configured. If you set Dallas as the default, every query that does not match a geo rule gets Dallas, regardless of where the nameserver answering is.

Anycast for your application means your VMs themselves share one IP, announced via BGP from both locations. The DNS answer is the anycast IP. The routing system picks which VM receives the connection. No geographic rules in DNS. The network layer does the steering.

You can combine them. Anycast DNS for fast lookups, and GeoDNS rules to send traffic to the right region. Or anycast DNS with an anycast IP returned in the A record, if you built the BGP setup. The DNS lookup and the application routing are separate layers.

Health checks and failover

GeoDNS alone does not monitor your servers. The nameserver keeps answering Amsterdam for Europe even when the Amsterdam VM is offline. Add health checks. Your DNS provider pings each endpoint. When Amsterdam fails, the nameserver stops returning that IP or falls back to a secondary address.

NodeRings GeoDNS supports health checks per location. Set a URL to test, a check interval, and what to do when it fails. The options are removing the failed location's answer or returning a backup address. The TTL is 30 to 60 seconds, so once a check fails and the nameserver stops returning that IP, most resolvers pick up the change within a minute.

Health checks introduce their own failure modes. The checker can reach Amsterdam, but your users cannot. The checker cannot reach Amsterdam, but the VM is fine and serving other traffic. Geographic diversity in checkers helps. Use monitors from multiple regions. If three out of five checkers in different locations see Amsterdam down, trust that. If only the Dallas checker thinks Amsterdam is down, that might be a peering issue, not a dead server.

Anycast failover is automatic. BGP withdraws the route when the session drops or the VM stops announcing. No separate health check system, no TTL wait. The downside is that partial failures are harder to handle. Amsterdam is up but slow. BGP still advertises it. Traffic keeps arriving. GeoDNS with health checks can remove a degraded server from rotation. Anycast cannot distinguish slow from fast, only reachable from unreachable.

Combining both gives layered resilience. The nameserver itself is anycast, so DNS queries are fast and survive a nameserver site failure. GeoDNS with health checks directs traffic to healthy application servers. The application IPs are unicast, so each location has a distinct address, and DNS failover moves traffic between them.

What to do about data

Two VPS in different regions need to agree on state. A login session created in Amsterdam should work in Dallas. A database write in Dallas should appear in Amsterdam.

The simplest answer is read replicas with a designated write primary. Amsterdam is primary. Dallas is a read-only replica. Writes go to Amsterdam, reads can hit either location. Replication lag is the time between a write landing in Amsterdam and Dallas seeing it. Lag is usually sub-second for nearby regions, longer for cross-continent links.

If Amsterdam fails, you can promote Dallas to primary. That promotion is a manual step or an automated runbook. The replica becomes the primary, starts accepting writes, and your DNS health check routes all traffic there. When Amsterdam recovers, it rejoins as a replica of Dallas, then you either leave Dallas as primary or fail back.

Multi-primary setups let both locations accept writes. Conflict resolution is the new problem. Two users update the same record at the same time, one in Amsterdam and one in Dallas. Last-write-wins is simple but loses data. CRDTs and operational transformation are complex but preserve intent. Databases like CockroachDB and Cassandra handle multi-region writes with tunable consistency. The latency cost is that a write must reach a quorum before it commits, which often means waiting for a cross-region round trip.

For stateless applications, session storage in Redis or Memcached can replicate across regions. Sticky sessions pin a user to one location for the duration of their session. The load balancer or DNS keeps sending them to the same server. When that server fails, they lose their session and log in again. Acceptable for some apps, unacceptable for others.

The data layer is where the two-VPS topology gets expensive. Running two independent servers is straightforward. Making them share state reliably is not. Replication lag, split-brain scenarios, consistency versus availability tradeoffs, and the operational burden of multi-region databases all appear. GeoDNS and anycast solve the routing question. Data synchronization is a separate problem with no simple answer.

DNS caching and resolver behavior

DNS answers are cached by resolvers. Publish a 60-second TTL, and resolvers hold the answer for up to 60 seconds before asking again. Shorten the TTL to 30 seconds for faster propagation. The tradeoff is more queries to your nameservers and slightly higher latency for users whose resolvers cannot serve from cache.

Some public resolvers clamp TTLs. Google Public DNS caches records for up to six hours regardless of the published TTL if it is longer. Cloudflare's 1.1.1.1 caches for up to three hours. A TTL of 86400 (one day) may be served from cache for less time than you specified. A TTL of 60 is usually respected.

The resolver sees itself or a client subnet prefix, not the end user. GeoDNS follows the resolver explains this in detail. Someone on 1.1.1.1 appears to be at the Cloudflare resolver site that handled the query, not their actual location. Someone on a VPN appears to be at the VPN exit. Mobile users on carrier-grade NAT appear to be at the carrier's gateway.

Privacy-focused resolvers may not send EDNS Client Subnet even when they have it. That improves user privacy but makes GeoDNS less accurate. The nameserver sees the resolver, routes based on that, and the user gets an answer that may not match their real location.

Failover timing is TTL plus detection time. The health check detects Amsterdam is down in 10 to 30 seconds depending on check interval and retry logic. The nameserver stops returning Amsterdam. Resolvers holding the old answer keep serving it until their cached TTL expires. For a 60-second TTL, full propagation takes 60 seconds after the nameserver change. For 30 seconds, 30 seconds. Plan for the worst case: last resolver to query before the failure, full TTL remaining.

Timeline showing health check failing at T+0, nameserver updated at T+15 seconds, and resolvers gradually picking up the new answer over the next 60 seconds as their cached entries expire.
Failover timeline with health checks. Detection takes 15 seconds. TTL takes up to 60 seconds to expire across all resolvers. Full failover can take 75 seconds for a 60-second TTL.

Decision table

FactorGeoDNSAnycast (application)
Setup complexityLow. Configure DNS rules, enable health checks.High. Obtain ASN, PI space, configure BGP, coordinate with hosts.
CostIncluded with DNS hosting. NodeRings includes it free.ASN fees (EUR 50–500/year), IP allocation fees, possible hosting upcharges for BGP.
Requires host supportOnly DNS hosting. Any VPS works.Host must allow BGP customer announcements. Many VPS providers do not.
Failover speedTTL-dependent. 30–60 seconds typical.Seconds to minutes, BGP convergence. No DNS cache wait.
Routing granularityCountry, region, state. Coarse, based on resolver location.Network proximity, AS path length. Can be more precise.
IP addressingEach location has its own IP. DNS returns the right one.Both locations share one IP. BGP routes packets.
Stateful connectionsSurvive failover if the user reconnects. DNS gives them a new IP.May break mid-connection if routing shifts, depending on BGP stability.
Data synchronizationRequired. DNS does not help with this.Required. Anycast does not help with this.
Suitable forMost small multi-region deployments. Easy to implement.High-traffic services needing single global IP or sub-minute failover without DNS involvement.

GeoDNS is the right answer for most small sites with two or three VPS in different regions. The setup is simple. The cost is low or included. Failover is fast enough for planned maintenance and most outages. You can add health checks, tune TTLs, and adjust geo rules without touching the application or the network.

Anycast for your application servers makes sense when you need a single global IP, when DNS caching is unacceptable, or when your architecture already includes BGP for other reasons. The operational cost is real. The host compatibility is limited. For two VPS, the effort usually outweighs the benefit unless your use case specifically demands what anycast provides.

Anycast DNS plus unicast app servers

The common pattern is anycast for the DNS infrastructure and unicast IPs for the application. ans1.nrings.io and ans2.nrings.io are anycast. Queries reach a nearby nameserver site. The A record for www.example.com returns 203.0.113.10 for Amsterdam and 198.51.100.10 for Dallas, both unicast. The browser connects to one of those IPs based on what DNS returned.

This gives you fast DNS lookups and resilient nameservers without the complexity of running BGP yourself. The application servers are plain VMs with ordinary IP addresses. GeoDNS on the zone steers traffic by region. Health checks pull failed servers from rotation. Failover happens in DNS after the TTL expires.

The two-VPS scenario fits this pattern well. Buy one VM from a host in Amsterdam and another from a different host in Dallas. Each comes with a static IPv4 address. Set those addresses in a geo record on your hosted DNS zone. Amsterdam gets 203.0.113.10, Dallas gets 198.51.100.10, default is Amsterdam. Configure health checks to test both endpoints. If Amsterdam fails the check, remove it from the answer or fall back to Dallas for European queries.

NodeRings lists Compute Instance plans from independent hosts in over 60 cities. Pick a VM in Amsterdam from one host and a VM in Dallas from another. Both orders go through one NodeRings account. GeoDNS is included, so the routing layer is ready without a separate purchase. Each host operates their own infrastructure. When one host has an incident, the VM with the other host keeps running.

The cost is two VPS bills, whatever the hosts charge for those plans, and DNS hosting. No ASN fees, no PI allocation costs, no BGP session charges. The operational burden is keeping both VMs updated and ensuring data replication works. Routing is handled in DNS with health checks and TTLs.

Common pitfalls

Do not shorten the TTL after the IP already changed. Resolvers holding the old answer are counting down the TTL they cached, which was the previous value. The new TTL applies only to the next fetch. Set the short TTL first, wait out the old TTL fully, then change the IP. For a 3600-second record, wait an hour after lowering the TTL to 60 before switching addresses.

Do not assume the resolver location matches the user location. Privacy resolvers, VPNs, and mobile carrier gateways all move the apparent source away from the actual user. GeoDNS is a best-effort approximation. A user in Berlin on 1.1.1.1 may appear to be at a Cloudflare site in Frankfurt, Amsterdam, or Warsaw depending on anycast routing.

Do not forget the default. Every geo record needs a default answer for queries that match no specific rule. Someone in South America querying a zone with only Europe and North America configured will get the default. The default should be a location that can serve global traffic, or at least traffic from regions you did not explicitly list.

Do not ignore health checks. GeoDNS without health checks keeps returning a dead server's IP until you manually intervene. Add checks to every location you list. Test from multiple vantage points. Set reasonable thresholds. One failed check is not enough to pull a server. Three consecutive failures or failures from multiple checkers are more reliable signals.

Do not expect anycast to solve data consistency. Anycast routes packets. It does not replicate databases or synchronize sessions. The same is true for GeoDNS. Both are routing mechanisms. Data synchronization is a separate layer you have to build.

Recent real-world context

Hetzner's Cloud DNS and reverse DNS API had a fault on November 3, 2026, starting at 08:58 UTC and resolving by 09:55 UTC, about 57 minutes. The issue affected DNS API calls and reverse DNS updates but not the resolution of already-configured zones. Hetzner's status page confirmed the resolution.

Cloudflare Gateway's DNS-over-TLS service over IPv4 had connectivity issues on November 2, 2026, from 22:12 UTC to 00:34 UTC on November 3, lasting about 2 hours and 22 minutes. Affected users experienced connection timeouts and failed DNS resolution over DoT IPv4. DoT over IPv6, DNS-over-HTTPS, and standard DNS over UDP/TCP were unaffected. Cloudflare's status page tracked the incident.

Both incidents were resolved within hours. Neither was a DNS protocol failure. Both were operational issues at specific providers. The lesson for small site operators is that DNS infrastructure can fail, and having DNS hosted separately from your application servers adds a layer of independence. If your DNS provider has an incident, your servers stay up but lookups may fail or be slow. If your server host has an incident, DNS keeps working and can fail over to your other location.

Multi-provider redundancy limits blast radius. The multi-provider baseline post covers that principle in detail. For DNS, using a provider whose infrastructure is separate from your VPS host adds resilience. NodeRings DNS sits on its own anycast network, independent of the Compute Instance hosts. If a VPS host has a network incident, DNS keeps answering and can steer traffic to a VM at a different host.

FAQ

Can I use GeoDNS with only one server?

Yes, but it has limited value. GeoDNS returns the same IP for every query if you only have one location configured. The benefit comes from having servers in multiple regions and routing traffic to the nearest or most appropriate one. With one server, standard DNS is simpler.

Does anycast need a /24 for IPv4?

For global reachability, yes. Many networks filter prefixes smaller than /24 to control routing table size. Announcing a /25 or longer prefix may work in some regions but will not propagate everywhere. IPv6 is more forgiving; a /48 is commonly accepted.

How does GeoDNS handle traffic from an unlisted region?

It returns the default address. Every geo record requires a default. If you configure Europe, North America, and Asia but someone queries from South America, they get the default. Make sure the default location can serve global traffic.

Can I failover between VPS providers with GeoDNS?

Yes. Buy a VM from one host in Amsterdam and another from a different host in Dallas. Set both in a geo record with health checks. When Amsterdam fails, the health check detects it and stops returning that IP. Traffic moves to Dallas. The VMs are independent, so a failure at one provider does not affect the other.

Why not just use a CDN?

A CDN caches static content and may proxy dynamic requests, but your origin servers still run somewhere. If your app needs compute in multiple regions for latency, compliance, or failover, you are running VMs or containers in those regions. GeoDNS or anycast routes traffic to those origins. A CDN can sit in front for caching and DDoS protection, but it does not replace the routing decision between your own servers.