Segmentation vs Fragmentation

What is the difference between Segmentation and Fragmentation? This is one of the questions that was once asked to me in an interview. So I thought of sharing this with you. Here is something in brief, that i am aware of.

A]  Segmentation :

  1. Segmentation takes place at Layer 4 i.e Transport Layer.
  2. This occurs during the original creation of the packets when a set of data doesn’t fit within the “Maximum Segment Size (MSS)”. The data is then chopped into multiple segments referred as “Protocol Data Unit”. This process is known as segmentation.
  3. Something about MSS : MSS is set as a TCP option initially in the TCP SYN packet during the 3 way handshake. This value cannot be changed after the connection is established. Default Maximum TCP segment size = 576 Bytes.
  4. In order to avoid Fragmentation (which we will see further) , note  that                              (Number of bytes in the data segment + the header) < MTU

B]  Fragmentation : 

  1. Fragmentation takes place at Layer 3 i.e Network Layer.
  2. This occurs during the original creation of frames where the network layer must send packets down to the Data Link Layer for transmission. Some Data Link Layer technologies have limits on the length of the data that can be sent. Inshort some links have smaller MTU (Maximum Transmission Unit).
  3. If the packet that is to be sent is larger than the MTU then it is chopped. This process is known as fragmentation. These pieces are reassembled once they arrive at the network layer of the destination.
  4. As mentioned earlier Fragmentation can be avoided if,                                                                 (Number of bytes in the data segment + the header) < MTU
  5. Something about MTU : MTU parameters usually appear in association with a communications interface (NIC, Serial port etc.). (Wikipedia) The maximum transmission unit (MTU) of a communication protocol of a layer is the size (in bytes) of the largest protocol data unit that a layer can pass onwards.