Wednesday 16 January 2013

Fragmentation of a datagram

We know that while transmitting a packet from source to destination, it may travel through different networks. The data link protocol used in different network may vary, and different data link protocols use different packet size. Data link protocol also specifies the maximum size of the packet or datagram that can carry. The maximum size is some times called Maximum transfer Unit (MTU). The maximum size supported by an Ethernet is 1500 bytes and X.25’s maximum packet size is 576 bytes. Each router in the network de-capsulate the received packet and process the data, after that it encapsulates into another frame before transmitting to next hop. Simply, format and size of the received datagram depends on the physical characteristics of the network through which the datagram just traveled and the size and format of the sent datagram depends on the network physical characteristics of the network through which the packet need to travel for reaching to next hop or router.
Fragmentation is the process of dividing a datagram to ensure that the packet can travel through the next network, it is depends upon the physical characteristics of the network through which the packet need to travel.
If a datagram fragmented then each fragment can pass through different routes. The reassembly of the fragments into its original form is the responsibility of the final destination node. We use three fields in the datagram header to deal with fragmentation.
You must read the previous post on IPv4 datagram in-order to understand the following fields. 

Identification

The sender of the packets adds a unique number to each packet. This is done by using a counter at the sender, while creating a packet the current counter value is copy to the identification field of the datagram
and then increment the counter by one. The identification number and the source IP address of the datagram uniquely identify the datagram as it leaves from the source system. The identification field is copied to each fragment of the packet that means each fragment of a single datagram has same identification number. At the receiving, end the fragments with same identification number grouped into one unit.

Flags

This 3-bits field used to determine whether, possible more fragmentation on the current fragment and whether it is the last fragment or more fragments are present after this. The first bit among the three bits are not used or reserved. The second bit is either 1 or 0, if it is 1 then no more fragmentation can possible on this datagram. If the second bit is zero (0) then we can fragment if necessary.  One (1) in the third bit field represent this is not the last fragment and 0 in the third field represents it is the last fragment.

Flag in fragmentation
Flag in fragmentation

    

Fragmentation offset

This field used to represent the relative position of this fragment with respect to the original datagram sent from the source node. The following figure illustrates how to find out the value for fragmentation offset. Here we consider a packet with initial size 16000 bytes and firstly it divide into three fragments of size 8000, 4000 and 4000 respectively. The second fragment is again fragment into two.

Calculate offset of a datagram
Calculate offset of a datagram

The identification fields’ value is same for all the fragments of a datagram. The final destination node follow the below rules to reassemble the fragments to original datagram;
The first fragment has offset value always zero. Then use the length of the first fragment to determine the offset of the second fragment (divide the first fragment’s length by 8 to get second fragment offset). To get the third fragment offset, first add the length of the first and second fragment length together and divide the result with 8. This process is continuing until the last fragment has reach.

Question from UGC NET December 2012
9. If a packet arrive with an M-bit value is '1' and a fragmentation offset value '0', then it is ---- fragment.
   (A) First
   (B) Middle
   (C) Last
   (D) All of the above

Next :  Chanel Capacity  (25-01-2013)
Previous : Datagram 

No comments:

Post a Comment