When a packet on a network exceeds the MTU value in size then in order to get the packet delivered to the destination, it is broken down into smaller chunks or fragmented and delivered to the destination where the fragmented packets are again reassembled to form the original packet.
The source device must send some additional information in the IP header for the destination device to be able to reassemble the fragments of a packet to get the original packet.
Few of the fields in the IP header used for this purpose are –
Total Length Field: After fragmenting, this field indicates the length of each fragment, not the length of the overall message. Normally, the fragment size is selected to match the MTU value in bytes after subtracting the IP header size of 20 bytes or more.
Identification Number: All the fragments of the same packet have the same identification number to allow the receiving device to identify all the fragments of a single packet.
Flags: It is a 3-bit field which is used to identify the fragments.
- bit 0: Reserved; must be zero
- bit 1: Don’t Fragment (DF)
- bit 2: More Fragments (MF)
The MF bit is set for all the fragments except the last one for which it is zero.
The DF bit is set to disable the fragmentation and in this case, if the packet size is greater than MTU value then it is dropped.
Fragmentation Offset: This field helps the destination device to place the fragments in the proper sequence to build the original packet.
The fragmentation offset value for the first fragment is always 0. The field is 13 bits wide, so the offset can be from 0 to 8191. Fragments are specified in units of 8 bytes, which is why fragment length must be a multiple of 8.
Let us take an example to understand the calculation for fragmentation offset:
Suppose we have a packet for 1700 bytes to be transmitted over an MTU of 1500 bytes.
First fragment:
- Fragment Offset: 0
- ID : 1
- MF = 1
- DF = 0
- Total Length : 1500 bytes
- Data Payload = 1500 -20 bytes IP header = 1480
Second Fragment:
- Fragment Offset: 185 (Calculation – Previous Offset + Previous Fragment Data transmitted/8)
- ID : 1
- MF = 0
- DF = 0
- Total Length: 240 bytes
- Data Payload = 240 bytes – 20 byes of IP header
Below is the diagram illustrating the fragmentation of packets as stated in the above computation –
ABOUT THE AUTHOR
I am here to share my knowledge and experience in the field of networking with the goal being – “The more you share, the more you learn.”
I am a biotechnologist by qualification and a Network Enthusiast by interest. I developed interest in networking being in the company of a passionate Network Professional, my husband.
I am a strong believer of the fact that “learning is a constant process of discovering yourself.”
– Rashmi Bhardwaj (Author/Editor)