Wednesday, 19 September 2012

How Data Packet routed in the Internet


Most of us use goggle.com to search on Internet but you ever thought that how our browser makes contact with the correct server? To understand this, you must understand the role of Domain Name Server (DNS).

In computer network each computer identify by its IP. There are two types of IP Addresses: Public and Private. Our computer connected to the router will uses private IP while server uses Public IP. The first thing is that the domain name must be convert into the corresponding IP. To do this a request is sent to the default gateway to contact the DNS server. The router has a configured DNS server IP to which this request is sent. DNS is used to convert domain name into IP address. When request is received by DNS, it checks whether it has the required information. If not then the DNS server forwards this request to the other DNS server. In this way, the domain name to IP address conversion is done and is sent back. Once the IP is known then a HTTP GET request to that particular IP is made and things move ahead. 
  • Once the IP address is known an HTTP GET request is made at the application layer. Then this request is forwarded to the Transport layer.
  • Packet is formed at Transport layer using one of two protocols: TCP and UDP. When packet is created then it is send to IP Layer. IP layer add information related to source IP destination IP, fragmentation information and Tome To Leave (TTL).
  • Now this packet enters into DATA LINK layer. DATA LINK layer add MAC address to it and moves on Physical layer. So stream of 0’s and 1’s is sent out of your NIC onto the physical media.

When the packet reaches to that router, then the router performs the following action :

  •  It decreases the TTL value and recomputes the check-sum of the packet.
  • The router searches in its routing table for destination IP address. If found then router forward the packet to the relevant host.

Now, at the destination:

  • The packet is first received at the physical layer which issues an interrupt query request to the CPU to indicate that some data is arrived and is waiting to be processed.
  • Now, this data sent to DATA LINK layer where it’s check for MAC address is checked for to verify destination.
  • If the above verification is passed then this packet is send to IP layer where some IP address checks and check-sum verifications are done and then it is passed to transport layer protocol.
  • When this is done then information is passed on application listening on port.
        In this way the request reaches the Google web server.

In this way data packet travels from source to destination on the Internet.