Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IPv4 Packet Header

packet
0-3: "Version"
4-7: "IHL"
8-15: "Type Of Service"
16-31: "Total Length"
32-47: "Identification"
48-50: "Flags"
51-63: "Fragment Offset"
64-71: "Time to Live"
72-79: "Protocol"
80-95: "Header Checksum"
96-127: "Source Address"
128-159: "Destination Address"
160-183: "Options"
184-191: "Padding"
FieldLengthDescription
Version4 bits0100 for IPv4, 0110 for IPv6
IHL — Internet Header Length4 bitsLength of the header in 32-bit words. Minimum value is 5 (no options, no padding).
ToS — Type of Service8 bitsQuality of Service. Now used for DSCP.
Total Length16 bitsTotal packet size in bytes (header + data). 16 bits × 8 = max packet size of 65,535 bytes.
Identification16 bitsUsed to uniquely identify fragmented packets to add reassembly.
Flags3 bitsalways 0, May Fragment, More Fragments
Fragment Offset13 bitsWhere the fragment belongs. Units of 8 octets (64 bits). First fragment is set to 0.
TTL — Time to Live8 bitsPrevents routing loops. Each router decrements by 1; packet is discarded at 0.
Protocol8 bitsWhat the packet encapsulates, Ex: 1 = ICMP, 6 = TCP, 17 = UDP, 88 = EIGRP, 89 = OSPF.
Header Checksum16 bitsCovers the IP header only (not data). Recomputed at each device that processes the IP header.
Source Address32 bitsThe SA — IP address of the sending host.
Destination Address32 bitsThe DA — IP address of the destination host.
IP OptionsVariableLoose/Strict Source Routing, Record Route, Timestamp. Mostly unused, historical.
PaddingVariableEnsures the header ends on a 32-bit boundary.

Flags

  Flags:  3 bits

    Various Control Flags.

      Bit 0: reserved, must be zero
      Bit 1: (DF) 0 = May Fragment,  1 = Don't Fragment.
      Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments.

          0   1   2
        +---+---+---+
        |   | D | M |
        | 0 | F | F |
        +---+---+---+
Last Modified • Sunday, June 14, 2026. 9:31 pm UTC+00:00 • Commit: e0033bb