TCP UDP packets are too large to cause fragmentation

We all know that MTU is a limitation of the network in the link layer on the data frame. Still taking Ethernet as an example, the MTU is 1500 bytes. An IP datagram is transmitted in Ethernet. If its length is greater than the MTU value, it will be fragmented and transmitted, so that the length of each datagram is less than the MTU. Fragmented IP datagrams do not necessarily arrive in order, but the information in the IP header allows these datagram fragments to be assembled in order. Fragmentation and reassembly of IP datagrams is done at the network layer.

     MSS (Maximum Segment Size)

    MSS is a concept in TCP (in the options field of the header). MSS is the maximum data segment that can be transmitted by a TCP packet each time. When the length of a TCP segment is greater than MSS, segment transmission is performed. The TCP protocol usually negotiates the MSS value of both parties when establishing a connection. Each party has an MSS option used to announce the MSS option it expects to receive (the MSS option only appears in the SYN segment, that is, the first two times of the TCP three-way handshake). The value of MSS is generally the MTU value minus the size of two headers (the size of the IP packet header 20Bytes and the header 20Bytes of the TCP data segment need to be subtracted). Therefore, if the link layer Ethernet is used, the value of MSS is often 1460. The standard MTU on the Internet (the smallest MTU, when the link layer network is x2.5) is 576, so if it is not set, the default value of MSS is 536 bytes. In many cases, the value of MSS is best taken in multiples of 512. Segmentation and reassembly of TCP segments is done at the transport layer.

    It is clear that there is a problem here. The reason for TCP segmentation is MSS, and the reason for IP segmentation is MTU. Since there is always MSS<=MTU, it is obvious that each segment of TCP segment after segmentation is added with The length after the IP header cannot exceed the MTU, so there is no need for IP fragmentation at the network layer. Therefore, IP fragmentation rarely occurs in TCP segments.

    Let's look at UDP datagrams. Since UDP datagrams do not fragment themselves, when the length exceeds the MTU, IP fragmentation will be performed at the network layer. Likewise, ICMP (in the network layer) also suffers from IP fragmentation.

Summary: UDP does not segment, it is divided by IP. TCP will be segmented, of course, without IP!

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324779912&siteId=291194637