Lokasa Mawati
Lokasa Mawati

Reputation: 481

If Anycast means I see only 1 IP address for a domain name distributed over many geographic regions

I am wondering about Anycast. From the diagram it looks like you can map a single IP address to multiple IP addresses. This means you can have an interface of 1 IP address, but then under the hood redirect it to region a or region b, geographically distributed.

Not knowing much about IP addresses, I try this:

$ ping google.com
PING google.com (216.58.194.206) ....
....

To me that says that google.com is at 216.58.194.206 IP address. I have a few questions about this:

  1. If that IP address will ever change.
  2. If this is a region-specific IP address.
  3. Or if this is probably (under the hood) redirecting to a region-specific IP address, if that's a thing.

I would like to do something like this:

mywebsite.com -> 123.123.123.123 -> 200.200.200.200 (region 1)
                                 -> 200.200.200.201 (region 2)
                                 -> 200.200.200.202 (region 3)
                                 ...
                                 -> 200.... (region n)

Where only 123.123.123.123 can connect to the region specific IP addresses, and when you do ping mywebsite.com you always see 123.123.123.123 no matter where you are in the world.

Wondering if that's how it works with Anycast, or if not then how it does work. I am trying to architect a system where there are many regions for reliability and latency optimization (closeness to request source), while at the same time having it so there is only 1 domain for all regions. That is, there is not zh.mywebsite.com for china, uk.mywebsite.com for UK, etc, it is all just mywebsite.com and under the hood it redirects to the appropriate region. Also, the reason for having the intermediate 123.123.123.123 IP is so that there is a constant interface to the regions, so when you do ping mywebsite.com you will always see 123.123.123.123, not 200.200.200.200 for region 1, etc. Or perhaps there is no way around this, which would be good to know: that the IP will always resolve to the region IP.

Actually now that I try ping google.com again I get a different IP address, so there's at least 2 for some reason.

Upvotes: 1

Views: 645

Answers (1)

John Hanley
John Hanley

Reputation: 81396

Suggestion: Ask a single question and not a broad question that covers the design of the global Internet. Ask about one cloud provider and not several. In my answer below I am limiting the amount of details that I am providing otherwise my answer would be the size of a book.

I am wondering about Anycast. From the diagram it looks like you can map a single IP address to multiple IP addresses. This means you can have an interface of 1 IP address, but then under the hood redirect it to region a or region b, geographically distributed.

In Google Cloud, a global IP address is used to route the customer to the closest Google Edge location, where the traffic is then sent via the Google internal network to the final destination. The final destination depends on the type of resource. Let's assume Google Compute Engine or AWS EC2.

AWS offers AWS Global Accelerator for Anycast IP addresses which provides similar technologies.

Not knowing much about IP addresses, I try this: ping google.com

For enterprise systems, it is common practice to have many compute servers provide services for a single DNS endpoint (google.com). The servers can be load balanced by the DNS server using multiple A records. The load balancing strategy can be round robin, least busy, geo-location based, etc. I do not know Google's internet design for the DNS name google.com, but the design possibilities are large. The domain can also be served by a load balancer that hides the backend implementation. Using a load balancer is a typical design but older legacy designs use DNS servers.

If that IP address will ever change.

The answer is Yes, No and Maybe. The answer depends on the internal design of the systems. Fault tolerant, elastic designs do not require a fixed static IP address. The goal of the DNS server to translate a DNS name (google.com) into an IP address (216.58.194.206) at that point in time that the translation is required.

If this is a region-specific IP address. Or if this is probably (under the hood) redirecting to a region-specific IP address, if that's a thing.

It depends on how Google designed its systems internally. Google offers both global and region IP addresses.

Where only 123.123.123.123 can connect to the region specific IP addresses, and when you do ping mywebsite.com you always see 123.123.123.123 no matter where you are in the world.

You are imposing a design criteria that is not necessary. The DNS server can provide the IP address translation for the domain name. Your question indicates an lack of understanding how public and private IP addressing is managed, how addresses are translated and routed and the interplay with DNS servers, load balancers and auto-scaling. Hopefully my answers will help you know what to learn about.

I am trying to architect a system where there are many regions for reliability and latency optimization (closeness to request source), while at the same time having it so there is only 1 domain for all regions.

Having one domain name (example.com) with servers located in Europe, US, South America and Asia is very easy to achieve with any cloud provider. Anycast is not required. You just need either a global load balancer (Google) or regional load balancers (AWS), and a modern DNS server, which both Google and AWS provide.

You have created a question covering both AWS and Google Cloud. The two providers are very similar at a high level but very different in implementation details. Pick one, learn how DNS, Load Balancers, and Auto-scaling works for either AWS or Google. Note: you can achieve your design goal mixing both AWS and Google Cloud, but why add that layer of complexity. The more complex your design, the more fragile it becomes. This means more management layers by humans or machines for logging, monitoring, metrics and alerting.

Upvotes: 2

Related Questions