What really happens when we type google.com into the address bar? For starters, google.com is just a name. Your computer must obtain an address in order to locate, connect to, and request data from the site. Let’s manually replicate what this entire process looks like.
Obtain IP address from url
To find the IP ddress, your computer looks up “google.com” in an internet-wide directory called a “DNS”. Here, it can see the IP address associated with that name. This process is what the IP, or Internet Protocol, is responsible for.
Kloth.net is a DNS lookup tool we will use.
When we look up google.com, using the localhost server and query type “A”, we receive the IP address 184.108.40.206. As we can see, this is the non-authoritative answer. It is non-authoritative because we are using the localhost DNS nameserver, which contains cached info from other nameservers. The authoritative answer will come directly from the DNS nameserver at google.com.
But first we need to find the name of the google.com nameserver.
To do this, we change our query type to “NS”, and we will see 4 nameservers listed. Now we can pick any one of those 4 nameservers as our new server instead of localhost, using query type “A” again. The resulting IP address is the authoritative answer, because it comes directly from one of the google.com nameservers: 220.127.116.11.
Note that the DNS server’s address always has #53 at the end. This is because DNS servers listen on port 53 for queries from DNS clients.
Connect to the host
Now that we have an authoritative IP address, we can proceed with connecting to the host at 18.104.22.168.
We will use Telnet, a protocol built on TCP/IP that allows computers to communicate with each other and files to be sent/received. The TCP, or Transmission Control Protocol, is responsible for data delivery of packets, routing application protocols to the correct destination.
The structure of a Telnet command is
telnet+ IP address + port number.
Because we are using HTTP, we know to use port 80, which is the port number designated for HTTP. There is a different one for HTTPS: 443.
So in the command line, we type
telnet 22.214.171.124 80. Now we are connected.
Make HTTP request for file
The HTTP, or Hypertext Transfer Protocol, usually takes place over TCP/IP, and allows for communication between host and client.
Now that we are connected, we can proceed with HTTP requests, which is how the client requests files from the server. In our case, we will make an HTTP request to view the homepage of google.com.
In the HTTP protocol, the “GET” command is how we request files. So when we type
GET /, the resulting output is the root folder of google.com, also known as the google.com homepage, or simply google.com.
Take a look at the header of the response we received from google. You will see
HTTP/1.0 200 OK. This 200 response code means that the request has succeeded.
We can also telnet directly to google.com, like
telnet google.com 80, since google.com is likely in the cache of your localhost. Note that it tries
126.96.36.199. This makes me wonder why the IP address telnet looked up is different than what we found earlier. Regardless, the IP addresses lead to the same location.
In addition to these steps, while loading a web page, the browser will parse the HTML and look for resources required to complete the web page, like images and scripts. For each item, the browser will make additional HTTP requests to the server.