Sunday, June 13, 2010

Data Transmission over Internet

There are lots of queries from my juniors regarding “How data packets are transmitted over intenet”. I tried my best to solve their queries. I hope there are more juniors who want to ask the same question but not able to contact me. So here it goes…

When you type any URL(Universal Resource Locator ) in addressbar of your browser like (www.techpandit.in into your browser’s URL area) and hit Return, the browser tells the Transport Layer that it wants to establish a connection and passes the URL down. The first thing happen is- Browser runs the DNS client that made the first packet (User Datagram Protocol packet) to go down the stack with a destination port of 53(DNS port) to the ip-address of your Domain Name Server (Packet gets the ip-address of DNS server by your’s ip settings) to request the IP address of www.techpandit.in

As soon as the IP address for the website is returned, the transport layer initiates a Transfer Control Protocol (TCP) connection to the server on which website is hosted by sending a Synchronization (SYN) packet. The SYN packet proposed following values for the connection: Maximum Transmittable Unit, Maximum Segment Size and Receive Window. The server on which website is hosted will either accept or reject this SYN packet by transmitting a Synchronization Acknowledgement (SYN-ACK). If accepted, your PC will send one more SYN packet and the web page will start loading. If rejected, the SYN-ACK your computer receives will have the edited values for these fields listed. If your computer accepts the changes it will send another SYN packet and the transfer will start. If your computer cannot accept the new values another SYN packet will be transmitted by your computer to the web server with more changes – and the process continues until both sides agree, or the connection times out or is cancelled.

In this way you have a connection to the website and data is transmitting. Packets are being sent from the web server to your computer and the page is loading on your web browser. This process is looks simple but let’s see about what’s really happen behind it.

Whenever a data packet leaves computer it must have 6 fields: Source and Destination ip-address, Source and Destination mac-address and Source and Destination port no. As the data-packet moves down from the Application Layer each layer “wraps” the data in it. The Transport Layer adds a TCP or UDP header with a source and destination port number. The Internet Layer adds source and destination ip-address . The Network Layer adds source and destination mac-address (Medium Access Control). If you don’t have the mac-address of destination the destination mac-address fields contains the mac-address of yours default gateway. The packet is then transmitted over the network to another node on the same network in which you computer lies. It’s sent to the default gateway that you have configured in ip-settings if destination is not in the same network. You see, MAC addresses are used to communicate with devices that are on the same network. IP addresses are used to communicate with devices on different networks. So, the source and destination MAC address is constantly changing as a packet is routed across a network (or the Internet). The source and destination IP address remains the same.

On the receiving computer, each layer “unwraps” the package. The Network layer “unwraps” the Network Layer “packaging” by removing the source and destination MAC and then passes the packet to Internet Layer. The Internet Layer “unwraps” the Internet Layer packaging by removing the IP header (source and destination IP) and then passes the packet to the Transport Layer. The Transport layer removes the Transport Layer header and passes the data to the correct application determined by the destination port number.

No comments:

Post a Comment