Internet Engineering Task Force (IETF) C. Bao Request for Comments: 7915 X. Li Obsoletes: 6145 CERNET Center/Tsinghua University Category: Standards Track F. Baker ISSN: 2070-1721 Cisco Systems T. Anderson Redpill Linpro F. Gont Huawei Technologies June 2016 IP/ICMP Translation Algorithm
AbstractThis document describes the Stateless IP/ICMP Translation Algorithm (SIIT), which translates between IPv4 and IPv6 packet headers (including ICMP headers). This document obsoletes RFC 6145. Status of This Memo This is an Internet Standards Track document. This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841. Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7915. Copyright Notice Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
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 6145 . . . . . . . . . . . . . . . . . . . . 5 3. Conventions . . . . . . . . . . . . . . . . . . . . . . . . . 5 4. Translating from IPv4 to IPv6 . . . . . . . . . . . . . . . . 6 4.1. Translating IPv4 Headers into IPv6 Headers . . . . . . . 7 4.2. Translating ICMPv4 Headers into ICMPv6 Headers . . . . . 9 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 . . . . . 19 5.3. Translating ICMPv6 Error Messages into ICMPv4 . . . . . . 22 5.4. Generation of ICMPv6 Error Messages . . . . . . . . . . . 23 5.5. Transport-Layer Header Translation . . . . . . . . . . . 23 5.6. Knowing When to Translate . . . . . . . . . . . . . . . . 24 6. Mapping of IP Addresses . . . . . . . . . . . . . . . . . . . 24 7. Special Considerations for ICMPv6 Packet Too Big . . . . . . 24 8. Security Considerations . . . . . . . . . . . . . . . . . . . 24 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 25 9.1. Normative References . . . . . . . . . . . . . . . . . . 25 9.2. Informative References . . . . . . . . . . . . . . . . . 27 Appendix A. Stateless Translation Workflow Example . . . . . . . 30 A.1. H6 Establishes Communication with H4 . . . . . . . . . . 30 A.2. H4 Establishes Communication with H6 . . . . . . . . . . 32 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 33 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 33
RFC6145]. Readers of this document are expected to have read and understood the framework described in [RFC6144]. Implementations of this IPv4/IPv6 translation specification MUST support one or more address mapping algorithms, which are defined in Section 6. Figure 1. --------- --------- // \\ // \\ / +----+ \ | |XLAT| | XLAT: IP/ICMP | IPv4 +----+ IPv6 | Translator | Domain | | Domain | | | | | \ | | / \\ // \\ // -------- --------- Figure 1: IPv4-IPv6 Translation Model The scenarios of the translation model are discussed in [RFC6144]. RFC6145], the translating function specified in this document does not translate any IPv4 options, and it does not translate IPv6 extension headers except the Fragment Header. The issues and algorithms in the translation of datagrams containing TCP segments are described in [RFC5382]. Fragmented IPv4 UDP packets that do not contain a UDP checksum (i.e., the UDP checksum field is zero) are not of significant use on the Internet, and in general will not be translated by the IP/ICMP translator (Section 4.5). However, when the translator is configured to forward the packet without a UDP checksum, the fragmented IPv4 UDP packets will be translated.
Fragmented ICMP/ICMPv6 packets will not be translated by IP/ICMP translators. The IP/ICMP header translation specified in this document is consistent with requirements of multicast IP/ICMP headers. However, IPv4 multicast addresses [RFC5771] cannot be mapped to IPv6 multicast addresses [RFC3307] based on the unicast mapping rule [RFC6052]. An example of experiments of the multicast address mapping can be found in [RFC6219]. RFC6144]. In both cases, we assume that a system (a node or an application) that has an IPv4 address but not an IPv6 address is communicating with a system that has an IPv6 address but no IPv4 address, or that the two systems do not have contiguous routing connectivity, or they might have contiguous routing connectivity but are interacting via masking addresses (i.e., hairpinning) [RFC4787], and hence are forced to have their communications translated. In the stateless mode, an IP/ICMP translator will convert IPv4 addresses to IPv6 and vice versa solely based on the configuration of the stateless IP/ICMP translator and information contained within the packet being translated. For example, for the default behavior defined in [RFC6052], a specific IPv6 address range will represent IPv4 systems (IPv4-converted addresses), and the IPv6 systems have addresses (IPv4-translatable addresses) that can be algorithmically mapped to a subset of the service provider's IPv4 addresses. Other stateless translation algorithms are defined in Section 6. The stateless translator does not keep any dynamic session or binding state, thus there is no requirement that the packets in a single session or flow traverse a single translator. In the stateful mode, a specific IPv6 address range (consisting of IPv4-converted IPv6 addresses) will typically represent IPv4 systems. The IPv6 nodes may use any IPv6 addresses [RFC4291] except in that range. A stateful IP/ICMP translator continuously maintains a dynamic translation table containing bindings between the IPv4 and IPv6 addresses, and likely also the Layer-4 identifiers, that are used in the translated packets. The exact address translations of any given packet thus become dependent on how packets belonging to the same session or flow have been translated. For this reason, stateful translation generally requires that all packets belonging to a single flow must traverse the same translator.
In order to be able to successfully translate a packet from IPv4 to IPv6 or vice versa, the translator must implement an address mapping algorithm. This document does not specify any such algorithms, instead these are referenced from Section 6. RFC6691]. Note that 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. Don't Fragment, ICMP Packet Too Big, and packet fragmentation are discussed in Sections 4 and 5 of this document. The reassembling of fragmented packets in the stateful translator is discussed in [RFC6146], since it requires state maintenance in the translator. RFC 6145 are the following: 1. Inserted the notes about IPv6 extension header handling: [Err3059], [Err3060], [Err3061], and [Err4090]. 2. Deprecated the algorithm that generates the IPv6 atomic fragments, as a result of the analysis in [ATOMIC] and the specification in [IPv6]. 3. Inserted the notes for stateless source address mapping for ICMPv6 packets [RFC6791]. 4. Supported new address mapping algorithms and moved the discussion of these algorithms to Section 6. RFC2119].
+-------------+ +-------------+ | 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. 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 MUST 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 MUST NOT 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. 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.
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. 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: Mapped to an IPv6 address based on the algorithms presented in Section 6. If the translator gets an illegal source address (e.g., 0.0.0.0, 127.0.0.1, etc.), the translator SHOULD silently discard the packet (as discussed in Section 5.3.7 of [RFC1812]). Note when translating ICMPv4 Error Messages into ICMPv6, the "illegal" source address will be translated for the purpose of trouble shooting. Destination Address: Mapped to an IPv6 address based on the algorithms presented in Section 6.
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 packet is a fragment or the DF bit is not set and the packet size is greater than the minimum IPv6 MTU in the network set by the translator configuration function), 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.
The actions needed to translate various ICMPv4 messages are as follows: ICMPv4 query messages: Echo and Echo Reply (Type 8 and Type 0): Adjust the Type values to 128 and 129, respectively, and adjust the ICMP checksum both to take the type change into account and to include the ICMPv6 pseudo-header. 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. Silently drop. ICMP Router Solicitation (Type 10): Single-hop message. Silently drop. Unknown ICMPv4 types: Silently drop. IGMP messages: While the Multicast Listener Discovery (MLD) messages specified in [RFC2710], [RFC3590], and [RFC3810] are the logical IPv6 counterparts for the IPv4 IGMP messages, all the "normal" IGMP messages are single-hop messages and SHOULD be silently dropped by the translator. Other IGMP messages might be used by multicast routing protocols and, since it would be a configuration error to try to have router adjacencies across IP/ICMP translators, those packets SHOULD also be silently dropped. ICMPv4 error messages: Destination Unreachable (Type 3): Translate the Code as described below, set the Type to 1, and adjust the ICMP checksum both to take the type/code change into account and to include the ICMPv6 pseudo-header. Translate the Code as follows: 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, but MUST NOT be set to a value smaller than the minimum IPv6 MTU (1280 bytes). That is, it should be set to maximum(1280, minimum((MTU value in the Packet Too Big Message) + 20, MTU_of_IPv6_nexthop, (MTU_of_IPv4_nexthop) + 20)). Note that if the IPv4 router set the MTU field to zero, i.e., the router does not implement [RFC1191], then the translator MUST use the plateau values specified in [RFC1191] to determine a likely path MTU and include that path MTU in the ICMPv6 packet. (Use the greatest plateau value that is less than the returned Total Length field, but that is larger than or equal to 1280.) See also the requirements in Section 7. Code 5 (Source Route Failed): Set the Code to 0 (No route to destination). Note that this error is unlikely since source routes are not translated. 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. 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 adjust the ICMP checksum both to take the type change into account and to include the ICMPv6 pseudo-header. The Code is unchanged. Parameter Problem (Type 12): Set the Type to 4, and adjust the ICMP checksum both to take the type/code change into account and to include the ICMPv6 pseudo-header. Translate the Code as follows: 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 is not 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 is not 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.
+--------------------------------+--------------------------------+ | 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: If the received ICMPv4 packet contains an ICMPv4 Extension [RFC4884], the translation of the ICMPv4 packet will cause the ICMPv6 packet to change length. When this occurs, the ICMPv6 Extension length attribute MUST be adjusted accordingly (e.g., longer due to the translation from IPv4 to IPv6). If the ICMPv4 Extension exceeds 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 the extensions as opaque bit strings, and those containing IPv4 address literals will not have their included addresses translated to IPv6 address literals; this may cause problems with processing of those ICMP extensions.
+-------------+ +-------------+ | 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 translation of the inner IP header can be done by invoking the function that translated the outer IP headers. This process MUST stop at the first embedded header and drop the packet if it contains more embedded headers. RFC6146]. The translator SHOULD allow an administrator to configure whether the ICMPv4 error messages are sent, rate-limited, or not sent. Section 4.1 of [RFC6052]), the recalculation and updating of the transport-layer headers that contain pseudo-headers need to be performed. 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 do not contain a UDP checksum (i.e., the UDP checksum field is zero), the translator SHOULD provide a configuration function to allow:
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 cannot 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.4. Other transport protocols (e.g., the Datagram Congestion Control Protocol (DCCP)) are OPTIONAL to support. In order to ease debugging and troubleshooting, translators MUST forward all transport protocols as described in the "Next Header" step of Section 4.1.