The relationship between MSS and MTU
Tu:maximum transmission Unit, the maximum transmission unit, is specified by hardware, such as an Ethernet MTU of 1500 bytes.
Mss:maximum segment size, the maximum section size, is the maximum data fragment size for each transmission of a TCP packet, typically by sending end-to-end TCP to notify the peer to the maximum TCP data that can be sent in each subsection. The MSS value is the MTU value minus the IPv4 header (in bytes) and the TCP header (byte).
Shards: If an IP datagram size exceeds the MTU of the corresponding link, IPV4 and IPV6 perform sharding (fragmentation), and the fragments are not usually reorganized (re-assembling) until they reach their destination. The IPV4 host performs shards on the datagram it generates, and the IPV4 router performs sharding on the data it forwards. However, IPV6 only performs shards on the host where the data is generated, and the IPV6 router does not perform shards on the data it forwards.
For example: an Ethernet host and a token ring on the network between the host to establish a connection, where the Ethernet host advertised MSS is 1460, the token Ring on-line host notified MSS 4096. Observation groupings, no more than 1460 bytes of data are found in two directions, why?
The size of the data sent to Ethernet on the token ring is not greater than 1460 bytes because the main advertised MSS value on Ethernet is 1460 bytes, so the length of the data sent on the token ring can not be greater than the MSS value; the Token Ring web host advertises an MSS value of 4096, That is, Ethernet can be sent to the Token Ring network TCP NET load value of 4096, but the Ethernet MTU value is determined by the hardware, the maximum support only 1500 (including IP head at least 20B and TCP head at least 20B), in order to avoid the Shard, Therefore, the net load of the data sent to the Token Ring network by Ethernet is also 1500-20-20=1460b, so the net data length in two directions will not be greater than 1460 bytes.
Load Balancing fault diagnosis: A mystery caused by an MSS value
network communication due to improper setting of the MTU is not uncommon, such as in the presence of ADSL devices, if the MTU of the device is set to 1500, often client access will be problematic, because the ADSL PPPoE protocol in the MTU accounted for 8 bytes, That is, the maximum MTU value of ADSL is 1492, if the client and the server set a large, the transmission of packets just over 1492 bytes, will cause the packet can not pass. In the program design, the application of MSS value is often the MTU-40 (TCP and IP header accounted for 20 bytes, the MTU is generally set to 1500), so basically all devices can accept the maximum MSS value will not be greater than 1500-40=1460, Then consider that the network may exist pppoe,vpn and other devices will take up more MTU bytes, so the network equipment manufacturers to provide the networking equipment will further reduce the MSS value settings, General network equipment set MSS value size of 1400 around.
MTU and MSS lead to packet loss issues
Explanation of "TCP segment of a reassembled PDU" in Wireshark
MTU and MSS
This article uses the Grasping Kit tool as Wireshark, its predecessor is the famous ethereal. The packet format for Wireshark Ethernet frames is:
Frame = Ethernet Header + IP header + TCP header + TCP Segment Data
(1) Ethernet Header = Byte = Dst Physical Address (6 byte) + SRC Physical Address (6 byte) + Type (2 byte) to The net frame header is referred to as a data frame .
(2) IP Header = Byte (without options field), data in the IP layer is called Datagram, the Shard is called Fragment .
(3) TCP Header = without options field, where data is called Streamin the TCP layer, and fragmentation is called Segment(UDP is called Message).
(4) 54 bytes followed by the TCP Data Payload section (portion), which is the application-tier user data.
The maximum transmission unit for IP datagrams below the Ethernet header is MTU(Maximum transmission unit,effect of short board), and for most LANs using Ethernet, mtu= 1500.
TCP packets can transmit the maximum data segment for the MSS, in order to achieve the best transmission performance, in the establishment of the TCP connection when the two sides negotiate MSS value, the minimum value of the MSS value provided by both sides is the maximum MSS value of this connection. MSS are often calculated based on MTU, usually mss=mtu-sizeof (IP header)-sizeof (TCP header) =1500-20-20=1460.
This way, after the data is segmented by the local TCP layer, it is handed over to the local IP layer and no shards are required at the local IP layer. However, IP shards may occur on the next hop routed neighbor router! Because the MTU of the router's network card may be less than the size of the IP datagram that needs to be forwarded. At this point, there are two possible scenarios on the router:
(1). If the source sender set this IP packet to be fragmented (May fragment,df=0), the router forwards the IP datagram as fragmented.
(2). If the source send side has set this IP datagram not to be fragmented (Don ' t fragment,df=1), the router discards the IP datagram and sends an ICMP shard error message to the source send side.
The relationship between MSS and MTU