Skip to content
Explore the learning library ☟
◎ Google Translate
SanchitGurukulTechnology · Education · Innovation Take a quiz

IPv4 and IPv6 Packet Headers: In-Depth Comparison

—
IPv4 and IPv6 both operate at the Internet layer of the TCP/IP model and provide the addressing and packet-delivery mechanisms required to move data across IP networks.
Although they perform the same fundamental role, their packet headers are designed differently.
IPv4 uses a variable-length header with several fields directly related to fragmentation, header length, and header integrity.
IPv6 uses a fixed 40-byte base header and moves much of the optional functionality into separate extension headers.
Understanding these differences is important for:

  • Network troubleshooting
  • Packet analysis
  • Firewall administration
  • Routing
  • MTU troubleshooting
  • Cybersecurity
  • IDS/IPS analysis
  • Network architecture
  • IPv6 migration
ipv4 vs ipv6

—

Understanding the IPv4 Header

An IPv4 packet begins with an IPv4 header followed by its payload.
The IPv4 header has a minimum length of:
20 bytes — 160 bits
IPv4 also supports an optional Options area.
When options are present, the IPv4 header can grow to a maximum of:
60 bytes — 480 bits

IPv4 Header Structure

IPv4 Packet Header Structure

IPv4 Header Fields

Field Size Purpose
Version 4 bits Identifies the packet as IPv4
IHL 4 bits Specifies IPv4 header length
DSCP 6 bits Used for differentiated traffic treatment
ECN 2 bits Supports Explicit Congestion Notification
Total Length 16 bits Size of the complete IPv4 packet
Identification 16 bits Used for fragmentation and reassembly
Flags 3 bits Controls fragmentation behavior
Fragment Offset 13 bits Identifies a fragment’s position
TTL 8 bits Limits how many routing hops the packet can traverse
Protocol 8 bits Identifies the next protocol carried in the payload
Header Checksum 16 bits Protects the IPv4 header against transmission errors
Source Address 32 bits IPv4 address of the source
Destination Address 32 bits IPv4 address of the destination
Options Variable Carries optional IPv4 information
Padding Variable Aligns the header to a 32-bit boundary when required

Version

The Version field is 4 bits.
For IPv4:
Version = 4
Packet-processing devices can use this field to identify the IP version.

Internet Header Length — IHL

The IHL field identifies the size of the IPv4 header in units of 32-bit words.
The minimum value is:
5
Therefore:
5 × 4 bytes = 20 bytes
The maximum IHL value is:
15
Therefore:
15 × 4 bytes = 60 bytes

DSCP and ECN

The 8-bit field historically associated with the IPv4 Type of Service mechanism is used in modern IP networking for:

  • DSCP — Differentiated Services Code Point
  • ECN — Explicit Congestion Notification

DSCP can be used as part of Quality of Service policies.
ECN can signal network congestion without requiring packet loss when supported by the endpoints and network.

Total Length

The Total Length field is 16 bits and specifies the size of the complete IPv4 packet:
IPv4 Header + Payload
The maximum value represented by this field is:
65,535 bytes

Identification, Flags and Fragment Offset

These fields support IPv4 fragmentation and reassembly.
Identification
Helps associate fragments belonging to the same original IPv4 datagram.
Flags
Includes important fragmentation controls such as:

  • DF — Don’t Fragment
  • MF — More Fragments

Fragment Offset
Identifies where a fragment belongs within the original datagram.

Time To Live — TTL

TTL is an 8-bit field used to prevent packets from circulating indefinitely.
Each router forwarding the packet reduces the TTL.
If the value reaches zero, the packet is discarded.
This mechanism is also fundamental to tools such as:
traceroute

Protocol

The Protocol field identifies what follows the IPv4 header.
Common values include:

Protocol Value
ICMP 1
TCP 6
UDP 17

Header Checksum

IPv4 contains a 16-bit header checksum.
It protects only the IPv4 header, not the packet payload.
Because TTL changes as a packet crosses routers, forwarding modifies the IPv4 header, requiring appropriate checksum handling during forwarding.

Source and Destination Addresses

IPv4 provides:
32-bit Source Address
and:
32-bit Destination Address
These fields identify the IPv4 endpoints represented in the packet header.
—

Understanding the IPv6 Base Header

IPv6 redesigns the IP header.
Unlike IPv4, the IPv6 base header has a fixed length:
40 bytes — 320 bits
It contains eight primary fields.

IPv6 Base Header Structure

IPv6 Base Header Structure

IPv6 Base Header Fields

Field Size Purpose
Version 4 bits Identifies IPv6
Traffic Class 8 bits Traffic classification and congestion-related information
Flow Label 20 bits Labels packets belonging to a flow
Payload Length 16 bits Length following the IPv6 base header
Next Header 8 bits Identifies the next header
Hop Limit 8 bits Limits forwarding hops
Source Address 128 bits IPv6 source address
Destination Address 128 bits IPv6 destination address

Version

The Version field is 4 bits.
For IPv6:
Version = 6

Traffic Class

The Traffic Class field is 8 bits.
It supports traffic classification mechanisms such as DSCP and ECN.

Flow Label

IPv6 introduces a 20-bit Flow Label.
It can identify packets belonging to a particular flow so that appropriate processing can be applied.
The Flow Label should not simply be interpreted as a replacement for IPv4 QoS fields.

Payload Length

The IPv6 Payload Length field is 16 bits.
Unlike IPv4 Total Length, it normally represents the number of bytes following the fixed IPv6 base header.
This includes extension headers, when present, plus upper-layer data.

Next Header

The Next Header field is fundamental to IPv6 packet processing.
It identifies what follows the current header.
That could be:

  • TCP
  • UDP
  • ICMPv6
  • An IPv6 extension header
  • Another supported upper-layer protocol

For example, an IPv6 packet carrying TCP directly can identify TCP through its Next Header field.
When extension headers are present, the Next Header fields create a header chain.

Hop Limit

IPv6 replaces the IPv4 field name TTL with:
Hop Limit
Each forwarding router decrements the Hop Limit.
When the value reaches zero, the packet is discarded.

Source and Destination Addresses

IPv6 provides:
128-bit Source Address
and:
128-bit Destination Address
The large address fields are one of the main reasons the IPv6 base header is 40 bytes even though it contains fewer primary fields than IPv4.
—

IPv4 vs IPv6 Header Comparison

The differences become clearer when the two headers are compared directly.

Header Structure Comparison

IPv4 Header vs IPv6 Header
Feature IPv4 IPv6
Base/Minimum Header 20 bytes minimum 40 bytes fixed
Maximum Base/Header Area Up to 60 bytes with options Base header remains 40 bytes
Address Length 32 bits 128 bits
Header Length Field IHL Not required for fixed base header
Packet Length Total Length Payload Length
Traffic Classification DSCP / ECN Traffic Class
Flow Label No equivalent base-header field 20 bits
Lifetime Control TTL Hop Limit
Upper Protocol Protocol Next Header
Header Checksum Present Not present
Fragmentation Fields Present in base header Fragment extension header when needed
Options Inside IPv4 header Primarily extension headers

Field Mapping

IPv4 Concept IPv6 Equivalent / Change
Version Version
IHL Removed because base header is fixed
DSCP / ECN Traffic Class
No Flow Label Flow Label added
Total Length Payload Length
Identification Moved to Fragment Header when fragmentation is used
Flags Fragmentation-related information moved out of base header
Fragment Offset Fragment Header
TTL Hop Limit
Protocol Next Header
Header Checksum Removed
32-bit Source 128-bit Source
32-bit Destination 128-bit Destination
Options Extension-header architecture

—

IPv6 Extension Headers and Fragmentation

One of the most important architectural differences is the use of IPv6 Extension Headers.
Optional Internet-layer information can be placed between the IPv6 base header and the upper-layer protocol.

IPv6 Header Chain

IPv6 Extension Header Chain

Common extension-header types encountered in IPv6 include:

  • Hop-by-Hop Options
  • Routing
  • Fragment
  • Destination Options
  • Authentication Header

ESP is also identified through the IPv6 Next Header mechanism, although protocol specifications make distinctions about how ESP is classified when describing IPv6 header chains.

Hop-by-Hop Options Header

The Hop-by-Hop Options header carries optional information intended for processing by nodes along the delivery path according to IPv6 processing rules.
It is identified by:
Next Header = 0
Operational handling of Hop-by-Hop options requires care and should not be reduced to the assumption that every router always performs expensive processing on every such packet.

Routing Header

The Routing header provides mechanisms allowing routing-related information to be carried in an IPv6 packet.
It is identified by:
Next Header = 43
Different Routing Header types have different purposes.

Fragment Header

IPv6 removes fragmentation fields from the fixed base header.
When IPv6 fragmentation is required, the source uses a:
Fragment Header
identified by:
Next Header = 44
The Fragment Header contains information including:

  • Fragment Offset
  • M flag
  • Identification

Destination Options Header

The Destination Options header carries optional information intended for processing by specified destination nodes according to its placement in the IPv6 header chain.
It is identified by:
Next Header = 60

Authentication Header and ESP

IPsec-related protocols can also appear in IP packet processing.
AH — Authentication Header
Protocol number:
51
ESP — Encapsulating Security Payload
Protocol number:
50
IPsec can provide security services such as:

  • Integrity
  • Authentication
  • Confidentiality through ESP when encryption is used
  • Anti-replay protection when configured

IPv4 vs IPv6 Fragmentation

Fragmentation behavior is a major operational difference.

IPv4 vs IPv6 Fragmentation

With IPv4:

  • A source can fragment a datagram.
  • A router may also fragment when necessary if fragmentation is allowed.
  • The destination performs reassembly.

With IPv6:

  • Routers do not fragment packets along the delivery path.
  • Fragmentation is performed by the source node when needed.
  • IPv6 uses the Fragment extension header for fragmented traffic.
  • Path MTU handling is therefore operationally important.

RFC 8200 defines IPv6 fragmentation as a source-node function rather than a router function.

—

Packet Analysis and Troubleshooting

Understanding headers becomes much more useful when analyzing actual traffic.

Wireshark IPv4 Example

A typical IPv4 TCP packet may show:

Output / Result
Internet Protocol Version 4

Version: 4
Header Length: 20 bytes
Differentiated Services Field
Total Length
Identification
Flags
Fragment Offset
Time to Live
Protocol: TCP (6)
Header Checksum
Source Address
Destination Address

Important fields to check include:

  • Source and destination
  • TTL
  • Protocol
  • Packet length
  • DF flag
  • Fragmentation
  • DSCP
  • Header checksum status where meaningful

Wireshark IPv6 Example

A typical IPv6 TCP packet without extension headers may show:

Output / Result
Internet Protocol Version 6

Version: 6
Traffic Class
Flow Label
Payload Length
Next Header: TCP (6)
Hop Limit
Source Address
Destination Address

If extension headers exist, Wireshark displays the additional header chain before the upper-layer protocol.

Useful Wireshark Display Filters

Display IPv4 Traffic

Command
ip

Display IPv6 Traffic

Command
ipv6

Display IPv4 Fragmented Traffic

Command
ip.flags.mf == 1 || ip.frag_offset > 0

Display IPv6 Fragment Headers

Command
ipv6.nxt == 44

Display ICMPv6

Command
icmpv6

Example MTU Problem

Consider an IPv6 sender transmitting traffic toward a destination through a path containing a smaller MTU.
The intermediate IPv6 router does not fragment the oversized packet.
Instead, correct Path MTU operation allows the source to learn that a smaller packet size is required.

mtu ipv6

—

Key Differences, Advantages and Summary

Does the IPv6 Header Improve Performance?

IPv6’s base-header design removes or relocates several fields found directly in IPv4.
For example:

  • No IHL field is required because the base header is fixed.
  • No IPv6 base-header checksum is present.
  • Fragmentation information is not carried in every normal IPv6 base header.
  • Optional functionality can use extension headers.

These changes simplify the base-header processing model.
However:

IPv6 Extension Headers and Security Devices

Extension headers provide flexibility, but they also create operational considerations.
Firewalls, IDS/IPS systems, load balancers, and packet-analysis tools may need to inspect an IPv6 header chain before determining the upper-layer protocol.
Unusually complex extension-header chains can therefore create:

  • Filtering challenges
  • Visibility issues
  • Security considerations
  • Interoperability concerns

This is one reason IPv6 security policies should explicitly account for extension headers and fragmented traffic.

Final IPv4 vs IPv6 Header Comparison

Characteristic IPv4 IPv6
IP Version 4 6
Address Size 32 bits 128 bits
Header Size 20–60 bytes Fixed 40-byte base header
Header Length Field IHL Not required
Packet Length Field Total Length Payload Length
Traffic Classification DSCP / ECN Traffic Class
Flow Label No Yes
Lifetime Field TTL Hop Limit
Upper-Layer Identification Protocol Next Header
Header Checksum Yes No
Fragmentation Fields Base header Fragment extension header
Router Fragmentation Possible when permitted Not performed
Options IPv4 Options IPv6 Extension Headers
Source Address 32 bits 128 bits
Destination Address 32 bits 128 bits

Key Takeaways

  1. IPv4 has a minimum 20-byte header that can grow to 60 bytes.
  2. IPv6 uses a fixed 40-byte base header.
  3. IPv6’s header is structurally simpler but not physically smaller than the minimum IPv4 header.
  4. IPv4 contains fragmentation fields directly in its base header.
  5. IPv6 uses a separate Fragment Header when fragmentation is required.
  6. IPv6 routers do not fragment packets in transit.
  7. IPv4 contains a header checksum; the IPv6 base header does not.
  8. IPv6 replaces IPv4 TTL terminology with Hop Limit.
  9. IPv6 replaces the IPv4 Protocol field concept with the more flexible Next Header mechanism.
  10. IPv6 extension headers provide optional functionality without changing the fixed base-header size.

Summary

IPv4 and IPv6 perform the same fundamental Internet-layer role but use significantly different packet-header architectures.
IPv4 uses a variable-length header containing fields for:

  • Header length
  • Fragmentation
  • Header checksum
  • Protocol identification
  • Addressing

IPv6 uses a fixed 40-byte base header and moves optional or specialized functionality into a header-chain architecture.
The important design change is therefore not:
“IPv6 has a smaller header.”
A more accurate explanation is:

For network engineers, understanding these differences is particularly important when troubleshooting:

  • MTU problems
  • Fragmentation
  • Firewall policies
  • IPv6 extension headers
  • TCP/UDP connectivity
  • ICMPv6
  • Packet captures

The best way to understand both protocols is to examine real IPv4 and IPv6 packets in tools such as Wireshark and compare the fields directly.
—

SanchitGurukul Static Resources

Official External References

Your feedback matters

Was this post helpful?

0 reactions

SanchitGurukul — Technology • Education • Innovation

Discussion

0 approved comments

No approved comments yet. You can start the discussion below.

Leave a Comment

No login is required. Name and email are used for moderation/security. Your email is never displayed publicly. All comments require administrator approval.

This field is not used to determine whether a comment is safe.

Plain text only. File uploads, scripts, executable code, abuse and spam are not accepted.


Discover more from SanchitGurukul

Subscribe to get the latest posts sent to your email.

Keep exploring

Related guides

Namaste! I’m SG Saarthi 👋Need help learning or finding something?