written 8.4 years ago by |
i. In order to make the IP protocol independent of the physical network, the designers decided to make the maximum length of the IP datagram equal to 65,535 bytes.
ii. This makes transmission more efficient if we use a protocol with an MTU of this size. However, for other physical networks, we must divide the datagram to make it possible to pass through these networks. This is called fragmentation.
iii. The source usually does not fragment the IP packet. The transport layer will instead segment the data into a size that can be accommodated by IP and the data link layer in use.
iv. When a datagram is fragmented, each fragment has its own header with most of the fields repeated, but some changed.
v. A fragmented datagram may itself be fragmented if it encounters a network with an even smaller MTU. In other words, a datagram can be fragmented several times before it reaches the final destination.
vi. A datagram can be fragmented by the source host or any router in the path. There assembly of the datagram, however, is done only by the destination host because each fragment becomes an independent datagram.
vii. An even stronger objection for reassembling packets during the transmission is the loss of efficiency it incurs.
viii. When a datagram is fragmented, required parts of the header must be copied by all fragments.
ix. The host or router that fragments a datagram must change the values of three fields: flags, fragmentation offset, and total length. The rest of the fields must be copied.
Fields Related to Fragmentation:
The fields that are related to fragmentation and reassembly of an IP datagram are the identification, flags, and fragmentation offset fields.
Identification:
i. This 16-bit field identifies a datagram originating from the source host. The combination of the identification and source IP address must uniquely define a datagram as it leaves the source host.
ii. To guarantee uniqueness, the IP protocol uses a counter to label the datagrams. The counter is initialized to a positive number.
iii. When the IP protocol sends a datagram, it copies the current value of the counter to the identification field and increments the counter by one.
iv. As long as the counter is kept in the main memory, uniqueness is guaranteed. When a datagram is fragmented, the value in the identification field is copied into all fragments.
v. In other words, all fragments have the same identification number, which is also the same as the original datagram.
vi. The identification number helps the destination in reassembling the datagram. It knows that all fragments having the same identification value should be assembled into one datagram.
Flags:
i. This is a three-bit field. The first bit is reserved (not used). The second bit is called the do not fragment bit.
ii. If its value is 1, the machine must not fragment the datagram. If it cannot pass the datagram through any available physical network, it discards the datagram and sends an ICMP error message to the source host. If its value is 0, the datagram can be fragmented if necessary.
iii. The third bit is called the more fragment bit.
iv. If its value is 1, it means the datagram is not the last fragment; there are more fragments after this one. If its value is 0, it means this is the last or only fragment.
Fragmentation offset:
i. This 13-bit field shows the relative position of this fragment with respect to the whole datagram.
ii. It is the offset of the data in the original datagram measured in units of 8 bytes. Figure shows a datagram with a data size of 4000 bytes fragmented into three fragments. The bytes in the original datagram are numbered 0 to 3999. The first fragment carries bytes 0 to 1399.
iii. The offset for this datagram is 0/8= 0. The second fragment carries bytes 1400 to 2799; the offset value for this fragment is 1400/8= 175.
iv. Finally, the third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8= 350.
The value of the offset is measured in units of 8 bytes. This is done because the length of the offset field is only 13 bits long and cannot represent a sequence of bytes greater than 8191. This forces hosts or routers that fragment datagrams to choose the size of each fragment so that the first byte number is divisible by 8.