Why segmentation? A datagram can be transmitted over several different networks. Each route splits the received frame into an IPv4 datagram, processes it, and encapsulates it into another frame. The format and length of the received frame depend on the protocol used by the physical network that the frame has just passed, the format and length of the sent frame depend on the protocol used by the physical network to which the frame will pass. Each data link layer protocol has its own frame format. A field defined in this format is the maximum length of the data field (MTU, the maximum transmission unit ). When a datagram is encapsulated into a frame, the total length of the datagram must be smaller than the maximum data length. This limitation lock is defined by the hardware and software used by the network. The MTU of different protocols is displayed. Medium, Ethernet MTU is 1500 bytes, but IPv4 requires the maximum data segment to be 65536. In addition, the header length must be greater than 65536 bytes. Therefore, IPv4 must be transmitted over Ethernet, if the MTU over Ethernet is exceeded, multipart transmission is required. Segmentation Principle When a datagram is segmented, each segment has its own header. Most of the fields are repeated, but some of them have changed. If a segmented datagram encounters a smaller MTU network, the segmented data is further segmented. In IPv4, data packets may be segmented by any route on the host or other paths. However, data packets can only be reorganized on the target host. Fields related to the segmentation and reorganization of IPv4 datagram are: identifier, flag, and segment offset. Identifier: uniquely identifies the data packet sent by the source host. For example, if the host sends a datagram for the first time, the ID of the datagram is 1. If the datagram is segmented, the ID of each subdatagram is also 1. The host then sends the second datagram, so this identifier is + 1, 2, and so on. Flag: This is a single-digit field. First Reserved for later use. The second digit is called a non-field. If the value is 1, the machine cannot segment the datagram. If the value is 0, the datagram is segmented as needed. The third digit is a multi-segment. If the value is 1, it indicates that the datagram is not the last segment. There are many segments after the segment. If the value is 0, it indicates that it is the last or unique segment. Slice offset: This 13-bit field indicates the relative position of the segment in the entire datagram. It is the data offset in the original datagram, in 8 bytes. It indicates that a 4000-byte datagram is divided into three fields. The offset is 8 bytes. This is because the offset field is only 13 characters long and can only represent 8192 bytes at the maximum. If the offset field is 8 bytes, it can represent 65536 bytes, the maximum length of an IPv4 datagram.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service