What happens when you type google.com in your browser and press Enter

What happens when you type google.com in your browser and press Enter

·

3 min read

When you type google.com into your browser, a series a events happens which takes a few fractions of a second. These events can be subdivided into three categories:

  1. DNS lookup

  2. Establishment of a connection with a web server

  3. Response from web server to client

Let’s take a closer look at what each step entails:

DNS lookup

Human beings are not good at using numbers to name something while digital computers rely on numbers to process information. This conflict between humans and computers necessitated the creation of the Domain Name System (DNS).

Every computer has a IP address to identify and web resources hosted on these computers also have an IP address that corresponds to a certain domain name. DNS provides a way to match human input in the form of a domain name to an IP Address which a computer understands.

First, your computer will check whether if it has stored a DNS record of the domain of interest locally in its cache and hosts file. If there is no matching record, the search proceeds to your internet service provider's cache. If the search was not successful in both your computer / ISP's cache, the DNS request is submitted to DNS servers

DNS Resolver

The DNS resolver or recursive resolver acts as the primary intermediary between a computer and other DNS servers. Its purpose is to forward a request to other domain name system servers and then send it back once fulfilled. When the DNS resolver receives a request, it will first search its cache to find a matching IP address for the domain name. If no match is found in its cache, the DNS resolver will send the request to the next DNS server which is the root nameserver.

Root Nameserver

The root nameserver is at the top of the DNS hierarchy and it gives directions to where the ip address coresponding to a particular domain name can be found. Once the root nameserver receives a request it will guide the requesting computer to the correct TLD nameserver.

TLD Nameserver

The TLD nameserver is a DNS server function is storing and managing information about domain names that use a specific top-level domain (TLD) eg. .com, .org e.t.c. If the request is not found at this point, the requesting computer is directed to foward the request to the last level which is the Authoritative Nameserver.

Authoritative Nameserver

The authoritative DNS nameserver is the final authority in the DNS resolution process. It stores all information related to the domain name you want to visit, including its IP address. The Authoriitative Nameserver will obtain the IP address and send it back to your computer, directing you to the site.

Connection & Response from web server to client

Request serving Upon receiving the web request, the web server would then process the request and generate a response, which would typically include the HTML, CSS, and JavaScript files that make up the web page. which would forwarded to the browser requesting the information. The browser would then use the HTML, CSS, and JavaScript files to render the web page to the client which is the home page of google.