Fragmentation Practice
Example 1
• 1440 byte packet that must be routed through an
interface with an MTU of 576 bytes (the packet
size all hosts should be prepared to accept to
comply with the IP RFC).
We’ll assume the smallest possible IP header size
of 20 bytes meaning the original packet contains
1420 bytes of data.
First Fragment
An Identification field populated with an ID number
A reserved bit not set, the Don’t Fragment flag not set and a More Fragments flag of 1 in
the Flags field, expressed in binary as: 001
The Fragment Offset field is set to zero as this is the first fragment, expressed in binary as: 0
0000 0000 0000
A Total Length field of 572 expressed in binary as: 0000 0010 0011 1100; the maximum possible
576 byte packet hasn’t been used because the fragment offset field in the following fragment must
be a multiple of 8 bytes – as the header is 20 bytes, this packet contains 552 bytes of data, with
868 bytes remaining
Second Fragment
An Identification field populated with the same ID number used for the first fragment
A reserved bit not set, the Don’t Fragment flag not set and a More Fragments flag of 1 in
the Flags field, expressed in binary as: 001
The Fragment Offset field is set to 69 (552/8), expressed in binary as: 0 0000 0100 0101
A Total Length field of 572 expressed in binary as: 0000 0010 0011 1100; this packet also
contains 552 bytes of data, with 316 bytes remaining
Third & Final Fragment
An Identification field populated with the same ID number used for the first and second fragments
A reserved bit not set, the Don’t Fragment flag not set and a More Fragments flag of 0 in
the Flags field, expressed in binary as: 000
The Fragment Offset field is set to 138 (1104/8), expressed in binary as: 0 0000 1000 1010
A Total Length field of 336 expressed in binary as: 0001 0101 0000; this packet contains 316
bytes of data
Example 2
• A datagram is carrying 1024 bytes of
data. If there is no option
information, what is the value of
the header length field? What is the
value of the total length field?
Solution:
• Given, Data-size = 1024 bytes.
• => Header-size = 20 bytes (since no option
bytes present)
• therefore, HLEN = 20/4 = 5.
• Total length of datagram = 1024 + 20 = 1044 bytes
Example 3
•A host is sending 100
datagrams to another host. If
the identification number of
the first datagram is 1024,
what is the identification
number of the last ?
Solution
Since Identification numbers are given in
sequence
• => the identification of last datagram =
1024+99 = 1123
Example 4
• A datagrams is divided into 10
fragments. if the identification
number of first fragment is 2091
then what is the identification
number of the last fragment ?
Solution
• Since Identification numbers for all fragments
remain same
• => the identification of last fragment = 2091
Example 5
• In an IP packet, the value of
HLEN is 616 and the value of the
total length field is 003816. How
many bytes of data are being
carried by this packet?
Solution
The HLEN value is 4, it means HLEN in decimal is => 6X16 0 =
6, therefore, Header-size = 6 X 4 = 24 bytes
• Given => Total length is 003816, it means length in
decimal
• => 3X161+8X160= 48+8 = 56 bytes [Total length = Header +
Data]
• Data = Total length - Header => 56-24 = 32 bytes
Example 6
A datagram of size 824 bytes has
arrived in which the offset value
is 100. What is the number of the
first byte and last byte ? (Given
HLEN=6)
Solution
• Given => HLEN = 6 => header-size= 6X4= 24 bytes
• => Datagram size = 820 bytes, therefore data-size = 824-24 = 800
bytes
• => offset = 100 , therefore first byte = 100X8 = 800
• since the data-size is 800 bytes=>last byte = 1599
Example 7
• Calculate the HLEN value if the
total length is 1200 bytes, 1176
of which is data from the upper
layer.
Solution:
• Given Total length = 1200 bytes
• => Data-size = 1176 bytes ( upper-layer data will be data-size in
datagram)
• => Header-size = 1200 - 1176 = 24 bytes
• Therefore, HLEN = 24/4 = 6
Example 8
• An IP packet of size 1600 bytes passes
through network segment before it
reaches its destination. The header
size of this packet is 30 bytes. The
maximum size of an IP packet in
intermediate network (MTU) is 1400
bytes. How the IP packet would be
fragmented in a router. Find all the
information for each fragments.
Solution
• Packet size = 1600 B => 30 + 1570
• Given MTU is 1400 bytes => Permitted Pkt size
= 30 + 1370 => 1400 bytes
• Since 1370 is not multiple of 8, therefore
feasible data-size is = 1368
• => So total data-bytes (1570) is fragmented
as 1368 + 202 bytes
First Fragment
• Packet Size = 30 + 1368 = 1398
bytes [header = 30 bytes , data
= 1368 bytes]
• Bytes Range = 0000 to 1367
M bit = 1
offset = 0000/8 = 0
Second Fragment
• Packet Size = 30 + 202 = 232 bytes
[header = 30 bytes , data = 202 bytes]
• Bytes Range = 1368 to 1569
• M bit = 0 offset = 1368/8 =
171
•
Example 9
•An IP packet of 520 bytes with an IP
header of 20 bytes was received by an
IP router with a Maximum Transmission
Unit (MTU) of 200 bytes. What are the
values of the necessary IP header fields
Solution
• Since the MTU is 200 bytes and the header size is 20 bytes, the maximum
data length is 180 bytes. However, since this length cannot be expressed in a
fragment offset since it is not divisible by 8, the greatest length of data that is
practical is 176 bytes.
• The total number of fragments is (520/200) which is equal to 3.
• Header length = 5 (20/4 Equals 5 because the scale factor is 4).
• e(efficiency) is given by (Data without header)/(Data with header) is equal
to 500/560 = 89.2 % .