Transferred from: Tsihang three layer network equipment the principle of fragmentation and recombination of IP packets

Source: Internet
Author: User

The principle of fragmentation and recombination of IP packets for three-layer network devices

For the network Shard, I wanted to tidy up a year ago, although the information on the network is many, but the true mastery of the essence of the real thing unless the Shard program, otherwise it is difficult to connect the whole protocol stack to understand. This article, including the design of the Shard schematic, takes an hour to complete, which is a little understanding of the record.

Three layer network equipment, which can be based on IP header information to identify and process the packet network equipment, in the forwarding of IP messages, often encountered from the upper layer of packets too long, resulting in the Mac head frame does not meet the IEEE802.3 standard maximum frame length, resulting in the problem can not be forwarded and to the end of the resolution. This requires the three layer to be fragmented, the long IP packets are split into small data blocks, generally specify the maximum IP packet (IP header + data) length should be within the range of 46~1500, so, plus the Mac head of 14 bytes and 4 bytes of verification, to meet the maximum frame length of Ethernet frame 1518 requirements.

So, how to shard? , assuming that there is now a total length of 4000 bytes of IP packets, a jumbo IP packet, in the three-layer time, the need to Shard, the packet length is controlled in the Ethernet II frame for a long range, and then forwarded.

If the Shard length is calculated as 1000 bytes, then the data portion of the 3,980-byte IP packet can be divided into 4 shards, denoted by a,b,c and D, respectively. Obviously, the data portion of the last Shard is the length of the remaining packet after subtracting the first three 1000bytes shards-980.

According to the fixed head length of 20 bytes, each shard will copy the IP header information of the source IP message, as the IP headers in front of the Shard, and need to modify the header information of the new IP packet composed of shards. If the header identifier field of the source IP message is = 15000, this value marks the number of the IP packet issued from the host three layer. The identifier field of the Shard is also 15000, in the new IP header, the Shard flag bit and the offset bit need to be modified.

1 MF: More shards  2 DF: Non-sharding  

1 for the first shard A, offset=0 is the first shard of the original IP packet, mf=1, then there is a shard message,  2 for the second Shard B, offset=125= (1000/8), Calculates the offset of the data portion of the second shard from the starting position of the data portion of the original IP packet, and mf=1 the following fragment;  3 ...  

Such a process, the implementation of the IP packet shard operation. To the end of the three layer, after receiving the mf=1 message, it is known that the message is a fragment of an IP packet, the need for a shard reorganization operation. When reorganizing, the length of the entire message is extracted from the head of the Shard (the length is 3980), while the offset domain is extracted, the portion of the Shard data is computed in the entire IP packet data portion, populated, and continues to receive subsequent shards (The Shard belongs to the same IP message based on the address information and the message number), Until a fragment-like mf=0 message is received, it indicates the end of the Shard, and after the reorganization of the previously reorganized message, it is handed over to the four-layer processing.

Problem: If the above message is fragmented, the data portion of the last Shard is less than 26 bytes long, plus 20 bytes of the fixed IP header, plus 14 bytes of the Ethernet header, plus 4 bytes of the checksum, What happens when the total IP packet length of the final shard is less than the minimum length of 64 bytes specified by Ethernet?

Transferred to: Tsihang three-layer network device for the fragmentation and reassembly of IP packets

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.