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

When you type "google.com" into your web browser and press Enter, your computer sends a request to the server where the website is hosted. The server then sends back the content of the website to your browser, which displays it for you to view.

As simple as that was, there is a lot that happens in between.

And to understand this you have to understand the fundamentals of networking (TCP/IP), how DNS works and what goes on on the servers.

In this article, I will try to provide a simple overview of the steps and processes and expand on areas that need a bit more explanation.

DNS

when we type google.com on your browser, your browser first checks its cache to check if it has the IP address cached as that is the only way computers can identify themselves over the internet, if the IP is not found in its cache it checks the cache of the operating system and if it is not still fond there it then forwards a request/query to the DNS (domain name system) resolver to find the IP address for that domain name.

Note that the resolver is usually provided by your ISP

The DNS resolver first checks its cache to check if it has the IP for that domain name, if not it goes to the root servers which know where to locate the TLD (top-level domain) servers ".COM" server for our case. The address of the TLD is then saved by the resolver which then goes to the .com servers, the TLD server checks its cache if it has the IP and if not it provides the name servers for that domain name which was known through the domain name registrar, name servers are usually the last bus stop, you can think of them as libraries that store the mapping of the domain name to IP addresses. The resolver then gets the IP address and returns it to the browser. Note that the IP address is then cached for a while by the resolver, the TLD server, the browser and the operating system.

NETWORK PROTOCOL

communication between devices on the internet happens over networks that have been set in place, we have an Internet protocol suite called TCP/IP which determines how networks are established. Before the adoption of TCP/IP, there were so many protocols used by different sub-networks and it was almost impossible to communicate with other networks not using your protocol, so the TCP/IP protocol was used to enforce integration. TCP/IP is a framework for organizing a set of communication protocols used in the internet and similar computer network according to the functional criteria. TCP/IP is a protocol suite that contains TCP (transmission control protocol), UDP (user datagram protocol) and IP (internet protocol). The Internet protocol suite provides end-to-end data communication specifying how data should be packetized, addressed, transmitted, routed, and received. This functionality is organized into four abstraction layers, which classify all related protocols according to each protocol's scope of networking. The layers are

  • Application layer

  • Transport layer

  • Internet layer

  • link layer

link-layer being the lowest and application-layer the highest layer.

So when you requested the web page from your browser and the request passes through the application layer through HTTP or HTTPS and passes the layers between until it gets to the actual movements of the signals through the network cables or over WiFi and then packetized in your router and sent through the internet and become reassembled when it gets to its destination address. which happens in the link layer, the network for communication is established through the TCP/IP model.

For more information on TCP/IP click here.

LOAD-BALANCER

having gotten the IP address for the domain name, the browser makes an HTTPS request to the web server for that server (google.com server), most times the request is first intercepted by a load balancer which then terminates the SSL encryption if configured to do so and then relays the request to the main server which contains the web server. This process of determining the server to relay the request to can be determined through several algorithms, examples of such algorithms are round robin, weighted, and Least Connection.

Assuming that appropriate firewalls were put in place to monitor the incoming and outgoing network traffic on the google servers, the request has to pass through them before it gets to the web server.

WEB-SERVER

the web server which depending on its configuration and what was requested either responds with a static page or sends the request to the application server which may or may not need to interact with the database to retrieve information and then responds to the client (you on your computer) with what you requested or an error code which represents the type of error that was encountered if any.

below is a web infrastructure schema of what was explained above. this is in no way accurate or in line with what google.com uses, but the diagram is just to aid your understanding.

conclusion

In conclusion, when you type google.com in your browser and press Enter, several things happen. Your browser sends a request to a Domain Name System (DNS) server to resolve the domain name into an IP address. The DNS server responds with the IP address of a Google server, and your browser establishes a connection to the server using the IP address. The server sends the HTML, CSS, and JavaScript code for the Google homepage to your browser, which then renders the page on your device. This process allows you to access the Google website and search the internet using the powerful search engine provided by Google.

this is my first blog, i will do better in the next one, i am open to corrections.