First PageLast Page   

Next PageEnd Page
5 - 4 路由器、数据包的分解和再拼装


The entire process is repeated at each router until the packet reaches its final destination. If a router receives a packet that is too large for the underlying network, IP will break the packet into manageable chunks. When the chunks arrive at their final destination, IP assembles the pieces into the original packet. This process is referred to as fragmentation and reassembly. Fragmentation often occurs in environments that have a mix of media such as Ethernet and Token Ring.
Let's look at how this works. An IP packet is received at the router. IP fragments the packet into three smaller packets. A new header is created for each new packet which includes:
  - a flag, to indicate that other fragments follow. A flag is not added to the last packet because no other fragments follow it.
  - a fragment ID to identify all fragments that belong together and a fragment offset to tell the receiving host how to reassemble the packet.
All three packets are routed to the remote network. Even if they travel through multiple routers packets are only reassembled when they reach the destination host. When the three packets are received by IP at the remote host, they are identified by the fragment ID as belonging together. Next, the fragment offset is used to reassemble them in the correct order. Finally, the reassembled packet is passed up the stack to either TCP or UDP.