Recall warm-up
- What is the scaling factor of the 13-bit Fragment Offset field in the IPv4 header?
Stuck? Peek at 3.2.1 IPv4 header fields: HLEN, Total Length, TTL, Protocol & Checksum
- Base header = 20 B (`HLEN = 5`); Max header = 60 B (`HLEN = 15`, max 40 B options).
- Multipliers: `Header = 4 × HLEN`, `Total Length = Header + Payload` (max 65,535 B), `Offset × 8 = start byte`.
- Per-hop changes: Every router decrements TTL by 1 (drops if 0) and recomputes Header Checksum (which covers IP header only).
- What is the standard MTU (maximum payload of a frame) of Ethernet?
Stuck? Peek at 2.4.1 Ethernet frame format, MAC address types, minimum and maximum frame sizes
- Frame: preamble 7 + SFD 1 | dest 6 | src 6 | type/len 2 | data 46–1500 | CRC 4.
- Frame 64–1518 bytes (preamble excluded); pad data to 46.
- MTU = 1500 bytes.
- First-byte LSB 1 → multicast; FF:…:FF → broadcast; else unicast.
- 64 bytes = 512 bits = CSMA/CD slot time at 10 Mbps.
- If an IPv4 datagram has Total Length = 4000 bytes and a 20-byte header, how many bytes of payload does it carry?
Stuck? Peek at 0.2.1 Bits, bytes and prefixes: powers of 10 for rates, powers of 2 for sizes
- 1 B = 8 b. Lower-case b = bit, upper-case B = byte.
- Rates: k = 10³, M = 10⁶, G = 10⁹ (bps).
- Sizes: K = 2¹⁰, M = 2²⁰, G = 2³⁰ (bytes) — unless the question says 1000.
- Time to push out = (size in bits) ÷ (rate in bit/s).
- ms = 10⁻³ s, µs = 10⁻⁶ s, ns = 10⁻⁹ s.
The Hook
Your laptop creates a 4000-byte IPv4 datagram and hands it down to Ethernet. But Ethernet refuses to carry a payload larger than its MTU of 1500 bytes! And along the path, another router might forward over a tunnel with an MTU of 620 bytes.
Unless the datagram's DF (Don't Fragment) flag is set to 1, the router slices the datagram into smaller valid IPv4 datagrams called fragments. Every fragment gets its own 20-byte IPv4 header and travels independently to the final destination.
Predict First
Total Length is 16 bits (up to 65,535 bytes), but the Fragment Offset field in Row 2 only had 13 bits left (max value 2¹³ − 1 = 8,191). How can a 13-bit number point to any byte position inside a 65,535-byte datagram?
,Because 2¹⁶ / 2¹³ = 2³ = 8! Every step of Fragment Offset represents an 8-byte block. That forces one strict rule: every fragment except the last MUST carry a payload whose byte length is a multiple of 8!
Core Concept
The Fragmentation Formula (Multiple-of-8 Rule)
Suppose a datagram with header size H (default 20 B) and data payload P bytes arrives at a link of maximum transmission unit MTU (where H + P > MTU):
- If DF = 1 (Don't Fragment): router drops the datagram and sends an error back to the source.
- If DF = 0: maximum data bytes in every non-final fragment is:
d_max = ⌊(MTU − H) / 8⌋ × 8(largest multiple of 8 that fits inMTU − H). - Number of fragments =
⌈P / d_max⌉.
What Goes into Each Fragment’s Header?
When an original datagram (carrying payload bytes 0 .. P−1) is split into fragments:
- Identification (16 bits): Copied identically into all fragments so the destination knows they belong to the same original datagram.
- More Fragments flag (MF):
MF = 1for every fragment that has more bytes of the original datagram following it;MF = 0ONLY on the very last fragment of the original datagram. - Fragment Offset (13 bits):
Offset = (starting payload byte index in ORIGINAL datagram) / 8. First fragment always hasOffset = 0. - Total Length (16 bits):
dᵢ + H(that fragment's payload plus its own 20-byte header!). Splitting into k fragments adds(k − 1) × 20bytes of extra header overhead!
Reassembly Only at Destination & Multi-Hop Re-Fragmentation
Why don't intermediate routers reassemble fragments right after a small-MTU link? Because in datagram packet switching, different fragments may take completely different paths and never pass through the same router again! Therefore, reassembly happens ONLY at the final destination host.
If an already-fragmented packet (with base offset Off₀ and flag MF₀) hits an even smaller MTU downstream, it is re-fragmented: sub-fragments compute their offsets relative to the ORIGINAL datagram (Off₀ + subByteStart/8), and all sub-fragments get MF = 1 except the last sub-fragment, which inherits MF₀!
| Sub-frag # (on MTU=620, d_max=600) | From 1st-hop Frag | Data Bytes (Total Len) | Original Byte Range | Offset (÷8) | MF |
|---|---|---|---|---|---|
| 1.1 | Frag 1 (1480B, MF=1) | 600 B (620 B) | 0 – 599 | 0 | 1 |
| 1.2 | Frag 1 (1480B, MF=1) | 600 B (620 B) | 600 – 1199 | 75 | 1 |
| 1.3 | Frag 1 (1480B, MF=1) | 280 B (300 B) | 1200 – 1479 | 150 | 1 (inherited from Frag 1!) |
Putting it together
- When a datagram exceeds a link’s MTU (and DF=0), the router splits it into fragments whose payloads (except the last) are multiples of 8 bytes.
- Each fragment carries the same Identification, its own 20-byte header, MF=1 (except the last of the original datagram, MF=0), and Offset = start_byte / 8.
- Fragments can be re-fragmented on smaller MTUs downstream and are reassembled only at the final destination host.
Visual
Worked Examples
A router with 20-byte IPv4 headers forwards onto a link with MTU = 600 bytes. What is the maximum number of data bytes each fragment can carry, and what is the Total Length of a full fragment?
Show the full solution
MTU − H = 600 − 20 = 580 bytes. Since 580 / 8 = 72.5, we round down to the nearest multiple of 8: d_max = 72 × 8 = 576 data bytes. Total Length of a full fragment = 576 + 20 = 596 bytes.
An IPv4 datagram of Total Length 4000 bytes (20-byte header, 3980 bytes payload) crosses an Ethernet link with MTU = 1500 bytes. Find the Total Length, Fragment Offset, and MF bit of every fragment.
Show the full solution
d_max = ⌊(1500 − 20)/8⌋ × 8 = 1480 bytes (offset step = 1480 / 8 = 185).
• Fragment 1: data = 1480 B (bytes 0..1479), Total Length = 1500, Offset = 0, MF = 1.
• Fragment 2: data = 1480 B (bytes 1480..2959), Total Length = 1500, Offset = 185, MF = 1.
• Fragment 3: remaining data = 3980 − 2960 = 1020 B (bytes 2960..3979), Total Length = 1040, Offset = 370, MF = 0.
(Offsets: 0, 185, 370.)
The 3 fragments from Example 2 (1480B, 1480B, 1020B) now traverse a second link with MTU = 620 bytes (so d_max = 600 bytes, offset step = 600 / 8 = 75). How many total fragments arrive at the destination, and what are all their offsets and MF bits?
Show the full solution
• Frag 1 (1480B, off=0, MF=1) splits into 600 + 600 + 280 → 3 fragments with offsets 0, 75, 150 and MFs 1, 1, 1.
• Frag 2 (1480B, off=185, MF=1) splits into 600 + 600 + 280 → 3 fragments with offsets 185, 185+75=260, 185+150=335 (185, 260, 335) and MFs 1, 1, 1.
• Frag 3 (1020B, off=370, MF=0) splits into 600 + 420 → 2 fragments with offsets 370, 370+75=445 (370, 445) and MFs 1, 0.
Total = 3 + 3 + 2 = 8 fragments!
GATE Traps
- Payload vs Total Length: If a question says "A datagram of 4000 bytes (including 20B header)", payload is 3980 B (not 4000 B!). Always check whether the given size includes the 20B header.
- Last fragment does NOT need a multiple-of-8 payload! Because no fragment comes after the last fragment, its payload can be any integer number of bytes.
- What if ONE fragment is lost? Since IP is best-effort and has no fragment-level retransmission, if even 1 fragment is lost, the destination's reassembly timer expires and the ENTIRE original datagram is discarded!
Memory Hook
Floor((MTU − 20)/8) × 8 for data; divide start byte by 8 for Offset; only the very last piece of the whole puzzle gets MF = 0!
Connect the Dots
That completes Chapter 3.2! After a quick Chapter 3.2 Lock-in, Chapter 3.3 tackles a practical mystery: how do billions of home and office devices browse the Internet when IPv4 only had 4.3 billion addresses total?
Self-Test
- NAT
A link has an MTU of 500 bytes. Assuming a standard 20-byte IPv4 header, what is the maximum number of data payload bytes that can be carried in a single non-final fragment?
Write your answer before opening the key.
- NAT
A router with MTU = 600 bytes fragments an IPv4 datagram carrying 1800 bytes of payload (plus a 20-byte header). How many fragments are produced?
Write your answer before opening the key.
- NAT
A destination host receives an IPv4 fragment with HLEN = 5, Total Length = 420 bytes, MF = 0, and Fragment Offset = 300. What was the total data payload size (in bytes, excluding the header) of the original unfragmented datagram?
Write your answer before opening the key.
- MSQ
Which of the following statements about IPv4 fragmentation are TRUE?
- Fragments of a datagram are reassembled only at the final destination host, never at intermediate routers.
- All fragments of the same datagram carry the exact same Identification field value.
- Every fragment except the last must have a Total Length that is a multiple of 8.
- If a datagram has DF = 1 and exceeds the outgoing link MTU, the router fragments it into two equal halves.
- MCQ
An original datagram is split into 4 fragments at Router R1. As Fragment 2 passes through Router R2, R2 splits Fragment 2 into 2 sub-fragments (2a and 2b). What are the MF bits of sub-fragments 2a and 2b?
- 2a has MF=1, 2b has MF=0
- 2a has MF=1, 2b has MF=1
- 2a has MF=0, 2b has MF=0
- 2a has MF=0, 2b has MF=1
Rule Card
- Max data per fragment:
d_max = ⌊(MTU − H)/8⌋ × 8(must be a multiple of 8 B). - Offset =
start_byte / 8(relative to original datagram); MF = 1 on all fragments except the very last of the original datagram (MF = 0). - Original payload from last fragment (MF=0):
8 × Offset + (TotalLength − 4×HLEN). - Reassembly: ONLY at final destination host.
Concept Ledger
- fragmentation
- fragment
- payload multiple of 8
- fragment offset
- MF (More Fragments) bit
- DF (Don't Fragment) bit
- reassembly at destination
- multi-hop re-fragmentation
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- 8 bytes (Offset = starting payload byte index ÷ 8).
- 1500 bytes.
- 4000 − 20 = 3980 bytes.
Self-test answers
- 480 — MTU − H = 500 − 20 = 480. Since 480 is divisible by 8 (480 = 60 × 8), max payload per fragment = 480 bytes.
- 4 — MTU − H = 600 − 20 = 580. Largest multiple of 8 ≤ 580 is 72 × 8 = 576 bytes. Number of fragments = ⌈1800 / 576⌉ = ⌈3.125⌉ = 4 fragments (576, 576, 576, 72).
- 2800 — Since MF = 0, this is the last fragment. It starts at byte 300 × 8 = 2400 and carries 420 − 20 = 400 bytes of data (bytes 2400..2799). Total original payload = 2400 + 400 = 2800 bytes.
- AB — Reassembly is at destination only, and Identification is copied to all fragments. It is the PAYLOAD length (not Total Length, since 20 is not a multiple of 8) that must be a multiple of 8; DF=1 causes the router to drop the packet.
- C: Payload length (Total Length − Header) must be a multiple of 8; 20 + 8k is not a multiple of 8!
- D: When DF = 1, the router drops the packet and never fragments it.
- B — Fragment 2 was a middle fragment of the original datagram, so it had MF = 1 (Fragments 3 and 4 follow it). Therefore both 2a and 2b still have more bytes of the original datagram following them → both have MF = 1!
- A: 2b is the last piece of Fragment 2, NOT the last piece of the original datagram!
- C: MF=0 is only for the very last fragment of the original datagram (Fragment 4).
- D: 2a is followed by 2b, so 2a must have MF=1.
Flashcards
- Formula for maximum data payload per non-final IPv4 fragment?
Reveal answer
d_max = ⌊(MTU − H) / 8⌋ × 8 bytes. - Why must every non-final fragment have a data payload that is a multiple of 8 bytes?
Reveal answer
Because the 13-bit Fragment Offset field counts in 8-byte units (2¹⁶ / 2¹³ = 8). - Where are IPv4 fragments reassembled, and why?
Reveal answer
Only at the final destination host, because different fragments may take different paths through the network. - How do you find the original datagram payload length from the last fragment (MF = 0)?
Reveal answer
Original payload = 8 × Offset + (Total Length − Header Length).
Exam shortcuts
- How the destination knows original payload size from ONLY the last fragment: The fragment with
MF = 0has starting byte8 × Offsetand dataTotal Length − 4×HLEN, soOriginal Payload = 8 × Offset_last + Data_last! — GATE questions giving you a single fragment with MF=0 and asking for the original datagram size. - Identifying the 1st vs Last fragment:
Offset == 0 && MF == 0→ unfragmented;Offset == 0 && MF == 1→ 1st fragment;Offset > 0 && MF == 1→ middle fragment;Offset > 0 && MF == 0→ last fragment. — instant classification of any arriving packet.