The Network Layer: Forwarding & IP

IP fragmentation

IP fragmentation is how a too-big datagram is chopped into smaller pieces so it can fit through a link with a smaller MTU, then put back together at the far end. Imagine mailing a long document that won't fit in one envelope: you split it into numbered pages, send each in its own envelope, and the recipient staples them back in order. IP does the same with bytes, and only the final destination reassembles — the routers in between never piece it back together.

Three header fields make it work in IPv4: the identification field tags every fragment of one original datagram with the same ID; the fragment offset says where this piece sits within the original (measured in 8-byte units); and the more-fragments flag is 1 on every piece except the last, telling the receiver to keep waiting. The destination collects all pieces sharing an ID, orders them by offset, sees the last one (more-fragments = 0), and rebuilds the original datagram. If even one fragment is lost, the whole datagram is discarded — there is no per-fragment retransmission at the IP layer.

Fragmentation is increasingly avoided because it is fragile and inefficient: it multiplies overhead, loses the entire datagram if any piece drops, and is a known vector for attacks (overlapping or tiny fragments). IPv6 makes a clean break: routers are not allowed to fragment at all; if a packet is too big, the router drops it and sends an ICMPv6 'packet too big', and the source host alone must fragment (using an extension header) or shrink. So in modern practice, the right answer is usually Path MTU Discovery, not fragmentation.

A 4000-byte payload crossing a 1500-byte-MTU link becomes three fragments, all sharing identification 0xABCD: offset 0 (more=1), offset 185 (= 1480/8, more=1), offset 370 (more=0). The destination reorders by offset and reassembles; lose any one and all 4000 bytes are gone.

Same ID, ordered by offset, last piece flagged — reassembly happens only at the destination.

Losing one fragment kills the whole datagram, and only the destination reassembles. IPv6 forbids router fragmentation entirely, so on IPv6 the source must size packets right or use Path MTU Discovery.

Also called
fragmentation and reassemblyIP 分段IP 分片