Free tech learning for everyone, from basics to pro

Network FundamentalsNetworking SecurityIntermediate

The IPv4 packet header: TTL, fragmentation, DSCP and the protocol field explained

In short: Every IPv4 packet starts with a header of at least 20 bytes. It carries the source and destination addresses, a TTL that stops packets looping forever, fragmentation fields, a DSCP value for QoS and a protocol number that says what is inside. Knowing these fields makes packet captures and MTU problems much easier to understand.

Why learn the header?

When you open a capture in Wireshark, write a firewall rule or troubleshoot a VPN that "connects but nothing loads", you are dealing with IPv4 header fields. You don't need to memorise bit positions, but you should know what each field does and which ones change as a packet travels.

Key IPv4 header fieldsVersion, IHL4 and header lengthDSCP / ECNQoS markingTotal lengthheader + dataID, flags, offsetfragmentationTTLhop limitProtocol6 TCP, 17 UDPChecksumheader onlySource IP32 bitsDestination IP32 bits
Figure 1. The fields of the 20-byte IPv4 header. Options, rarely used, can extend it to 60 bytes.

The fields that matter most

FieldWhat it doesChanges in transit?
Version and IHLAlways 4 for IPv4; IHL gives the header length in 32-bit words (5 = 20 bytes)No
DSCP and ECNThe old Type of Service byte. 6 bits of DSCP mark traffic class for QoS (EF, value 46, for voice); 2 ECN bits signal congestion without droppingCan be re-marked at trust boundaries
Total lengthSize of header plus data in bytes, up to 65,535Only if fragmented
Identification, flags, fragment offsetLet the receiver reassemble fragments. Flags include DF (Don't Fragment) and MF (More Fragments)Set when fragmenting
Time to live (TTL)Each router subtracts 1; at 0 the packet is dropped and an ICMP Time Exceeded message is sent backYes, every hop
ProtocolWhat the payload is: 1 ICMP, 6 TCP, 17 UDP, 47 GRE, 50 ESP, 89 OSPFNo
Header checksumDetects damage to the header only (not the data)Recalculated every hop because TTL changes
Source and destination address32-bit IPv4 addressesOnly when NAT rewrites them

TTL: stopping loops and tracing paths

If a routing mistake sends a packet round in a circle, TTL guarantees it eventually dies instead of circulating forever. Operating systems start at different values (commonly 64 for Linux and macOS, 128 for Windows, 255 for many network devices), so the TTL you see in a reply gives a rough hint about the sender and how many hops away it is. Traceroute deliberately sends packets with TTL 1, 2, 3 and so on to make each router reveal itself.

Fragmentation and MTU problems

A router that must forward a packet larger than the next link's MTU has two choices. If DF is clear, it can split the packet into fragments, which the destination reassembles. If DF is set, it drops the packet and sends back ICMP "fragmentation needed" (type 3, code 4) with the MTU it can handle. Modern hosts set DF and use this feedback to find the largest size that works end to end: path MTU discovery.

Tunnels such as GRE, IPsec and PPPoE add headers, so the usable MTU inside them is smaller than 1500. If a firewall blocks the ICMP feedback, large packets silently disappear while small ones work. This "black hole" is why you should never block all ICMP. Common fixes are clamping the TCP MSS on the tunnel interface and allowing ICMP type 3.

ping 192.0.2.10 -f -l 1472        (Windows: DF set, 1472 + 28 header bytes = 1500)
ping -M do -s 1472 192.0.2.10     (Linux equivalent)
interface Tunnel0
 ip mtu 1400
 ip tcp adjust-mss 1360

Real-world example: after a site moved to a PPPoE broadband line, staff could load some web pages but others hung half-way and file uploads failed. Pings with 1472-byte packets and DF set failed while 1464 worked, because PPPoE uses 8 bytes. Setting ip tcp adjust-mss 1452 on the WAN interface solved it without touching any PC.

Practice

A packet leaves a host with TTL 64 and crosses three routers. What TTL does it arrive with?
61. Each router reduces it by one.
Why is the header checksum recalculated at every router?
Because the TTL field changes at each hop, so the old checksum would no longer be valid.
Small pings work through a VPN but large file transfers stall. What is a likely cause and fix?
An MTU or path MTU discovery problem, often because ICMP fragmentation-needed messages are blocked. Allow ICMP type 3 and clamp the TCP MSS (or lower the tunnel MTU).

Key takeaways

  • The IPv4 header is normally 20 bytes and carries addresses, TTL, protocol, DSCP and fragment fields.
  • TTL drops by one per router and stops routing loops; traceroute relies on it.
  • The protocol field identifies the payload: 1 ICMP, 6 TCP, 17 UDP, 50 ESP.
  • DF plus ICMP type 3 code 4 drives path MTU discovery; blocking that ICMP creates black holes.
  • Tunnels reduce the usable MTU, so clamp the TCP MSS on tunnel interfaces.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.