MSS is the abbreviation of the Maximum Segment Size of maxitum segment size, meaning the maximum data segment that TCP data packets can transmit each time. It is a concept in the TCP protocol. The MSS value indicates the size of the TCP packet's net load data. The setting of the packet size can achieve the same effect as setting the MTU value. It is to prevent the packet size sent by the host from exceeding the MTU value of the network link from being discarded. However, in practice, the MSS value is often replaced by MTU when implemented in TCP. The implementation principle is: some TCP implementations only send the MSS option when the target host is on a non-direct connection network, the PC will be connected to the destination IP address, negotiate an MSS parameter as a reference for sending data packets by yourself. The MSS parameter indicates the maximum unsharded data packet size on the peer end and only the net load is included.
In the subsequent sections, we will further study and understand the principle and application of MTU and TCP-MSS through a simple experiment.
1. MTU
Recall the structure of the ethernetii frame DMAc + SMAC + Type + Data + CRC. Due to the electrical limitations of Ethernet transmission, each Ethernet frame has a minimum size of 64 bytes, and the maximum size cannot exceed 1518 bytes, for Ethernet frames smaller than or greater than this limit, we can regard them as incorrect data frames. Generally, Ethernet forwarding devices will discard these data frames. Data frames smaller than 64 bytes are generally produced by "fragments" produced by Ethernet conflicts, line interference, or bad Ethernet interfaces. For these "fragments" less than 64 bytes ", the MAC Sub-layer is filled with data fields to ensure that the length of the entire data frame is no less than 64 bytes for transmission.
Why do Ethernet rules stipulate that the data frame length is no less than 64 bytes?
Ethernet is not reliable, which means that the sender does not know whether the Peer of the data sent by the sender has received the data, but if the packet sent by the sender has an error, it will be re-transmitted. When will an error occur? What does an error mean? How does Ethernet detect an error?
Ethernet errors are mainly caused by a collision. A collision means that two machines listen to the network at the same time and send data at the same time. A collision is normal for Ethernet. The well-known CSMA/CD is used to detect conflicts. If a detects that the network is idle, it starts to send data packets and tries its best to transmit them. When the data packet has not reached B, B also detects that the network is idle and starts to send data packets, in this case, a collision occurs. B finds a collision and starts to send a collision signal. The so-called collision signal is a continuous 01010101 or 10101010, And the hexadecimal system is 55 or AA. The collision signal will return to a. If a has not sent the packet when the collision signal reaches a, a will know that the packet has encountered an error and re-transmits the packet. However, if the collision signal returns to a, and the packet has been sent (when the packet is short), a will not re-transmit the packet.
Why is this retransmission mechanism designed for Ethernet. First, Ethernet does not want to adopt a connection mechanism because it will reduce efficiency, but he wants to have a certain retransmission mechanism, because the retransmission of Ethernet is in microseconds, And the retransmission of the transport layer, for example, if TCP retransmission reaches the millisecond level and the application layer retransmission reaches the second level, we can see that the lower the layer retransmission, the faster the speed. Therefore, for Ethernet errors, the Ethernet must have a retransmission mechanism. To ensure retransmission over Ethernet, a must ensure that the data packet is not transmitted when a receives the collision signal. To achieve this requirement, the distance between A and B is critical, that is to say, the back-and-forth time for signal transmission between A and B must be controlled within a certain range. IEEE defines this standard. In a collision domain, the round-trip time between the farthest two machines must be less than 512bit time. (when the back-to-back time is less than 512 bits, the so-called bit time is the time required to transmit a bit ). This is also the diameter of a collision domain.
When there are 512 bits, that is, the transmission time of 64 bytes. If the Ethernet data packet is greater than or equal to 64 bytes, it can be ensured that when the collision signal reaches a, the data packet has not been transmitted completely.
Let's take a look at how the 512bit time came from?
First look at a relatively old but popular standard: 10base5, an Ethernet standard, which is used to use a base band local network with a coarse coaxial cable and a speed of 10 Mbps. In a bus network, the maximum transmission distance is 500. The network node is equipped with a transceiver that is inserted into the 15-pin connection unit interface on the NIC and connected to the cable. It also serves as thick Ethernet, thicknet, and thickware. See also coaxial cable, Ethernet, which refers to the 10 Mbit/s baseband Ethernet specification using a standard (coarse) 50Ω baseband coaxial cable. It is part of the IEEE 802.3 baseband physical layer specification. The distance between each network segment is 500 m, the maximum network span is 2500 m, and the maximum number of terminals for each network segment is 100, the distance between each workstation is an integer multiple of 2 to 5 MB.
The round-trip time of the collision domain mentioned above was defined according to the 10 m network standard at that time. 10base5 allowed the farthest two workstation to be 2.5 kilometers away from each other, the electronic signal return time of 2.5 km is about us.
Based on CSMA/CD, the minimum packet is calculated in 51.2us and 10 Mbps: 51.2us * 10 Mbps = 512 bit = 64 bytes.
This is why Ethernet requires a minimum of 64 bytes. One is based on the CSMA/CD requirements, and the other is based on the 10 m network standards at that time.
Ethernet frames cannot exceed 1518 bytes. This is also a rule, but without these restrictions, the principle of 1518 is mainly to consider the transmission efficiency accuracy.
Since the maximum data frame of Ethernet ethernetii is 1518 bytes, remove the frame header of an Ethernet frame (DMAc destination MAC address 48bit = 6 bytes + SMAC source MAC address 48bit = 6 bytes + type domain 2 bytes) 14bytes and frame tail CRC (FCS) the verification part is 4 bytes. Then the rest of the places that carry the upper-layer protocol, that is, the maximum data domain can only have bytes, which we call MTU. This is where the network layer protocol is very concerned, because the network layer protocol, for example, the IP protocol, determines whether to split the data transmitted from the upper layer based on this value. It is like a box that cannot hold a big chunk of bread. We need to cut the bread into slices and put it in multiple boxes.
Example: ICMP Packet
Project |
Content |
Length (bytes) |
Remarks |
Packet Length |
|
1516 |
Total Packet Length |
Ethernet header |
Destination |
6 |
The destination MAC and source MAC are 48 bits, respectively occupying 6 bytes. |
Source: |
6 |
Protocol type: |
2 |
IP Header |
Header Length: |
20 |
IP Header |
ICMP |
ICMP Type |
8 |
ICMP Header |
ICMP data area: |
1470 |
ICMP Net Load Length |
FCs |
|
4 |
Frame verification serial number |
About MTU, TCP-MSS (RPM)