Fields

Version

  • Length: 4 bits

Identifies the version of IP used.

  • IPv4 = 4 (0100)

  • IPv6 = 6 (0110)

Internet Header Length (IHL)

  • Length: 4 bits

The final field of the IPv4 header (Options) is variable in length, so this field is necessary to indicate the total length of the header.

Identifies the length of the header in 4-byte incremets.

Value of 5 = 5 * 4-bytes = 20 bytes.

Minimum value is 5 (60 bytes).

DSCP

Differentiated Services Code Point

  • Length: 6 bits

Used for QoS (Quality of Service).

Used to prioritize delay-sensitive data (streaming voice, video, etc).

ECN

Explicit Congestion Notification

  • Length: 2 bits

Provides end-to-end notification of network congestion without dropping packets.

Optional feature that requires both endpoints, as well as the underlying network infrastructure, to support it.

Total Length

  • Length: 16 bits

Indicates the toal length of the packet (L3 header + L4 segment).

Measured in bytes (not 4-bytes increments like IHL).

Minimum value of 20 (meaning a IPv4 header with no encapsulated data).

Maximum value of 65,535 (maximum of 16-bit value).

Identification

  • Length: 16 bits

If a packet is fragmented ue to being too large, this field is used to identify which packet the fragment belong to.

All fragments of the same packet will have their own IPv4 header with the same alue in this field.

Packets are fragmented if larger than the MTU.

  • The MTU is usually 1500 bytes

Flags

  • Length: 3 bits

Used to control/identify fragments.

Bit 0 - Reserved, always set to 0.

Bit 1 - Don't Fragment (DF bit), used to indicate a packet that should not be fragmented.

Bit 2 - More Fragments (MF bit), set to 1 if there are more fragments in the packet, set to 0 for the last fragment.

Offset

  • Length: 13 bits

Used to indicate the position of the fragment within the original, unfragmented IP packet.

Allows fragmented packets to be reassembled even if the fragments arrive out of order.

Time To Live

  • Length: 8 bits

A router will drop a packet with a TTL of 0.

Used to prevent infinite loops.

Originally designed to indicate the packet's maximum lifetime in seconds.

In practice, indicates a hop count: each time the packet arrives at a router, the router decreases the TTL by 1.

Protocol

  • Length: 8 bits

Indicates the protocol of the encapsulated L4PDU.

Value of 6: TCP

Value of 17: UDP

Value of 1: ICMP

Value of 89: OSPD (dynamic routing protocol)

Heaer Checksum

  • Length: 16 bits

A calculated checksum used to check for erros in the IPv4 header.

When a router receives a packet, it calculates the checksum of the heaer and compares it to the one this field of the header.

If they do not match, the router drops the packet.

Used to check for erros only in the UPv4 header.

IP relies on the encapsulated protocol to detect errors in the encapsulated data.

Both TCP and UDP have their own checksum fields to detect errors in the encapsulated data.

Source/Destination IP Address

  • Length: 32 bits (each)

Source IP Address

IPv4 address of the sender of the packet.

Destination IP Address

IPv4 address of the intended receiver of the packet.

Options

  • Length: 0 to 320 bits

Rarely used.

If the IHL field is greater than 5, it means that Options are present.

Last updated