Reassembly Algorithm

Recreating the original datagram from the fragments is called reassembly

Reassembly is always done at the receiver because:

  • Each fragment are independent being connection, hence can take a different path to reach the destination. Fragments of the same datagram can take different path.
  • If the intermediate router has to do reassembly, then it has to maintain some state of the fragments coming. But IP is a connection and stateless protocol.

Reassembly Algorithm:

  • Receiver has to first determine whether the datagram is fragmented or not by using Offset and More fragment fields.
  • Collect all the fragment with same identification field
  • Collect the first fragment by seeing the offset value of 0.
  • Divide the length of first fragment by 8, it gives the offset of second fragment.
  • Divide the length of first and second fragment together by 8, this gives 3 fragment offset.
  • Continue this process till MF becomes 0 , means this is the last fragment.
untitled image

There is a reassemble timer which starts as soon as the first fragment is received and if all the fragments is not received before that timer elapsed, all the segment collected so far are discarded.

Categories: Networking

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: