Anurag, At 2016-06-04 02:52:46 +0530 Anurag Bhatia <me@anuragbhatia.com> wrote:
Someone asked me question on why google uses cname for their services anyways? I mean I get it that for Google Apps customers it makes sense to have mail.domain.com pointed to a cname rather then A record to a host which may die.
But why for their own services? Like e.g "mail.google.com" is cname to googlemail.l.google.com. and googlemail.l.google.com. eventually returns A record. This adds up one extra step in resolution and I wonder why Google does it this way? What advantage they get ? or What advantage they miss if they simply return record which I am getting for googlemail.l.google.com. directly as A record for mail.google.com ?
I guess that this is a CDN trick, to give different answers based on the resolver's originating IP address (or client-subnet EDNS0 information, if available). In Beijing I get this: $ host mail.google.com mail.google.com is an alias for googlemail.l.google.com. googlemail.l.google.com is an alias for mail-china.l.google.com. mail-china.l.google.com has address 74.125.203.19 mail-china.l.google.com has address 74.125.203.18 mail-china.l.google.com has address 74.125.203.17 mail-china.l.google.com has address 74.125.203.83 mail-china.l.google.com has IPv6 address 2404:6800:4005:802::2005 The CNAME chain can send users to servers closer to where they are, and allows operators to redirect traffic to less-busy servers or even take sites offline easily. Cheers, -- Shane