Skip to main content

IP Header: Key Differences Between IPv4 and IPv6

IP Header

Visual Representation of IP Header Structure

In computer networking, an IP (Internet Protocol) header is a crucial part of data packets. It contains essential information required for routing and delivering the packet to its intended destination. Understanding IP headers, particularly those for IPv4 and IPv6, helps us grasp how data moves across the internet efficiently and securely.

IPv4 Header: Breaking Down the Components​

The IPv4 header is typically 20 bytes (160 bits) long without options. It can be extended up to 60 bytes (480 bits) if options are used. Let's look at each field within this header and understand its purpose.

Version (4 bits)​

Indicates the version of the IP protocol. For IPv4, this field is set to 4.

Internet Header Length (IHL) (4 bits)​

Specifies the length of the IP header in 32-bit words. The minimum value is 5 (which equals 20 bytes), and the maximum is 15 (which equals 60 bytes).

Type of Service (ToS) (8 bits)​

  • This field is used for quality of service features, such as:

    • Differentiated Services Code Point (DSCP) (6 bits): Prioritizes the packet for Quality of Service (QoS) management. For instance, VoIP calls might use a higher priority to ensure call quality.

    • Explicit Congestion Notification (ECN) (2 bits): Indicates network congestion to avoid packet loss by adjusting transmission rates without dropping packets.

Total Length (16 bits)​

Specifies the total packet size, including both the header and the data, measured in bytes.

Identification (16 bits)​

A unique identifier used to group fragments of the same IP datagram, helping the destination system reassemble the original packet.

Flags (3 bits)​

Controls fragmentation:

  • Reserved bit: Must be zero.

  • Don't Fragment (DF): If set, prevents fragmentation.

  • More Fragments (MF): If set, indicates more fragments are following.

Fragment Offset (13 bits)​

Used to identify the position of a fragment within the original packet, aiding in reassembly.

Time to Live (TTL) (8 bits)​

This value determines how long the packet can travel. Each router along the path decreases this value by 1. If it reaches 0, the packet is discarded, preventing it from circulating indefinitely.

Protocol (8 bits)​

Specifies the protocol used in the data portion of the IP datagram. Examples: 6 for TCP, 17 for UDP.

Header Checksum (16 bits)​

A checksum used for error-checking the header only. It ensures data integrity of the header.

Source IP Address (32 bits)​

The IP address of the packet's origin.

Destination IP Address (32 bits)​

The IP address of the packet's destination.

Options (variable length)​

Optional field for additional control and debugging information. Padding is used to align the header to a 32-bit boundary if options are present.

IPv6 Header: Simplified for Efficiency​

IPv6 was developed to address the limitations of IPv4, including address space exhaustion. The IPv6 header is streamlined to improve processing speed.

Version (4 bits)​

Set to 6 for IPv6.

Traffic Class (8 bits)​

Similar to IPv4's Type of Service field, this is used for QoS management, specifying packet priority.

Flow Label (20 bits)​

Used to identify and handle specific data flows, improving QoS by ensuring packets belonging to the same flow are treated consistently.

Payload Length (16 bits)​

Specifies the length of the data payload, excluding the header. This is a change from IPv4, where the total length included the header.

Next Header (8 bits)​

Identifies the type of header immediately following the IPv6 header. It could be a transport layer protocol like TCP/UDP or an extension header.

Hop Limit (8 bits)​

Similar to IPv4's TTL, it specifies the maximum number of hops. Each router along the path reduces this by 1. If it reaches 0, the packet is discarded.

Source IP Address (128 bits)​

The IP address of the packet's origin. With IPv6, the address size has increased significantly to accommodate more unique IPs.

Destination IP Address (128 bits)​

The IP address of the packet's intended recipient.