IP Protocol Structure

This page covers IPv4 and IPv6

IP Protocol Relationships

Source: IETF RFC 791

IPv4 Header Format

Source: IETF RFC 791
  • Version: 4 bits. The Version field indicates the format of the internet header
  • IHL: 4 bits. Internet Header Length is the length of the internet header in 32 bit words, and thus points to the beginning of the data. The minimum value for a correct header is 5.
  • Type of Service: 8 bits. The quality of service desired.
  • Total Length: 16 bits. Total Length is the length of the datagram, measured in octets, including internet header and data. Up to 65,535 octets.
  • Identification: 16 bits. An identifying value assigned by the sender to aid in assembling the fragments of a datagram.
  • Flags: 3 bits. 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.
  • Fragment Offset: 13 bits. This field indicates where in the datagram this fragment belongs.
  • Time to Live: 8 bits. Indicates the maximum time the datagram is allowed to remain in the internet system. If this field contains the value zero, then the datagram must be destroyed.
  • Protocol: 8 bits. Protocols are assignments: IETF RFC 1700
  • Header Checksum: 16 bits.
  • Source Address: 32 bits
  • Destination Address: 32 bits
  • Options: variable. Options may appear or not in datagrams.

IPv6 Header Format

Source: IETF RFC 8200
  • Version: 4-bit Internet Protocol version number = 6
  • Traffic Class: 8-bit Traffic Class field
  • Flow Label: 20-bit flow label
  • Payload Length: 16-bit unsigned integer; the rest of the packet following this IPv6 header, in octets
  • Next Header: the type of header immediately following the IPv6 header
  • Hop Limit: 8-bit unsigned integer. Decremented by 1 by each node that forwards the packet
  • Source Address: 128-bit address of the originator of the packet. When source is unspecified address, it must not be forwarded.
  • Destination Address: 128-bit address of the intended recipient of the packet (possibly not the ultimate recipient, if a Routing header is present).

IPv6 Extension Headers

Source: IETF RFC 8200