IPv4 Fragmentation and Header Practice
Free IPv4 practice for the CCNA, Network+ and GIAC GCIA: split a packet into fragments for a smaller MTU, or read a captured header in hex. Check my answer names the slip, such as an offset in bytes instead of 8-byte units or IHL read as bytes.
In decimal, not hex.
Fragmentation problems use a 20-byte header with no options, and every fragment but the last is as large as the MTU allows, as in RFC 791's example procedure. Addresses and values are made up for practice.
Practise the exams
GIAC GCIA lists IP headers and fragmentation as exam objectives, Network+ N10-009 covers IP types in objective 1.4 and MTU in 2.2, and CCNA 200-301 v2.0 topic 2.4 includes packet capture output. Start with the free real exam questions, then get the full pack.
Fragmentation FAQ
How do you work out the fragment offset?
Take the data bytes that come before the fragment and divide by 8. RFC 791 measures the Fragment Offset field in units of 8 octets, and the first fragment has offset 0. With a 1,500-byte MTU and a 20-byte header each full fragment carries 1,480 bytes of data, so the offsets go 0, 185, 370 and so on.
Why must the data in each fragment be a multiple of 8 bytes?
Because the offset counts 8-byte blocks. RFC 791 splits the data on an 8 octet boundary, so every fragment except the last carries a multiple of 8 bytes. With a 576-byte MTU there is room for 556 bytes, which rounds down to 552. The last fragment carries whatever is left and goes out as soon as it fits the MTU.
How many fragments does a packet need?
Subtract the 20-byte header to get the data, divide by the data each fragment carries and round up. Every fragment gets its own header, so the fragments' total lengths add up to more than the original. In RFC 791's own example, 452 bytes of data and an MTU of 280 give two fragments with total lengths 276 and 216 and offsets 0 and 32.
When is the MF flag set?
MF (More Fragments) is 1 on every fragment except the last. A whole packet has MF 0 and offset 0. When a router splits a packet that is already a fragment, the last new piece keeps the MF value that packet had, and each new offset adds the packet's own offset.
What happens when DF is set and the packet is too big?
The router drops it. RFC 792 says the gateway must discard the datagram, and RFC 1191 requires the router to send the source an ICMP Destination Unreachable message, code 4, "fragmentation needed and DF set", with the MTU of the next hop. That is how Path MTU Discovery learns the path MTU. A packet that fits the MTU goes out whole, whatever DF says.
How do I read IHL and the header length?
IHL is the low 4 bits of the first byte and counts 32-bit words, so 0x45 means version 4 and IHL 5, a 20-byte header. The smallest valid IHL is 5. IHL 6 means 24 bytes, with 4 bytes of options before the data. Total length, in bytes 2 and 3, includes the header, so the data is total length minus IHL times 4.
Where are the flags and the fragment offset in the header?
In bytes 6 and 7. The first 3 bits are the flags: a reserved bit that is always 0, then DF, then MF. The other 13 bits are the fragment offset. So 0x4000 is DF on its own, and 0x20B9 is MF with offset 0xB9, which is 185: that fragment's data starts at byte 1,480.
Which protocol numbers should I know?
The Protocol field, byte 9, names the protocol carried in the data, with numbers assigned by IANA: 1 ICMP, 6 TCP, 17 UDP, 47 GRE, 50 ESP, 51 AH and 89 OSPF. They are decimal, so 0x11 in a capture is 17, which is UDP.
Which exams cover this?
GIAC GCIA has IP Headers ("dissect IP packet headers") and Fragmentation among its exam objectives. CompTIA Network+ N10-009 lists IP types (ICMP, TCP, UDP, GRE, AH and ESP) in objective 1.4 and MTU in objective 2.2. CCNA 200-301 v2.0 topic 2.4 includes troubleshooting with packet capture output.
Sources
- IETF, RFC 791, Internet Protocol: the header format and every field (Version, IHL in 32-bit words, Total Length, flags DF and MF, Fragment Offset in 8-octet units, TTL, Protocol, header checksum, option types 0 and 1), fragmentation on 8 octet boundaries, the example fragmentation procedure and the Appendix A examples.
- IETF, RFC 792, Internet Control Message Protocol: Destination Unreachable code 4, "fragmentation needed and DF set", and that the gateway must discard a datagram it would have to fragment when DF is on.
- IETF, RFC 1191, Path MTU Discovery, section 4: the router is required to return that message, with the next-hop MTU.
- IETF, RFC 1071, Computing the Internet Checksum, section 3: the one's complement sum used to check that every header shown has a valid checksum.
- IANA, Assigned Internet Protocol Numbers (last updated 9 March 2026): 1 ICMP, 6 TCP, 17 UDP, 47 GRE, 50 ESP, 51 AH, 89 OSPFIGP.
- Exam fit: GIAC GCIA exam objectives (IP Headers, Fragmentation), CompTIA Network+ N10-009 exam objectives (1.4 and 2.2) and Cisco CCNA 200-301 v2.0 exam topics (2.4).
- Checked 20 November 2026: the drill reproduces RFC 791's Appendix A examples 1 and 2 and RFC 1071's checksum example, and an independent solver that runs RFC 791's procedure step by step agreed with it on 6,000 generated problems. The addresses, MTUs and other values are made up for practice.
Checked 20 November 2026 against RFC 791, RFC 792, RFC 1191 and the IANA protocol numbers registry.
- CalculatorSubnet mask calculatorNetwork, broadcast, host range, mask, wildcard and binary for any IPv4 address and CIDR prefix, plus subnet splitting.
- DrillSubnetting practiceUnlimited random questions at three levels, with worked answers.
- DrillNAT practiceName inside local, inside global, outside local and outside global, and read NAT translation tables.