Search code examples
google-mapsdnsip-addressgoogle-docsdig

Why different Google services has the same IP address?


I'm starting to study DNS system and the way it works. I'm using dig on ubuntu to solve some domain names and I'm trying with different Google services. Even if services are totally different, it happened that I received the same IP address.

$ dig docs.google.com

;; ANSWER SECTION:
docs.google.com.    264 IN  A   216.58.198.14

and

$ dig drive.google.com

;; ANSWER SECTION:
docs.google.com.    264 IN  A   216.58.198.14

In other occasions, I received the same address trying to solve yet more services like mail.google.com or maps.google.com.

Can anybody help me and explain me the way it works? Does this have anything to do with time?

Thank you a lot.


Solution

  • First of all docs.google.com and drive.google.com are different domains.

    And yes different domains can have the same ip address. This is called a Shared Web Hosting.

    In name-based virtual hosting, also called shared IP hosting, the virtual hosts serve multiple hostnames on a single machine with a single IP address. This is possible because when a web browser requests a resource from a web server using HTTP/1.1 it includes the requested hostname as part of the request. The server uses this information to determine which web site to show the user. When you register/purchase your domain name on a particular "registrars name server", your DNS settings are kept on their server, and in most cases point your domain to the Name Server of your hosting provider. This Name Server is where the IP number (currently associated with your domain name) resides.