Fragmentation
分片
Fragmentation of an internet datagram is necessary when it originates in a local net that allows a large packet size and must traverse a local net that limits packets to a
smaller size to reach its destination.
当一个很大的包在一个网络中传输,大于mtu时,就必须对它进行分片
An internet datagram can be marked "don't fragment." Any internet datagram so marked is not to be internet fragmented under any circumstances. If internet datagram marked don't
fragment cannot be delivered to its destination without fragmenting it, it is to be discarded instead.
任何一个包可以设置IP包头的选项为不被分片。任何情况下都不要分片。那么如果一个包因为过大必须要分片才可以传输的话,此时该包就会被丢弃
Fragmentation, transmission and reassembly across a local network which is invisible to the internet protocol module is called intranet fragmentation and may be used [6].
分片,传输,重组 在多个网络中 更是经常遇到,由IP模块实现,称为内联网分片
The internet fragmentation and reassembly procedure needs to be able to break a datagram into an almost arbitrary number of pieces that can be later reassembled. The receiver of
the fragments uses the identification field to ensure that fragments of different datagrams are not mixed. The fragment offset field tells the receiver the position of a
fragment in the original datagram. The fragment offset and length determine the portion of the original datagram covered by this fragment. The more-fragments flag indicates (by
being reset) the last fragment. These fields provide sufficient information to reassemble datagrams.
分片和重组的机制是对一个大包拆分成任意块的多个包发出去,之后再重组。那么接收者在收到经过分片的包,需要识别它们再组合。IP包头中的identification,fragment offset ,ip length
,more-fragments 为重组包提供了足够的信息
fragment offset : 指示分片的位置,length 怎么转换该分片
more-fragments : 指示最后的一个分片
The identification field is used to distinguish the fragments of one datagram from those of another. The originating protocol module of an internet datagram sets the
identification field to a value that must be unique for that source-destination pair and protocol for the time the datagram will be active in the internet system. The
originating protocol module of a complete datagram sets the more-fragments flag to zero and the fragment offset to zero.
identification 用来辨别 一个包中分片的相对于一个包中的其他分片。在包传输的过程中,原始IP模块为source-desting pair and protocol 设置该值的唯一性
在原始的协该模协中 将一个完整的包 的 more-fragments ragment offset 都设为0
To fragment a long internet datagram, an internet protocol module (for example, in a gateway), creates two new internet datagrams and copies the contents of the internet header
fields from the long datagram into both new internet headers. The data of the long datagram is divided into two portions on a 8 octet (64 bit) boundary (the second portion might
not be an integral multiple of 8 octets, but the first must be). Call the number of 8 octet blocks in the first portion NFB (for Number of Fragment Blocks). The first portion of
the data is placed in the first new internet datagram, and the total length field is set to the length of the first datagram. The more-fragments flag is set to one. The second portion of the data is placed in the second new internet datagram, and the total length field is set to the length of the second datagram. The more-fragments flag carries the same value as the long datagram. The fragment offset field of the second new internet datagram is set to the value of that field in the long datagram plus NFB.
为了对一个大包进行片,一个IP协议模块(比如 网关),先创建两个新包且复制原始包的包头中的域到新的两个包的包头中,数据将按8字节为单位分拆到两个包中,第一包绝对是8字节的倍数,数据填充完当然还要重新计算新的包的checksum 和IP 的包大小total length