IPv4 Header Format and Key Fragmentation/Integrity Fields (TTL, Header Checksum, Flags, Fragment Offset)
IPv4 Header Format and Key Fragmentation/Integrity Fields (TTL, Header Checksum, Flags, Fragment Offset)
The IPv4 header is a fixed-length base header of 20 bytes (unless options are present). It contains control fields used for routing, fragmentation, and basic integrity checking. The diagram below shows the standard header layout and where the requested fields sit. 2
Key bit positions in the base header (first 20 bytes):
- TTL: 8-bit field at byte offset 8 (after Flags/Fragment Offset)
- Header Checksum: 16-bit field immediately following TTL
- Flags + Fragmentation Offset: packed into a 16-bit field split as 3-bit Flags and 13-bit Fragment Offset 2
The fields you asked about are involved in: preventing infinite routing loops (TTL), hop-by-hop header integrity (Header Checksum), controlling whether fragmentation is permitted and how fragments are reassembled (Flags), and specifying where a fragment’s payload belongs in the original datagram (Fragmentation Offset). 2
keyword
keyword IPv4 Header
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩ ↩2 ↩3 ↩4 ↩5
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩ ↩2 ↩3
From IPv4 header fields to fragmentation behavior (conceptual flow)
- 1Step 1
Each router reduces the packet's TTL by 1. If TTL reaches 0, the packet is discarded (preventing endless looping).
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
-
- 2Step 2
Because TTL changes at each hop, routers recompute the IPv4 header checksum before forwarding.
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
-
- 3Step 3
If the packet cannot fit a link (e.g., MTU constraints), fragmentation may be performed depending on the Flags field (notably the DF bit).
Footnotes
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩
-
- 4Step 4
The fragment’s Flags (e.g., MF) and Fragmentation Offset determine reassembly ordering and whether more fragments follow.
Footnotes
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩
-
- 5Step 5
Reassembly is based on the Identification and the fragment offsets; Offset units are in 8-byte blocks.
Footnotes
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩
-
IPv4 TTL field
The TTL (Time To Live) field is an 8-bit value. It is designed to limit the lifetime of an IPv4 datagram in the network so it does not circulate indefinitely. Each router decrements TTL by 1, and when TTL becomes 0, the router drops the packet (the TTL mechanism prevents routing loops from persisting forever).
What TTL changes affect:
Important learning terms:
- TTL
- hop
- router
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩ ↩2
Practical implication
Because TTL is decremented at every hop, a router must also update the IPv4 header checksum before forwarding; otherwise receivers/next hops would reject the header as corrupted.
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
IPv4 Header Checksum field
The Header Checksum field is a 16-bit checksum that covers the IPv4 header (not the payload). It is primarily used for error detection on the header while the packet moves hop-by-hop.
Since routers decrement TTL, the header changes, so the checksum must be recomputed by each router that forwards the packet.
Learning terms:
- Header Checksum
- one's complement
- integrity
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩ ↩2
Common misconception
IPv4’s header checksum is not an end-to-end checksum for the whole datagram; it is recomputed at each hop because the header (e.g., TTL) changes.
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
IPv4 Flags field (DF/MF/Reserved)
The Flags are the top 3 bits of the 16-bit “Flags + Fragment Offset” field. They control fragmentation behavior. 2
Common interpretation:
- DF (Don’t Fragment): when set, fragmentation is not allowed.
- MF (More Fragments): when set, indicates that more fragments follow.
- Reserved: typically must be zero in modern usage (its exact meaning depends on the RFC framework and must not be used for general fragment control).
Why these matter:
- If a packet is too large for a path, the system decides whether to fragment or drop (depending on DF) and indicates whether the receiver should expect additional fragments (via MF).
Learning terms:
- Flags
- DF
- MF
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩ ↩2 ↩3
IPv4 Fragmentation Offset field
The Fragmentation Offset is the lower 13 bits of the same 16-bit field as the Flags. It specifies the position of a fragment’s data within the original payload for reassembly. 2
Key details:
- The offset is measured in units of 8-byte blocks (i.e., each offset step corresponds to 8 bytes).
- The receiver uses these offsets (together with the Identification field) to place fragments in the correct order/positions during reassembly.
Learning terms:
- Fragmentation Offset
- fragment
- reassembly
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩ ↩2 ↩3
Hop-by-hop lifecycle of the requested IPv4 fields
Set base header
Packet creation (sender)Sender sets TTL initial value, computes initial header checksum, and (if needed) sets Flags + Fragment Offset." 2
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩
Decrement TTL + recompute checksum
Each router hopRouter subtracts 1 from TTL; because the header changed, it recomputes Header Checksum before forwarding."
Footnotes
-
Internet Protocol (IPv4) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Defines IPv4 header fields including TTL and Header Checksum and hop-by-hop behavior. ↩
Use Flags + Fragment Offset
Fragmentation/reassembly context (path constraints)Flags determine fragmentation policy; Fragment Offset provides placement for receiver reassembly."
Footnotes
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩
Reassemble (if fragments were sent)
ReceiverReceiver uses offsets (and identification) to reconstruct the original payload."
Footnotes
-
IP Fragmentation and Reassembly (overview of Flags and Fragment Offset bits; offset units in 8-byte blocks) — RFC 791 (https://www.rfc-editor.org/rfc/rfc791) - Specifies Flags (DF/MF/reserved) and Fragment Offset semantics/units used for reassembly. ↩
Where key fields live in the IPv4 base header (bit-level view)
Relative ordering within the first 20-byte header; helps anchor TTL, checksum, flags, and fragment offset.
IPv4 Header Basics (including TTL and checksum concepts)
Edge cases and exam-ready clarifications
IPv4 header fields: fast recall
Knowledge Check
In the IPv4 header, what is the primary function of the TTL field?
Key terms recap
Remember: TTL, Header Checksum, Flags, Fragmentation Offset.