When we learn the TCP/IP protocol, we know that if the TCP message segment is very long, it will be fragmented at the time of sending, and when it is accepted, the same IP datagram will occur when the length exceeds a certain value, and the Shard will be re-reorganized at the receiving end.
Let's look at two concepts that are closely related to TCP segment segmentation and IP datagram fragmentation.
MTU (maximum transmission unit)
The MTU is already mentioned, which is a limitation of the network in the link layer to the data frame, still taking Ethernet as an example, the MTU is 1500 bytes. An IP datagram is transmitted over Ethernet, and if its length is greater than the MTU value, it is necessary to make a shard transfer so that the length of each piece of datagram is less than the MTU. The IP datagram for a shard transfer does not necessarily arrive in order, but the information in the IP header allows these datagrams to be assembled sequentially. The fragmentation and reassembly of IP datagrams is done in the network layer.
MSS (maximum segment size)
MSS is a concept in TCP (the first option field). MSS is the maximum data segment that TCP packets can transmit each time, and the length of TCP segment is larger than MSS, it is necessary to segment transmission. The TCP protocol usually negotiates the MSS values of both sides when establishing the connection, each of which has the MSS option to advertise its desired reception (MSS option only appears in the SYN segment, which is the first two times the TCP three handshake). MSS value is generally the MTU value minus two header size (need to subtract the size of the IP packet header 20Bytes and TCP data Segment header 20Bytes), so if the link layer Ethernet, MSS value is often 1460. While the standard MTU on the Internet (the smallest MTU, the link layer network is x2.5) is 576, then if not set, the default value of MSS is 536 bytes. Many times, the value of MSS is best to take a multiple of 512. The segmentation and recombination of TCP message segments is done at the transport level.
There is a problem here, it is natural to understand that the reason for the TCP segment is the MTU, because there is always mss<=mtu, it is obvious that each segment of TCP packet after the MSS,IP and the length of the IP header cannot exceed the MTU, Therefore, there is no need for IP fragmentation at the network level. Therefore, the TCP packet segment rarely occurs with IP shards.
Again, UDP datagrams, because UDP datagrams do not fragment themselves, so when the length exceeds the MTU, the network layer will be IP shards. Similarly, ICMP (in the network layer) also has an IP shard condition.
Summary: UDP does not fragment, it is divided by IP. TCP will fragment, of course, no IP to divide!
In addition, after the IP datagram is fragmented, only the first piece with the UDP header or ICMP header, the remaining shards only the IP header, after the end of the endpoint based on the information in the IP header and re-network layer reorganization. TCP headers are in each segment of the packet, and the TCP header is reorganized at the transport layer after the endpoint. Once the IP datagram is fragmented, it will only be reorganized after it arrives at the destination, not to other network protocols, and the next station will be reorganized.
Finally, for the datagram of the IP shard, the entire datagram is re-transmitted even if only one piece of data is lost (since there is a retransmission, the transport layer uses a retransmission protocol, such as the TCP protocol). This is because the IP layer itself does not have a time-out retransmission mechanism------is responsible for timeouts and retransmissions by higher-level (such as TCP). When a segment from a TCP packet (in a piece of IP datagram) is lost, TCP will re-send the entire TCP segment after timeout, which corresponds to an IP datagram (there may be multiple IP shards), and there is no way to retransmit only one data shard in the datagram.
[To] "Network protocol" TCP segment with UDP/IP shard (MTU Max transmission Unit, MSS maximum segment size)