Fragmentation and assembly of datagrams

Source: Internet
Author: User

1. IP datagram Format

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/84/80/wKioL1eSLnOjz84DAAPu67g5jzY361.png-wh_500x0-wm_3 -wmp_4-s_2695026659.png "title=" Image.png "alt=" Wkiol1eslnojz84daapu67g5jzy361.png-wh_50 "/>


2. MTU

MTU (Maximum transmission Unit): The maximum length of a data field in a frame format.


3. sharding

1) Conditions of the Shard

When the datagram length exceeds the maximum transmission unit MTU allowed by the network, the long datagram must be fragmented before it can be transmitted over the network.

2) How to Shard

For each IP datagram sent by the sending side, its target-literate segment contains a unique value. This value is copied to each slice when the datagram is fragmented. The flag field uses one of the bits to represent "more slices." In addition to the last piece, each of the other components of the datagram is to put the bit 1. The Slice offset field refers to the position at which the slice is offset from the beginning of the original datagram. In addition, when the datagram is fragmented, the total length value of each slice is changed to the length value of the slice.

Finally, a bit in the flag field is called a "non-shard" bit. If you place this bit 1,ip, the datagram will not be fragmented.

When the IP datagram is fragmented, each piece becomes a grouping, has its own IP header, and is independent of the other groupings when routing is selected. In this way, when these slices of the datagram arrive at the destination, it may be out of order, but there is enough information in the IP header to allow the receiver to assemble the datagram correctly.


4. Assembly

In order to regroup these datagram shards, the receiving host allocates a storage buffer when the first Shard arrives. This host will also start a timer. When subsequent shards of the datagram arrive, the data is copied to the location indicated by the slice offset field in the buffer memory. When all shards arrive, the complete, non-fragmented original packet is restored. Processing continues as if it were a non-fragmented datagram.


5, three-bit flag

The highest bit in the Flag field is currently meaningless

The lowest bit in the Flag field is recorded as MF (more Fragment), and Mf=1 is the datagram with "shards" behind it. Mf=0 says this is the last of several datagrams.

The one in the middle of the flag field is recorded as DF (Don ' t Fragment), meaning "cannot shard." Shards are allowed only when df=0.


This article is from the "lovemeright" blog, make sure to keep this source http://lovemeright.blog.51cto.com/10808587/1828973

Fragmentation and assembly of datagrams

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.