Chapter recap
Chapter 3.2 opened the 20–60 byte IPv4 header and traced how oversized datagrams survive links with small MTUs. Remember the three scaling factors (HLEN × 4, Total Length × 1, Fragment Offset × 8), the per-hop changes (TTL − 1 and recomputed Header Checksum), and the golden rules of fragmentation (d_max = ⌊(MTU − H)/8⌋ × 8, MF = 0 only on the final piece of the original datagram, reassembly only at the destination).
Merged rule card
From 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).
From 3.2.2 IPv4 fragmentation, offsets, MF bit & multi-hop re-fragmentation
- 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.
Practice questions
- NAT · 1 mark
An IPv4 datagram has HLEN = 7 and Total Length = 528 bytes. What is the length of the data payload in bytes?
Write your answer before opening the key.
- MCQ · 1 mark
An IPv4 datagram is created with 18 bytes of options. What is the value of the 4-bit HLEN field?
- 9
- 10
- 38
- 40
- NAT · 2 marks
An IPv4 datagram of Total Length 3020 bytes (with a 20-byte header) crosses a link with MTU = 1020 bytes. What is the Fragment Offset of the 3rd (last) fragment?
Write your answer before opening the key.
- NAT · 2 marks
When a single IPv4 datagram (20-byte header, 2400-byte payload) is fragmented across a link with MTU = 820 bytes, what is the sum of the Total Length fields (in bytes) across all resulting fragments?
Write your answer before opening the key.
- MCQ · 2 marks
For a link with MTU = 550 bytes and a 20-byte IPv4 header, what is the Total Length (in bytes) of the first fragment of a 2000-byte datagram?
- 550
- 548
- 528
- 530
- MSQ · 2 marks
Which of the following statements about the IPv4 header are CORRECT?
- If the Flag bits are DF=0 and MF=0 and Fragment Offset=0, the packet is an unfragmented complete datagram.
- The IPv4 Header Checksum is recomputed at every router.
- The Identification field is incremented by 1 at every router hop.
- If TTL reaches 0 at a router, the router drops the datagram.
- NAT · 2 marks
A datagram with 2000 bytes of payload (20B header) passes through Link 1 (MTU = 1500 B) and then Link 2 (MTU = 620 B). How many fragments reach the destination?
Write your answer before opening the key.
- MCQ · 1 mark
Which forwarding table entry is chosen only when no other entry in the table matches the destination IPv4 address?
- 127.0.0.0/8
- 255.255.255.255/32
- 0.0.0.0/0
- 224.0.0.0/4
Answer key
Try the questions first. Open when you are ready to check.
- 500 — Header = 7 × 4 = 28 bytes. Payload = 528 − 28 = 500 bytes.
- B — 20B base + 18B options = 38B, padded to the next multiple of 4 → 40 bytes. HLEN = 40 / 4 = 10.
- A: 9 × 4 = 36 < 38.
- C: HLEN counts 4-byte words, not bytes.
- D: 40 is the byte length; HLEN is 40/4 = 10.
- 250 — Payload = 3000 B. MTU − H = 1000 B, which is divisible by 8 (1000 / 8 = 125). Frag 1 covers 0..999 (off=0), Frag 2 covers 1000..1999 (off=125), Frag 3 covers 2000..2999 → Offset = 2000 / 8 = 250.
- 2460 — d_max = ⌊(820 − 20)/8⌋ × 8 = 800 B → 3 fragments of 800 B payload each, plus 3 × 20 B = 60 B of headers → 2400 + 60 = 2460 bytes.
- B — MTU − H = 550 − 20 = 530 B. Largest multiple of 8 ≤ 530 is 66 × 8 = 528 B of data. Adding the 20-byte header gives Total Length = 528 + 20 = 548 bytes.
- A: 550 − 20 = 530 is not divisible by 8.
- C: 528 is the data payload length, forgetting the 20-byte header.
- D: 530 is MTU − 20.
- ABD — MF=0 & Offset=0 means complete datagram; checksum is updated because TTL decrements; TTL=0 drops the packet. Identification is fixed by the source.
- C: Identification is set by the source host and never incremented by routers.
- 4 — Link 1 (d_max=1480): splits 2000B into 1480B + 520B (2 frags). Link 2 (d_max=600): splits 1480B into 600B + 600B + 280B (3 frags), while the 520B frag (total len 540B ≤ 620B) passes untouched (1 frag). Total = 3 + 1 = 4 fragments.
- C — 0.0.0.0/0 has prefix length 0, matching every address as the fallback default route.
- A: Loopback block.
- B: Limited broadcast.
- D: Class D multicast block.