RFC 1883
Internet Protocol, Version 6 (IPv6) Specification
RFC 1883: Internet Protocol, Version 6 (IPv6) Specification ๐
Part 1 of 9 ๐
okay bestie, the title block is giving everything ๐ this is RFC 1883, the Internet Protocol, Version 6 (IPv6) Specification ๐, from the Network Working Group ๐ง. It was written by S. Deering (Xerox PARC) and R. Hinden (Ipsilon Networks) ๐. It's a Standards Track document, so it's an actual Internet standard and not just vibes ๐ฅ, and it's dated December 1995 ๐ . The title block doesn't list anything it obsoletes or updates โจ.
Status of this Memo ๐
so this doc specifies an Internet standards track protocol for the Internet community ๐ and it's literally asking for discussion and suggestions for improvements ๐ฌ. If you want the current standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐. Distribution of this memo is unlimited ๐ฆ.
Abstract ๐ธ
this doc specifies version 6 of the Internet Protocol (IPv6), also sometimes called IP Next Generation or IPng ๐ .
Table of Contents ๐
1. Introduction..................................................3
2. Terminology...................................................4
3. IPv6 Header Format............................................5
4. IPv6 Extension Headers........................................6
4.1 Extension Header Order...................................8
4.2 Options..................................................9
4.3 Hop-by-Hop Options Header...............................11
4.4 Routing Header..........................................13
4.5 Fragment Header.........................................19
4.6 Destination Options Header..............................24
4.7 No Next Header..........................................25
5. Packet Size Issues...........................................26
6. Flow Labels..................................................28
7. Priority.....................................................30
8. Upper-Layer Protocol Issues..................................31
8.1 Upper-Layer Checksums...................................31
8.2 Maximum Packet Lifetime.................................32
8.3 Maximum Upper-Layer Payload Size........................32
Appendix A. Formatting Guidelines for Options...................33
Security Considerations.........................................36
Acknowledgments.................................................36
Authors' Addresses..............................................36
References......................................................37
1. Introduction โจ
okay so IP version 6 (IPv6) is a brand new version of the Internet Protocol ๐ฆ, designed as the successor to IP version 4 (IPv4) [RFC-791]. The changes from IPv4 to IPv6 mostly fall into these categories:
- Expanded Addressing Capabilities ๐: IPv6 increases the IP address size from 32 bits to 128 bits, to support more levels of addressing hierarchy, a much greater number of addressable nodes, and simpler auto-configuration of addresses. The scalability of multicast routing is improved by adding a "scope" field to multicast addresses. And a new type of address called an "anycast address" is defined, used to send a packet to any one of a group of nodes.
- Header Format Simplification ๐งน: Some IPv4 header fields have been dropped or made optional, to reduce the common-case processing cost of packet handling and to limit the bandwidth cost of the IPv6 header.
- Improved Support for Extensions and Options ๐งฉ: Changes in the way IP header options are encoded allows for more efficient forwarding, less stringent limits on the length of options, and greater flexibility for introducing new options in the future.
- Flow Labeling Capability ๐ท๏ธ: A new capability is added to enable the labeling of packets belonging to particular traffic "flows" for which the sender requests special handling, such as non-default quality of service or "real-time" service.
- Authentication and Privacy Capabilities ๐: Extensions to support authentication, data integrity, and (optional) data confidentiality are specified for IPv6.
this document specifies the basic IPv6 header and the initially-defined IPv6 extension headers and options ๐. It also talks about packet size issues, the semantics of flow labels and priority, and the effects of IPv6 on upper-layer protocols. The format and semantics of IPv6 addresses are specified separately in [RFC-1884]. The IPv6 version of ICMP, which all IPv6 implementations are required to include, is specified in [RFC-1885].
2. Terminology ๐
okay this is the glossary, and you'll want to know these terms before anything else ๐
node - a device that implements IPv6.
router - a node that forwards IPv6 packets not explicitly
addressed to itself. [See Note below].
host - any node that is not a router. [See Note below].
upper layer - a protocol layer immediately above IPv6. Examples are
transport protocols such as TCP and UDP, control
protocols such as ICMP, routing protocols such as OSPF,
and internet or lower-layer protocols being "tunneled"
over (i.e., encapsulated in) IPv6 such as IPX,
AppleTalk, or IPv6 itself.
link - a communication facility or medium over which nodes can
communicate at the link layer, i.e., the layer
immediately below IPv6. Examples are Ethernets (simple
or bridged); PPP links; X.25, Frame Relay, or ATM
networks; and internet (or higher) layer "tunnels",
such as tunnels over IPv4 or IPv6 itself.
neighbors - nodes attached to the same link.
interface - a node's attachment to a link.
address - an IPv6-layer identifier for an interface or a set of
interfaces.
packet - an IPv6 header plus payload.
link MTU - the maximum transmission unit, i.e., maximum packet
size in octets, that can be conveyed in one piece over
a link.
path MTU - the minimum link MTU of all the links in a path between
a source node and a destination node.
โ ๏ธ the Note below is important, so don't skip it ๐
Note: it's possible, though unusual ๐ค, for a device with multiple interfaces to be configured to forward non-self-destined packets arriving from some set (fewer than all) of its interfaces, and to discard non-self-destined packets arriving from its other interfaces. A device like that must obey the protocol requirements for routers when it receives packets from, and interacts with neighbors over, the former (forwarding) interfaces. It must obey the protocol requirements for hosts when it receives packets from, and interacts with neighbors over, the latter (non-forwarding) interfaces.
3. IPv6 Header Format ๐
this is the main event bestie ๐ here's the header layout:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| Prio. | Flow Label |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Payload Length | Next Header | Hop Limit |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Source Address +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Destination Address +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
and here's what each field does ๐ง (the Version field is literally just the number 6, iconic ๐):
Version 4-bit Internet Protocol version number = 6.
Prio. 4-bit priority value. See section 7.
Flow Label 24-bit flow label. See section 6.
Payload Length 16-bit unsigned integer. Length of payload,
i.e., the rest of the packet following the
IPv6 header, in octets. If zero, indicates that
the payload length is carried in a Jumbo Payload
hop-by-hop option.
Next Header 8-bit selector. Identifies the type of header
immediately following the IPv6 header. Uses
the same values as the IPv4 Protocol field
[RFC-1700 et seq.].
Hop Limit 8-bit unsigned integer. Decremented by 1 by
each node that forwards the packet. The packet
is discarded if Hop Limit is decremented to
zero.
Source Address 128-bit address of the originator of the
packet. See [RFC-1884].
Destination Address 128-bit address of the intended recipient
of the packet (possibly not the ultimate
recipient, if a Routing header is present).
See [RFC-1884] and section 4.4.
4. IPv6 Extension Headers โจ
okay so IPv6 keeps its optional internet-layer info in separate headers that can sit between the IPv6 header and the upper-layer header ๐ there's only a small number of these, and each one has its own distinct Next Header value. a packet can carry zero, one, or more of them, and each one is identified by the Next Header field of whatever header came right before it ๐
it's like a little chain:
+---------------+------------------------
| IPv6 header | TCP header + data
| |
| Next Header = |
| TCP |
+---------------+------------------------
+---------------+----------------+------------------------
| IPv6 header | Routing header | TCP header + data
| | |
| Next Header = | Next Header = |
| Routing | TCP |
+---------------+----------------+------------------------
+---------------+----------------+-----------------+-----------------
| IPv6 header | Routing header | Fragment header | fragment of TCP
| | | | header + data
| Next Header = | Next Header = | Next Header = |
| Routing | Fragment | TCP |
+---------------+----------------+-----------------+-----------------
okay so with one exception, extension headers aren't examined or processed by any node along the delivery path ๐ฆ they wait until the packet reaches the node (or each node in the group, if it's multicast) named in the Destination Address field of the IPv6 header. then normal demultiplexing on the IPv6 Next Header field kicks off the module that handles the first extension header, or the upper-layer header if there isn't one. whether the packet keeps going depends on the contents and semantics of each extension header ๐ง so extension headers MUST be processed strictly in the order they appear in the packet. a receiver MUST NOT, for example, scan through a packet hunting for one particular kind of extension header and process that one before handling all the ones in front of it. no line-cutting, bestie ๐
the exception is the Hop-by-Hop Options header ๐ it carries info that MUST be examined and processed by every node along the delivery path, including the source and destination nodes. when it's present, it MUST immediately follow the IPv6 header, and you can spot it by the value zero in the Next Header field of the IPv6 header.
if a node has to move on to the next header because of what it just processed, but the Next Header value in the current header isn't one it recognizes, it SHOULD discard the packet and send an ICMP Parameter Problem message to the source of the packet. that message uses ICMP Code value 2 ("unrecognized Next Header type encountered"), and the ICMP Pointer field holds the offset of the unrecognized value within the original packet ๐ the same action SHOULD be taken if a node runs into a Next Header value of zero in any header that isn't an IPv6 header.
every extension header is an integer multiple of 8 octets long, so the headers after it keep their 8-octet alignment ๐ธ and multi-octet fields inside each extension header sit on their natural boundaries. in other words, a field that's n octets wide lives at an integer multiple of n octets from the start of the header, for n = 1, 2, 4, or 8. so cute, right?
a full IPv6 implementation includes these extension headers:
Hop-by-Hop OptionsRouting (Type 0)FragmentDestination OptionsAuthenticationEncapsulating Security Payload
the first four are specified in this document, and the last two are specified in [RFC-1826] and [RFC-1827], respectively.
4.1. Extension Header Order โจ
when a packet uses more than one extension header, it is RECOMMENDED that they show up in this order ๐
IPv6 header
Hop-by-Hop Options header
Destination Options header (note 1)
Routing header
Fragment header
Authentication header (note 2)
Encapsulating Security Payload header (note 2)
Destination Options header (note 3)
upper-layer header
note 1: for options to be processed by the first destination
that appears in the IPv6 Destination Address field
plus subsequent destinations listed in the Routing
header.
note 2: additional recommendations regarding the relative
order of the Authentication and Encapsulating
Security Payload headers are given in [RFC-1827].
note 3: for options to be processed only by the final
destination of the packet.
each extension header SHOULD occur at most once, with one exception: the Destination Options header SHOULD occur at most twice (once before a Routing header and once before the upper-layer header) ๐
if the upper-layer header is another IPv6 header (that's IPv6 getting tunneled or encapsulated in IPv6), it MAY be followed by its own extension headers. those are separately subject to the same ordering recommendations ๐
if and when other extension headers get defined, their ordering constraints relative to the ones listed above MUST be specified. ๐
IPv6 nodes MUST accept and attempt to process extension headers in any order, and they MUST handle them occurring any number of times in the same packet. the one exception is the Hop-by-Hop Options header, which is restricted to appearing immediately after an IPv6 header only. ๐ซถ still, it is strongly advised that sources of IPv6 packets stick to the recommended order above until and unless later specifications revise that recommendation. honestly the vibe is: be predictable, bestie.
4.2. Options โจ
two of the currently-defined extension headers, the Hop-by-Hop Options header and the Destination Options header, carry a variable number of type-length-value (TLV) encoded "options" ๐ they look like this:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
| Option Type | Opt Data Len | Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
Option Type 8-bit identifier of the type of option.
Opt Data Len 8-bit unsigned integer. Length of the Option
Data field of this option, in octets.
Option Data Variable-length field. Option-Type-specific
data.
the sequence of options inside a header MUST be processed strictly in the order they appear in the header. a receiver MUST NOT, for example, scan through the header looking for a particular kind of option and process that option before handling all the ones before it. the no-line-cutting rule is back, and it's giving strict ๐ง
the Option Type identifiers are encoded so that their highest-order two bits say what action to take if the processing IPv6 node doesn't recognize the Option Type ๐ฆ
00 - skip over this option and continue processing the header.
01 - discard the packet.
10 - discard the packet and, regardless of whether or not the
packets's Destination Address was a multicast address, send
an ICMP Parameter Problem, Code 2, message to the packet's
Source Address, pointing to the unrecognized Option Type.
11 - discard the packet and, only if the packet's Destination
Address was not a multicast address, send an ICMP Parameter
Problem, Code 2, message to the packet's Source Address,
pointing to the unrecognized Option Type.
the third-highest-order bit of the Option Type says whether the Option Data of that option can change en-route to the packet's final destination ๐ธ when an Authentication header is present in the packet, then for any option whose data may change en-route, its entire Option Data field MUST be treated as zero-valued octets when computing or verifying the packet's authenticating value. big brain stuff, fr fr ๐ฅ
0 - Option Data does not change en-route
1 - Option Data may change en-route
individual options can have their own alignment requirements, so that multi-octet values inside Option Data fields land on natural boundaries โจ the alignment requirement of an option uses the notation xn+y, which means the Option Type MUST appear at an integer multiple of x octets from the start of the header, plus y octets. for example:
2n means any 2-octet offset from the start of the header.
8n+2 means any 8-octet offset from the start of the header,
plus 2 octets.
there are two padding options that get used when they're needed to align later options, and to pad out the containing header to a multiple of 8 octets in length ๐ these padding options MUST be recognized by all IPv6 implementations, no exceptions ๐ โโ๏ธ
Pad1 option (alignment requirement: none)
+-+-+-+-+-+-+-+-+
| 0 |
+-+-+-+-+-+-+-+-+
NOTE! the format of the Pad1 option is a special case -- it does
not have length and value fields.
the Pad1 option inserts one octet of padding into the Options area of a header. if you need more than one octet of padding, the PadN option (next up!) SHOULD be used instead of multiple Pad1 options ๐
PadN option (alignment requirement: none)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
| 1 | Opt Data Len | Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
the PadN option inserts two or more octets of padding into the Options area of a header. for N octets of padding, the Opt Data Len field holds the value N-2, and the Option Data is N-2 zero-valued octets. main character energy for padding ๐
Appendix A contains formatting guidelines for designing new options. ๐งโโ๏ธ
4.3. Hop-by-Hop Options Header ๐
okay so the Hop-by-Hop Options header is where the optional info lives that MUST be examined by every node along a packet's delivery path ๐
every single hop, no skipping! It's identified by a Next Header value of 0 in the IPv6 header, and it looks like this:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
. .
. Options .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Here's the breakdown of each field ๐ฆ
Next Headeris an 8-bit selector. It tells you what type of header is sitting right after the Hop-by-Hop Options header. It uses the same values as the IPv4 Protocol field [RFC-1700 et seq.] ๐งHdr Ext Lenis an 8-bit unsigned integer. It's the length of the Hop-by-Hop Options header in 8-octet units, not counting the first 8 octets ๐Optionsis a variable-length field. Its length is set so the whole Hop-by-Hop Options header comes out to an integer multiple of 8 octets long โจ It holds one or more TLV-encoded options, as described in section 4.2 ๐
In addition to the Pad1 and PadN options from section 4.2, there's one more hop-by-hop option defined here, and it's a main character ๐
Jumbo Payload option (alignment requirement: 4n + 2)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 194 |Opt Data Len=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Jumbo Payload Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
So the Jumbo Payload option is how you send IPv6 packets with payloads longer than 65,535 octets ๐ The Jumbo Payload Length is the length of the packet in octets. It doesn't count the IPv6 header, but it does count the Hop-by-Hop Options header. It MUST be greater than 65,535 ๐ฅ If a packet shows up with a Jumbo Payload option whose Jumbo Payload Length is less than or equal to 65,535, an ICMP Parameter Problem message, Code 0, SHOULD be sent back to the packet's source. It should point to the high-order octet of the invalid Jumbo Payload Length field ๐
Next, the Payload Length field in the IPv6 header MUST be set to zero in every packet that carries the Jumbo Payload option ๐ If a packet arrives with a valid Jumbo Payload option present and a non-zero IPv6 Payload Length field, an ICMP Parameter Problem message, Code 0, SHOULD be sent to the packet's source, pointing to the Option Type field of the Jumbo Payload option ๐ญ
The Jumbo Payload option MUST NOT be used in a packet that carries a Fragment header ๐ซ If a Fragment header shows up in a packet that has a valid Jumbo Payload option, an ICMP Parameter Problem message, Code 0, SHOULD be sent to the packet's source, pointing to the first octet of the Fragment header ๐ซถ
An implementation that doesn't support the Jumbo Payload option cannot have interfaces to links whose link MTU is greater than 65,575. That's 40 octets of IPv6 header plus 65,535 octets of payload. Bestie, don't let your links get too thicc for your implementation ๐ ๐
4.4. Routing Header ๐บ๏ธโจ
okay bestie, so the Routing header is how an IPv6 source gets to say "stop by these intermediate nodes before you slay the final destination" ๐
it's lowkey giving IPv4 Source Route options vibes, no cap ๐ฆ It's identified by a Next Header value of 43 in the header right before it, and it looks like this:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | Routing Type | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. type-specific data .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
okay, here's the rundown on each field ๐
Next Header: an 8-bit selector that tells you what type of header comes right after the Routing header. It uses the same values as the IPv4 Protocol field [RFC-1700 et seq.].Hdr Ext Len: an 8-bit unsigned integer giving the length of the Routing header in 8-octet units, not counting the first 8 octets.Routing Type: an 8-bit identifier for which variant of Routing header you're looking at ๐งSegments Left: an 8-bit unsigned integer. It's the number of route segments still remaining, aka the explicitly listed intermediate nodes that still need a visit before the final destination.type-specific data: variable-length, and its format depends on the Routing Type. Its length is set so the whole Routing header ends up as an integer multiple of 8 octets long ๐
okay the plot twist ๐ญ what if a node runs into a Routing header with a Routing Type value it doesn't recognize? The REQUIRED behavior depends on what Segments Left is set to:
- If
Segments Leftis zero, the node MUST ignore the Routing header and proceed to process the next header in the packet, whose type is identified by theNext Headerfield in the Routing header. - If
Segments Leftis non-zero, the node MUST discard the packet and send an ICMP Parameter Problem, Code 0, message to the packet's Source Address, pointing to the unrecognized Routing Type.
now let's look at the Type 0 Routing header, which has its own format ๐
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | Routing Type=0| Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved | Strict/Loose Bit Map |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Address[1] +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Address[2] +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. . .
. . .
. . .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Address[n] +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
the Type 0 fields, bestie ๐
Next Header: same deal as before. It's the type of header right after the Routing header, using the same values as the IPv4 Protocol field [RFC-1700 et seq.].Hdr Ext Len: an 8-bit unsigned integer giving the length of the Routing header in 8-octet units, not counting the first 8 octets. For the Type 0 Routing header,Hdr Ext Lenis equal to two times the number of addresses in the header, and it MUST be an even number less than or equal to 46.Routing Type: 0.Segments Left: an 8-bit unsigned integer. It's the number of route segments remaining, aka the explicitly listed intermediate nodes still to be visited before reaching the final destination. Maximum legal value = 23.Reserved: an 8-bit reserved field. It's initialized to zero for transmission and ignored on reception.Strict/Loose Bit Map: a 24-bit bit-map, numbered 0 to 23, left-to-right. For each segment of the route, it indicates whether or not the next destination address MUST be a neighbor of the preceding address. 1 means strict (MUST be a neighbor), and 0 means loose (need not be a neighbor).Address[1..n]: a vector of 128-bit addresses, numbered 1 to n.
multicast addresses are a hard no ๐ โโ๏ธ They MUST NOT appear in a Routing header of Type 0, or in the IPv6 Destination Address field of a packet carrying a Routing header of Type 0.
if bit number 0 of the Strict/Loose Bit Map is 1, the Destination Address field of the IPv6 header in the original packet MUST identify a neighbor of the originating node. if bit number 0 is 0, the originator MAY use any legal, non-multicast address as the initial Destination Address ๐ซถ
bits numbered greater than n (where n is the number of addresses in the Routing header) MUST be set to 0 by the originator, and receivers ignore them ๐ง
A Routing header isn't examined or processed until it reaches the node identified in the Destination Address field of the IPv6 header. In that node, dispatching on the Next Header field of the immediately preceding header invokes the Routing header module. For Routing Type 0, that module runs this algorithm:
if Segments Left = 0 {
proceed to process the next header in the packet, whose type is
identified by the Next Header field in the Routing header
}
else if Hdr Ext Len is odd or greater than 46 {
send an ICMP Parameter Problem, Code 0, message to the Source
Address, pointing to the Hdr Ext Len field, and discard the
packet
}
else {
compute n, the number of addresses in the Routing header, by
dividing Hdr Ext Len by 2
if Segments Left is greater than n {
send an ICMP Parameter Problem, Code 0, message to the Source
Address, pointing to the Segments Left field, and discard the
packet
}
else {
decrement Segments Left by 1;
compute i, the index of the next address to be visited in
the address vector, by subtracting Segments Left from n
if Address [i] or the IPv6 Destination Address is multicast {
discard the packet
}
else {
swap the IPv6 Destination Address and Address[i]
if bit i of the Strict/Loose Bit map has value 1 and the
new Destination Address is not the address of a neighbor
of this node {
send an ICMP Destination Unreachable -- Not a Neighbor
message to the Source Address and discard the packet
}
else if the IPv6 Hop Limit is less than or equal to 1 {
send an ICMP Time Exceeded -- Hop Limit Exceeded in
Transit message to the Source Address and discard the
packet
}
else {
decrement the Hop Limit by 1
resubmit the packet to the IPv6 module for transmission
to the new destination
}
}
}
}
okay, time for the glow-up example ๐ Say a source node S sends a packet to destination node D, and uses a Routing header to route it via intermediate nodes I1, I2, and I3. Here's how the relevant IPv6 header and Routing header fields look on each segment of the delivery path โจ
As the packet travels from S to I1:
Source Address = S Hdr Ext Len = 6
Destination Address = I1 Segments Left = 3
Address[1] = I2
(if bit 0 of the Bit Map is 1, Address[2] = I3
S and I1 MUST be neighbors; Address[3] = D
this is checked by S)
As the packet travels from I1 to I2:
Source Address = S Hdr Ext Len = 6
Destination Address = I2 Segments Left = 2
Address[1] = I1
(if bit 1 of the Bit Map is 1, Address[2] = I3
I1 and I2 MUST be neighbors; Address[3] = D
this is checked by I1)
As the packet travels from I2 to I3:
Source Address = S Hdr Ext Len = 6
Destination Address = I3 Segments Left = 1
Address[1] = I1
(if bit 2 of the Bit Map is 1, Address[2] = I2
I2 and I3 MUST be neighbors; Address[3] = D
this is checked by I2)
As the packet travels from I3 to D:
Source Address = S Hdr Ext Len = 6
Destination Address = D Segments Left = 0
Address[1] = I1
(if bit 3 of the Bit Map is 1, Address[2] = I2
I3 and D MUST be neighbors; Address[3] = I3
this is checked by I3)
4.5. Fragment Header โจ
okay bestie, the Fragment header is how an IPv6 source sends a packet that's bigger than the path MTU can handle ๐ฆ. plot twist: unlike IPv4, fragmentation in IPv6 is only done by source nodes, not by routers along the delivery path -- see section 5 ๐ซถ. The Fragment header is identified by a Next Header value of 44 in the immediately preceding header, and it looks like this ๐:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Reserved | Fragment Offset |Res|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Here's the field rundown ๐:
Next Header: 8-bit selector. It identifies the initial header type of the Fragmentable Part of the original packet (defined below). It uses the same values as the IPv4 Protocol field [RFC-1700 et seq.].Reserved: 8-bit reserved field. It gets initialized to zero for transmission and gets ignored on reception.Fragment Offset: 13-bit unsigned integer. It's the offset, in 8-octet units, of the data following this header, relative to the start of the Fragmentable Part of the original packet.Res: 2-bit reserved field. It gets initialized to zero for transmission and gets ignored on reception.M flag: 1 = more fragments; 0 = last fragment.Identification: 32 bits. See the description below.
So, to send a packet that's too large for the MTU of the path to its destination, a source node MAY divide the packet into fragments and send each fragment as a separate packet, to be reassembled at the receiver. Iconic behaviour ๐ .
For every packet that's going to be fragmented, the source node generates an Identification value. The Identification MUST be different than that of any other fragmented packet sent recently* with the same Source Address and Destination Address. If a Routing header is present, the Destination Address that matters is that of the final destination ๐ง.
* "recently" means within the maximum likely lifetime of a packet, including transit time from source to destination and time spent awaiting reassembly with other fragments of the same packet. However, it is not required that a source node know the maximum packet lifetime. Rather, it's assumed the requirement can be met by maintaining the Identification value as a simple, 32-bit, "wrap-around" counter, incremented each time a packet MUST be fragmented. It is an implementation choice whether to maintain a single counter for the node or multiple counters, e.g., one for each of the node's possible source addresses, or one for each active (source address, destination address) combination.
Now the big one ๐ฆ. The initial, large, unfragmented packet is called the "original packet", and it's split into two parts, like this:
original packet:
+------------------+----------------------//-----------------------+
| Unfragmentable | Fragmentable |
| Part | Part |
+------------------+----------------------//-----------------------+
The Unfragmentable Part is the IPv6 header plus any extension headers that MUST be processed by nodes en route to the destination. In other words, it's all headers up to and including the Routing header if present, else the Hop-by-Hop Options header if present, else no extension headers.
The Fragmentable Part is the rest of the packet: any extension headers that only need processing by the final destination node(s), plus the upper-layer header and data.
The Fragmentable Part of the original packet gets divided into fragments. Each one is an integer multiple of 8 octets long, except possibly the last ("rightmost") one. The fragments get sent in separate "fragment packets", like so ๐ธ:
original packet:
+------------------+--------------+--------------+--//--+----------+
| Unfragmentable | first | second | | last |
| Part | fragment | fragment | .... | fragment |
+------------------+--------------+--------------+--//--+----------+
fragment packets:
+------------------+--------+--------------+
| Unfragmentable |Fragment| first |
| Part | Header | fragment |
+------------------+--------+--------------+
+------------------+--------+--------------+
| Unfragmentable |Fragment| second |
| Part | Header | fragment |
+------------------+--------+--------------+
o
o
o
+------------------+--------+----------+
| Unfragmentable |Fragment| last |
| Part | Header | fragment |
+------------------+--------+----------+
Each fragment packet is made up of three bits ๐งฉ:
- The Unfragmentable Part of the original packet, with two edits. The Payload Length of the original IPv6 header is changed to hold the length of this fragment packet only (excluding the length of the IPv6 header itself). The Next Header field of the last header of the Unfragmentable Part is changed to 44.
- A Fragment header containing:
- The Next Header value that identifies the first header of the Fragmentable Part of the original packet.
- A Fragment Offset containing the offset of the fragment, in 8-octet units, relative to the start of the Fragmentable Part of the original packet. The Fragment Offset of the first ("leftmost") fragment is 0.
- An M flag value of 0 if the fragment is the last ("rightmost") one, else an M flag value of 1.
- The Identification value generated for the original packet.
- The fragment itself.
The lengths of the fragments MUST be chosen so the resulting fragment packets fit within the MTU of the path to the packets' destination(s). Non-negotiable, bestie ๐.
At the destination, the fragment packets get reassembled back into their original, unfragmented form ๐:
reassembled original packet:
+------------------+----------------------//------------------------+
| Unfragmentable | Fragmentable |
| Part | Part |
+------------------+----------------------//------------------------+
The following rules govern reassembly ๐:
- An original packet is reassembled only from fragment packets that have the same Source Address, Destination Address, and Fragment Identification.
- The Unfragmentable Part of the reassembled packet consists of all headers up to, but not including, the Fragment header of the first fragment packet (that's the packet whose Fragment Offset is zero), with two changes:
- The Next Header field of the last header of the Unfragmentable Part is obtained from the Next Header field of the first fragment's Fragment header.
- The Payload Length of the reassembled packet is computed from the length of the Unfragmentable Part and the length and offset of the last fragment. For example, a formula for computing the Payload Length of the reassembled original packet is:
PL.orig = PL.first - FL.first - 8 + (8 * FO.last) + FL.last
where
PL.orig = Payload Length field of reassembled packet.
PL.first = Payload Length field of first fragment packet.
FL.first = length of fragment following Fragment header of
first fragment packet.
FO.last = Fragment Offset field of Fragment header of
last fragment packet.
FL.last = length of fragment following Fragment header of
last fragment packet.
- The Fragmentable Part of the reassembled packet is built from the fragments following the Fragment headers in each of the fragment packets. The length of each fragment is worked out by subtracting from the packet's Payload Length the length of the headers between the IPv6 header and the fragment itself. Its relative position in the Fragmentable Part comes from its Fragment Offset value.
- The Fragment header is not present in the final, reassembled packet.
The following error conditions MAY arise when reassembling fragmented packets ๐จ:
- If insufficient fragments are received to complete reassembly of a packet within 60 seconds of the reception of the first-arriving fragment of that packet, reassembly of that packet MUST be abandoned, and all the fragments that have been received for that packet MUST be discarded. If the first fragment (i.e., the one with a Fragment Offset of zero) has been received, an ICMP Time Exceeded -- Fragment Reassembly Time Exceeded message SHOULD be sent to the source of that fragment.
- If the length of a fragment, as derived from the fragment packet's Payload Length field, is not a multiple of 8 octets and the M flag of that fragment is 1, then that fragment MUST be discarded and an ICMP Parameter Problem, Code 0, message SHOULD be sent to the source of the fragment, pointing to the Payload Length field of the fragment packet.
- If the length and offset of a fragment are such that the Payload Length of the packet reassembled from that fragment would exceed 65,535 octets, then that fragment MUST be discarded and an ICMP Parameter Problem, Code 0, message SHOULD be sent to the source of the fragment, pointing to the Fragment Offset field of the fragment packet.
The following conditions are not expected to occur, but they're not considered errors if they do ๐:
- The number and content of the headers preceding the Fragment header of different fragments of the same original packet MAY differ. Whatever headers are present before the Fragment header in each fragment packet get processed when the packets arrive, prior to queueing the fragments for reassembly. Only those headers in the Offset zero fragment packet are retained in the reassembled packet.
- The Next Header values in the Fragment headers of different fragments of the same original packet MAY differ. Only the value from the Offset zero fragment packet is used for reassembly.
4.6 Destination Options Header ๐
okay so the Destination Options header is where you stash optional info that only the destination node(s) actually need to look at ๐
It's identified by a Next Header value of 60 in the header right before it. Here's the layout:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
. .
. Options .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Next Header๐ฆ is an 8-bit selector. It tells you what type of header comes right after the Destination Options header, and it uses the same values as the IPv4 Protocol field [RFC-1700 et seq.].Hdr Ext Lenis an 8-bit unsigned integer. It's the length of the Destination Options header in 8-octet units, not counting the first 8 octets.Optionsis a variable-length field, sized so the whole Destination Options header is an integer multiple of 8 octets long. It holds one or more TLV-encoded options, as described in section 4.2 โจ
The only destination options defined in this document are the Pad1 and PadN options specified in section 4.2 ๐ธ
Now here's the tea ๐ There are two ways to encode optional destination info in an IPv6 packet. You can either make it an option inside the Destination Options header, or make it a separate extension header. The Fragment header and the Authentication header are examples of the second approach. Which one you can use depends on what you want a destination node to do if it doesn't understand the info:
- If the desired action is for the destination node to discard the packet and, only if the packet's Destination Address is not a multicast address, send an ICMP Unrecognized Type message to the packet's Source Address, then the info may be encoded either as a separate header or as an option in the Destination Options header whose Option Type has the value
11in its highest-order two bits. The choice may depend on things like which one takes fewer octets, or which one yields better alignment or more efficient parsing ๐ง - If any other action is desired, the info must be encoded as an option in the Destination Options header whose Option Type has the value
00,01, or10in its highest-order two bits, specifying the desired action (see section 4.2) ๐
4.7 No Next Header ๐
okay this one is simple but iconic ๐ญ The value 59 in the Next Header field of an IPv6 header or any extension header means there's nothing following that header. If the Payload Length field of the IPv6 header says there are octets past the end of a header whose Next Header field contains 59, those octets must be ignored, and they get passed on unchanged if the packet is forwarded ๐ซถ
5. Packet Size Issues ๐ฆ
bestie, this section is all about how big your packets can be without causing chaos ๐ IPv6 requires that every link in the internet have an MTU of 576 octets or greater. On any link that cannot convey a 576-octet packet in one piece, link-specific fragmentation and reassembly must be provided at a layer below IPv6 ๐ฅ
From each link to which a node is directly attached, the node must be able to accept packets as large as that link's MTU. Links that have a configurable MTU (for example, PPP links [RFC-1661]) must be configured to have an MTU of at least 576 octets. It is recommended that a larger MTU be configured, to accommodate possible encapsulations (i.e., tunneling) without incurring fragmentation ๐ธ
It is strongly recommended that IPv6 nodes implement Path MTU Discovery [RFC-1191], in order to discover and take advantage of paths with MTU greater than 576 octets โจ However, a minimal IPv6 implementation (e.g., in a boot ROM) may simply restrict itself to sending packets no larger than 576 octets, and omit implementation of Path MTU Discovery. Totally valid, no judgment ๐
In order to send a packet larger than a path's MTU, a node may use the IPv6 Fragment header to fragment the packet at the source and have it reassembled at the destination(s). However, the use of such fragmentation is discouraged in any application that is able to adjust its packets to fit the measured path MTU (i.e., down to 576 octets) ๐
A node must be able to accept a fragmented packet that, after reassembly, is as large as 1500 octets, including the IPv6 header. A node is permitted to accept fragmented packets that reassemble to more than 1500 octets. However, a node must not send fragments that reassemble to a size greater than 1500 octets unless it has explicit knowledge that the destination(s) can reassemble a packet of that size ๐
In response to an IPv6 packet that is sent to an IPv4 destination (i.e., a packet that undergoes translation from IPv6 to IPv4), the originating IPv6 node may receive an ICMP Packet Too Big message reporting a Next-Hop MTU less than 576. In that case, the IPv6 node is not required to reduce the size of subsequent packets to less than 576, but must include a Fragment header in those packets so that the IPv6-to-IPv4 translating router can obtain a suitable Identification value to use in resulting IPv4 fragments. Note that this means the payload may have to be reduced to 528 octets (576 minus 40 for the IPv6 header and 8 for the Fragment header), and smaller still if additional extension headers are used ๐ง
Note: Path MTU Discovery must be performed even in cases where a host "thinks" a destination is attached to the same link as itself. ๐
Note: Unlike IPv4, it is unnecessary in IPv6 to set a "Don't Fragment" flag in the packet header in order to perform Path MTU Discovery; that is an implicit attribute of every IPv6 packet. Also, those parts of the RFC-1191 procedures that involve use of a table of MTU "plateaus" do not apply to IPv6, because the IPv6 version of the "Datagram Too Big" message always identifies the exact MTU to be used. โจ
6. Flow Labels โจ
okay bestie, so the 24-bit Flow Label field in the IPv6 header ๐ฆ is something a source MAY use to tag packets it wants special handling for from the IPv6 routers ๐ , like non-default quality of service or "real-time" service ๐. ngl this whole part of IPv6 is still experimental ๐งช at the time of writing, and it could change once the Internet's flow requirements get clearer ๐. Until then, hosts or routers that don't support the Flow Label stuff are REQUIRED to set the field to zero when they originate a packet, pass it on unchanged when they forward a packet, and ignore it when they receive one ๐ซถ.
A flow is basically a sequence of packets sent from one particular source to one particular destination (unicast or multicast ๐ธ) where the source wants the routers in between to give it special treatment ๐. That special treatment could be communicated by a control protocol, like a resource reservation protocol, or by info inside the flow's packets themselves, e.g., in a hop-by-hop option โจ. The details of those control protocols or options are beyond the scope of this document, so no spoilers here ๐.
There can be multiple active flows from a source to a destination, plus traffic that isn't part of any flow at all ๐. A flow is uniquely identified by the combination of a source address and a non-zero flow label ๐. Packets that aren't in a flow carry a flow label of zero.
A flow label gets assigned to a flow by the flow's source node ๐ง. New flow labels MUST be chosen (pseudo-)randomly and uniformly from the range 1 to FFFFFF hex ๐ฒ. Why random? So that any set of bits in the Flow Label field can be used as a hash key by routers, for looking up the state tied to the flow ๐. It's giving smart design, honestly.
All packets belonging to the same flow MUST be sent with the same source address, destination address, priority, and flow label ๐. If any of those packets includes a Hop-by-Hop Options header, then they all MUST be originated with the same Hop-by-Hop Options header contents (excluding the Next Header field of the Hop-by-Hop Options header) ๐. If any of those packets includes a Routing header, then they all MUST be originated with the same contents in all extension headers up to and including the Routing header (excluding the Next Header field in the Routing header) ๐ฆ. Routers or destinations are permitted, but not REQUIRED, to verify that these conditions are satisfied ๐ต๏ธโโ๏ธ. If a violation is detected, it SHOULD be reported to the source by an ICMP Parameter Problem message, Code 0, pointing to the high-order octet of the Flow Label field (i.e., offset 1 within the IPv6 packet) ๐จ. not me being this specific about offsets, but it's for the best ๐ญ.
Routers are free to "opportunistically" set up flow-handling state for any flow, even when no explicit flow establishment info has been given to them through a control protocol, a hop-by-hop option, or any other means ๐. For example, when a router gets a packet from a particular source with an unknown, non-zero flow label, it MAY process the IPv6 header and any necessary extension headers as if the flow label were zero ๐ง . That processing covers figuring out the next-hop interface, and possibly other stuff, like updating a hop-by-hop option, advancing the pointer and addresses in a Routing header, or deciding how to queue the packet based on its Priority field ๐ฆ. The router MAY then choose to "remember" the results of those steps and cache that info, using the source address plus the flow label as the cache key ๐๏ธ. Subsequent packets with the same source address and flow label MAY then be handled by referring to the cached info, instead of re-examining all those fields that (per the previous paragraph's rules) can be assumed unchanged from the first packet in the flow ๐ . big efficiency energy.
Cached flow-handling state that's set up opportunistically, as we just covered, MUST be discarded no more than 6 seconds after it's established, whether or not packets of the same flow keep arriving โฐ. If another packet with the same source address and flow label shows up after that cached state has been discarded, the packet gets full, normal processing (as if its flow label were zero), which may result in the re-creation of cached flow state for that flow ๐.
The lifetime of flow-handling state that's set up explicitly, for example by a control protocol or a hop-by-hop option, MUST be specified as part of the explicit set-up mechanism's specification ๐. It MAY exceed 6 seconds ๐.
A source MUST NOT re-use a flow label for a new flow within the lifetime of any flow-handling state that might have been established for the prior use of that label ๐ โโ๏ธ. Since flow-handling state with a lifetime of 6 seconds may be established opportunistically for any flow, the minimum gap between the last packet of one flow and the first packet of a new flow using the same flow label is 6 seconds โณ. Flow labels used for explicitly set-up flows with longer flow-state lifetimes MUST remain unused for those longer lifetimes before being re-used for new flows ๐ซง.
When a node stops and restarts (e.g., after a "crash" ๐), it MUST be careful not to use a flow label it might have used for an earlier flow whose lifetime may not have expired yet ๐ฌ. There are two ways to handle that. One is recording flow label usage on stable storage so it can be remembered across crashes ๐พ. The other is refraining from using any flow labels until the maximum lifetime of any possibly previously established flows has expired (at least 6 seconds, and more if explicit flow set-up mechanisms with longer lifetimes might have been used) ๐ฐ๏ธ. This MAY be accomplished either way. If the minimum time for rebooting the node is known (often more than 6 seconds), that time can be deducted from the necessary waiting period before the node starts allocating flow labels ๐งฎ.
There is no requirement that all, or even most, packets belong to flows (i.e., carry non-zero flow labels) ๐ท. This is here to remind protocol designers and implementors not to assume otherwise ๐ซถ. For example, it would be unwise to design a router whose performance is only adequate if most packets belong to flows, or to design a header compression scheme that only works on packets that belong to flows ๐. don't be that designer, periodt ๐ .
7. Priority ๐
The 4-bit Priority field in the IPv6 header lets a source flag the delivery priority it wants for its packets, relative to the other packets from that same source ๐. The Priority values are split into two ranges ๐. Values 0 through 7 are for traffic where the source is doing congestion control, meaning traffic that "backs off" when congestion shows up, like TCP traffic ๐ข. Values 8 through 15 are for traffic that does NOT back off in response to congestion, e.g., "real-time" packets being sent at a constant rate ๐ถ.
For congestion-controlled traffic, the following Priority values are RECOMMENDED for particular application categories ๐:
0 - uncharacterized traffic
1 - "filler" traffic (e.g., netnews)
2 - unattended data transfer (e.g., email)
3 - (reserved)
4 - attended bulk transfer (e.g., FTP, NFS)
5 - (reserved)
6 - interactive traffic (e.g., telnet, X)
7 - internet control traffic (e.g., routing protocols, SNMP)
For non-congestion-controlled traffic, the lowest Priority value (8) SHOULD be used for packets the sender is most okay with having dropped under congestion (e.g., high-fidelity video traffic) ๐ฅ, and the highest value (15) SHOULD be used for packets the sender is least okay with having dropped (e.g., low-fidelity audio traffic) ๐ง. There's no relative ordering implied between the congestion-controlled priorities and the non-congestion-controlled priorities, so don't go comparing 0 to 8 like they're on the same ladder ๐ โโ๏ธโจ.
8. Upper-Layer Protocol Issues ๐ธ
8.1 Upper-Layer Checksums ๐งฎ
okay bestie, any transport or other upper-layer protocol that puts the addresses from the IP header into its checksum MUST be modified for IPv6 ๐ซถ it has to use the 128-bit IPv6 addresses instead of the 32-bit IPv4 ones. ๐ here's the TCP and UDP "pseudo-header" for IPv6, and it's giving very structured ๐ธ
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Source Address +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Destination Address +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Payload Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| zero | Next Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- okay so if the packet has a
Routingheader, theDestination Addressused in the pseudo-header is that of the final destination โจ at the originating node, that address lives in the last element of theRoutingheader, and at the recipient(s) it's in theDestination Addressfield of the IPv6 header. - the
Next Headervalue in the pseudo-header identifies the upper-layer protocol (like6for TCP, or17for UDP) ๐ฆ it'll be different from theNext Headervalue in the IPv6 header if there are extension headers between the IPv6 header and the upper-layer header. - the
Payload Lengthin the pseudo-header is the length of the upper-layer packet, including the upper-layer header ๐ it'll be less than thePayload Lengthin the IPv6 header (or in the Jumbo Payload option) if there are extension headers between the IPv6 header and the upper-layer header. - unlike IPv4, the UDP checksum is not OPTIONAL when UDP packets are originated by an IPv6 node ๐ญ whenever an IPv6 node originates a UDP packet, it MUST compute a UDP checksum over the packet and the pseudo-header, and if that computation comes out as zero, it MUST be changed to hex
FFFFbefore it goes in the UDP header. IPv6 receivers MUST discard UDP packets containing a zero checksum, and they SHOULD log the error ๐
the IPv6 version of ICMP [RFC-1885] also includes the pseudo-header above in its checksum, which is a change from IPv4 ICMP (IPv4 ICMP doesn't include a pseudo-header at all ๐). the reason is to protect ICMP from misdelivery or corruption of the IPv6 header fields it depends on, which, unlike IPv4, aren't covered by an internet-layer checksum. the Next Header field in the pseudo-header for ICMP holds the value 58, which identifies the IPv6 version of ICMP ๐ง
8.2 Maximum Packet Lifetime โณ
unlike IPv4, IPv6 nodes are not REQUIRED to enforce maximum packet lifetime ๐ that's literally why the IPv4 "Time to Live" field got renamed to Hop Limit in IPv6. in practice, very few (if any) IPv4 implementations actually follow the rule to limit packet lifetime, so this isn't really a change in practice, periodt ๐
any upper-layer protocol that relies on the internet layer (IPv4 or IPv6) to limit packet lifetime ought to be upgraded to bring its own way of detecting and discarding obsolete packets ๐ซถ
8.3 Maximum Upper-Layer Payload Size ๐
okay so when you're computing the maximum payload size available for upper-layer data, an upper-layer protocol MUST take into account that the IPv6 header is bigger than the IPv4 header ๐ for example, in IPv4, TCP's MSS option is computed as the maximum packet size (a default value, or a value learned through Path MTU Discovery) minus 40 octets (20 octets for the minimum-length IPv4 header and 20 octets for the minimum-length TCP header) โจ but when you're using TCP over IPv6, the MSS MUST be computed as the maximum packet size minus 60 octets, because the minimum-length IPv6 header (an IPv6 header with no extension headers) is 20 octets longer than a minimum-length IPv4 header ๐ฆ๐
Appendix A. Formatting Guidelines for Options โจ
okay so this appendix is the cheat sheet for designing new options that live in the Hop-by-Hop Options header or the Destination Options header (the ones from section 4.2 ๐ง). these tips come with three assumptions, bestie:
- one desirable thing is that any multi-octet fields inside the Option Data area sit on their natural boundaries. a field n octets wide should start at an integer multiple of n octets from the start of the Hop-by-Hop or Destination Options header, for
n = 1, 2, 4, or 8. - another desirable thing is that the Hop-by-Hop or Destination Options header takes up as little space as possible, but it has to be an integer multiple of 8 octets long ๐
- it can be assumed that when either option-bearing header shows up, it carries a very small number of options, usually just one ๐
these assumptions point to one approach. lay out the fields from smallest to largest with no interior padding, then work out the alignment for the whole option from the largest field (up to a max alignment of 8 octets). here's how it plays out ๐
Example 1 ๐
if an option X needs two data fields, one 8 octets long and one 4 octets long, it's laid out like this:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type=X |Opt Data Len=12|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ 8-octet field +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
its alignment requirement is 8n+2, which makes sure the 8-octet field starts at a multiple-of-8 offset from the start of the enclosing header ๐ฆ and here's a full Hop-by-Hop or Destination Options header with just this one option:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len=1 | Option Type=X |Opt Data Len=12|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ 8-octet field +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Example 2 ๐ธ
if an option Y needs three data fields, one 4 octets long, one 2 octets long, and one 1 octet long, it's laid out like this:
+-+-+-+-+-+-+-+-+
| Option Type=Y |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Opt Data Len=7 | 1-octet field | 2-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
its alignment requirement is 4n+3, which makes sure the 4-octet field starts at a multiple-of-4 offset from the start of the enclosing header ๐ and the full Hop-by-Hop or Destination Options header with this one option looks like:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len=1 | Pad1 Option=0 | Option Type=Y |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Opt Data Len=7 | 1-octet field | 2-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PadN Option=1 |Opt Data Len=2 | 0 | 0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Example 3 ๐ง
a Hop-by-Hop or Destination Options header containing both option X and option Y from Examples 1 and 2 ends up in one of two formats, depending on which option shows up first ๐
if X comes first:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len=3 | Option Type=X |Opt Data Len=12|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ 8-octet field +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PadN Option=1 |Opt Data Len=1 | 0 | Option Type=Y |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Opt Data Len=7 | 1-octet field | 2-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PadN Option=1 |Opt Data Len=2 | 0 | 0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
if Y comes first:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len=3 | Pad1 Option=0 | Option Type=Y |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Opt Data Len=7 | 1-octet field | 2-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PadN Option=1 |Opt Data Len=4 | 0 | 0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0 | 0 | Option Type=X |Opt Data Len=12|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4-octet field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ 8-octet field +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Security Considerations ๐
this bit is serious, bestie, so read it carefully ๐จ
this document specifies that the IP Authentication Header [RFC-1826] and the IP Encapsulating Security Payload [RFC-1827] be used with IPv6, in conformance with the Security Architecture for the Internet Protocol [RFC-1825].
Acknowledgments ๐ซถ
the authors are SO grateful to the members of the IPng working group, the End-to-End Protocols research group, and the Internet Community At Large for all their many helpful suggestions ๐
Authors' Addresses ๐
Stephen E. Deering Robert M. Hinden
Xerox Palo Alto Research Center Ipsilon Networks, Inc.
3333 Coyote Hill Road 2191 E. Bayshore Road, Suite 100
Palo Alto, CA 94304 Palo Alto, CA 94303
USA USA
Phone: +1 415 812 4839 Phone: +1 415 846 4604
Fax: +1 415 812 4471 Fax: +1 415 855 1414
EMail: deering@parc.xerox.com EMail: hinden@ipsilon.com
References ๐
[RFC-1825] Atkinson, R., "Security Architecture for the Internet
Protocol", RFC 1825, Naval Research Laboratory, August
1995.
[RFC-1826] Atkinson, R., "IP Authentication Header", RFC 1826,
Naval Research Laboratory, August 1995.
[RFC-1827] Atkinson, R., "IP Encapsulating Security Protocol
(ESP)", RFC 1827, Naval Research Laboratory, August
1995.
[RFC-1885] Conta, A., and S. Deering, "Internet Control Message
Protocol (ICMPv6) for the Internet Protocol Version 6
(IPv6) Specification", RFC 1885, Digital Equipment
Corporation, Xerox PARC, December 1995.
[RFC-1884] Hinden, R., and S. Deering, Editors, "IP Version 6
Addressing Architecture", RFC 1884, Ipsilon Networks,
Xerox PARC, December 1995.
[RFC-1191] Mogul, J., and S. Deering, "Path MTU Discovery", RFC
1191, DECWRL, Stanford University, November 1990.
[RFC-791] Postel, J., "Internet Protocol", STD 5, RFC 791,
USC/Information Sciences Institute, September 1981.
[RFC-1700] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2,
RFC 1700, USC/Information Sciences Institute, October
1994.
[RFC-1661] Simpson, W., Editor, "The Point-to-Point Protocol
(PPP)", STD 51, RFC 1661, Daydreamer, July 1994.
๐ฆ where this page comes from
- ietf: rfc1883 1995-12
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms