6

I just curiously wanted to know about the question regarding L4, L3 Data Chunks, IP Fragmentation :

  1. Data chunking happened at Layer 4(Transport, TCP), and
  2. Fragmentation at Layer 3(Network, ipv4)

According to Wikipedia, data chunk happens at L4: "Transmission Control Protocol accepts data from a data stream, divides it into chunks, and adds a TCP header creating a TCP segment" Source: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure

Also, there is fragmentation happening at Layer 3(Network).. Now there are two questions here-

  1. I believe data chunking happening at L4 because of the MTU size limit exceeded, then why there is another process called Fragmentation?

  2. If data chunking is happening or not, there will be a sequence number for each TCP segment.. how can a TCP segment associated with each packet fragment in L3 for successful reassembly at receiver side?

Please see picture(for second query)- enter image description here

Any help is greatly appreciated..

2 Answers2

8

The transport-layer protocol needs to make sure that data can be properly packetized. If it lacks support for that (like UDP), the application layer needs to take care of it.

IP fragmentation in the network layer is an mechanism primarily intended to enable forwarding when the MTU within the path shrinks. It is not intended as the primary sizing mechanism due to its limitations:

  • IP fragmentation works on the IP packet level and is therefore limited to 64 KB packets. A transport-layer protocol can support arbitrary stream lengths.
  • Fragmentation is very inefficient when packets are lost - the network layer (IP) doesn't even try to recover lost fragments or even packets, and since the whole packet doesn't make it through the stack when a single fragment is lost, the transport-layer protocol or the application would need to retransmit the entire packet.
  • The transport layer can do quite a few things more than simple data chunking, like sub-addressing (ports), stream control, congestion control, error recovery, packet/segment reordering.

Reassembly of fragmented packets happens at the network layer, before data is passed up the stack to the transport-layer protocol.

Not all transport-layer protocols support data segmentation (e.g. UDP doesn't), so datagrams too large for the MTU need to be fragmented or sent with smaller data chunks by the application.

Initially, fragmentation was the strategy to deal with varying MTU sizes across a large network but due to increased router load and being generally inefficient, that has largely been replaced by path MTU discovery. For IPv6, routers do not support fragmentation at all, they drop oversized packets. If fragmentation is required the sending host needs to handle that.

Zac67
  • 90,111
  • 4
  • 75
  • 141
4

TCP segmentation process is based on MSS (maximum segment size, that is based on the MTU (usually) and can be different for both sides of communication). It is segmentation (right name for this process), not fragmentation. "If data chunking is happening or not, there will be a sequence number for each TCP segment" is not right sentence - if you see sequence number, it is segmentation process. It begins anytime you start send data via TCP sessions, and it does not matter, either application use data portion more than MSS or not - you can see sequence and it is TCP segments.

MSS is based on MTU right now just to avoid IP fragmentation. So idea is put one TCP segment to one IP packet.

IP fragmentation is not based on TCP at all, it based on MTU of the interface and can be used for TCP/UDP/ICMP whatever. It is another path of OSI model. Full IP packet is recreated based on the IP flags (more fragments, offset value).

You can read a lot about this in detail, for example, here https://www.cisco.com/c/en/us/support/docs/ip/generic-routing-encapsulation-gre/25885-pmtud-ipfrag.html