What Happens When You Type https://www.google.com
Tags: devops, alx, dns, web
Published: 2024-05-11 20:44:10

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82z4c7sr9xbw19mqa3g1.png)

In our modern digital era, internet browsing has seamlessly woven itself into the fabric of our daily lives. When we enter a URL like “https://www.google.com” and press Enter, a series of intricate steps unfold behind the scenes to bring forth the desired web page. Let’s delve deeper into the fascinating journey that occurs when you input “https://www.google.com” into your web browser.

## Domain Name System (DNS)
The domain name "www.google.com" must first be translated into an IP address. The process of converting is known as DNS resolution. In order to determine whether the IP address for the domain name is already saved in the local DNS cache on your computer or router, the DNS resolution procedure starts there. Your computer or router needs to send a DNS query to a DNS server if the IP address cannot be discovered in the local DNS cache. Usually, your Internet service provider's DNS server receives this DNS query. The DNS server then looks for the IP address associated with the domain name in its own cache. The DNS server will recursively search other DNS servers until it locates one that can supply the IP address for "www.google.com" if it does not already have it in its cache.

**Why is DNS necessary?**
It is challenging for humans to interact directly with IP addresses, which are the actual numerical addresses of websites on the internet. Imagine having to memorize all the phone numbers in your contacts and recall them mentally every time you want to call someone. It would be difficult, and most likely, you’d forget many numbers and lose track of who belongs to which number. That’s why we store phone numbers in our devices and assign names to each contact.

Now, consider DNS (Domain Name System). It simplifies our interaction with the internet and various websites. Instead of memorizing IP addresses for servers hosting those websites, all you need is the website’s URL. DNS plays a crucial role, especially when multiple servers host the same website. In such cases, you don’t need to know the specific IPs of those servers. Just enter the website’s URL in your browser, and DNS will fetch the corresponding IPs for you.

Let’s explore the steps that DNS performs to translate domain names into the IPs of the desired websites.

**Client Query:** When a user enters a domain name (e.g., “google.com”) into their web browser, the DNS resolver receives the query, but before that your browser checks it's own caches.

**Local DNS Cache Check (Browser):** The browser first checks the local DNS cache within the user’s web browser. If the IP address for the domain name is already stored there (from previous visits), the browser can skip further steps and directly use the cached IP address.

**Local DNS Cache Check (Operating System):** Additionally, the operating system (OS) maintains its own DNS cache. It checks this OS-level cache as well. If the IP address is found here, it can be used without querying external DNS servers.
When the information is not in your computer’s local cache, it will query another server. Recursive DNS servers have their own local cache, much like your computer.

**Contact the Recursive DNS Servers:** Another name for recursive DNS servers is DNS resolvers (usually provided by your Internet Service Provider or a public DNS service). It's possible that a common domain name is already in its cache. If the domain is cached, the query will end here, and the website will display to the user.

**Root Nameserver:** If the IP address isn’t cached in the DNS resolvers, the resolver sends a request to the root nameserver, seeking information about the top-level domain (TLD) associated with the given domain name.

**TLD Server:** The root server responds by providing the IP address of a TLD server responsible for resolving “.com” domains.

**Authoritative Nameserver:** The TLD server directs the resolver to the authoritative nameserver for the specific domain (“google.com”). This final nameserver holds the complete record for the domain.

**Recursive Process:** The recursive server retrieves and stores the IP address from the authoritative nameserver and send it to the web browser.

![DNS Queries](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i47uy2kscnsgvoh1zwe7.png)

The DNS process now ends when the browser receives the IP address linked to the domain it is attempting to access, and a new series of instructions known as the TCP/IP protocol commences.

## TCP/IP

The browser establishes the TCP connection with the server.
It establishes a connection with the computer after locating its IP address, which contains the information about your website. Network communication occurs through adherence to internet protocol. The most popular protocol is TCP/IP. Two people establish a connection through a procedure known as the "TCP 3-way handshake." Let's quickly review the procedure:

1. A client computer transmits a SYN message, which indicates whether or not the second computer is accepting new connections.
2. A second computer then sends an acknowledgement message together with a SYN message if it is available for a new connection.
3. The first computer then receives the message and responds with an ACK message.

![Three way handshake process](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2q1g0m7twlwtg34zntzy.png)

TCP/IP is a set of protocols designed in layers for computer systems linked to the internet. The following is a list of the layers:

**1- Application Layer**
Direct communication between apps, such as your browser, takes place at the first layer, called the Application layer. This layer contains protocols like SMTP (which is used to check email) and HTTP (which is used to visit websites). Data from the browser is received by the Application layer, which then uses a port to deliver it to the second layer.

**2- Transport Layer**
The second layer is called the Transport Layer, and it contains both TCP and another method known as UDP. Any protocol interacting with this layer at the application layer uses a different port so that TCP can determine where the data is coming from. After receiving the data, TCP splits it up into smaller pieces called segments, which are also called packets, so that each can go as far as possible in the least amount of time. To ensure proper reassembling of the segments upon reaching their destination, TCP appends a header to each segment that includes error checking information and instructions on what order to reassemble the segments into. This allows the computer to ascertain whether the segments arrived without any issues. The segments are then put onto the third layer after this is complete.

**3- Internet Layer**
The segments are received by the third layer, the Internet layer, which adds the origin and destination IP addresses to each segment so that the segments are aware of their origin and destination no matter which way they choose to travel. The segments are then transmitted to the upper layer.

**4- Data Link Layer**
It is responsible for the node-to-node delivery of data. Its major role is to ensure error-free transmission of information.it is responsible of Physical Addressing: It provides physical addressing for network components. The unique address assigned to each network interface card (NIC) is called the Media Access Control (MAC) address. it is also responsible of Frame Creation, The data link layer takes data packets from the network layer (above it) and converts them into frames. These frames include the necessary control information for reliable communication.

**5- Physical Layer**
Physical Layer deals with the actual transmission of bits over the physical medium, including signal encoding, modulation, and synchronization. Together, with Data Link Layer, these layers ensure reliable communication within a network .


![TCP/IP model layers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ouv9nyz32ezukzkmbhd4.png)
Common TCP/IP protocols include:

1. The Hypertext Transfer Protocol (HTTP) is used for communication between a web server and a web browser.
2. HTTP Secure (the http with an s, or https, as in our URL) controls secure communication between a web server and a web browser.
3. Computer-to-computer file transfer is managed by the File Transfer Protocol.

At that point, the browser asks the server to provide the page data via HTTPS in order to communicate with it. The data is then returned to the browser by the server.

## Firewall

Firewalls are a type of network security instrument. observe both inbound and outbound network traffic before determining whether to permit or prohibit a specific kind of communication based on pre-established standards. When you have a firewall configured on your computer, the chat and any pertinent packets exchanged with https://www.google.com are monitored until the connection is terminated. This greatly reduces the risk of malware attacks, which is especially advantageous for facilitating secure online communication.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub33sll218wi367dwgs4.png)

## HTTPS/SSL

HTTPS (Hypertext Transfer Protocol Secure) is a secure version of HTTP (Hypertext Transfer Protocol). It ensures encrypted communication between a web server and a web browser. When you visit a website using HTTPS, your data is protected during transmission. Here’s how it works:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sd9exwis2w94dj43ucnv.jpeg)

**Encryption:** HTTPS uses an encryption protocol called Transport Layer Security (TLS) (formerly known as Secure Sockets Layer or SSL). This protocol encrypts data to increase security during transfer.
**Public Key Infrastructure (PKI):** TLS employs an asymmetric key system:
      _Private Key_: Controlled by the website owner, the private key remains confidential on the web server. It’s used to decrypt information encrypted by the public key.
      _Public Key_: Available to anyone who wants to interact securely with the server. Data encrypted with the public key can only be decrypted by the private key.
**Secure Communication:**
Your browser asks the server for the public key when you visit an HTTPS website. The public key is sent by the server. After generating a symmetric session key and encrypting it using the public key of the server, your browser sends it back. Using its private key, the server decrypts the session key. For safe communication, the browser and server now share the same session key.
**Why HTTPS Matters:**
HTTPS protects sensitive data transmission (such as when logging into an email account or bank account) and identifies websites as secure (look for the padlock icon in the URL bar). It also keeps information from being easily accessed by network eavesdroppers.


![SSL certifcation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i1o8n88zioqd3bx4nq60.png)

## Load Balancer
Each and every day, we all conduct Google searches. If https://www.google.com is hosted on a single server, your browser may take longer to load the site's content—that is, if it loads at all. This is due to the fact that millions of users frequently attempt to access the same website simultaneously. Multiple high-capacity servers, each with a distinct IP address, are provided by companies such as Google to manage the traffic to https://www.google.com. The traffic from different parts of the world needs to be distributed across the available servers even in cases when there are numerous of them. A load balancer can help with this.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0yp46eqt6gezsb9wnm6.png)

Here, load-balancers refer to software or hardware components that distribute server requests from clients to numerous servers inside the same network. Using many scheduling techniques in tandem within a single software package is known as load balancing. Located between the servers and the clients, load balancers are physical devices that are also known as specialty switches or routers.

## WEB Server & Application Server
A web server is a type of computer system that responds to user requests via the World Wide Web by processing them and returning data via various protocols, including Hypertext Transfer Protocol (HTTP). Its main duty is to display material on websites by processing, storing, and sending web pages to users.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ocu6hr80zzy3l2n409k.png)
An application server can offer dynamic content, carry out business logic for enterprise applications, and integrate several distinct protocols for client response, in contrast to a web server, which was intended to primarily deliver static content.

For instance, your computer will receive the requested page from the server when you type "https://www.google.com" into your browser.

## DATABASE
Databases use an organized format to store data, making frequent upkeep and fast searches easier. A database can be used to store, manage, and retrieve any type of information. A methodical approach has been taken in gathering this data.

Data management is made feasible by the database management system, which stores user data, updates location and time zone information, manages session data, and more. It makes it possible to keep data structured and in a structurally solid and aesthetically beautiful manner. The database system is the means by which the application server and database server communicate in order to store, retrieve, edit, and remove data from the database system. The database will be accessed in accordance with the request, taking into account our IP address, since we are currently gaining access to the Google site. Consequently, the application server will create and send us an HTML page that is more suited to our requirements.

## Conclusion
These are just a few general overviews of how the internet functions, but maybe this helps anyone who are wondering about the following: "What happens if I push Enter after typing https://www.google.com into the browser?" I want to sincerely thank you for visiting and reading, and I hope this was helpful.