0

TCP IP Layers and role in webpage request

Welcome readers. Today we are going to discuss about TCP IP layers and what is the role of these layers in web communication. As we all know that we are in world of internet where every information is part of a very big network. We connect to the network and get the desired information from the source to our devices. TCP IP Layers is part of this whole system. Pretty simple process, isn’t it?

Not exactly. However this seems a simple process but it involves too many technologies, layers and combination of hardware. All these work hand in hand to get you delivered with the information you requested.

Let’s first discuss about how website works.

Web Request Life Cycle

In general below is the flow of any web request.

tcp ip layers and role

  1. User types any address in any browser e.g. www.google.com.
  2. Browser sends request to web server.
  3. Web server creates a new process or assign a thread to process this request.
  4. Web server processes the request and generate the response.
  5. Client gets this response.
  6. Now assigned process or thread is free to receive another requests.
  7. Browser displays the response to user.

This is very basic and top view of the process. But aim of this article is to get you aware with the complete flow of information from source to destination.

OSI Layers vs TCP IP Layers

As we have studied about OSI model which has seven layers. These layers are a complete picture of information flow from top level application to low level cables and signals. Below is the OSI layers.

tcp ip layers and role

You can get more details about OSI model here.

http://www.omnisecu.com/tcpip/osi-model.php

However OSI layers are the base of communication but we don’t use this in real world. OSI model is now just a conceptual model to represent separation of layers and functionalities.

We use the TCP/IP Network Model.  OSI layers are merged in TCP IP layers to create a real world communication model. Following is the mapping of OSI layers with TCP IP layers. 

tcp ip layers and role

From above image we can see that how TCP IP layers are refactored version of OSI layers. It merges few layers of OSI into one layer.

Web request and communication

Now let’s come to the communication flow when we request any webpage.

  • Whenever we type any address i.e. google.com in address bar of any browser, processing gets started. Web browser uses Hypertext Transfer Protocol which is an Application layer protocol.
  • Web browser is programmed in such a way that it extracts IP address of the URL you typed using Domain Name System. DNS is also an Application layer protocol. Once DNS look up is done, browser gets IP address of the google primary server.

dns look up

  • Browser now creates a HTTP packet having request details of google.com.
  • The packet is still in our PC. Now browser connects to the lower layer. Every layer have some interface exposed to above and below layers so that these layers can communicate with each other. So the browser gives the HTTP packet to TCP process (Transmission Control Protocol) which is a Transport Layer protocol.
  • TCP’s main function is to split request into multiple packets. These packets are having packet level identity. TCP controls the reliability of message transmissions through handshakes and acknowledgements. TCP creates a pipe between source and destinations so that system can transfer the data. This pipe called as TCP connection.
  • TCP now put own info on top of these packets. System needs this information to maintain the session/connection.
  • The packet is still in our PC. TCP now handovers these packets to next layer through its provided interface i.e. IP process (Internet Protocol) which is an Internet Layer protocol.
  • The main job of IP layer is addressing and routing. This layer puts source, destination IP addresses and routing information in packets so that packets can be route to the correct location. 
  • IP now put its own info on top of TCP packet. System needs this information for routing in the internet.
  • The packet is still in our PC. IP now handovers the packet to network access/network interface layer. Network access layer defines the protocols and hardware required to deliver data across some physical network. Most of the PC users Ethernet.
  • Our PC now encapsulates Ethernet header and Ethernet trailer with the IP packet, creates an Ethernet frame. Ethernet contains MAC address which is used to send frame locally (Local area network
  • Now your PC physically transmits the bits of this Ethernet frame, using electricity signals over the Ethernet cabling.
  • The packet is now out of our PC. It reaches Google’s web server. Note that all packets are not transmitted using same route. These may go through different routes using the most efficient routing.
  • The web server physically receives the electrical signal over a cable, and re-creates the same bits by interpreting the meaning of the electrical signals.
  • Web server now de-encapsulates the IP packets from the Ethernet frame by removing and discarding the Ethernet header and trailer. After this it hands over to Internet protocol layer.
  • Internet protocol layer then verifies source and destination info and then hands over to TCP layer.
  • TCP layer reads the TCP information. It merges all incoming packets and create HTTP packet which source created originally.
  • This layer provide acknowledgement about each packet so that if any packet is missing or corrupt then source can transmit that again. This confirms the reliability of the message.
  • And finally TCP hands it over to HTTP process which understands the HTTP get request.

tcp ip layers and role

  • Web server now process the request through running web process hence generates the response. 
  • Server sends this response in the same way to the intended device which initiated the request.
  • Finally information reaches to device’s application layer then browser displays this as web page. 

So this is how all the layers are in action when we request a webpage.