RFC 6145

IP/ICMP Translation Algorithm

๐Ÿ“… published April 2011, from ietf

IP/ICMP Translation Algorithm ๐Ÿฆ‹

okay bestie, so this is RFC 6145 ๐ŸŽ€ It's a Standards Track doc from the IETF (ISSN 2070-1721), dated April 2011. The authors are X. Li and C. Bao from CERNET Center/Tsinghua University, plus F. Baker from Cisco Systems ๐Ÿ’… It obsoletes RFC 2765, so this is its replacement, and it doesn't update anything else.

Abstract โœจ

okay so the whole point is the Stateless IP/ICMP Translation Algorithm (SIIT) ๐Ÿงš It translates between IPv4 and IPv6 packet headers, and that includes the ICMP headers too. This doc obsoletes RFC 2765.

Status of This Memo ๐ŸŒธ

this one is an Internet Standards Track document. It's a product of the Internet Engineering Task Force (IETF), so it represents the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more on Internet Standards, check Section 2 of RFC 5741.

for the current status, any errata, and how to send feedback, go to http://www.rfc-editor.org/info/rfc6145 ๐Ÿ”—

the copyright is 2011 IETF Trust and the people listed as document authors, all rights reserved ๐Ÿ™ˆ This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as they were on the publication date. Read those carefully, because they spell out your rights and restrictions. Any Code Components pulled out of this document have to include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as the Simplified BSD License describes.

this doc may include material from IETF Documents or IETF Contributions that were published or made publicly available before November 10, 2008. The people who control the copyright in some of that material might not have given the IETF Trust permission to allow modifications outside the IETF Standards Process. So unless you get an adequate license from those copyright holders, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process. The only exceptions are formatting it for publication as an RFC, or translating it into languages other than English ๐ŸŒˆ

Table of Contents ๐Ÿ“š

   1.  Introduction and Motivation  . . . . . . . . . . . . . . . . .  3
     1.1.  IPv4-IPv6 Translation Model  . . . . . . . . . . . . . . .  3
     1.2.  Applicability and Limitations  . . . . . . . . . . . . . .  3
     1.3.  Stateless vs. Stateful Mode  . . . . . . . . . . . . . . .  4
     1.4.  Path MTU Discovery and Fragmentation . . . . . . . . . . .  5
   2.  Changes from RFC 2765  . . . . . . . . . . . . . . . . . . . .  5
   3.  Conventions  . . . . . . . . . . . . . . . . . . . . . . . . .  6
   4.  Translating from IPv4 to IPv6  . . . . . . . . . . . . . . . .  6
     4.1.  Translating IPv4 Headers into IPv6 Headers . . . . . . . .  7
     4.2.  Translating ICMPv4 Headers into ICMPv6 Headers . . . . . . 10
     4.3.  Translating ICMPv4 Error Messages into ICMPv6  . . . . . . 13
     4.4.  Generation of ICMPv4 Error Message . . . . . . . . . . . . 14
     4.5.  Transport-Layer Header Translation . . . . . . . . . . . . 14
     4.6.  Knowing When to Translate  . . . . . . . . . . . . . . . . 15
   5.  Translating from IPv6 to IPv4  . . . . . . . . . . . . . . . . 15
     5.1.  Translating IPv6 Headers into IPv4 Headers . . . . . . . . 17
       5.1.1.  IPv6 Fragment Processing . . . . . . . . . . . . . . . 19
     5.2.  Translating ICMPv6 Headers into ICMPv4 Headers . . . . . . 20
     5.3.  Translating ICMPv6 Error Messages into ICMPv4  . . . . . . 22
     5.4.  Generation of ICMPv6 Error Messages  . . . . . . . . . . . 23
     5.5.  Transport-Layer Header Translation . . . . . . . . . . . . 24
     5.6.  Knowing When to Translate  . . . . . . . . . . . . . . . . 24
   6.  Special Considerations for ICMPv6 Packet Too Big . . . . . . . 24
   7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 25
   8.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 26
   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 26
     9.1.  Normative References . . . . . . . . . . . . . . . . . . . 26
     9.2.  Informative References . . . . . . . . . . . . . . . . . . 28
   Appendix A.  Stateless Translation Workflow Example  . . . . . . . 30
     A.1.  H6 Establishes Communication with H4 . . . . . . . . . . . 30
     A.2.  H4 Establishes Communication with H6 . . . . . . . . . . . 32

1. Introduction and Motivation ๐ŸŽ€

okay so this doc came out of the 2008-2010 effort to replace NAT-PT [RFC2766]. NAT-PT got moved to Historic status when [RFC4966] was published in 2007 ๐Ÿ’… This one is directly derived from Erik Nordmark's "Stateless IP/ICMP Translation Algorithm (SIIT)" [RFC2765]. That one gives stateless translation between IPv4 [RFC0791] and IPv6 [RFC2460], and between ICMPv4 [RFC0792] and ICMPv6 [RFC4443]. This document obsoletes RFC 2765 [RFC2765], and the changes from RFC 2765 [RFC2765] are listed in Section 2.

readers are expected to already understand the framework in [RFC6144] โœจ Implementations of this IPv4/IPv6 translation spec MUST also support the address translation algorithms in [RFC6052]. Implementations MAY also support stateful translation [RFC6146] ๐Ÿซถ

1.1. IPv4-IPv6 Translation Model ๐Ÿงš

the translation model has two or more network domains connected by one or more IP/ICMP translators (XLATs), as shown in Figure 1 ๐Ÿ’–

            ---------          ---------
          //        \\       //         \\
        /             +----+              \
       |              |XLAT|               | XLAT: IP/ICMP
       |   IPv4       +----+   IPv6        |       Translator
       |   Domain     |    |   Domain      |
       |              |    |               |
        \             |    |              /
         \\         //      \\          //
            --------          ---------

               Figure 1: IPv4-IPv6 Translation Model

the scenarios for this model are discussed in [RFC6144] ๐ŸŒธ

1.2. Applicability and Limitations ๐Ÿ“

this doc only specifies the translation algorithms between IPv4 packets and IPv6 packets ๐Ÿ’…

same as RFC 2765 [RFC2765], the translating function here does not translate any IPv4 options. It also doesn't translate IPv6 extension headers, except for the Fragment Header ๐Ÿ™ˆ

the issues and algorithms for translating datagrams that contain TCP segments are in [RFC5382] ๐Ÿฆ‹

fragmented IPv4 UDP packets without a UDP checksum (aka the UDP checksum field is zero) aren't really useful on the Internet, so in general the IP/ICMP translator won't translate them ๐Ÿ’€ BUT if the translator is configured to forward a packet without a UDP checksum, then those fragmented IPv4 UDP packets WILL get translated ๐Ÿ‘‘

fragmented ICMP/ICMPv6 packets won't be translated by the IP/ICMP translator ๐Ÿ˜ญ

the IP/ICMP header translation in this doc is consistent with the requirements of multicast IP/ICMP headers. However, IPv4 multicast addresses [RFC5771] can't be mapped to IPv6 multicast addresses [RFC3307] using the unicast mapping rule [RFC6052] ๐Ÿฅบ

1.3. Stateless vs. Stateful Mode ๐ŸŒˆ

an IP/ICMP translator can run in two modes, stateless and stateful [RFC6144] โœจ In both cases we're assuming a system (a node or an application) with an IPv4 address but no IPv6 address is talking to a system with an IPv6 address but no IPv4 address. Or the two systems don't have contiguous routing connectivity, so their communication has to be translated ๐Ÿซถ

in stateless mode, a specific IPv6 address range represents IPv4 systems (IPv4-converted addresses). The IPv6 systems have addresses (IPv4-translatable addresses) that can be algorithmically mapped to a subset of the service provider's IPv4 addresses. IPv4-translatable addresses are a subset of IPv4-converted addresses ๐Ÿงš Basically there's no need to worry about translation tables, because the IPv4 and IPv6 counterparts are algorithmically related ๐Ÿ’–

in stateful mode, a specific IPv6 address range still represents IPv4 systems (IPv4-converted addresses), but the IPv6 systems can use any IPv6 addresses [RFC4291] except the ones in that range. Here a translation table IS required to bind the IPv6 systems' addresses to the IPv4 addresses kept in the translator ๐Ÿ“š

the address translation mechanisms for stateless and stateful translation are defined in [RFC6052] ๐ŸŽ€

1.4. Path MTU Discovery and Fragmentation ๐Ÿ”ฅ

the IPv4 header is 20+ octets and the IPv6 header is 40 octets, so handling the maximum packet size is critical for the IPv4/IPv6 translator ๐Ÿ˜ญ There are three mechanisms for this: path MTU discovery (PMTUD), fragmentation, and transport-layer negotiation such as the TCP Maximum Segment Size (MSS) option [RFC0879].

the big rule here: the translator MUST behave as a router, i.e., the translator MUST send a Packet Too Big error message or fragment the packet when the packet size exceeds the MTU of the next-hop interface. no skipping this one bestie ๐Ÿšจ

Don't Fragment, ICMP Packet Too Big, and packet fragmentation are covered in Sections 4 and 5 of this document. Reassembling fragmented packets in the stateful translator is covered in [RFC6146], since that needs state maintenance in the translator ๐Ÿ’…

2. Changes from RFC 2765 ๐Ÿ“

okay so here's everything that changed from RFC 2765 ๐Ÿฆ‹

  1. Redescribing the network model to match present and projected usage. The scenarios, applicability, and limitations originally presented in RFC 2765 [RFC2765] moved to the framework document [RFC6144] โœจ
  2. Moving the address format to the address format document [RFC6052], so it lines up with other docs on the topic ๐Ÿงš
  3. Describing the header translation for stateless and stateful operations. The details of session database and mapping table handling for stateful translation are in the stateful translation document [RFC6146] ๐Ÿ’œ
  4. Refining the header translation, fragmentation handling, ICMP translation, and ICMP error translation in the IPv4-to-IPv6 direction, as well as in the IPv6-to-IPv4 direction ๐Ÿ”ฅ
  5. Adding more discussion on transport-layer header translation ๐ŸŒธ
  6. Adding Section 5.1.1 for "IPv6 Fragment Processing" ๐ŸŽ€
  7. Adding Section 6 for "Special Considerations for ICMPv6 Packet Too Big" ๐Ÿ‘‘
  8. Updating Section 7 for "Security Considerations" ๐Ÿซถ
  9. Adding Appendix A "Stateless translation workflow example" ๐ŸŒˆ

3. Conventions ๐Ÿ’…

the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119] ๐Ÿฆ‹

4. Translating from IPv4 to IPv6 โœจ

okay bestie, so when an IP/ICMP translator gets an IPv4 datagram that's headed toward the IPv6 domain ๐Ÿฆ‹, it translates the IPv4 header into an IPv6 header. The original IPv4 header gets yeeted and replaced with the new IPv6 one, and the transport checksum gets updated as needed (if the translator supports that transport ๐Ÿ’…). The data part? Left totally alone, no cap. Then the translator forwards the packet based on the IPv6 destination address ๐Ÿš€.

          +-------------+                 +-------------+
          |    IPv4     |                 |    IPv6     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |  Transport- |                 |  Fragment   |
          |   Layer     |      ===>       |   Header    |
          |   Header    |                 | (if needed) |
          +-------------+                 +-------------+
          |             |                 |  Transport- |
          ~    Data     ~                 |   Layer     |
          |             |                 |   Header    |
          +-------------+                 +-------------+
                                          |             |
                                          ~    Data     ~
                                          |             |
                                          +-------------+

                Figure 2: IPv4-to-IPv6 Translation

Path MTU discovery is mandatory in IPv6, but it is optional in IPv4. IPv6 routers never fragment a packet -- only the sender can do fragmentation. Main character rules, honestly ๐Ÿ‘‘.

When an IPv4 node performs path MTU discovery (by setting the Don't Fragment (DF) bit in the header) ๐ŸŒธ, path MTU discovery can operate end-to-end, i.e., across the translator. In this case, either IPv4 or IPv6 routers (including the translator) might send back ICMP Packet Too Big messages to the sender. When the IPv6 routers send these ICMPv6 errors, they will pass through a translator that will translate the ICMPv6 error to a form that the IPv4 sender can understand. As a result, an IPv6 Fragment Header is only included if the IPv4 packet is already fragmented.

However, when the IPv4 sender does not set the DF bit, the translator MUST ensure that the packet does not exceed the path MTU on the IPv6 side. This is done by fragmenting the IPv4 packet (with Fragment Headers) so that it fits in 1280-byte IPv6 packets, since that is the minimum IPv6 MTU. The IPv6 Fragment Header has been shown to cause operational difficulties in practice due to limited firewall fragmentation support, etc. ๐Ÿ˜ญ In an environment where the network owned/operated by the same entity that owns/operates the translator, the translator MAY provide a configuration function for the network administrator to adjust the threshold of the minimum IPv6 MTU to a value that reflects the real value of the minimum IPv6 MTU in the network (greater than 1280 bytes). This will help reduce the chance of including the Fragment Header in the packets.

When the IPv4 sender does not set the DF bit, the translator SHOULD always include an IPv6 Fragment Header to indicate that the sender allows fragmentation. The translator MAY provide a configuration function that allows the translator not to include the Fragment Header for the non-fragmented IPv6 packets.

The rules in Section 4.1 ensure that when packets are fragmented, either by the sender or by IPv4 routers, the low-order 16 bits of the fragment identification are carried end-to-end, ensuring that packets are correctly reassembled. In addition, the rules in Section 4.1 use the presence of an IPv6 Fragment Header to indicate that the sender might not be using path MTU discovery (i.e., the packet should not have the DF flag set should it later be translated back to IPv4). ๐Ÿงš

Other than the special rules for handling fragments and path MTU discovery, the actual translation of the packet header consists of a simple translation as defined below. Note that ICMPv4 packets require special handling in order to translate the content of ICMPv4 error messages and also to add the ICMPv6 pseudo-header checksum.

The translator SHOULD make sure that the packets belonging to the same flow leave the translator in the same order in which they arrived. Order matters, periodt ๐Ÿ’œ.

4.1. Translating IPv4 Headers into IPv6 Headers

If the DF flag is not set and the IPv4 packet will result in an IPv6 packet larger than 1280 bytes, the packet SHOULD be fragmented so the resulting IPv6 packet (with Fragment Header added to each fragment) will be less than or equal to 1280 bytes. For example, if the packet is fragmented prior to the translation, the IPv4 packets should be fragmented so that their length, excluding the IPv4 header, is at most 1232 bytes (1280 minus 40 for the IPv6 header and 8 for the Fragment Header). The translator MAY provide a configuration function for the network administrator to adjust the threshold of the minimum IPv6 MTU to a value greater than 1280-byte if the real value of the minimum IPv6 MTU in the network is known to the administrator. The resulting fragments are then translated independently using the logic described below.

If the DF bit is set and the MTU of the next-hop interface is less than the total length value of the IPv4 packet plus 20, the translator MUST send an ICMPv4 "Fragmentation Needed" error message to the IPv4 source address. Bestie, this one is serious ๐Ÿ’€.

If the DF bit is set and the packet is not a fragment (i.e., the More Fragments (MF) flag is not set and the Fragment Offset is equal to zero), then the translator SHOULD NOT add a Fragment Header to the resulting packet. The IPv6 header fields are set as follows:

  • Version: 6
  • Traffic Class: By default, copied from the IP Type Of Service (TOS) octet. According to [RFC2474], the semantics of the bits are identical in IPv4 and IPv6. However, in some IPv4 environments these fields might be used with the old semantics of "Type Of Service and Precedence". An implementation of a translator SHOULD support an administratively configurable option to ignore the IPv4 TOS and always set the IPv6 traffic class (TC) to zero. In addition, if the translator is at an administrative boundary, the filtering and update considerations of [RFC2475] may be applicable.
  • Flow Label: 0 (all zero bits)
  • Payload Length: Total length value from the IPv4 header, minus the size of the IPv4 header and IPv4 options, if present.
  • Next Header: For ICMPv4 (1), it is changed to ICMPv6 (58); otherwise, the protocol field MUST be copied from the IPv4 header.
  • Hop Limit: The hop limit is derived from the TTL value in the IPv4 header. Since the translator is a router, as part of forwarding the packet it needs to decrement either the IPv4 TTL (before the translation) or the IPv6 Hop Limit (after the translation). As part of decrementing the TTL or Hop Limit, the translator (as any router) MUST check for zero and send the ICMPv4 "TTL Exceeded" or ICMPv6 "Hop Limit Exceeded" error.
  • Source Address: The IPv4-converted address derived from the IPv4 source address per [RFC6052], Section 2.3.

If the translator gets an illegal source address (e.g., 0.0.0.0, 127.0.0.1, etc.), the translator SHOULD silently drop the packet (as discussed in Section 5.3.7 of [RFC1812]).

  • Destination Address: In the stateless mode, which is to say that if the IPv4 destination address is within a range of configured IPv4 stateless translation prefix, the IPv6 destination address is the IPv4-translatable address derived from the IPv4 destination address per [RFC6052], Section 2.3. A workflow example of stateless translation is shown in Appendix A of this document.

In the stateful mode (which is to say that if the IPv4 destination address is not within the range of any configured IPv4 stateless translation prefix), the IPv6 destination address and corresponding transport-layer destination port are derived from the Binding Information Bases (BIBs) reflecting current session state in the translator as described in [RFC6146].

If any IPv4 options are present in the IPv4 packet, they MUST be ignored and the packet translated normally; there is no attempt to translate the options. However, if an unexpired source route option is present then the packet MUST instead be discarded, and an ICMPv4 "Destination Unreachable, Source Route Failed" (Type 3, Code 5) error message SHOULD be returned to the sender. ๐Ÿ™ˆ

If there is a need to add a Fragment Header (the DF bit is not set or the packet is a fragment), the header fields are set as above with the following exceptions:

IPv6 fields:

  • Payload Length: Total length value from the IPv4 header, plus 8 for the Fragment Header, minus the size of the IPv4 header and IPv4 options, if present.
  • Next Header: Fragment Header (44).

Fragment Header fields:

  • Next Header: For ICMPv4 (1), it is changed to ICMPv6 (58); otherwise, the protocol field MUST be copied from the IPv4 header.
  • Fragment Offset: Fragment Offset copied from the IPv4 header.
  • M flag: More Fragments bit copied from the IPv4 header.
  • Identification: The low-order 16 bits copied from the Identification field in the IPv4 header. The high-order 16 bits set to zero.

4.2. Translating ICMPv4 Headers into ICMPv6 Headers โœจ

okay so, every ICMPv4 message that gets translated needs its ICMPv6 checksum calculated as part of the translation ๐Ÿงฎ bc ICMPv6 has a pseudo-header checksum just like UDP and TCP do. it's giving consistency ๐Ÿ’…

also, every ICMPv4 packet MUST have its Type translated ๐Ÿซถ and for ICMPv4 error messages, the IP header inside the packet MUST be translated too ๐ŸŽ€

here's how each ICMPv4 message gets handled ๐Ÿฆ‹

ICMPv4 query messages:

  • Echo and Echo Reply (Type 8 and Type 0): change the Type values to 128 and 129, respectively ๐ŸŒธ Then fix the ICMP checksum so it accounts for the type change AND includes the ICMPv6 pseudo-header. iconic โœจ
  • Information Request/Reply (Type 15 and Type 16): obsoleted in ICMPv6 ๐Ÿ’€ Silently drop.
  • Timestamp and Timestamp Reply (Type 13 and Type 14): obsoleted in ICMPv6 ๐Ÿ™ˆ Silently drop.
  • Address Mask Request/Reply (Type 17 and Type 18): obsoleted in ICMPv6 ๐Ÿ˜ญ Silently drop.
  • ICMP Router Advertisement (Type 9): single-hop message, so it's giving "not my problem" ๐Ÿ™…โ€โ™€๏ธ Silently drop.
  • ICMP Router Solicitation (Type 10): single-hop message too ๐Ÿ™…โ€โ™€๏ธ Silently drop.
  • Unknown ICMPv4 types: silently drop ๐Ÿซฅ
  • IGMP messages: okay so, MLD [RFC2710] [RFC3590] [RFC3810] is the logical IPv6 version of IGMP ๐Ÿงš BUT all the "normal" IGMP messages are single-hop messages, so they SHOULD be silently dropped by the translator ๐Ÿ“ Other IGMP messages might be used by multicast routing protocols. Trying to have router adjacencies across IP/ICMP translators would be a configuration error, so those packets SHOULD also be silently dropped ๐Ÿšซ not literally the vibe we want

ICMPv4 error messages:

  • Destination Unreachable (Type 3): translate the Code as described below, set the Type to 1, and fix the ICMP checksum so it takes the type/code change into account AND includes the ICMPv6 pseudo-header ๐Ÿ”ฅ

Translate the Code like this:

  • Code 0, 1 (Net Unreachable, Host Unreachable): set the Code to 0 (No route to destination) ๐Ÿ—บ๏ธ
  • Code 2 (Protocol Unreachable): translate to an ICMPv6 Parameter Problem (Type 4, Code 1) and make the Pointer point to the IPv6 Next Header field ๐Ÿ‘‘
  • Code 3 (Port Unreachable): set the Code to 4 (Port unreachable) ๐ŸŽฏ
  • Code 4 (Fragmentation Needed and DF was Set): translate to an ICMPv6 Packet Too Big message (Type 2) with Code set to 0 ๐ŸŒˆ The MTU field MUST be adjusted for the difference between the IPv4 and IPv6 header sizes, i.e., minimum(advertised MTU+20, MTU_of_IPv6_nexthop, (MTU_of_IPv4_nexthop)+20) ๐Ÿงฎ Also, if the IPv4 router set the MTU field to zero (aka it doesn't implement [RFC1191]), the translator MUST use the plateau values specified in [RFC1191] to figure out a likely path MTU and include that path MTU in the ICMPv6 packet. Use the greatest plateau value that's less than the returned Total Length field ๐Ÿฆ‹

See also the requirements in Section 6 ๐Ÿซถ

  • Code 5 (Source Route Failed): set the Code to 0 (No route to destination) ๐Ÿ™ƒ This error is unlikely since source routes aren't translated, ngl
  • Code 6, 7, 8: set the Code to 0 (No route to destination) ๐Ÿ—บ๏ธ
  • Code 9, 10 (Communication with Destination Host Administratively Prohibited): set the Code to 1 (Communication with destination administratively prohibited) ๐Ÿ”’
  • Code 11, 12: set the Code to 0 (No route to destination) ๐Ÿ—บ๏ธ
  • Code 13 (Communication Administratively Prohibited): set the Code to 1 (Communication with destination administratively prohibited) ๐Ÿ”’
  • Code 14 (Host Precedence Violation): silently drop ๐Ÿ’…
  • Code 15 (Precedence cutoff in effect): set the Code to 1 (Communication with destination administratively prohibited) ๐Ÿ”’
  • Other Code values: silently drop ๐Ÿซฅ
  • Redirect (Type 5): single-hop message, so silently drop ๐Ÿ™…โ€โ™€๏ธ
  • Alternative Host Address (Type 6): silently drop ๐Ÿซฅ
  • Source Quench (Type 4): obsoleted in ICMPv6 ๐Ÿ˜ญ Silently drop.
  • Time Exceeded (Type 11): set the Type to 3, and fix the ICMP checksum so it accounts for the type change AND includes the ICMPv6 pseudo-header โฐ The Code stays the same ๐Ÿซถ
  • Parameter Problem (Type 12): set the Type to 4, and fix the ICMP checksum so it takes the type/code change into account AND includes the ICMPv6 pseudo-header ๐Ÿงฉ

Translate the Code like this:

  • Code 0 (Pointer indicates the error): set the Code to 0 (Erroneous header field encountered) and update the pointer as defined in Figure 3 ๐ŸŽฏ (If the Original IPv4 Pointer Value isn't listed, or the Translated IPv6 Pointer Value is listed as "n/a", silently drop the packet ๐Ÿซฅ)
  • Code 1 (Missing a required option): silently drop ๐Ÿซฅ
  • Code 2 (Bad length): set the Code to 0 (Erroneous header field encountered) and update the pointer as defined in Figure 3 ๐ŸŽฏ (If the Original IPv4 Pointer Value isn't listed, or the Translated IPv6 Pointer Value is listed as "n/a", silently drop the packet ๐Ÿซฅ)
  • Other Code values: silently drop ๐Ÿซฅ
  • Unknown ICMPv4 types: silently drop ๐Ÿซฅ

Here's the pointer mapping for Figure 3 ๐Ÿ“ It's a whole vibe ๐ŸŒธ

+--------------------------------+--------------------------------+
|   Original IPv4 Pointer Value  | Translated IPv6 Pointer Value  |
+--------------------------------+--------------------------------+
|  0  | Version/IHL              |  0  | Version/Traffic Class    |
|  1  | Type Of Service          |  1  | Traffic Class/Flow Label |
| 2,3 | Total Length             |  4  | Payload Length           |
| 4,5 | Identification           | n/a |                          |
|  6  | Flags/Fragment Offset    | n/a |                          |
|  7  | Fragment Offset          | n/a |                          |
|  8  | Time to Live             |  7  | Hop Limit                |
|  9  | Protocol                 |  6  | Next Header              |
|10,11| Header Checksum          | n/a |                          |
|12-15| Source Address           |  8  | Source Address           |
|16-19| Destination Address      | 24  | Destination Address      |
+--------------------------------+--------------------------------+

Figure 3: Pointer Value for Translating from IPv4 to IPv6 ๐Ÿ“

  • ICMP Error Payload: okay this one's important ๐Ÿšจ If the received ICMPv4 packet contains an ICMPv4 Extension [RFC4884], translating it will make the ICMPv6 packet change length. When that happens, the ICMPv6 Extension length attribute MUST be adjusted accordingly (e.g., longer, because IPv6 is bigger than IPv4) ๐Ÿ“ If the ICMPv4 Extension is bigger than the maximum size of an ICMPv6 message on the outgoing interface, the ICMPv4 extension SHOULD be simply truncated โœ‚๏ธ For extensions not defined in [RFC4884], the translator passes them along as opaque bit strings. Any that contain IPv4 address literals won't have those addresses translated to IPv6 address literals, and this may cause problems when processing those ICMP extensions ๐Ÿ˜ฌ

4.3. Translating ICMPv4 Error Messages into ICMPv6

okay so, the ICMPv4 and ICMPv6 error message formats are different, as we just saw ๐Ÿ™ƒ The ICMP error messages that contain the packet in error MUST be translated just like a normal IP packet ๐Ÿ“ฆ And if translating this "packet in error" changes the length of the datagram, the Total Length field in the outer IPv6 header MUST be updated ๐Ÿ“

          +-------------+                 +-------------+
          |    IPv4     |                 |    IPv6     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |   ICMPv4    |                 |   ICMPv6    |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |    IPv4     |      ===>       |    IPv6     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |   Partial   |                 |   Partial   |
          |  Transport- |                 |  Transport- |
          |   Layer     |                 |   Layer     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+

Figure 4: IPv4-to-IPv6 ICMP Error Translation ๐Ÿ–ผ๏ธ

The inner IP header can be translated by calling the same function that translated the outer IP headers ๐Ÿ” This process MUST stop at the first embedded header, and it MUST drop the packet if it contains more embedded headers ๐Ÿ›‘


4.4. Generation of ICMPv4 Error Message

If the IPv4 packet gets discarded, the translator SHOULD be able to send an ICMPv4 error message back to the original sender ๐Ÿ“จ The exception is if the discarded packet is itself an ICMPv4 message ๐Ÿ™…โ€โ™€๏ธ The ICMPv4 message, if sent, has a Type of 3 (Destination Unreachable) and a Code of 13 (Communication Administratively Prohibited), unless this document or [RFC6146] specifies otherwise ๐Ÿ”’ The translator SHOULD also let an administrator configure whether ICMPv4 error messages are sent, rate-limited, or not sent at all ๐ŸŽ›๏ธ


4.5. Transport-Layer Header Translation

If the address translation algorithm isn't checksum neutral (see Section 4.1 of [RFC6052]), the transport-layer headers that contain pseudo-headers need to be recalculated and updated ๐Ÿงฎ Translators MUST do this for TCP and ICMP packets, and for UDP packets that contain a UDP checksum (i.e., the UDP checksum field is not zero) ๐Ÿ’–

For UDP packets that don't contain a UDP checksum (i.e., the UDP checksum field is zero), the translator SHOULD provide a configuration function that allows:

  1. Dropping the packet and generating a system management event that specifies at least the IP addresses and port numbers of the packet ๐Ÿ—’๏ธ
  2. Calculating an IPv6 checksum and forwarding the packet (which has performance implications) โšก

A stateless translator can't compute the UDP checksum of fragmented packets ๐Ÿ˜ญ So when a stateless translator receives the first fragment of a fragmented UDP IPv4 packet and the checksum field is zero, the translator SHOULD drop the packet and generate a system management event that specifies at least the IP addresses and port numbers in the packet ๐Ÿซ 

For a stateful translator, the handling of fragmented UDP IPv4 packets with a zero checksum is discussed in [RFC6146]), Section 3.1 ๐Ÿ“–

Other transport protocols (e.g., DCCP) are OPTIONAL to support ๐ŸŒˆ But to make debugging and troubleshooting easier, translators MUST forward all transport protocols as described in the "Next Header" step of Section 4.1 ๐Ÿ”โœจ

4.6. Knowing When to Translate โœจ

okay so here's the deal: if the IP/ICMP translator also does normal forwarding, and the destination IPv4 address can be reached by a more specific route without translation, it MUST forward the packet without translating it ๐Ÿ’…. Otherwise, when a translator gets an IPv4 datagram addressed to an IPv4 destination that represents a host in the IPv6 domain, the packet MUST be translated to IPv6 ๐Ÿฆ‹.

5. Translating from IPv6 to IPv4 ๐ŸŒˆ

When an IP/ICMP translator gets an IPv6 datagram headed for the IPv4 domain, it swaps the IPv6 header for an IPv4 header. The original IPv6 header is removed and replaced, bestie ๐ŸŽ€.

Here's the tea on checksums. The ICMPv6 [RFC4443], TCP [RFC0793], UDP [RFC0768], and DCCP [RFC4340] headers all have checksums that cover the IP header. So if the address mapping algorithm is not checksum neutral, the checksum MUST be evaluated before translation, and the ICMP and transport-layer headers MUST be updated ๐Ÿ”ฅ. The data portion stays exactly the same, and then the IP/ICMP translator forwards the packet based on the IPv4 destination address.

              +-------------+                 +-------------+
              |    IPv6     |                 |    IPv4     |
              |   Header    |                 |   Header    |
              +-------------+                 +-------------+
              |  Fragment   |                 |  Transport  |
              |   Header    |      ===>       |   Layer     |
              |(if present) |                 |   Header    |
              +-------------+                 +-------------+
              |  Transport  |                 |             |
              |   Layer     |                 ~    Data     ~
              |   Header    |                 |             |
              +-------------+                 +-------------+
              |             |
              ~    Data     ~
              |             |
              +-------------+

                    Figure 5: IPv6-to-IPv4 Translation

Okay, now the drama ๐Ÿ˜ญ. IPv6 and IPv4 are different when it comes to fragmentation and minimum link MTU, and that messes with translation. An IPv6 link has to have an MTU of 1280 bytes or greater. For IPv4, the limit is 68 bytes. Path MTU discovery across a translator depends on ICMP Packet Too Big messages being received and processed by IPv6 hosts. That includes an ICMP Packet Too Big that says the MTU is less than the IPv6 minimum MTU. This requirement is described in Section 5 of [RFC2460] (for IPv6's 1280-octet minimum MTU) and Section 5 of [RFC1883] (for IPv6's older 576-octet minimum MTU) ๐Ÿงš.

Now the main character moment ๐Ÿ‘‘. If an ICMPv4 Packet Too Big message is translated to an ICMPv6 Packet Too Big message, and the ICMPv6 one actually gets delivered to and correctly processed by the IPv6 hosts (for example, on a network run by the same people who run the translator), then the translator can count on IPv6 hosts sending later packets to the same IPv6 destination with IPv6 Fragment Headers ๐ŸŒธ. In that setup, when the translator gets an IPv6 packet with a Fragment Header, it SHOULD generate the IPv4 packet with a cleared Don't Fragment bit. It should also use the identification value from the IPv6 Fragment Header, for all of the IPv6 fragments (MF=0 or MF=1).

But if an ICMPv4 Packet Too Big message gets filtered (by a network firewall or by the host itself), or the IPv6 hosts don't process it correctly, then the IPv6 host will never generate an IPv6 packet with the IPv6 Fragment Header ๐Ÿ’€. In that situation, the translator SHOULD set the IPv4 Don't Fragment bit. Setting that bit might create PMTUD black holes [RFC2923] if there are IPv4 links smaller than 1260 octets. Still, that's considered safer than causing IPv4 reassembly errors [RFC4963] ๐Ÿซถ.

Aside from the special rules for fragments and path MTU discovery, translating the packet header is pretty simple, as defined below. Just a heads up: ICMPv6 packets need special handling to translate the contents of ICMPv6 error messages, and also to remove the ICMPv6 pseudo-header checksum ๐Ÿ™ˆ.

The translator SHOULD make sure packets in the same flow leave the translator in the same order they arrived. Order matters, periodt ๐Ÿ’œ.

5.1. Translating IPv6 Headers into IPv4 Headers โœจ

If there is no IPv6 Fragment Header, the IPv4 header fields get set like this:

  • Version: 4
  • Internet Header Length: 5 (no IPv4 options)
  • Type of Service (TOS) Octet: By default, copied from the IPv6 Traffic Class (all 8 bits). According to [RFC2474], the bits mean the same thing in IPv4 and IPv6. However, in some IPv4 environments these bits might still be used with the old "Type Of Service and Precedence" semantics. An implementation of a translator SHOULD provide the ability to ignore the IPv6 traffic class and always set the IPv4 TOS Octet to a specified value. Also, if the translator sits at an administrative boundary, the filtering and update considerations of [RFC2475] may apply ๐Ÿ“.
  • Total Length: Payload length value from the IPv6 header, plus the size of the IPv4 header.
  • Identification: All zero. To avoid black holes caused by ICMPv4 filtering or non-[RFC2460]-compatible IPv6 hosts (a workaround is discussed in Section 6), the translator MAY provide a function to generate the identification value if the packet size is greater than 88 bytes and less than or equal to 1280 bytes.
    • The translator SHOULD provide a method for operators to enable or disable this function.
  • Flags: The More Fragments flag is set to zero. The Don't Fragment (DF) flag is set to one. To avoid black holes caused by ICMPv4 filtering or non-[RFC2460]-compatible IPv6 hosts (a workaround is discussed in Section 6), the translator MAY provide a function as follows. If the packet size is greater than 88 bytes and less than or equal to 1280 bytes, it sets the DF flag to zero. Otherwise, it sets the DF flag to one.
    • The translator SHOULD provide a method for operators to enable or disable this function.
  • Fragment Offset: All zeros.
  • Time to Live: Derived from the Hop Limit value in the IPv6 header. Since the translator is a router, as part of forwarding the packet it needs to decrement either the IPv6 Hop Limit (before translation) or the IPv4 TTL (after translation). As part of decrementing the TTL or Hop Limit, the translator (like any router) MUST check for zero and send the ICMPv4 "TTL Exceeded" or ICMPv6 "Hop Limit Exceeded" error ๐Ÿฆ‹.
  • Protocol: The IPv6-Frag (44) header is handled as discussed in Section 5.1.1. ICMPv6 (58) is changed to ICMPv4 (1), and the payload is translated as discussed in Section 5.2. The IPv6 headers HOPOPT (0), IPv6-Route (43), and IPv6-Opts (60) are skipped over during processing, since they have no meaning in IPv4. For the first 'next header' that doesn't match any of the cases above, its Next Header value (which contains the transport protocol number) is copied to the protocol field in the IPv4 header. This means all transport protocols get translated ๐Ÿ‘‘.
    • Note: Some translated protocols will fail at the receiver for various reasons. Some are known to fail when translated (e.g., IPsec Authentication Header (51)). Others will fail checksum validation if the address translation is not checksum neutral [RFC6052], and the translator doesn't update the transport protocol's checksum (because the translator doesn't support recalculating the checksum for that transport protocol; see Section 5.5).
  • Header Checksum: Computed once the IPv4 header has been created.
  • Source Address: In stateless mode (meaning the IPv6 source address is within the range of a configured IPv6 translation prefix), the IPv4 source address is derived from the IPv6 source address per [RFC6052], Section 2.3. Note that the original IPv6 source address is an IPv4-translatable address. A workflow example of stateless translation is shown in Appendix A of this document. If the translator only supports stateless mode, and the IPv6 source address is not within the range of a configured IPv6 prefix, the translator SHOULD drop the packet and respond with an ICMPv6 "Destination Unreachable, Source address failed ingress/egress policy" (Type 1, Code 5) ๐ŸŒˆ.
    • In stateful mode (meaning the IPv6 source address is not within the range of any configured IPv6 stateless translation prefix), the IPv4 source address and transport-layer source port that match the IPv4-related IPv6 source address and source port are derived from the Binding Information Bases (BIBs), as described in [RFC6146].
    • In both stateless and stateful modes, if the translator gets an illegal source address (e.g., ::1, etc.), the translator SHOULD silently drop the packet ๐Ÿ™ˆ.
  • Destination Address: The IPv4 destination address is derived from the IPv6 destination address of the datagram being translated, per [RFC6052], Section 2.3. Note that the original IPv6 destination address is an IPv4-converted address ๐Ÿงš.

If a Routing header with a non-zero Segments Left field is present, the packet MUST NOT be translated. An ICMPv6 "parameter problem/erroneous header field encountered" (Type 4, Code 0) error message SHOULD be returned to the sender, with the Pointer field indicating the first byte of the Segments Left field ๐Ÿ’….

5.1.1. IPv6 Fragment Processing ๐Ÿฆ‹

If the IPv6 packet contains a Fragment Header, the header fields are set as above, with these exceptions:

  • Total Length: Payload length value from the IPv6 header, minus 8 for the Fragment Header, plus the size of the IPv4 header.
  • Identification: Copied from the low-order 16 bits of the Identification field in the Fragment Header.
  • Flags: The IPv4 More Fragments (MF) flag is copied from the M flag in the IPv6 Fragment Header. The IPv4 Don't Fragment (DF) flag is cleared (set to zero), which allows this packet to be further fragmented by IPv4 routers ๐Ÿ“.
  • Fragment Offset: Copied from the Fragment Offset field of the IPv6 Fragment Header.
  • Protocol: For ICMPv6 (58), it is changed to ICMPv4 (1). Otherwise, extension headers are skipped, and the Next Header field is copied from the last IPv6 header.

If a translated packet with DF set to 1 would be larger than the MTU of the next-hop interface, the translator MUST drop the packet and send the ICMPv6 Packet Too Big (Type 2, Code 0) error message to the IPv6 host, with an adjusted MTU in the ICMPv6 message. That's the fragment rules, and they're lowkey a lot, but you've got this ๐Ÿ’–โœจ

5.2. Translating ICMPv6 Headers into ICMPv4 Headers โœจ

okay so if a non-checksum-neutral translation address is being used, the ICMPv4 checksum field MUST be updated as part of the translation ๐Ÿงฎ because ICMPv6 (unlike ICMPv4) puts a pseudo-header in the checksum, just like UDP and TCP do. ICMPv6 being the one with the extra pseudo-header is so main character ๐Ÿ’…

also, all ICMP packets MUST have the Type translated, and for ICMP error messages the included IP header MUST be translated too ๐ŸŽ€ this is where it gets spicy ๐ŸŒถ๏ธ the IPv6 addresses in that header might not be IPv4-translatable, so there won't be a matching IPv4 address for them. in that case the translator can do stateful translation ๐Ÿฆ‹ a way for it to do stateless translation of that address is left for future work ๐Ÿ”ฎ

here's the rundown of what to do with each ICMPv6 message ๐Ÿ“‹

ICMPv6 informational messages:

  • Echo Request and Echo Reply (Type 128 and 129): change the Type values to 8 and 0, respectively, and update the ICMP checksum to account for the type change and to leave out the ICMPv6 pseudo-header ๐Ÿ“
  • MLD Multicast Listener Query/Report/Done (Type 130, 131, 132): these are single-hop messages, so silently drop them ๐Ÿ™ˆ
  • Neighbor Discovery messages (Type 133 through 137): also single-hop, so silently drop ๐Ÿ’€
  • Unknown informational messages: silently drop ๐Ÿซถ

ICMPv6 error messages:

  • Destination Unreachable (Type 1): set the Type to 3 and update the ICMP checksum to account for the type/code change and to leave out the ICMPv6 pseudo-header.

translate the Code like this:

  • Code 0 (No route to destination): set the Code to 1 (Host unreachable).
  • Code 1 (Communication with destination administratively prohibited): set the Code to 10 (Communication with destination host administratively prohibited).
  • Code 2 (Beyond scope of source address): set the Code to 1 (Host unreachable). ngl this one is very unlikely, since an IPv4-translatable source address is typically considered to have global scope ๐ŸŒ
  • Code 3 (Address unreachable): set the Code to 1 (Host unreachable).
  • Code 4 (Port unreachable): set the Code to 3 (Port unreachable).
  • Other Code values: silently drop.
  • Packet Too Big (Type 2): translate this to an ICMPv4 Destination Unreachable (Type 3) with Code 4, and update the ICMPv4 checksum to account for the type change and to leave out the ICMPv6 pseudo-header. The MTU field MUST be adjusted for the difference between the IPv4 and IPv6 header sizes, taking into account whether or not the packet in error includes a Fragment Header, i.e., minimum(advertised MTU-20, MTU_of_IPv4_nexthop, (MTU_of_IPv6_nexthop)-20) ๐Ÿ“ the math is giving ๐Ÿง 

see also the requirements in Section 6 ๐Ÿ“š

  • Time Exceeded (Type 3): set the Type to 11 and update the ICMPv4 checksum to account for the type change and to leave out the ICMPv6 pseudo-header. the Code stays the same โœจ
  • Parameter Problem (Type 4): translate the Type and Code as follows, and update the ICMPv4 checksum to account for the type/code change and to leave out the ICMPv6 pseudo-header.

translate the Code like this:

  • Code 0 (Erroneous header field encountered): set this to Type 12, Code 0, and update the pointer as defined in Figure 6. (If the Original IPv6 Pointer Value is not listed or the Translated IPv4 Pointer Value is listed as "n/a", silently drop the packet. ๐Ÿ˜ญ)
  • Code 1 (Unrecognized Next Header type encountered): translate this to an ICMPv4 protocol unreachable (Type 3, Code 2) ๐Ÿ”
  • Code 2 (Unrecognized IPv6 option encountered): silently drop.
  • Unknown error messages: silently drop ๐Ÿ‘‹

here's the pointer table for Figure 6 ๐Ÿ—บ๏ธ

+--------------------------------+--------------------------------+
|   Original IPv6 Pointer Value  | Translated IPv4 Pointer Value  |
+--------------------------------+--------------------------------+
|  0  | Version/Traffic Class    |  0  | Version/IHL, Type Of Ser |
|  1  | Traffic Class/Flow Label |  1  | Type Of Service          |
| 2,3 | Flow Label               | n/a |                          |
| 4,5 | Payload Length           |  2  | Total Length             |
|  6  | Next Header              |  9  | Protocol                 |
|  7  | Hop Limit                |  8  | Time to Live             |
| 8-23| Source Address           | 12  | Source Address           |
|24-39| Destination Address      | 16  | Destination Address      |
+--------------------------------+--------------------------------+

        Figure 6: Pointer Value for Translating from IPv6 to IPv4

ICMP Error Payload: if the received ICMPv6 packet contains an ICMPv6 Extension [RFC4884], the translated ICMPv4 packet will change length ๐Ÿ“ when that happens, the ICMPv6 Extension length attribute MUST be adjusted accordingly (e.g., shorter due to the translation from IPv6 to IPv4). for extensions that aren't defined in [RFC4884], the translator passes them along as opaque bit strings, and any IPv6 address literals inside them will NOT be translated to IPv4 address literals. this may cause problems with processing those ICMP extensions ๐Ÿฅบ


5.3. Translating ICMPv6 Error Messages into ICMPv4 ๐Ÿฆ‹

ICMPv4 and ICMPv6 error message formats are different in a few ways, as we covered above ๐Ÿ’• the ICMP error messages that contain the packet in error MUST be translated just like a normal IP packet. because translating that "packet in error" will probably change the length of the datagram, the Total Length field in the outer IPv4 header MUST be updated ๐Ÿ“

here's the picture ๐Ÿ–ผ๏ธ

          +-------------+                 +-------------+
          |    IPv6     |                 |    IPv4     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |   ICMPv6    |                 |   ICMPv4    |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |    IPv6     |      ===>       |    IPv4     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+
          |   Partial   |                 |   Partial   |
          |  Transport- |                 |  Transport- |
          |   Layer     |                 |   Layer     |
          |   Header    |                 |   Header    |
          +-------------+                 +-------------+

           Figure 7: IPv6-to-IPv4 ICMP Error Translation

the inner IP header can be translated by calling the same function that translated the outer IP headers ๐Ÿ”„ this process MUST stop at the first embedded header, and the packet MUST be dropped if it has more embedded headers ๐Ÿ›‘ the IPv6 addresses in that header may not be IPv4-translatable, and there won't be corresponding IPv4 addresses either. in that case the translator can do stateful translation, and a way to do stateless translation is left for future work ๐Ÿ”ฎ


5.4. Generation of ICMPv6 Error Messages ๐Ÿšจ

if the IPv6 packet gets discarded, the translator SHOULD send an ICMPv6 error message back to the original sender of the packet, unless the discarded packet is itself an ICMPv6 message ๐Ÿ“จ

if the ICMPv6 error message is being sent because the IPv6 source address is not an IPv4-translatable address and the translator is stateless, the ICMPv6 message (if sent) MUST have Type 1 and Code 5 (Source address failed ingress/egress policy) ๐Ÿšซ in other cases, the ICMPv6 message MUST have Type 1 (Destination Unreachable) and Code 1 (Communication with destination administratively prohibited), unless otherwise specified in this document or [RFC6146] ๐Ÿ™…โ€โ™€๏ธ the translator SHOULD let an administrator configure whether the ICMPv6 error messages are sent, rate-limited, or not sent ๐ŸŽ›๏ธ


5.5. Transport-Layer Header Translation ๐Ÿงฉ

if the address translation algorithm is not checksum neutral (see Section 4.1 of [RFC6052]), the transport-layer headers that contain pseudo-headers need to be recalculated and updated ๐Ÿ”ง translators MUST do this for TCP, UDP, and ICMP ๐Ÿ’–

other transport protocols (e.g., DCCP) are OPTIONAL to support ๐ŸŒˆ but to make debugging and troubleshooting easier, translators MUST forward all transport protocols as described in the "Protocol" step of Section 5.1 ๐Ÿ”


5.6. Knowing When to Translate ๐Ÿงญ

if the IP/ICMP translator also provides a normal forwarding function, and the destination address is reachable by a more specific route without translation, the router MUST forward the packet without translating it ๐Ÿ›ฃ๏ธ when an IP/ICMP translator receives an IPv6 datagram addressed to an IPv6 address that represents a host in the IPv4 domain, the IPv6 packet MUST be translated to IPv4 ๐ŸŒธ

6. Special Considerations for ICMPv6 Packet Too Big โœจ

okay bestie, this part is where things get spicy ๐ŸŒถ๏ธ. Two recent studies looked at how IPv6-capable web servers on the Internet handle an IPv6 Packet Too Big, and the results are kinda rough ๐Ÿ˜ญ. About 95% responded as expected to a PTB that said MTU = 1280, but only 43% responded as expected to a PTB that said MTU < 1280. It's believed that firewalls violating Section 4.3.1 of [RFC4890] are the culprits ๐Ÿ™ˆ. Both failures (that 5% wrong response at MTU = 1280 and the 57% wrong response at MTU < 1280) will cause PMTUD black holes [RFC2923] ๐Ÿ’€. The translator can't fix the first case (MTU = 1280), but it can improve the second case (MTU < 1280) ๐Ÿ’…. There are two approaches to handling ICMPv6 messages that indicate an MTU < 1280, and it SHOULD be possible to configure a translator for either of them ๐ŸŽ€.

The first approach is to limit where the IPv6/IPv4 translator gets deployed. Four of the scenarios meant for stateless IPv6/IPv4 translators don't have IPv6 hosts on the Internet (Scenarios 1, 2, 5, and 6 described in [RFC6144], which talk about "An IPv6 network") ๐Ÿงš. In those scenarios, IPv6 hosts, IPv6-host-based firewalls, and IPv6 network firewalls can be administered in compliance with Section 4.3.1 of [RFC4890], so they dodge the problem seen with IPv6 hosts on the Internet โœจ.

The second approach is necessary if the translator has IPv6 hosts, IPv6-host-based firewalls, or IPv6 network firewalls that do not (or cannot) comply with Section 5 of [RFC2460], like IPv6 hosts on the Internet ๐Ÿ‘€. This approach has the translator do the following:

  1. In the IPv4-to-IPv6 direction: if the MTU value of ICMPv4 Packet Too Big (PTB) messages is less than 1280, change it to 1280. The goal here is to get the IPv6 host and IPv6 firewall to process the ICMP PTB message and send later packets to that destination with an IPv6 Fragment Header ๐ŸŒˆ.

Note: Based on recent studies, this works for 95% of IPv6 hosts on the Internet ๐Ÿซถ.

  1. In the IPv6-to-IPv4 direction:
    • A. If there is a Fragment Header in the IPv6 packet, the last 16 bits of its value MUST be used for the IPv4 identification value ๐Ÿ”ฅ.
    • B. If there is no Fragment Header in the IPv6 packet:
      • a. If the packet is less than or equal to 1280 bytes:
        • The translator SHOULD set DF to 0 and generate an IPv4 identification value ๐Ÿฆ‹.
        • To avoid the problems described in [RFC4963], it is RECOMMENDED that the translator maintain 3-tuple state for generating the IPv4 identification value ๐Ÿ’œ.
      • b. If the packet is greater than 1280 bytes, the translator SHOULD set the IPv4 DF bit to 1 ๐Ÿ‘‘.

7. Security Considerations ๐Ÿ”

Okay, this section is serious but also kinda iconic. Stateless IP/ICMP translators don't add any new security issues beyond the ones already in IPv4, IPv6, and the routing protocols that get packets to the translator in the first place ๐Ÿ›ก๏ธ.

There are potential issues that can pop up when you derive an IPv4 address from an IPv6 address, especially with addresses like broadcast or loopback addresses and the non-IPv4-translatable IPv6 addresses, etc. [RFC6052] covers these issues ๐Ÿ˜ค.

Just like network address translation of IPv4 to IPv4, the IPsec Authentication Header [RFC4302] cannot be used across an IPv6-to-IPv4 translator ๐Ÿšซ.

Also like network address translation of IPv4 to IPv4, packets with tunnel mode Encapsulating Security Payload (ESP) can be translated, since tunnel mode ESP doesn't depend on header fields that come before the ESP header ๐ŸŽ€. Transport mode ESP, though, will fail with IPv6-to-IPv4 translation unless checksum-neutral addresses are used ๐Ÿ’€. In both cases, the IPsec ESP endpoints will normally detect the presence of the translator and encapsulate ESP in UDP packets [RFC3948] ๐Ÿฆ‹.


8. Acknowledgements ๐Ÿซถ

This is under development by a large group of people ๐ŸŒธ. Those who posted to the list during the discussion include Alexey Melnikov, Andrew Sullivan, Andrew Yourtchenko, Brian Carpenter, Dan Wing, Dave Thaler, David Harrington, Ed Jankiewicz, Hiroshi Miyata, Iljitsch van Beijnum, Jari Arkko, Jerry Huang, John Schnizlein, Jouni Korhonen, Kentaro Ebisawa, Kevin Yin, Magnus Westerlund, Marcelo Bagnulo Braun, Margaret Wasserman, Masahito Endo, Phil Roberts, Philip Matthews, Reinaldo Penno, Remi Denis-Courmont, Remi Despres, Sean Turner, Senthil Sivakumar, Simon Perreault, Stewart Bryant, Tim Polk, Tero Kivinen, and Zen Cao ๐Ÿ’–.


9. References ๐Ÿ“š

9.1. Normative References

  • [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August 1980.
  • [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, September 1981.
  • [RFC0792] Postel, J., "Internet Control Message Protocol", STD 5, RFC 792, September 1981.
  • [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, September 1981.
  • [RFC1812] Baker, F., "Requirements for IP Version 4 Routers", RFC 1812, June 1995.
  • [RFC1883] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 1883, December 1995.
  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 2460, December 1998.
  • [RFC2765] Nordmark, E., "Stateless IP/ICMP Translation Algorithm (SIIT)", RFC 2765, February 2000.
  • [RFC3948] Huttunen, A., Swander, B., Volpe, V., DiBurro, L., and M. Stenberg, "UDP Encapsulation of IPsec ESP Packets", RFC 3948, January 2005.
  • [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, February 2006.
  • [RFC4340] Kohler, E., Handley, M., and S. Floyd, "Datagram Congestion Control Protocol (DCCP)", RFC 4340, March 2006.
  • [RFC4443] Conta, A., Deering, S., and M. Gupta, "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification", RFC 4443, March 2006.
  • [RFC4884] Bonica, R., Gan, D., Tappan, D., and C. Pignataro, "Extended ICMP to Support Multi-Part Messages", RFC 4884, April 2007.
  • [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, RFC 5382, October 2008.
  • [RFC5771] Cotton, M., Vegoda, L., and D. Meyer, "IANA Guidelines for IPv4 Multicast Address Assignments", BCP 51, RFC 5771, March 2010.
  • [RFC6052] Bao, C., Huitema, C., Bagnulo, M., Boucadair, M., and X. Li, "IPv6 Addressing of IPv4/IPv6 Translators", RFC 6052, October 2010.
  • [RFC6146] Bagnulo, M., Matthews, P., and I. Beijnum, "Stateful NAT64: Network Address and Protocol Translation from IPv6 Clients to IPv4 Servers", RFC 6146, April 2011.

9.2. Informative References

  • [RFC0879] Postel, J., "TCP maximum segment size and related topics", RFC 879, November 1983.
  • [RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, November 1990.
  • [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, "Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers", RFC 2474, December 1998.
  • [RFC2475] Blake, S., Black, D., Carlson, M., Davies, E., Wang, Z., and W. Weiss, "An Architecture for Differentiated Services", RFC 2475, December 1998.
  • [RFC2710] Deering, S., Fenner, W., and B. Haberman, "Multicast Listener Discovery (MLD) for IPv6", RFC 2710, October 1999.
  • [RFC2766] Tsirtsis, G. and P. Srisuresh, "Network Address Translation - Protocol Translation (NAT-PT)", RFC 2766, February 2000.
  • [RFC2923] Lahey, K., "TCP Problems with Path MTU Discovery", RFC 2923, September 2000.
  • [RFC3307] Haberman, B., "Allocation Guidelines for IPv6 Multicast Addresses", RFC 3307, August 2002.
  • [RFC3590] Haberman, B., "Source Address Selection for the Multicast Listener Discovery (MLD) Protocol", RFC 3590, September 2003.
  • [RFC3810] Vida, R. and L. Costa, "Multicast Listener Discovery Version 2 (MLDv2) for IPv6", RFC 3810, June 2004.
  • [RFC3849] Huston, G., Lord, A., and P. Smith, "IPv6 Address Prefix Reserved for Documentation", RFC 3849, July 2004.
  • [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, December 2005.
  • [RFC4890] Davies, E. and J. Mohacsi, "Recommendations for Filtering ICMPv6 Messages in Firewalls", RFC 4890, May 2007.
  • [RFC4963] Heffner, J., Mathis, M., and B. Chandler, "IPv4 Reassembly Errors at High Data Rates", RFC 4963, July 2007.
  • [RFC4966] Aoun, C. and E. Davies, "Reasons to Move the Network Address Translator - Protocol Translator (NAT-PT) to Historic Status", RFC 4966, July 2007.
  • [RFC5737] Arkko, J., Cotton, M., and L. Vegoda, "IPv4 Address Blocks Reserved for Documentation", RFC 5737, January 2010.
  • [RFC6144] Baker, F., Li, X., Bao, C., and K. Yin, "Framework for IPv4/IPv6 Translation", RFC 6144, April 2011.

Appendix A. Stateless Translation Workflow Example ๐Ÿงธ

Here's a stateless translation workflow example, and it's giving very neat diagram energy ๐ŸŽ€. The documentation address blocks 2001:db8::/32 [RFC3849], 192.0.2.0/24, and 198.51.100.0/24 [RFC5737] are used in this example ๐ŸŒธ.

          +--------------+                   +--------------+
          | IPv4 network |                   | IPv6 network |
          |              |     +-------+     |              |
          |   +----+     |-----| XLAT  |---- |  +----+      |
          |   | H4 |-----|     +-------+     |--| H6 |      |
          |   +----+     |                   |  +----+      |
          +--------------+                   +--------------+

                               Figure 8

A translator (XLAT) connects the IPv6 network to the IPv4 network ๐ŸŒ‰. This XLAT uses the Network-Specific Prefix (NSP) 2001:db8:100::/40 defined in [RFC6052] to represent IPv4 addresses in the IPv6 address space (IPv4-converted addresses), and to represent IPv6 addresses (IPv4-translatable addresses) in the IPv4 address space โœจ. In this example, 192.0.2.0/24 is the IPv4 block of the corresponding IPv4-translatable addresses ๐Ÿ’œ.

Based on the address mapping rule, the IPv6 node H6 has an IPv4-translatable IPv6 address 2001:db8:1c0:2:21:: (address mapping from 192.0.2.33) ๐Ÿฆ‹. The IPv4 node H4 has IPv4 address 198.51.100.2 ๐Ÿ“.

The IPv6 routing is configured so that IPv6 packets addressed to a destination address in 2001:db8:100::/40 are routed to the IPv6 interface of the XLAT ๐Ÿ›ฃ๏ธ.

The IPv4 routing is configured so that IPv4 packets addressed to a destination address in 192.0.2.0/24 are routed to the IPv4 interface of the XLAT ๐Ÿš.

A.1. H6 Establishes Communication with H4 ๐Ÿ’Œ

okay so here's how H6 starts talking to H4 ๐Ÿฆ‹ it's giving main character energy โœจ

  1. H6 does the destination address mapping, so the IPv4-converted address 2001:db8:1c6:3364:2:: gets formed from 198.51.100.2 using the address mapping algorithm [RFC6052]. ๐ŸŽ€
  2. H6 sends a packet to H4 ๐Ÿ“จ. The packet goes from the source address 2001:db8:1c0:2:21:: to the destination address 2001:db8:1c6:3364:2::. ๐Ÿ’–
  3. The packet gets routed to the IPv6 interface of the XLAT, since IPv6 routing is set up that way ๐Ÿ›ฃ๏ธ.
  4. The XLAT receives the packet and does the following ๐Ÿ‘€:
    • The XLAT translates the IPv6 header into an IPv4 header using the IP/ICMP Translation Algorithm defined in this document. ๐Ÿ”
    • The XLAT puts 192.0.2.33 in as the source address and 198.51.100.2 in as the destination address. ngl this part is so clever ๐Ÿง  those two addresses are pulled straight out of the received IPv6 packet's source address 2001:db8:1c0:2:21:: (the IPv4-translatable address) and destination address 2001:db8:1c6:3364:2:: (the IPv4-converted address).
  5. The XLAT sends the translated packet out of its IPv4 interface, and the packet lands at H4 ๐ŸŽฏ.
  6. H4 responds with a packet that has destination address 192.0.2.33 and source address 198.51.100.2 ๐Ÿ’Œ.
  7. The packet gets routed to the IPv4 interface of the XLAT, since IPv4 routing is set up that way ๐Ÿ›ฃ๏ธ. Then the XLAT does this ๐Ÿ’…:
    • The XLAT translates the IPv4 header into an IPv6 header using the IP/ICMP Translation Algorithm defined in this document. ๐Ÿ”
    • The XLAT puts 2001:db8:1c0:2:21:: in as the destination address and 2001:db8:1c6:3364:2:: in as the source address. Again, these are built straight from the destination IPv4 address 192.0.2.33 and the source IPv4 address 198.51.100.2 of the received IPv4 packet. ๐Ÿซถ
  8. The translated packet is sent out of the IPv6 interface to H6 ๐ŸŒˆ.

The packet exchange between H6 and H4 keeps going until the session is finished. bestie that's the whole loop ๐Ÿ”ฅ


A.2. H4 Establishes Communication with H6 ๐ŸŒธ

now let's flip it so H4 starts the convo with H6 ๐Ÿฆ‹ same vibes, opposite direction ๐Ÿ˜ญ

  1. H4 does the destination address mapping, so 192.0.2.33 gets formed from the IPv4-translatable address 2001:db8:1c0:2:21:: using the address mapping algorithm [RFC6052]. ๐ŸŽ€
  2. H4 sends a packet to H6 ๐Ÿ“จ. The packet goes from the source address 198.51.100.2 to the destination address 192.0.2.33. ๐Ÿ’œ
  3. The packet gets routed to the IPv4 interface of the XLAT, since IPv4 routing is set up that way ๐Ÿ›ฃ๏ธ.
  4. The XLAT receives the packet and does the following ๐Ÿ‘€:
    • The XLAT translates the IPv4 header into an IPv6 header using the IP/ICMP Translation Algorithm defined in this document. ๐Ÿ”
    • The XLAT puts 2001:db8:1c6:3364:2:: in as the source address and 2001:db8:1c0:2:21:: in as the destination address. ngl this is literally the mirror of step 4 in A.1 ๐Ÿชž those come directly from the source IPv4 address 198.51.100.2 (the IPv4-converted address 2001:db8:1c6:3364:2::) and destination IPv4 address 192.0.2.33 (the IPv4-translatable address 2001:db8:1c0:2:21::) of the received IPv4 packet.
  5. The XLAT sends the translated packet out its IPv6 interface, and it arrives at H6 ๐ŸŽฏ.
  6. H6 responds with a packet that has destination address 2001:db8:1c6:3364:2:: and source address 2001:db8:1c0:2:21:: ๐Ÿ’–.
  7. The packet gets routed to the IPv6 interface of the XLAT, since IPv6 routing is set up that way ๐Ÿ›ฃ๏ธ. Then the XLAT does this ๐Ÿ’…:
    • The XLAT translates the IPv6 header into an IPv4 header using the IP/ICMP Translation Algorithm defined in this document. ๐Ÿ”
    • The XLAT puts 198.51.100.2 in as the destination address and 192.0.2.33 in as the source address. These are formed directly from the destination IPv6 address 2001:db8:1c6:3364:2:: and the source IPv6 address 2001:db8:1c0:2:21:: of the received IPv6 packet. ๐Ÿซถ
  8. The translated packet is sent out the IPv4 interface to H4 ๐ŸŒˆ.

The packet exchange between H4 and H6 keeps going until the session is finished. and that's a wrap on the example, periodt ๐Ÿ‘‘โœจ


Authors' Addresses ๐ŸŽ€

Xing Li
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing,   100084
China

Phone: +86 10-62785983
EMail: xing@cernet.edu.cn


Congxiao Bao
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing,   100084
China

Phone: +86 10-62785983
EMail: congxiao@cernet.edu.cn


Fred Baker
Cisco Systems
Santa Barbara, California  93117
USA

Phone: +1-408-526-4257
EMail: fred@cisco.com
๐Ÿ“ฆ where this page comes from