IPv4 Fragmentation: Computing Datagram Position and Payload Sequence Numbers
To solve the problem, we use the IPv4 fragmentation semantics from the IPv4 header:
- [keyword]{def="M bit"="More Fragments flag; when 1, more fragments follow, when 0, this is the last fragment"}
- [keyword]{def="HLEN (IHL)"="IPv4 Internet Header Length; number of 32-bit words in the header"}
- [keyword]{def="Fragment Offset"="13-bit value in IPv4 that specifies where this fragment’s payload begins, in units of 8 octets"}
- [keyword]{def="Total Length"="Total size of the IPv4 datagram (header + payload) in octets"}
Key rules:
- Fragment offset is measured in 8-octet blocks (i.e., multiply by 8 to get the payload’s starting byte position relative to the original datagram) 2.
- The IPv4 payload begins after the header: header length in octets is .
- The last byte of the payload is determined from when using 0-based payload indexing; for the “sequence numbers of first and last payload bytes,” we convert consistently to byte positions 2.
We’ll now compute the requested quantities (datagram position, first payload byte sequence number, last payload byte sequence number) directly from the given values.
Footnotes
-
RFC 791 (Internet Protocol) - Defines IPv4 fragmentation, including fragment offset measured in 8-octet units and the More Fragments flag. ↩ ↩2
-
[IPv4 header length (IHL) and total length meaning] (https://en.wikipedia.org/wiki/IPv4#Header) - Explains IHL as 32-bit words and Total Length as header+payload in octets. ↩ ↩2 ↩3
Compute datagram position and payload byte sequence numbers
- 1Step 1
HLEN = 10 means header length = octets.
- 2Step 2
Total length = 400 octets, so payload length = octets.
- 3Step 3
Fragment offset = 300; since it is in 8-octet units, payload start position = (bytes from the start of the original datagram payload).
- 4Step 4
M bit = 0 implies this is the last fragment (no subsequent fragments). This helps confirm the fragment’s end is final, but the numeric end still comes from Total Length.
- 5Step 5
First payload byte sequence number = payload start position = .
- 6Step 6
Last payload byte sequence number = .
Final computed values
1) Position of the datagram (fragment payload starting position)
Using IPv4 [keyword]{def="Fragment Offset"="Fragment starting position in units of 8 octets"} rule:
So, the fragment’s payload begins at byte 2400 of the original datagram payload stream 2.
2) Sequence number of the first payload byte
The first payload byte of this fragment is exactly at the payload start position:
3) Sequence number of the last payload byte
Payload length is octets, so the last byte is:
Answer (in bytes relative to original datagram payload start):
- Datagram position (payload start byte):
- First payload byte sequence number:
- Last payload byte sequence number:
Footnotes
-
RFC 791 (Internet Protocol) - Defines IPv4 fragmentation, including fragment offset measured in 8-octet units and the More Fragments flag. ↩
-
[IPv4 header length (IHL) and total length meaning] (https://en.wikipedia.org/wiki/IPv4#Header) - Explains IHL as 32-bit words and Total Length as header+payload in octets. ↩
Remember the two multipliers
IPv4 fragmentation uses two important conversions: header size is octets, while fragment offset is in 8-octet units, i.e., multiply by to get a byte position 2.
Footnotes
-
RFC 791 (Internet Protocol) - Defines IPv4 fragmentation, including fragment offset measured in 8-octet units and the More Fragments flag. ↩
-
[IPv4 header length (IHL) and total length meaning] (https://en.wikipedia.org/wiki/IPv4#Header) - Explains IHL as 32-bit words and Total Length as header+payload in octets. ↩
Be careful about the meaning of sequence numbers
The problem’s “sequence numbers of payload bytes” are interpreted as byte indices relative to the original (unfragmented) datagram payload start. With that convention, the last byte is .
Fragmentation field → payload positions workflow
Header sizing
Step AFootnotes
-
[IPv4 header length (IHL) and total length meaning] (https://en.wikipedia.org/wiki/IPv4#Header) - Explains IHL as 32-bit words and Total Length as header+payload in octets. ↩
Payload sizing
Step BFootnotes
-
[IPv4 header length (IHL) and total length meaning] (https://en.wikipedia.org/wiki/IPv4#Header) - Explains IHL as 32-bit words and Total Length as header+payload in octets. ↩
Starting offset
Step CConvert fragment offset to bytes: ."
Footnotes
-
RFC 791 (Internet Protocol) - Defines IPv4 fragmentation, including fragment offset measured in 8-octet units and the More Fragments flag. ↩
First/last payload byte indices
Step DFirst = start; Last = start + payloadLen − 1."
Computed byte index range of this IPv4 fragment payload
Relative to the original datagram payload start (byte indices).
Common checks and edge cases
Knowledge Check
In IPv4 fragmentation, the fragment offset field indicates the fragment start position in units of:
Knowledge Check
Using the values Position = 2400 and payload length = 360, the last payload byte index is: