IP Fragmentation Tutorial
This tutorial explains IP fragmentation using clear formulas, step-by-step calculations, and
real-world practice questions. IP fragmentation happens when an IP packet is larger than
the Maximum Transmission Unit (MTU) of a network link. The packet must be broken into
smaller fragments so it can be transmitted successfully.
1. Key Concepts You Must Know
MTU (Maximum Transmission Unit): The largest packet size (in bytes) that can pass
through a link.
IP Header Size: Usually 20 bytes (without options).
Fragment Offset: Shows where a fragment belongs in the original packet. Measured in 8-
byte units.
MF (More Fragments) Bit: 1 means more fragments follow; 0 means this is the last
fragment.
DF (Don't Fragment) Bit: If set to 1, fragmentation is not allowed.
Payload/Data Size: The data part of the IP packet (Total Length - IP Header).
Each fragment gets its own IP header, so every fragment adds 20 bytes overhead.
2. Important Formulas for Fragmentation
1) Original Data Size = Original Total Length - IP Header Size
2) Max Data Per Fragment = MTU - IP Header Size
3) Fragment Data Size (except last) must be a multiple of 8 bytes.
4) Number of Full Fragments = floor(Original Data Size / Fragment Data Size)
5) Remaining Data = Original Data Size mod Fragment Data Size
6) Fragment Offset = (Bytes sent before this fragment) / 8
7) Fragment Total Length = Fragment Data Size + IP Header Size
3. Fragmentation Procedure (Step-by-Step)
Step 1: Identify the MTU of the link.
Step 2: Identify the IP header size (normally 20 bytes).
Step 3: Compute the original payload size.
Step 4: Compute maximum payload per fragment (MTU - 20).
Step 5: Adjust fragment payload size to the nearest multiple of 8 bytes.
Step 6: Divide the payload into fragments.
Step 7: Compute fragment offsets for each fragment.
Step 8: Set MF bit = 1 for all fragments except the last fragment (MF=0).
Step 9: Compute total length of each fragment.
4. Practice Questions with Full Solutions (10 Real-World Examples)
Question 1: Sending a File Over Ethernet
Scenario:
A host sends an IP packet of total length 2000 bytes over a link with MTU = 1500 bytes. IP
header = 20 bytes. Fragment the packet.
Step-by-Step Solution:
Step 1: Original Data Size = 2000 - 20 = 1980 bytes
Step 2: Max Data Per Fragment = 1500 - 20 = 1480 bytes
Step 3: 1480 is divisible by 8 → OK (1480/8 = 185 units)
Step 4: First fragment data = 1480 bytes
Remaining data = 1980 - 1480 = 500 bytes
Step 5: Fragment 1 Total Length = 1480 + 20 = 1500 bytes
Fragment 1 Offset = 0/8 = 0, MF=1
Step 6: Fragment 2 data = 500 bytes (last fragment)
Fragment 2 Total Length = 500 + 20 = 520 bytes
Fragment 2 Offset = 1480/8 = 185, MF=0
Question 2: University Wi-Fi Link
Scenario:
Mukuba University Wi-Fi has MTU = 1400 bytes. A packet of 3000 bytes must pass through.
IP header = 20 bytes.
Step-by-Step Solution:
1. Original Data Size = 3000 - 20 = 2980 bytes
2. Max Data Per Fragment = 1400 - 20 = 1380 bytes
3. 1380 is not divisible by 8 → nearest lower multiple of 8 = 1376 bytes
4. Fragment 1 data = 1376 bytes
5. Remaining = 2980 - 1376 = 1604 bytes
6. Fragment 2 data = 1376 bytes
7. Remaining = 1604 - 1376 = 228 bytes
8. Fragment 3 data = 228 bytes (last fragment)
9. Fragment 1 Total Length = 1376 + 20 = 1396 bytes, Offset=0, MF=1
10. Fragment 2 Total Length = 1376 + 20 = 1396 bytes, Offset=1376/8=172, MF=1
11. Fragment 3 Total Length = 228 + 20 = 248 bytes, Offset=(1376+1376)/8=344, MF=0
Question 3: ISP Link with MTU 576
Scenario:
A packet of total length 1500 bytes crosses an old WAN link with MTU = 576 bytes. Header =
20 bytes.
Step-by-Step Solution:
1. Original Data Size = 1500 - 20 = 1480 bytes
2. Max Data Per Fragment = 576 - 20 = 556 bytes
3. 556 not divisible by 8 → nearest lower multiple of 8 = 552 bytes
4. Fragment 1 data = 552 bytes
5. Fragment 2 data = 552 bytes
6. Remaining = 1480 - (552+552) = 376 bytes
7. Fragment 3 data = 376 bytes (last)
8. Fragment 1 Total Length = 552+20=572, Offset=0, MF=1
9. Fragment 2 Total Length = 572, Offset=552/8=69, MF=1
10. Fragment 3 Total Length = 376+20=396, Offset=(552+552)/8=138, MF=0
Question 4: Video Streaming Packet
Scenario:
A streaming server sends a 4000-byte IP packet. MTU = 1500 bytes. Header = 20 bytes.
Step-by-Step Solution:
1. Original Data Size = 4000 - 20 = 3980 bytes
2. Max Data Per Fragment = 1500 - 20 = 1480 bytes (divisible by 8)
3. Fragment 1 data = 1480 bytes
4. Fragment 2 data = 1480 bytes
5. Remaining = 3980 - 2960 = 1020 bytes
6. Fragment 3 data = 1020 bytes (last)
7. Fragment 1 Total Length = 1500, Offset=0, MF=1
8. Fragment 2 Total Length = 1500, Offset=1480/8=185, MF=1
9. Fragment 3 Total Length = 1020+20=1040, Offset=2960/8=370, MF=0
Question 5: VPN Tunnel Overhead
Scenario:
A packet of total length 1800 bytes enters a VPN tunnel that reduces MTU to 1300 bytes.
Header = 20 bytes.
Step-by-Step Solution:
1. Original Data Size = 1800 - 20 = 1780 bytes
2. Max Data Per Fragment = 1300 - 20 = 1280 bytes
3. 1280 divisible by 8 (1280/8=160)
4. Fragment 1 data = 1280 bytes
5. Remaining = 1780 - 1280 = 500 bytes
6. Fragment 2 data = 500 bytes (last)
7. Fragment 1 Total Length = 1280+20=1300, Offset=0, MF=1
8. Fragment 2 Total Length = 500+20=520, Offset=1280/8=160, MF=0
Question 6: Mobile Network MTU 1280
Scenario:
A smartphone sends a 2500-byte packet through a mobile network with MTU = 1280 bytes.
Header = 20 bytes.
Step-by-Step Solution:
1. Original Data Size = 2500 - 20 = 2480 bytes
2. Max Data Per Fragment = 1280 - 20 = 1260 bytes
3. 1260 not divisible by 8 → nearest lower multiple of 8 = 1256 bytes
4. Fragment 1 data = 1256 bytes
5. Remaining = 2480 - 1256 = 1224 bytes
6. Fragment 2 data = 1224 bytes (last)
7. Fragment 1 Total Length = 1256+20=1276, Offset=0, MF=1
8. Fragment 2 Total Length = 1224+20=1244, Offset=1256/8=157, MF=0
Question 7: Campus Backbone Link
Scenario:
Mukuba University backbone has MTU = 1600 bytes. A router forwards a 5000-byte packet.
Header = 20 bytes.
Step-by-Step Solution:
1. Original Data Size = 5000 - 20 = 4980 bytes
2. Max Data Per Fragment = 1600 - 20 = 1580 bytes
3. 1580 not divisible by 8 → nearest lower multiple of 8 = 1576 bytes
4. Fragment 1 data = 1576 bytes
5. Fragment 2 data = 1576 bytes
6. Fragment 3 data = 1576 bytes
7. Remaining = 4980 - 4728 = 252 bytes
8. Fragment 4 data = 252 bytes (last)
9. Offsets: F1=0, F2=1576/8=197, F3=3152/8=394, F4=4728/8=591
10. Total Lengths: F1=1596, F2=1596, F3=1596, F4=272
11. MF bits: F1=1, F2=1, F3=1, F4=0
Question 8: Packet with IP Options (Header 24 bytes)
Scenario:
A packet has IP header size = 24 bytes (options included). Total length = 2200 bytes. MTU =
1000 bytes.
Step-by-Step Solution:
1. Original Data Size = 2200 - 24 = 2176 bytes
2. Max Data Per Fragment = 1000 - 24 = 976 bytes
3. 976 divisible by 8 (976/8=122)
4. Fragment 1 data = 976 bytes
5. Fragment 2 data = 976 bytes
6. Remaining = 2176 - 1952 = 224 bytes
7. Fragment 3 data = 224 bytes (last)
8. Fragment Total Lengths: F1=1000, F2=1000, F3=224+24=248
9. Offsets: F1=0, F2=976/8=122, F3=1952/8=244
10. MF: F1=1, F2=1, F3=0
Question 9: Network Printer Sending Data
Scenario:
A printer sends a 3500-byte packet through a link with MTU = 1200 bytes. Header = 20
bytes.
Step-by-Step Solution:
1. Original Data Size = 3500 - 20 = 3480 bytes
2. Max Data Per Fragment = 1200 - 20 = 1180 bytes
3. 1180 not divisible by 8 → nearest lower multiple of 8 = 1176 bytes
4. Fragment 1 data = 1176 bytes
5. Fragment 2 data = 1176 bytes
6. Remaining = 3480 - 2352 = 1128 bytes
7. Fragment 3 data = 1128 bytes (last)
8. Fragment Total Lengths: F1=1196, F2=1196, F3=1128+20=1148
9. Offsets: F1=0, F2=1176/8=147, F3=2352/8=294
10. MF: F1=1, F2=1, F3=0
Question 10: Cloud Server Packet Across Multiple Links
Scenario:
A cloud server sends a 6000-byte packet. The path includes a bottleneck link with MTU =
1500 bytes. Header = 20 bytes.
Step-by-Step Solution:
1. Original Data Size = 6000 - 20 = 5980 bytes
2. Max Data Per Fragment = 1500 - 20 = 1480 bytes (divisible by 8)
3. Fragments: 1480, 1480, 1480, 1480, remaining
4. Total used by 4 fragments = 5920 bytes
5. Remaining = 5980 - 5920 = 60 bytes
6. Fragment 5 data = 60 bytes (last)
7. Fragment Total Lengths: F1=1500, F2=1500, F3=1500, F4=1500, F5=60+20=80
8. Offsets: F1=0, F2=1480/8=185, F3=2960/8=370, F4=4440/8=555, F5=5920/8=740
9. MF bits: F1=1, F2=1, F3=1, F4=1, F5=0
5. Summary Notes
Always subtract the IP header to get the real data size.
Fragment payload size must be divisible by 8 bytes except the last fragment.
Fragment Offset is always measured in 8-byte blocks.
Every fragment gets a new IP header.
MF=1 means more fragments follow; MF=0 means last fragment.
The receiver reassembles fragments using Identification, Offset, and MF bits.
6. Quick Revision Exercise (No Solution)
Try this on your own:
A packet of total length 4100 bytes must pass through a link with MTU = 1000 bytes.
Assume IP header = 20 bytes. Calculate the fragments, offsets, and MF bits.