Difference between IP Fragmentation and TCP Segmentation

     IP fragmentation occurs at Layer 3 (IP) and that TCP segmentation occurs at Layer 4 (TCP). IP Fragmentation takes place when packets that are larger than the Maximum Transmission Unit (MTU) of an interface  are sent out this interface. These packets will have to be either fragmented, or discarded when they are sent out the interface. If the Don’t Fragment (DF) bit is not set in the IP header of the packet, the packet will be fragmented. If the DF bit is set in the IP header of the packet, the packet is dropped and an ICMP error message indicating the next-hop MTU value will be returned to the sender. All the fragments of an IP packet carry the same Ident in the IP  header, this allows the final receiver to reassemble the fragments into the original IP packet. Please see Resolve IP Fragmentation, MTU, MSS, and PMTUD Issues with GRE and IPSEC for more information.   TCP Segmentation takes place when when an application on an end station is sending data. The application data is broken into what TCP considers the best-sized chunks to send. This unit of data passed from TCP to IP is called a segment. TCP segments are sent in IP datagrams. These IP datagrams can then become IP Fragments as they pass through the network and encounter lower MTU links than they can fit through.

   TCP will first segment this data into TCP segments (based on TCP MSS value) and will add the TCP header and pass this TCP segment to IP. Then IP will add an IP header to send the packet to the remote end host. If the IP packet with the TCP segment is larger than the IP MTU on an outgoing interface on the path between the TCP hosts then IP will fragment the the IP/TCP packet in order to fit. These IP packet fragments will be reassembled on the remote host by the IP layer and the complete TCP segment (that was originally sent) will be handed to the TCP layer. The TCP layer has no idea that IP had fragmented the packet during transit. NAT can deal with IP fragments but it does not deal with TCP Segments.


Popular posts from this blog

MATLAB code for Circular Convolution using Matrix method

Positive number pipe in angular 2+