IP Fragmentation

https://www.cisco.com/c/en/us/tech/ip/index.html

When the IP protocol transmits data packets, it divides the data packets into several fragments for transmission, and reorganizes them in the target system. This process is called fragmentation. IP fragmentation occurs when the size of the IP packet to be transmitted exceeds the maximum transmission unit (MTU). For example, the maximum IP packet size (MTU) that can be transmitted in an Ethernet (Ethernet) environment is 1500 bytes. If the size of the packet to be transmitted exceeds 1500 bytes, it needs to be fragmented and transmitted. It can be seen from this that IP fragmentation is a frequent event in the network environment.

    An important feature of IP is the ability to fragment packets when they are too large to be sent on the selected hardware interface. Oversized packets are split into two or more IP fragments of a size suitable for sending on the selected network. On the way to the destination host, the fragment may be further fragmented by intermediate routers. At the destination host, an IP datagram may be placed within one IP packet or multiple IP packets. Because each shard may reach the destination host by different paths, only the destination host has the opportunity to see all the shards. Therefore, only the destination host can reassemble all fragments into a complete datagram and submit it to the appropriate transport layer protocol.
    
    There are three fields in the IP header to implement fragmentation and reassembly:
    iphdr->id
    iphdr->frag_off

    Identification field (iphdr->id), flag field (3 high-order bits of iphdr->frag_off) and offset field (13 low-order bits of iphdr->frag_off). The flag field consists of 3 bit flags.
    (1) Bit 0 is reserved and must be 0;
    (2) Bit 1 is a "don't fragment" (DF -- Don't Fragment) flag, if this bit is set to 1, IP will not fragment the datagram At this time, if a datagram that needs to be fragmented arrives, the datagram will be discarded and an ICMP error message will be sent to the initiator.
    (3) Bit 2 is the "More Fragment" (MF -- More Fragment) flag. This bit is set to 1 for every piece that makes up the datagram except the last piece.
    The Fragment Offset field (the 13 low-order bits of iphdr->frag_off) refers to the position where the fragment offsets the beginning of the original datagram. In addition, when the datagram is fragmented, the total length value of each fragment should be changed to the length value of the fragment.
    In BSD, the flags and offset fields are combined and accessed by iphdr->frag_off. iphdr->id identifies the fragment of a particular datagram, iphdr->frag_off determines the position of the fragment within the original datagram, and MF identifies each fragment except the last one.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324911192&siteId=291194637