Thursday, 7 June 2012

IP Fragmentation - Explained !!!



Fragmentation Example 



Station A needs to send a payload size of 1400 bytes (octets) to station B across the networks as shown above. Data needs to be fragmented because the payload is too big to fit the smallest MTU size (620 bytes) in one of the network.

Show the Data Length, More Flag, and Fragment Offset values in each of the resulting fragments.

Solutions:

  1. Determine that actual data size for transmission.
    The dada needs to be transmitted is 1400 octets

We will assume that the size of the IP header is 20 octets. 
 

So each frame can carry an IP datagram with a 20-octet header and 600 data octets. Note the 600 is divisible by 8. If not, we need to take the nearest multiple of 8 in the Data part of the MTU frame. The reason is that the fragment offset must be a multiple of 8-byte.

  1. The number of fragments needed to transmit 1400 data octets:
Define
n = number of fragments
d = total number of data to be transmitted at the network layer = IP data = 1400
m = maximum data size for the network = 600


So we need 3 fragments, 2 fragments of 600 octets and the last one is (1400 – 2 x 600) = 200 octets.

Please note that the fragment offset is in 8-byte unit.


Fragment Number
Data Length
Fragment Offset
(
8-byte)
More Flag
1
600
0
1
2
600
600/8 = 75
1
3
200
75+75 = 150
0

Both Fragment Offset and More Flag are used for reassembly of fragments. The More Flag is one except the last fragment. The More Flag for the last fragment is 0 to indicate no more fragments.


References : 

RFC 791 & RFC 815 discusses about IP datagrams, fragmentation and reassembly.