IPv6 packet: Difference between revisions

Content deleted Content added
Hopefully clearer language in Fragmentation
m Reverted edits by 2600:100F:B1B1:DD02:0:1D:E02C:C501 (talk) (HG) (3.4.13)
 
(99 intermediate revisions by 38 users not shown)
Line 1:
{{short description|Smallest message entity exchanged using Internet Protocol version 6}}
{{Update|part=RFC8200|date=November 2017}}
An '''IPv6 packet''' is the smallest message entity exchanged via the Internet Protocol across an [[IPv6|Internet Protocol version 6 (IPv6)]] network.
 
An '''IPv6 packet''' is the smallest message entity exchanged using [[Internet Protocol version 6]] (IPv6). [[Network packet|Packet]]s consist of control information for addressing and routing and a [[payload (computing)|payload]] of user data. The control information in IPv6 packets is subdivided into a mandatory fixed [[header (computing)|header]] and optional extension headers. The payload of an IPv6 packet is typically a [[datagram]] or segment of the higher-level [[Transporttransport Layerlayer]] protocol, but may be data for an [[Internetinternet Layerlayer]] (e.g., [[ICMPv6]]) or [[Linklink Layerlayer]] (e.g., [[OSPF]]) instead.
 
IPv6 packets are typically transmitted over athe [[Linklink Layer]]layer protocol(i.e., such asover [[Ethernet]] or [[Wi-Fi]]), which encapsulates each packet in a [[frame (networking)|frame]], but. thisPackets may also be transported over a higher -layer [[tunneling protocol]], such as [[IPv4]] when using [[6to4]] or [[Teredo tunneling|Teredo]] transition technologies.
 
In contrast to IPv4, [[router (computing)|routers]] do not fragment IPv6 packets larger than the [[maximum transmission unit]] (MTU), it is the sole responsibility of the originating node. A minimum MTU of 1,280 [[octet (computing)|octets]] is mandated by IPv6, but [[Host (network)|hosts]] are "strongly recommended" to use [[Path MTU Discovery]] to take advantage of MTUs greater than the minimum.{{Ref RFC|8200}}
[[router (computing)|Router]]s do not fragment IPv6 packets, as they do for IPv4. [[Host (network)|Hosts]] are "strongly recommended"<ref name=rfc8200>{{Cite IETF|rfc=8200|title=Internet Protocol, Version 6 (IPv6) Specification|authorlink1=Steve Deering|author1=S. Deering|author2=R. Hinden|publisher=[[Internet Engineering Task Force]] (IETF)|date=July 2017}} Obsoletes RFC 2460.</ref> to implement [[Path MTU Discovery]] to take advantage of [[Maximum transmission unit|MTU]]s greater than the smallest MTU of 1280 [[octet (computing)|octets]]. A node may use the IPv6 Fragment header to fragment the packet at the source and have it reassembled at the destination(s).<ref name=rfc8200></ref>
 
Since July 2017, the [[Internet Assigned Numbers Authority]] (IANA) ishas been responsible for registering all IPv6 parameters that are used in IPv6 packet headers.<ref name=rfc8200/>
 
==Fixed header==
The fixed header starts an IPv6 packet and has a size of 40 [[octet (computing)|octets]] (320 [[bit|bits]]).<ref{{Ref name=rfc8200RFC|8200}} />The bytes of the multi-byte fields are in the [[network byte order]].
{{APHD|start|title=Fixed header format}}
It has the following format:
{{APHD|0|bits1=4|bits2=8|bits3=20|field1=Version|field2=Traffic class|field3=Flow label}}
:{| class="wikitable" style="text-align: center"
{{APHD|4|bits1=16|bits2=8|bits3=8|field1=Payload length|field2=Next header|field3=Hop limit}}
|+Fixed header format
{{APHD|8|bits1=128|field1=Source address}}
|-
{{APHD|24|bits1=128|field1=Destination address}}
! style="border-bottom:none; border-right:none;"| ''Offsets''
{{APHD|end}}
! style="border-left:none;"| [[Octet (computing)|Octet]]
;{{APHD|def|name=Version|length=4 bits|text=The constant 6 (bit sequence {{mono|0110}}).}}
! colspan="8" | 0
;{{anchor|Traffic Class field}}{{APHD|def|name=Traffic Class|length=6+2 bits|text=The bits of this field hold two values. The six most-significant bits hold the [[differentiated services field]] (DS field), which is used to classify packets.{{Ref RFC|2474}}{{Ref RFC|3260}} Currently, all standard DS fields end with a '0'&nbsp;bit. Any DS field that ends with two '1'&nbsp;bits is intended for local or experimental use.{{Ref RFC|4727}} The remaining two bits are used for [[Explicit Congestion Notification]] (ECN);{{Ref RFC|3168}} priority values subdivide into ranges: traffic where the source provides congestion control and non-congestion control traffic.}}
! colspan="8" | 1
;{{APHD|def|name=Flow Label|length=20 bits|text=A high-entropy identifier of a flow of packets between a source and destination. A flow is a group of packets, e.g., a TCP session or a media stream. The special flow label 0 means the packet does not belong to any flow (using this scheme). An older scheme identifies flow by source address and port, destination address and port, protocol (value of the last ''Next Header'' field).{{Ref RFC|6437}} It has further been suggested that the flow label be used to help detect spoofed packets.<ref>[http://tools.ietf.org/html/draft-blake-ipv6-flow-label-nonce-02 Use of the IPv6 Flow Label as a Transport-Layer Nonce to Defend Against Off-Path Spoofing Attacks]</ref>}}
! colspan="8" | 2
;{{APHD|def|name=Payload Length|length=16 bits|text=The size of the payload in octets, including any extension headers. The length is set to zero when a ''Hop-by-Hop'' extension header carries a [[#Jumbogram|Jumbo Payload]] option.{{Ref RFC|2675}}}}
! colspan="8" | 3
;{{APHD|def|name=Next Header|length=8 bits|text=Specifies the type of the next header. This field usually specifies the [[transport layer]] protocol used by a packet's payload. When extension headers are present in the packet this field indicates which extension header follows. The values are shared with those used for the IPv4 protocol field, as both fields have the same function (see [[List of IP protocol numbers]]).}}
|-
;{{APHD|def|name=Hop Limit|length=8 bits|text=Replaces the [[time to live]] field in IPv4. This value is decremented by one at each forwarding node and the packet is discarded if it becomes 0. However, the destination node should process the packet normally even if received with a hop limit of 0.}}
! style="border-top: none" | [[Octet (computing)|Octet]]
;{{APHD|def|name=Source Address|length=128 bits|text=The unicast [[IPv6 address]] of the sending node.}}
! [[Bit]]
;{{APHD|def|name=Destination Address|length=128 bits|text=The IPv6 unicast or multicast address of the destination node(s).}}
! style="width:2.6%;"| 0
In order to increase performance, and since current [[link layer]] technology and transport layer protocols are assumed to provide sufficient error detection,{{Ref RFC|1726|section=2.6}} the header has no [[checksum]] to protect it.{{Ref RFC|8200}}
! style="width:2.6%;"| 1
! style="width:2.6%;"| 2
! style="width:2.6%;"| 3
! style="width:2.6%;"| 4
! style="width:2.6%;"| 5
! style="width:2.6%;"| 6
! style="width:2.6%;"| 7
! style="width:2.6%;"| 8
! style="width:2.6%;"| 9
! style="width:2.6%;"| 10
! style="width:2.6%;"| 11
! style="width:2.6%;"| 12
! style="width:2.6%;"| 13
! style="width:2.6%;"| 14
! style="width:2.6%;"| 15
! style="width:2.6%;"| 16
! style="width:2.6%;"| 17
! style="width:2.6%;"| 18
! style="width:2.6%;"| 19
! style="width:2.6%;"| 20
! style="width:2.6%;"| 21
! style="width:2.6%;"| 22
! style="width:2.6%;"| 23
! style="width:2.6%;"| 24
! style="width:2.6%;"| 25
! style="width:2.6%;"| 26
! style="width:2.6%;"| 27
! style="width:2.6%;"| 28
! style="width:2.6%;"| 29
! style="width:2.6%;"| 30
! style="width:2.6%;"| 31
|-
! 0
! 0
| colspan="4"|''Version''
| colspan="8"|''Traffic Class''
| colspan="20"|''Flow Label''
|-
! 4
! 32
| colspan="16"|''Payload Length''
| colspan="8"|''Next Header''
| colspan="8"|''Hop Limit''
|-
! 8
! 64
| colspan="32" rowspan="4"|''Source Address''
|-
! 12
! 96
|-
! 16
! 128
|-
! 20
! 160
|-
! 24
! 192
| colspan="32" rowspan="4"|''Destination Address''
|-
! 28
! 224
|-
! 32
! 256
|-
! 36
! 288
|}
 
==Extension headers==
; ''Version'' (4 bits): The constant 6 (bit sequence <tt>0110</tt>).
Extension headers carry optional [[internet layer]] information and are placed between the fixed header and the upper-layer protocol header.<ref name=rfc8200 /> Extension headers form a chain, using the ''Next Header'' fields. The ''Next Header'' field in the fixed header indicates the type of the first extension header; the ''Next Header'' field of the last extension header indicates the type of the upper-layer protocol header in the payload of the packet. All extension headers are a multiple of 8 octets in size; some extension headers require internal padding to meet this requirement.
; ''Traffic Class'' (6+2 bits) : The bits of this field hold two values. The six most-significant bits hold the [[Differentiated Services]] (DS) field, which is used to classify packets.<ref name=rfc2474>{{Cite IETF|rfc=2474|author=K. Nickols|author2=S. Blake|authorlink3=Fred Baker (IETF chair)|author3=F. Baker|author4=D. Black|date=December 1998|title=Definition of the Differentiated Service Field (DS Field) in the IPv4 and IPv6 Headers}}</ref><ref name=rfc3260>{{Cite IETF|rfc=3260|author=D. Grossman|date=April 2002|title=New Terminology and Clarifications for DiffServ}}</ref> Currently, all standard DS fields end with a '0'&nbsp;bit. Any DS field that ends with two '1'&nbsp;bits is intended for local or experimental use.<ref name=rfc4727></ref>
: The remaining two bits are used for [[Explicit Congestion Notification]] (ECN);<ref name=rfc3168>{{Cite IETF|rfc=3168|author=K. Ramakrishnan|author2=S. Floyd|author3=D. Black|date=September 2001|title=The Addition of Explicit Congestion Notification (ECN) to IP}}</ref> priority values subdivide into ranges: traffic where the source provides congestion control and non-congestion control traffic.
; ''Flow Label'' (20 bits): Originally created for giving [[real-time computing|real-time applications]] special service.<ref name=rfc8200 /> When set to a non-zero value, it serves as a hint to routers and switches with multiple outbound paths that these packets should stay on the same path, so that they will not be reordered.<ref name=rfc3595>{{Cite IETF|rfc=3595|author=B. Wijnen|date=September 2003|title=Textual Conventions for IPv6 Flow Label}}</ref><ref name=rfc6437>{{Cite IETF|rfc=6437|author=S. Amante|author2=B. Carpenter|author3=S. Jiang|author4=J. Rajahalme|date=November 2011|title=IPv6 Flow Label Specification}}</ref> It has further been suggested that the flow label be used to help detect spoofed packets.<ref>[http://tools.ietf.org/html/draft-blake-ipv6-flow-label-nonce-02 draft-blake-ipv6-flow-label-nonce-02]</ref>
; ''Payload Length'' (16 bits): The size of the payload in octets, including any extension headers. The length is set to zero when a ''Hop-by-Hop'' extension header carries a [[#Jumbogram|Jumbo Payload]] option.<ref name=rfc2675>{{Cite IETF|rfc=2675|author=D. Borman|authorlink2=Steve Deering|author2=S. Deering|author3=R. Hinden|date=August 1999|title=IPv6 Jumbograms}}</ref>
; ''Next Header'' (8 bits): Specifies the type of the next header. This field usually specifies the [[transport layer]] protocol used by a packet's payload. When extension headers are present in the packet this field indicates which extension header follows. The values are [[List of IP protocol numbers|shared]] with those used for the IPv4 protocol field, as both fields have the same function (see [[List of IP protocol numbers]]).
; ''Hop Limit'' (8 bits): Replaces the [[time to live]] field of IPv4. This value is decremented by one at each forwarding node and packet discarded if it becomes 0. However destination node should process the packet normally even if hop limit becomes 0.
; ''Source Address'' (128 bits): The [[IPv6 address]] of the sending node.
; ''Destination Address'' (128 bits): The IPv6 address of the destination node(s).
 
There are several extension headers defined, and new extension headers may be defined in the future. Most extension headers are examined and processed at the packet's destination. ''Hop-by-Hop Options'' can be processed and modified by intermediate nodes and, if present, must be the first extension. All extension headers are optional and should appear at most once, except for the ''Destination Options'' header extension, which may appear twice.<ref name=rfc8200 />
In order to increase performance, and since current [[link layer]] technology and transport or application layer protocols are assumed to provide sufficient error detection,<ref name=rfc1726>{{Cite IETF|rfc=1726|author=C. Partridge|author2=F. Kastenholz|date=December 1994|title=Technical Criteria for Choosing IP The Next Generation (IPng)|section=6.2}}</ref> the header has no [[checksum]] to protect it.<ref name=rfc8200/>
 
==Extension headers==
Extension headers carry optional [[Internet Layer]] information, and are placed between the fixed header and the upper-layer protocol header.<ref name=rfc8200 /> The headers form a chain, using the ''Next Header'' fields. The ''Next Header'' field in the fixed header indicates the type of the first extension header; the ''Next Header'' field of the last extension header indicates the type of the upper-layer protocol header in the payload of the packet.
 
If a node does not recognize a specific extension header, it should discard the packet and send a ''Parameter Problem'' message ([[ICMPv6]] type 4, code 1).<ref name=rfc8200 />
All extension headers are a multiple of 8 octets in size; some extension headers require internal padding to meet this requirement.
 
There are several extension headers defined,<ref name=rfc8200 /> and new extension headers may be defined in the future. Extension headers are to be examined and processed at the packet's destination only, except for ''Hop-by-Hop Options'', which need to be processed at every intermediate node on the packet's path, including sending and receiving node. The defined extension headers below are listed in the preferred order, shouldfor the case where there beis more than one extension header following the fixed header. Note that all extension headers are optional and should only appear at most once, except for the ''Destination Options'' header, which may appear twice.
 
{| class="wikitable" <!-- Listed in order as recommended by RFC8200 -->
If a node does not recognize a specific extension header, it should discard the packet and send a ''Parameter Problem'' message ([[ICMPv6]] type 4, code 1).<ref name=rfc8200 /> When a Next Header value <tt>0</tt> appears in a header other than the fixed header a node should do the same.
:{| class="wikitable" <!-- Listed in order as recommended by RFC8200 -->
|-
! Extension Headerheader
! [[List of IP protocol numbers|TypeNext Header field value]]
! Description
|-
| ''[[IPv6 packet#Hop-by-hop options and destination options|Hop-by-Hop Options]]''
| | 0 || Options that need to be examined by all devices on the path.
|-
| ''[[IPv6 packet#Hop-by-hop options and destination options|Destination Options]]'' (before routing header) <!-- May appear twice in the chain of headers. -->
| | 60 || Options that need to be examined only by the destination of the packet.
|-
| ''[[IPv6 packet#Routing|Routing]]''
| | 43 || Methods to specify the route for a datagram (used with [[Mobile IPv6]]).
|-
| ''[[IPv6 packet#Fragment|Fragment]]''
| | 44 || Contains parameters for fragmentation of datagrams.
|-
| ''[[IPv6 packet#Authentication Header (AH) and Encapsulating Security Payload (ESP)|Authentication Header (AH)]]''
| | 51 || Contains information used to verify the authenticity of most parts of the packet.
|-
| ''[[IPv6 packet#Authentication Header (AH) and Encapsulating Security Payload (ESP)|Encapsulating Security Payload (ESP)]]''
| | 50 || Carries encrypted data for secure communication.
|-
| ''[[IPv6 packet#Hop-by-hop options and destination options|Destination Options]]'' (before upper-layer header) <!-- May appear twice in the chain of headers. -->
| | 60 || Options that need to be examined only by the destination of the packet.
|-
| ''Mobility'' (currently without upper-layer header) <!-- RFC 6275 -->
| | 135 || Parameters used with [[Mobile IPv6]].
|-
| ''Host Identity Protocol'' || 139 || Used for [[Host Identity Protocol]] version 2 (HIPv2).<ref name=rfc7401>{{CiteRef IETFRFC|rfc=7401|title=Host Identity Protocol Version 2 (HIPv2)|editor=R. Moskowitz|author1=T. Heer|author2=P. Jokela|author3=T. Henderson|date=April 2015|publisher=[[Internet Engineering Task Force]] (IETF)|issn=2070-1721}}</ref>
|-
| ''Shim6 Protocol'' || 140 || Used for [[Shim6]].<ref name=rfc5533>{{CiteRef IETFRFC|rfc=5533|title=Shim6: Level 3 Multihoming Shim Protocol for IPv6|author1=E. Nordmark|author2=M. Bagnulo}}
|date=June 2009|publisher=Networking Working Group}}</ref>
|-
| Reserved || 253 || Used for experimentation and testing{{Ref RFC|3692}}{{Ref RFC|4727}}
| Reserved || 253 || Used for experimentation and testing.<ref name=rfc3692>{{Cite IETF|rfc=3692|title=Assigning Experimental and Testing Numbers Considered Useful|author=T. Narten|date=January 2004|publisher=Network Working Group}} BCP 82. Updates RFC 2434.</ref><ref name=rfc4727>{{Cite IETF|rfc=4727|title=Experimental Values in IPv4, IPv6, ICMPv4, ICMPv6, UDP, and TCP Headers|author=B. Fenner|publisher=Network Working Group|date=November 2006}}</ref>
|-
| Reserved || 254 || Used for experimentation and testing.<ref name=rfc3692/><ref name=rfc4727/>
|}
 
Value 59 (No Next Header) in the Next Header field indicates that there is no next header ''whatsoever'' following this one, not even a header of an upper-layer protocol. It means that, from the header's point of view, the IPv6 packet ends right after it: the payload should be empty. There could, however, still be data in the payload if the payload length in the first header of the packet is greater than the length of all extension headers in the packet. This data should be ignored by hosts, but passed unaltered by routers.<ref name=rfc8200/>{{rp|4.7}}
There could, however, still be data in the payload if the payload length in the first header of the packet is greater than the length of all extension headers in the packet. This data should be ignored by hosts, but passed unaltered by routers.
 
===Hop-by-hop options and destination options===
{{anchor|hop-by-hop options|destination options}}
The ''Hop-by-Hop Options'' extension header needs to be examined by all nodes on the packet's path, including sending and receiving nodes. The ''Destination Options'' extension header need to be examined by the destination node(s) only. The extension headers are both at least 8 octets in size; if more options are present than will fit in that space, blocks of 8 octets are added to the header repeatedly—containing options and padding—until all options are represented.
The ''Hop-by-Hop Options'' extension header may be examined and altered by all nodes on the packet's path, including sending and receiving nodes. (For authentication, option values that may change along the path are ignored.) The ''Destination Options'' extension header needs to be examined by the destination node(s) only. The extension headers are both at least 8 octets in size; if more options are present than will fit in that space, blocks of 8 octets, containing options and padding, are added to the header repeatedly until all options are represented.
:{| class="wikitable" style="text-align: center"
{{APHD|+start|title=''Hop-by-Hop Options'' and ''Destination Options'' extension header format}}
{{APHD|0|bits1=8|bits2=8|bits3=16|field1=Next header|field2=Header extension length|field3=Options and padding}}
|-
{{APHD|4|bits1=32|field1=Options and padding}}
! style="border-bottom:none; border-right:none;"| ''Offsets''
{{APHD|8|bits1=0|background1=linen|field1=Optional: more Options and padding}}
! style="border-left:none;"| Octet
{{APHD|end}}
! colspan="8" | 0
;{{APHD|def|name=Next Header|length=8 bits|text=Specifies the [[List of IP protocol numbers|type]] of the next header.}}
! colspan="8" | 1
;{{APHD|def|name=Header extension length|length=8 bits|text=Length of this header in 8-octet units, not including the first 8 octets.}}
! colspan="8" | 2
;{{APHD|def|name=Options and padding|length=variable|text=Contains one or more options, and optional padding fields to align options and to make the total header length a multiple of 8 octets. Options are [[Type–length–value|TLV]]-coded.}}
! colspan="8" | 3
|-
! style="border-top: none" | Octet
! Bit
! style="width:2.6%;"| 0
! style="width:2.6%;"| 1
! style="width:2.6%;"| 2
! style="width:2.6%;"| 3
! style="width:2.6%;"| 4
! style="width:2.6%;"| 5
! style="width:2.6%;"| 6
! style="width:2.6%;"| 7
! style="width:2.6%;"| 8
! style="width:2.6%;"| 9
! style="width:2.6%;"| 10
! style="width:2.6%;"| 11
! style="width:2.6%;"| 12
! style="width:2.6%;"| 13
! style="width:2.6%;"| 14
! style="width:2.6%;"| 15
! style="width:2.6%;"| 16
! style="width:2.6%;"| 17
! style="width:2.6%;"| 18
! style="width:2.6%;"| 19
! style="width:2.6%;"| 20
! style="width:2.6%;"| 21
! style="width:2.6%;"| 22
! style="width:2.6%;"| 23
! style="width:2.6%;"| 24
! style="width:2.6%;"| 25
! style="width:2.6%;"| 26
! style="width:2.6%;"| 27
! style="width:2.6%;"| 28
! style="width:2.6%;"| 29
! style="width:2.6%;"| 30
! style="width:2.6%;"| 31
|-
! 0
! 0
| colspan="8"|''Next Header
| colspan="8"|''Hdr Ext Len
| colspan="16"|''Options and Padding''
|-
! 4
! 32
| colspan="32"|''Options and Padding''
|-
! 8
! 64
| colspan="32" rowspan=2|Optional: more ''Options and Padding'' ...
|-
! 12
! 96
|}
; ''Next Header'' (8 bits) : Specifies the [[List of IP protocol numbers|type]] of the next header.
; ''Hdr Ext Len'' (8 bits) : Length of this header in 8-octet units, not including the first 8 octets.
; ''Options'' (variable) : Contains one or more options, and optional padding fields to align options and to make the total header length a multiple of 8 octets. Options are [[Type-length-value|TLV]]-coded.
 
===Routing===
The ''Routing'' extension header is used to direct a packet to one or more intermediate nodes before being sent to its destination. The header is at least 8 octets in size; if more ''Type-specific Data'' is needed than will fit in 4 octets, blocks of 8 octets are added to the header repeatedly, until all ''Type-specific Data'' is placed.<ref name=rfc8200/>
{{APHD|start|title=''Routing'' extension header format}}
:{| class="wikitable" style="text-align: center"
{{APHD|0|bits1=8|bits2=8|bits3=8|bits4=8|field1=Next header|field2=Header extension length|field3=Routing type|field4=Segments left}}
|+''Routing'' extension header format
{{APHD|4|bits1=32|field1=Type-specific data}}
|-
{{APHD|8|bits1=0|background1=linen|field1=Optional: more type-specific data...}}
! style="border-bottom:none; border-right:none;"| ''Offsets''
{{APHD|end}}
! style="border-left:none;"| Octet
;{{APHD|def|name=Next header|length=8 bits|text=Indicates the type of the next header.}}
! colspan="8" | 0
;{{APHD|def|name=Header extension length|length=8 bits|text=The length of this header, in multiples of 8 octets, not including the first 8 octets.}}
! colspan="8" | 1
;{{APHD|def|name=Routing type|length=8 bits|text=A value between 0 and 255, as assigned by [[IANA]].<ref name=iana_routing_options>{{Cite web|url=https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml|title=Internet Protocol Version 6 (IPv6) Parameters: Routing Types|publisher=[[IANA]]|access-date=2021-10-15}}</ref>}}
! colspan="8" | 2
! colspan="8" | 3
|-
! style="border-top: none" | Octet
! Bit
! style="width:2.6%;"| 0
! style="width:2.6%;"| 1
! style="width:2.6%;"| 2
! style="width:2.6%;"| 3
! style="width:2.6%;"| 4
! style="width:2.6%;"| 5
! style="width:2.6%;"| 6
! style="width:2.6%;"| 7
! style="width:2.6%;"| 8
! style="width:2.6%;"| 9
! style="width:2.6%;"| 10
! style="width:2.6%;"| 11
! style="width:2.6%;"| 12
! style="width:2.6%;"| 13
! style="width:2.6%;"| 14
! style="width:2.6%;"| 15
! style="width:2.6%;"| 16
! style="width:2.6%;"| 17
! style="width:2.6%;"| 18
! style="width:2.6%;"| 19
! style="width:2.6%;"| 20
! style="width:2.6%;"| 21
! style="width:2.6%;"| 22
! style="width:2.6%;"| 23
! style="width:2.6%;"| 24
! style="width:2.6%;"| 25
! style="width:2.6%;"| 26
! style="width:2.6%;"| 27
! style="width:2.6%;"| 28
! style="width:2.6%;"| 29
! style="width:2.6%;"| 30
! style="width:2.6%;"| 31
|-
! 0
! 0
| colspan="8"|''Next Header''
| colspan="8"|''Hdr Ext Len''
| colspan="8"|''Routing Type''
| colspan="8"|''Segments Left''
|-
! 4
! 32
| colspan="32"|''Type-specific Data''
|-
! 8
! 64
| colspan="32" rowspan="2"|Optional: more ''Type-specific Data'' ...
|-
! 12
! 96
|}
; ''Next Header'' (8 bits): Indicates the type of the next header.
; ''Hdr Ext Len'' (8 bits): The length of this header, in multiples of 8 octets, not including the first 8 octets.
; ''Routing Type'' (8 bits): A value between 0 and 255, as assigned by [[IANA]].<ref name=iana_routing_options>{{Cite web|url=https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml|title=Internet Protocol Version 6 (IPv6) Parameters: Routing Types|publisher=[[IANA]]|accessdate=2017-11-17}}</ref>
:{| class="wikitable" style="text-align: left"
!| Type
Line 303 ⟶ 103:
| 0
| Deprecated
| Due to the fact that with Routing Header type 0 a simple but effective [[denial-of-service attack]] could be launched,<ref>{{cite web |url=http://www.secdev.org/conf/IPv6_RH_security-csw07.pdf |title=IPv6 Routing Header Security |author=Philippe Biondi, Arnoud Ebalard |date=April 2007 |publisher=[[EADS]] |quote=Type 0: the evil mechanism... |accessdateaccess-date=3 December 2010}}</ref> [[denial-of-servicethis attack]]header couldwas bedeprecated launched,in 2007 and host and routers are required to ignore these headers.{{Ref RFC|5095}}
this header is deprecated since 2007<ref name=rfc5095>{{Cite IETF|rfc=5095|author=J. Abley|author2=P. Savola|author3=G. Neville-Neil|date=December 2007|title=Deprecation of Type 0 Routing Headers in IPv6}}</ref> and host and routers are required to ignore these headers.
|-
| 1
| Deprecated
| Used for the Nimrod<ref name=rfc1992>project{{CiteRef IETFRFC|rfc=1992|author=I. Castineyra|author2=N. Chiappa|author3=M. Steenstrup|date=August 1996|title=The Nimrod Routing Architecture}}</ref> project funded by [[DARPA]]. It iswas deprecated sincein 2009.
|-
| 2
| Allowed
| A limited version of type 0 and is used for [[Mobile IPv6]], where it can hold the Homehome Addressaddress of the Mobilemobile Nodenode.
|-
| 3
| Allowed
| RPL Source Route Header{{Ref RFC|6554}} for low-power and lossy networks.
| RPL Source Route Header<ref name=rfc6554>{{Cite IETF|rfc=6554|title=An IPv6 Routing Header for Source Routes with the Routing Protocol for Low-Power and Lossy Networks (RPL)|author1=J. Hui|author2=JP. Vasseur|author3=D. Culler|author4=V. Manral|publisher=[[Internet Engineering Task Force]] (IETF)|date=March 2012}}</ref> for Low-Power and Lossy Networks.
|-
| 4
| 253 || Private Use
| Allowed
| Segment Routing Header (SRH).{{Ref RFC|8754}}
|-
| 253 || Private use
| May be used for testing, not for actual implementations. ''RFC3692-style Experiment 1''.<ref name=rfc3692></ref>
|-
| 254 || Private Useuse
| May be used for testing, not for actual implementations. ''RFC3692-style Experiment 2''.<ref name=rfc3692></ref>
|}
; ''{{APHD|def|name=Segments Left'' (|length=8 bits): |text=Number of nodes this packet still has to visit before reaching its final destination.}}
; ''{{APHD|def|name=Type-specific Data'' (|length=variable): |text=Data that belongs to this type of routing header.}}
 
===Fragment===
In order to send a packet that is larger than the path [[Maximum transmission unit|MTU]], the sending node splits the packet into fragments. The ''Fragment'' extension header carries the information necessary to reassemble the original (unfragmented) packet.<ref{{Ref name=rfc8200/>RFC|8200}}
{{APHD|start|title=''Fragment'' extension header format}}
:{| class="wikitable" style="text-align: center"
{{APHD|0|bits1=8|bits2=8|bits3=13|bits4=2|field1=Next Header|field2=Reserved|field3=Fragment offset|field4=Res|hint4=Reserved2|field5=M|hint5=M Flag}}
|+''Fragment'' extension header format
{{APHD|4|bits1=32|field1=Identification}}
|-
{{APHD|end}}
! style="border-bottom:none; border-right:none;"| ''Offsets''
;{{APHD|def|name=Next header|length=8 bits|text=Identifies the type of the next header.}}
! style="border-left:none;"| Octet
;{{APHD|def|name=Reserved|length=8 bits|constraint=Reserved == 0|text=Initialized to all zeroes.}}
! colspan="8" | 0
;{{APHD|def|name=Fragment offset|length=13 bits|text=Offset, in 8-octet units, relative to the start of the fragmentable part of the original packet.}}
! colspan="8" | 1
;{{APHD|def|name=Reserved2|short=Res|length=2 bits|constraint=Res == 0|text=Reserved; initialized to zeroes.}}
! colspan="8" | 2
;{{APHD|def|name=M Flag|short=M|length=1 bit|text=1 means more fragments follow; 0 means last fragment.}}
! colspan="8" | 3
;{{APHD|def|name=Identification|length=32 bits|text=Packet identification value, generated by the source node. Needed for reassembly of the original packet.}}
|-
! style="border-top: none" | Octet
! Bit
! style="width:2.6%;"| 0
! style="width:2.6%;"| 1
! style="width:2.6%;"| 2
! style="width:2.6%;"| 3
! style="width:2.6%;"| 4
! style="width:2.6%;"| 5
! style="width:2.6%;"| 6
! style="width:2.6%;"| 7
! style="width:2.6%;"| 8
! style="width:2.6%;"| 9
! style="width:2.6%;"| 10
! style="width:2.6%;"| 11
! style="width:2.6%;"| 12
! style="width:2.6%;"| 13
! style="width:2.6%;"| 14
! style="width:2.6%;"| 15
! style="width:2.6%;"| 16
! style="width:2.6%;"| 17
! style="width:2.6%;"| 18
! style="width:2.6%;"| 19
! style="width:2.6%;"| 20
! style="width:2.6%;"| 21
! style="width:2.6%;"| 22
! style="width:2.6%;"| 23
! style="width:2.6%;"| 24
! style="width:2.6%;"| 25
! style="width:2.6%;"| 26
! style="width:2.6%;"| 27
! style="width:2.6%;"| 28
! style="width:2.6%;"| 29
! style="width:2.6%;"| 30
! style="width:2.6%;"| 31
|-
! 0
! 0
| colspan="8"|''Next Header''
| colspan="8"|''Reserved''
| colspan="13"|''Fragment Offset''
| colspan="2"|''Res''
| colspan="1"|''M''
|-
! 4
! 32
| colspan="32"|''Identification''
|}
; ''Next Header'' (8 bits): Identifies the type of the next header.
; ''Reserved'' (8 bits): Initialized to all zeroes.
; ''Fragment Offset'' (13 bits): Offset, in 8-octet units, relative to the start of the fragmentable part of the original packet.
; ''Res'' (2 bits): Reserved; initialized to zeroes.
; ''M Flag'' (1 bit): 1 means more fragments follow; 0 means last fragment.
; ''Identification'' (32 bits): Packet identification value, generated by the source node. Needed for reassembly of the original packet.
 
===Authentication Header (AH) and Encapsulating Security Payload (ESP)===
The ''[[IPsec#Authentication Header|Authentication Header]]'' and the ''[[IPsec#Encapsulating Security Payload|Encapsulating Security Payload]]'' are part of [[IPsec]] and are used identically in IPv6 and in IPv4.<ref name=rfc4302>{{CiteRef IETFRFC|rfc=4302|author=S. Kent|date=December 2005|title=IP Authentication Header}}</ref><ref name=rfc4303>{{CiteRef IETFRFC|rfc=4302|author=S. Kent|date=December 2005|title=IP Encapsulating Security Payload4303}}</ref>
 
==Payload==
The fixed and optional IPv6 headers are followed withby the ''upper-layer payload'', the data provided by the transport layer, for example a [[Transmission Control Protocol|TCP]] segment or a [[User Datagram Protocol|UDP]] datagram. The ''Next Header'' field of the last IPv6 header indicates what type of payload is contained in this packet.
 
===Standard payload length===
The [[#Fixed header|payload length field of IPv6]] (and [[IPv4#Header|IPv4]]) has a size of 16&nbsp;bits, capable of specifying a maximum length of [[65535 (number)|{{Val|65535}}]] octets for the payload. In practice, hosts determine the maximum usable payload length using [[Path MTU Discovery]] (yielding the minimum [[maximum transmission unit|MTU]] along the path from sender to receiver), to avoid having to fragment packets. Most link-layer protocols have MTUs considerably smaller than {{Val|65535}} octets.
Most [[Link Layer]] protocols have MTUs considerably smaller than {{Val|65535}} octets.
 
===Jumbogram===
 
{{See also|Jumbogram#IPv6 jumbograms}}
 
An optional feature of IPv6, the ''jumbo payload'' option in a ''Hop-By-Hop Options'' extension header,<ref name=rfc2675/> allows the exchange of packets with payloads of up to one octet less than 4{{nbsp}}[[Gigabyte|GB]] (2<sup>32</sup>{{nbsp}}−{{nbsp}}1{{nbsp}}= [[4294967295 (number)|{{Val|4294967295}}]] octets), by making use of a 32-bit length field. Packets with such payloads are called [[jumbogram]]s.
 
Since both [[Transmission Control Protocol|TCP]] and [[User Datagram Protocol|UDP]] include fields limited to 16&nbsp;bits (length, urgent data pointer), support for IPv6 jumbograms requires modifications to the [[Transporttransport Layer]]layer protocol implementation.<ref name=rfc2675 /> Jumbograms are only relevant for links that have a [[maximum transmission unit|MTU]] larger than {{Val|65583}} octets <!-- The RFC mentions 65575 octets (payload + fixed header) but ignores the fact that you need a Hop-by-Hop extension header to enable payloads over 65535 octets. -->(more than {{Val|65535}} octets for the payload, plus 40 octets for the fixed header, plus 8 octets for the ''Hop-by-Hop'' extension header). Only a few link-layer protocols can process packets larger than {{Val|65535}} octets.{{Citation needed|date=July 2010}}
Only few Link Layer protocols can process packets larger than {{Val|65535}} octets.{{Citation needed|date=July 2010}}
 
==Fragmentation==
Unlike in IPv4, IPv6 [[router (computing)|router]]s (intermediate nodes) never fragment IPv6 packets. Packets exceeding the size of the [[Maximummaximum transmission unit]] (or MTU) of the destination link are dropped and this condition is signaled by a ''Packet too Bigbig'' [[ICMPv6]] type 2 message to the originating node, similarly to the IPv4 method when the [[IPv4#Flags|''Don't Fragment]]'' bit]] is set.<ref name=rfc8200 /> End nodes in IPv6 are expected to perform [[Path MTU Discovery]] to determine the maximum size of packets to send, and the upper-layer protocol is expected to limit the payload size. If the upper-layer protocol is unable to do so, the sending host may use the [[IPv6 packet#Fragment|''Fragment'' extension header]] instead.
 
However, if the upper-layer protocol is unable to do so, the ''sending host'' may use the [[IPv6 packet#Fragment|Fragment extension header]] in order to perform end-to-end fragmentation of IPv6 packets. Any data link layer conveying IPv6 data must at least be capable of deliveringtransmitting an IP packet containing up to 12801,280 bytes, thus the sending endpoint may limit its packets to 12801,280 bytes and avoid any need for [[fragmentation or Path MTU Discovery]] or fragmentation.
 
===Fragmenting===
A packet containing athe first fragment of an original (larger) packet consists of twofive parts: the unfragmentableper-fragment part ofheaders (the crucial original packetheaders (whichthat isare repeatedly used in each fragment), followed by the same''Fragment'' forextension header containing a zero Offset, then all fragmentsthe remaining original extension headers, then the original upper-layer header (alternatively the ESP header), and a piece of the fragmentableoriginal partpayload.<ref name=rfc8200 /> Each subsequent packet consists of three parts: the originalper-fragment packetheaders, identifiedfollowed by athe ''Fragment'' Offset.extension header, Theand Fragmentby Offseta part of the firstoriginal ("leftmost")payload fragmentas isidentified 0by a Fragment Offset.<ref name=rfc8200></ref>
 
The unfragmentableper-fragment partheaders ofare adetermined packetbased consistson ofwhether the fixedoriginal contains ''Routing'' or ''Hop-by-Hop'' extension header. andIf someneither ofexists, the per-fragment part is just the fixed header. If the ''Routing'' extension headersheader ofexists, the originalper-fragment packetheaders (ifinclude present):the fixed header and all the extension headers up to and including the ''Routing'' extensionone. header, or elseIf the ''Hop-by-Hop'' extension header. Ifexists, neitherthe extensionper-fragment headers areconsist present,of only the unfragmentablefixed partheader is justand the fixed''Hop-by-Hop'' extension header.
 
TheIn ''Nextany Header'' value ofcase, the last (extension) header of the unfragmentableper-fragment part ishas its ''Next Header'' value set to <tt>{{mono|44</tt>}} to indicate that a ''Fragment'' extension header follows. After theEach ''Fragment'' extension header ahas fragmentits of''M'' flag set to {{mono|1}} (indicating more fragments follow), except the restlast, whose flag is set to {{mono|0}}. Each fragment's length is a multiple of the8 originaloctets, packetexcept, followspotentially, the last fragment.
 
The per-fragment headers were historically called the "unfragmentable part", referring to pre-2014 possibility of fragmenting the rest of the header. Now no headers are actually fragmentable.{{Ref RFC|7112}}
The first fragment(s) hold the rest of the extension headers (if present). After that the rest of the payload follows. Each fragment is a multiple of 8 octets in length, except the last fragment.
 
Each ''Fragment'' extension header has its ''M'' flag set to <tt>1</tt> (indicating more fragments follow), except the last, whose flag is set to <tt>0</tt>.
 
===Reassembly===
The original packet is reassembled by the receiving node by collecting all fragments and placing each fragment at theits rightindicated offset and discarding the ''Fragment'' extension headers of the packets that carried them. Packets containing fragments need not arrive in sequence; they will be rearranged by the receiving node.
 
If not all fragments are received within 60 seconds after receiving the first packet with a fragment, reassembly of the original packet is abandoned and all fragments are discarded. If the first fragment was received (which contains the fixed header) and one or more others are missing, a ''Time Exceeded'' message ([[ICMPv6]] type 3, code 1) is returned to the node originating the fragmented packet.
 
IfWhen notreassembling allnode fragmentsdetects area receivedfragment withinthat 60 seconds after receiving the first packetoverlaps with aanother fragment, the reassembly of the original packet is abandonedaborted and all fragments are discardeddropped. IfA thenode ''first''may fragmentoptionally wasignore receivedthe (whichexact containsduplicates the fixed header),of a ''Timefragment Exceeded''instead messageof ([[ICMPv6]]treating typeexact 3,duplicates codeas 1)overlapping iseach returnedother.<ref toname=rfc8200 the/> node originating the fragmented packet, if the packet was discarded for this reason.
 
Receiving hosts must make a best-effort attempt to reassemble fragmented IP datagrams that, after reassembly, contain up to 1500 bytes. Hosts are permitted to make an attempt to reassemble fragmented datagrams larger than 15001,500 bytes, but they are also permitted to silently discard any datagram after it becomes apparent that the reassembled packet would be larger than 15001,500 bytes. Therefore, senders should avoid sending fragmented IP datagrams with a total reassembled size larger than 15001,500 bytes, unless they have previous assuranceknowledge that the receiver is capable of reassembling such large datagrams.
 
===Security===
Research has shown that the use of fragmentation can be leveraged to evade network security controls. As a result, itin is now required that2014 the firstearlier fragmentallowance offor an IPv6 packet containsoverflowing the entire IPv6 header chain,<ref name=rfc7112>{{Citebeyond IETF|rfc=7112the |title=Implicationsfirst offragment Oversizedbecame IPv6forbidden Headerin Chains |author=F. Gont|author2=V. Manral|author3=R. Bonica|date=January 2014}}</ref>order suchto thatavoid some very pathological fragmentation cases are forbidden.<ref name=rfc7112/> Additionally, as a result of research on the evasion of Router Advertisement Guard,<ref name=rfc7113>{{CiteRef IETFRFC|rfc=7113 |title=Implementation Advice for IPv6 Router Advertisement Guard (RA-Guard) |author=F. Gont |date=February 2014}}</ref> the use of fragmentation with [[Neighbor Discovery]] is deprecated, and the use of fragmentation with [[Secure Neighbor Discovery|Secure Neighbor Discovery]] (SEND)]] is discouraged.<ref name=rfc6980>{{CiteRef IETFRFC|rfc=6980 |title=Security Implications of IPv6 Fragmentation with IPv6 Neighbor Discovery|author=F. Gont |date=August 2013}}</ref>
 
==References==
{{Reflist|40em}}
 
{{IPv6}}