behave X. Li Internet-Draft C. Bao Obsoletes: 2765 (if approved) CERNET Center/Tsinghua University Intended status: Standards Track F. Baker Expires: June 20, 2010 Cisco Systems December 17, 2009 IP/ICMP Translation Algorithm draft-ietf-behave-v6v4-xlate-05 Abstract This document specifies an update to the Stateless IP/ICMP Translation Algorithm (SIIT) described in RFC 2765. The algorithm translates between IPv4 and IPv6 packet headers (including ICMP headers). This specification addresses both a stateless and a stateful mode. In the stateless mode, translation information is carried in the address itself, permitting both IPv4->IPv6 and IPv6->IPv4 session establishment without maintaining state in the IP/ICMP translator. In the stateful mode, translation state is maintained between IPv4 address/transport port tuples and IPv6 address/transport port tuples, enabling IPv6 systems to open sessions with IPv4 systems. The choice of operational mode is made by the operator deploying the network and is critical to the operation of the applications using it. Acknowledgement of previous work This document is a product of the 2008-2009 effort to define a replacement for NAT-PT. It is an update to and directly derivative from Erik Nordmark's [RFC2765], which similarly provides both stateless and stateful translation between IPv4 [RFC0791] and IPv6 [RFC2460], and between ICMPv4 [RFC0792] and ICMPv6 [RFC4443]. The original document was a product of the NGTRANS working group. The changes in this document reflect five components: 1. Redescribing the network model to map to present and projected usage [I-D.ietf-behave-v6v4-framework]. 2. Moving the address format to the address format document [I-D.ietf-behave-address-format], to coordinate with other drafts on the topic. 3. Describing both stateful and stateless operation. Li, et al. Expires June 20, 2010 [Page 1] Internet-Draft IPv4/IPv6 Translation December 2009 4. Some changes in ICMP. 5. Updating references. Requirements 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]. Status of this Memo This Internet-Draft is submitted to IETF in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on June 20, 2010. Copyright Notice Copyright (c) 2009 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 BSD License. Li, et al. Expires June 20, 2010 [Page 2] Internet-Draft IPv4/IPv6 Translation December 2009 This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, 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, except to format it for publication as an RFC or to translate it into languages other than English. Table of Contents 1. Introduction and Motivation . . . . . . . . . . . . . . . . . 4 1.1. Translation Model . . . . . . . . . . . . . . . . . . . . 4 1.2. Applicability and Limitations . . . . . . . . . . . . . . 5 1.3. Stateless vs. Stateful Mode . . . . . . . . . . . . . . . 6 1.4. Path MTU discovery and fragmentation . . . . . . . . . . . 6 2. Translating from IPv4 to IPv6 . . . . . . . . . . . . . . . . 7 2.1. Translating IPv4 Headers into IPv6 Headers . . . . . . . . 8 2.2. Translating UDP over IPv4 . . . . . . . . . . . . . . . . 10 2.3. Translating ICMPv4 Headers into ICMPv6 Headers . . . . . . 11 2.4. Translating ICMPv4 Error Messages into ICMPv6 . . . . . . 14 2.5. Translator sending ICMP error message . . . . . . . . . . 14 2.6. Transport-layer Header Translation . . . . . . . . . . . . 14 2.7. Knowing when to Translate . . . . . . . . . . . . . . . . 15 3. Translating from IPv6 to IPv4 . . . . . . . . . . . . . . . . 15 3.1. Translating IPv6 Headers into IPv4 Headers . . . . . . . . 16 3.2. Translating ICMPv6 Headers into ICMPv4 Headers . . . . . . 18 3.3. Translating ICMPv6 Error Messages into ICMPv4 . . . . . . 20 3.4. Translator sending ICMPv6 error message . . . . . . . . . 21 3.5. Transport-layer Header Translation . . . . . . . . . . . . 21 3.6. Knowing when to Translate . . . . . . . . . . . . . . . . 21 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22 5. Security Considerations . . . . . . . . . . . . . . . . . . . 22 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 22 7. Appendix A: Translating pointer in Parameter Problem . . . . . 23 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8.1. Normative References . . . . . . . . . . . . . . . . . . . 24 8.2. Informative References . . . . . . . . . . . . . . . . . . 24 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 26 Li, et al. Expires June 20, 2010 [Page 3] Internet-Draft IPv4/IPv6 Translation December 2009 1. Introduction and Motivation An understanding of the framework presented in [I-D.ietf-behave-v6v4-framework] is presumed in this document. The transition mechanisms specified in [RFC4213] handle the case of dual IPv4/IPv6 hosts interoperating with both dual IPv4/IPv6 hosts and IPv4-only hosts, which is needed early in the transition to IPv6. The dual IPv4/IPv6 hosts are assigned both an IPv4 and one or more IPv6 addresses. The number of available globally unique IPv4 addresses is becoming smaller and smaller as the Internet grows; we expect that there will be a desire to take advantage of the large IPv6 address space and not require that every new Internet node have a permanently assigned IPv4 address. SIIT [RFC2765] is designed for the case of small networks (e.g., a single subnet) and for a site that has IPv6-only hosts in a dual IPv4/IPv6 network. This use assumes a mechanism for IPv6 nodes to acquire a temporary address from the pool of IPv4 addresses. However, SIIT is not useful in the case when the IPv6 nodes need to acquire temporary IPv4 addresses from a "distant" SIIT box operated by a different administration, or require that the IPv6 Internet contain routes for IPv4-mapped addresses (The latter is known to be a very bad idea due to the size of the IPv4 routing table that would potentially be injected into IPv6 routing in the form of IPv4-mapped addresses.) In addition, due to the IPv4 address depletion problem, it is desirable that a single IPv4 address needs to be shared via transport port multiplexing for different IPv6 nodes when they communicate with other IPv4 hosts. Furthermore, in SIIT [RFC2765], an IPv6-only node that works through SIIT translators needs some modifications beyond a normal IPv6-only node. These modifications are not strictly implied in this document, since normal IPv6 addresses can be used in the IPv6 end nodes. A detailed discussion of translation scenarios is presented in [I-D.ietf-behave-v6v4-framework], while the technical specification of the translation algorithm itself is covered in this document. 1.1. Translation Model This document specifies the translation algorithm that is one of the components described in [I-D.ietf-behave-v6v4-framework] needed to make IPv6-only nodes interoperate with IPv4-only nodes as shown in Figure 1. Li, et al. Expires June 20, 2010 [Page 4] Internet-Draft IPv4/IPv6 Translation December 2009 -------- -------- // IPv4 \\ // IPv6 \\ / Domain \ / Domain \ / +----+ +--+ \ | |XLAT| |S2| | Sn: Servers | +--+ +----+ +--+ | Hn: Clients | |S1| +----+ | | +--+ |DNS | +--+ | XLAT: V4/V6 Translator \ +--+ +----+ |H2| / DNS: DNS Server \ |H1| / \ +--+ / \\ +--+ // \\ // -------- -------- Figure 1: Translation Model The translation model consists of two or more network domains connected by one or more IP/ICMP translators. One of those networks either routes IPv4 but not IPv6, or contains some hosts that only implement IPv4 or have IPv4 only applications (even if the host and the network support IPv6). The other network either routes IPv6 but not IPv4, or contains some hosts that only implement IPv6 or has IPv6 only applications. Both networks contain clients, servers, and peers. 1.2. Applicability and Limitations The use of this translation algorithm assumes that the IPv6 network is somehow well-connected i.e., when an IPv6 node wants to communicate with another IPv6 node there is an IPv6 path between them. Various tunneling schemes exist that can provide such a path, but those mechanisms and their use is outside the scope of this document and [RFC2765]. The translation algorithm can be used not only in a subnet, but can also be used in service provider's backbone network. The translating function specified in this document does not translate any IPv4 options and it does not translate IPv6 routing headers, hop-by-hop extension headers, destination options headers or source routing headers, same as in [RFC2765]. The issues and algorithms in the translation of datagram containing TCP segments are described in [RFC5382]. The considerations of that document are applicable in this case as well. Fragmented IPv4 UDP packets that do not contain a UDP checksum (i.e. the UDP checksum field is zero) are not of significant use in the Internet and will not be translated by the IP/ICMP translator Li, et al. Expires June 20, 2010 [Page 5] Internet-Draft IPv4/IPv6 Translation December 2009 [Miller][Dongjin]. IPv4 multicast addresses [RFC3171] cannot be mapped to IPv6 multicast addresses [RFC3307] based on the unicast mapping rule. However, a special rule for address translation can be created for the multicast packet translation algorithm; if that is done, the IP/ICMP header translation aspect of this memo works. 1.3. Stateless vs. Stateful Mode The IP/ICMP translator has two possible modes of operation: stateless and stateful [I-D.ietf-behave-v6v4-framework]. In both cases, we assume that a system 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 and hence are forced to have their communications translated. In the stateless mode, a specific IPv6 address range will represent IPv4 systems (IPv4-converted addresses), and the IPv6 systems have addresses that can be algorithmatically mapped to a subset of the service provider's IPv4 addresses (IPv4-translatable addresses). In this mode, there is no need to concern oneself with port translation or translation tables, as the IPv4 and IPv6 counterparts are algorithmically related. An implementation example of the stateless translation is summarized in [I-D.xli-behave-ivi]. In the stateful mode, a specific IPv6 address range will represent IPv4 systems (IPv4-converted addresses), but the IPv6 systems may use any [RFC4291] addresses except in that range. In this case, a translation table is required to bind the IPv6 systems' addresses to the IPv4 addresses maintained in the translator. The address translation mechanisms for the stateless and the stateful translations are defined in [I-D.ietf-behave-address-format]. 1.4. Path MTU discovery and fragmentation Due to the different sizes of the IPv4 and IPv6 header, which are 20+ octets and 40+ octets respectively, handling the maximum packet size is critical for the operation of the IPv4/IPv6 translator. There are three mechanisms to handle this issue: the path MTU discovery, fragmentation and transport layer negotiation such as the TCP MSS option. Note that the translator MUST behave as a router, i.e. the translator MUST send packet too big error message when the packet size exceeds the MTU of the next hop interface. "Don't Fragment", ICMP "too big", and packet fragmentation are Li, et al. Expires June 20, 2010 [Page 6] Internet-Draft IPv4/IPv6 Translation December 2009 discussed in "Translating from IPv4 to IPv6" and "Translating from IPv6 to IPv4" sections of this document. The reassembling of the fragmented packets in the stateful translator is discussed in [I-D.ietf-behave-v6v4-xlate-stateful], since it requires the state maintenance in the translator. 2. Translating from IPv4 to IPv6 When an IP/ICMP translator receives an IPv4 datagram addressed to a destination towards the IPv6 domain, it translates the IPv4 header of that packet into an IPv6 header. Since the ICMP [RFC0792][RFC4443], TCP [RFC0793] and UDP [RFC0768] headers contain checksums that cover IP header information, if the address mapping algorithm is not checksum-neutral, the ICMP and transport-layer headers MUST be updated. The data portion of the packet is left unchanged. The IP/ ICMP translator then forwards the packet based on the IPv6 destination address. The original IPv4 header on the packet is removed and replaced by an IPv6 header. +-------------+ +-------------+ | IPv4 | | IPv6 | | Header | | Header | +-------------+ +-------------+ | Transport | | Fragment | | Layer | ===> | Header | | Header | |(not always) | +-------------+ +-------------+ | | | Transport | ~ Data ~ | Layer | | | | Header | +-------------+ +-------------+ | | ~ Data ~ | | +-------------+ Figure 2: IPv4-to-IPv6 Translation One of the differences between IPv4 and IPv6, is that in IPv6 path MTU discovery is mandatory but it is optional in IPv4. This implies that IPv6 routers will never fragment a packet - only the sender can do fragmentation. When the IPv4 node performs path MTU discovery (by setting the DF bit in the header) the 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" Li, et al. Expires June 20, 2010 [Page 7] Internet-Draft IPv4/IPv6 Translation December 2009 messages to the sender. When the IPv6 routers send these ICMP errors they will pass through a translator that will translate the ICMP error to a form that the IPv4 sender can understand. In this case, 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 has to ensure that the packet does not exceed the path MTU on the IPv6 side. This is done by fragmenting the IPv4 packet so that it fits in 1280 byte IPv6 packets, since that is the minimum IPv6 packet size. Also, when the IPv4 sender does not set the DF bit the translator MUST always include an IPv6 fragment header to indicate that the sender allows fragmentation. That is needed should the packet pass through an IP/ICMP translator. The above rules 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 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 mapping as defined below. Note that ICMP packets require special handling in order to translate the content of ICMP error message and also to add the ICMP pseudo-header checksum. 2.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 IPv4 packet MUST be fragmented prior to translating it. Since IPv4 packets with DF not set will always result in a fragment header being added to the packet the IPv4 packets must 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 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 or equal to the total length value of the IPv4 packet minus 20, Send ICMP (packet too big) to IPv4 source address. If the DF bit is set and the packet is not a fragment (i.e., the MF flag is not set and the Fragment Offset is zero) then the translator SHOULD NOT add a fragment header to the packet. The IPv6 header fields are set as follows: Li, et al. Expires June 20, 2010 [Page 8] Internet-Draft IPv4/IPv6 Translation December 2009 Version: 6 Traffic Class: By default, copied from IP Type Of Service 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 provide the ability to ignore the IPv4 "TOS" and always set the IPv6 traffic class 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 IPv4 header, minus the size of the IPv4 header and IPv4 options, if present. Next Header: For ICMP (1) changed to ICMPv6 (58), otherwise protocol field copied from IPv4 header. Hop Limit: TTL value copied from 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) needs to check for zero and send the ICMPv4 "ttl exceeded" or ICMPv6 "hop limit exceeded" error. Source Address: The IPv6 source address is derived from the IPv4 source address. Note that the IPv6 source address is the IPv4- converted address. Destination Address: In stateless mode, which is to say that if the IPv4 destination address is within the range of the IPv4 stateless translation prefix, the IPv6 destination address is derived from the IPv4 destination address. Note that the IPv6 destination address is the IPv4-translatable address. In stateful mode, which is to say that if the IPv4 destination address is not within the range of the IPv4 stateless translation prefix, the IPv6 address and corresponding transport-layer destination port are derived from the database reflecting current session state in the translator. Database maintenance is as described in [I-D.ietf-behave-v6v4-xlate-stateful]. If the destination address is in the multicast range, the multicast address mapping method should be applied. Li, et al. Expires June 20, 2010 [Page 9] Internet-Draft IPv4/IPv6 Translation December 2009 If IPv4 options are present in the IPv4 packet, they are ignored i.e., there is no attempt to translate them. 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 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 ICMP (1) changed to ICMPv6 (58), otherwise protocol field copied from 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. 2.2. Translating UDP over IPv4 When a translator receives an unfragmented UDP IPv4 packet and the checksum field is zero, the translator SHOULD compute the missing UDP checksum as part of translating the packet. Also, the translator SHOULD maintain a counter of how many UDP checksums are generated in this manner. 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 specifying at least the IP addresses and port numbers in the packet. When it receives fragments other than the first it SHOULD silently drop the packet, since there is no port information to log. The handling of the fragmented UDP IPv4 packets with zero checksum Li, et al. Expires June 20, 2010 [Page 10] Internet-Draft IPv4/IPv6 Translation December 2009 field is discussed in [I-D.ietf-behave-v6v4-xlate-stateful]. 2.3. Translating ICMPv4 Headers into ICMPv6 Headers All ICMP messages that are to be translated require that the ICMP checksum field be updated as part of the translation since ICMPv6, unlike ICMPv4, has a pseudo-header checksum just like UDP and TCP. In addition, all ICMP packets need to have the Type value translated and, for ICMP error messages, the included IP header also needs translation. The actions needed to translate various ICMPv4 messages are: ICMPv4 query messages: Echo and Echo Reply (Type 8 and Type 0) Adjust the type 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 MLD messages [RFC2710][RFC3590][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 [I-D.venaas-behave-v4v6mc-framework]. 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. Li, et al. Expires June 20, 2010 [Page 11] Internet-Draft IPv4/IPv6 Translation December 2009 ICMPv4 error messages: Destination Unreachable (Type 3) For all codes that are not explicitly listed below, set the Type to 1. Translate the code field as follows: Code 0, 1 (net, host unreachable): Set 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 Code to 4 (port unreachable). Code 4 (fragmentation needed and DF set): Translate to an ICMPv6 Packet Too Big message (Type 2) with code 0. The MTU field needs to be adjusted for the difference between the IPv4 and IPv6 header sizes, i.e. minimum(advertised MTU+20, MTU_t6, MTU_t4+20). Note that if the IPv4 router did not set the MTU field, 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.) Code 5 (source route failed): Set Code to 0 (no route to destination). Note that this error is unlikely since source routes are not translated. Code 6,7: Set Code to 0 (no route to destination). Code 8: Set Code to 0 (no route to destination). Code 9, 10 (communication with destination host administratively prohibited): Set Code to 1 (communication with destination administratively prohibited) Code 11, 12: Set Code to 0 (no route to destination). Code 13 (Communication Administratively Prohibited): Set Code to 1 (communication with destination administratively prohibited). Li, et al. Expires June 20, 2010 [Page 12] Internet-Draft IPv4/IPv6 Translation December 2009 Code 14 (Host Precedence Violation): Silently drop. Code 15 (Precedence cutoff in effect): Set Code to 1 (communication with destination administratively prohibited). 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 field to 3. The Code field is unchanged. Parameter Problem (Type 12) Set the Type field to 4. Translate the code field as follows: Code 0 (Pointer indicates the error): Set the code to 0 (erroneous header field encountered) and update the pointer as defined in Appendix A. 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 Appendix A. Other Code values: Silently drop Unknown ICMPv4 types Silently drop. ICMP Error Payload If the received ICMP packet contains an ICMP Extension [RFC4884] the translation of the ICMP packet will cause the ICMP packet to change length. When this occurs, the ICMP Extension length attribute MUST be adjusted accordingly (e.g., longer due to the translation from IPv4 to IPv6). If the ICMP Extension exceeds the maximum size of an ICMPv6 message on the outgoing interface, the ICMP 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 those addresses translated to IPv6 address literals; this is likely to cause problems with processing of those ICMP extensions. Li, et al. Expires June 20, 2010 [Page 13] Internet-Draft IPv4/IPv6 Translation December 2009 2.4. Translating ICMPv4 Error Messages into ICMPv6 There are some differences between the IPv4 and the IPv6 ICMP error message formats as detailed above. In addition, the ICMP error messages contain the IP header for the packet in error, which needs to be translated just like a normal IP header. The translation of this "packet in error" is likely to change the length of the datagram. Thus the Payload Length field in the outer IPv6 header might need to be updated. +-------------+ +-------------+ | IPv4 | | IPv6 | | Header | | Header | +-------------+ +-------------+ | ICMPv4 | | ICMPv6 | | Header | | Header | +-------------+ +-------------+ | IPv4 | ===> | IPv6 | | Header | | Header | +-------------+ +-------------+ | Partial | | Partial | | Transport | | Transport | | Layer | | Layer | | Header | | Header | +-------------+ +-------------+ Figure 3: IPv4-to-IPv6 ICMP Error Translation The translation of the inner IP header can be done by recursively invoking the function that translated the outer IP headers. 2.5. Translator sending ICMP error message If the packet is discarded, then the translator SHOULD be able to send back an ICMP message to the original sender of the packet, unless the discarded packet is itself an ICMP message. The ICMP message, if sent, has a type of 3 (Destination Unreachable) and a code of 13 (Communication Administratively Prohibited). The translator device MUST allow to configure whether the ICMP error messages are sent, rate-limited or not sent. 2.6. Transport-layer Header Translation If the address translation algorithm is not checksum neutral, the recalculation and updating of the transport-layer headers MUST be performed. UDP/IPv4 datagrams with a checksum of zero MAY be dropped and MAY have their checksum calculated for injection into the IPv6 domain. This choice SHOULD be under configuration control. Li, et al. Expires June 20, 2010 [Page 14] Internet-Draft IPv4/IPv6 Translation December 2009 2.7. Knowing when to Translate If the IP/ICMP translator is implemented in a router providing both translation and normal forwarding, and the address is reachable by a more specific route without translation, the router MUST forward it without translating it. Otherwise, when an IP/ICMP translator receives an IPv4 datagram addressed to a destination towards the IPv6 domain, the packet will be translated to IPv6. 3. Translating from IPv6 to IPv4 When an IP/ICMP translator receives an IPv6 datagram addressed to a destination towards the IPv4 domain, it translates the IPv6 header of that packet into an IPv4 header. Since the ICMP [RFC0792][RFC4443], TCP [RFC0793] and UDP [RFC0768] headers contain checksums that cover the IP header, if the address mapping algorithm is not checksum- neutral, the ICMP and transport-layer headers MUST be updated. The data portion of the packet is left unchanged. The IP/ICMP translator then forwards the packet based on the IPv4 destination address. The original IPv6 header on the packet is removed and replaced by an IPv4 header. +-------------+ +-------------+ | IPv6 | | IPv4 | | Header | | Header | +-------------+ +-------------+ | Fragment | | Transport | | Header | ===> | Layer | |(if present) | | Header | +-------------+ +-------------+ | Transport | | | | Layer | ~ Data ~ | Header | | | +-------------+ +-------------+ | | ~ Data ~ | | +-------------+ Figure 4: IPv6-to-IPv4 Translation There are some differences between IPv6 and IPv4 in the area of fragmentation and the minimum link MTU that affect the translation. An IPv6 link has to have an MTU of 1280 bytes or greater. The corresponding limit for IPv4 is 68 bytes. Thus, unless there were special measures, it would not be possible to do end-to-end path MTU discovery when the path includes a translator since the IPv6 node Li, et al. Expires June 20, 2010 [Page 15] Internet-Draft IPv4/IPv6 Translation December 2009 might receive ICMP "packet too big" messages originated by an IPv4 router that report an MTU less than 1280. However, [RFC2460] section 5 requires that IPv6 nodes handle such an ICMP "packet too big" message by reducing the path MTU to 1280 and including an IPv6 fragment header with each packet. This allows end-to-end path MTU discovery across the translator as long as the path MTU is 1280 bytes or greater. When the path MTU drops below the 1280 limit the IPv6 sender will originate 1280-byte packets that will be fragmented by IPv4 routers along the path after being translated to IPv4. The only drawback with this scheme is that it is not possible to use PMTU to do optimal UDP fragmentation (as opposed to completely avoiding fragmentation) at the sender, since the presence of an IPv6 fragment header is interpreted that it is okay to fragment the packet on the IPv4 side. Thus if a UDP application wants to send large packets independent of the PMTU, the sender will only be able to determine the path MTU on the IPv6 side of the translator. If the path MTU on the IPv4 side of the translator is smaller, then the IPv6 sender will not receive any ICMP "too big" errors and cannot adjust the size fragments it is sending. Other than the special rules for handling fragments and path MTU discovery the actual translation of the packet header consists of a simple mapping as defined below. Note that ICMP packets require special handling in order to translate the contents of ICMP error message and also to add the ICMP pseudo-header checksum. 3.1. Translating IPv6 Headers into IPv4 Headers If there is no IPv6 Fragment header, the IPv4 header fields are set as follows: 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 semantics of the bits are identical in IPv4 and IPv6. However, in some IPv4 environments, these bits might be used with the old semantics of "Type Of Service and Precedence". 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. In addition, if the translator is at an administrative boundary, the filtering and update considerations of [RFC2475] may be applicable. Li, et al. Expires June 20, 2010 [Page 16] Internet-Draft IPv4/IPv6 Translation December 2009 Total Length: Payload length value from IPv6 header, plus the size of the IPv4 header. Identification: All zero. Flags: The More Fragments flag is set to zero. The Don't Fragments flag is set to one. Fragment Offset: All zero. Time to Live: Hop Limit value copied from IPv6 header. Since the translator is a router, as part of forwarding the packet it needs to decrement either the IPv6 Hop Limit (before the translation) or the IPv4 TTL (after the translation). As part of decrementing the TTL or Hop Limit the translator (as any router) needs to check for zero and send the ICMPv4 "ttl exceeded" or ICMPv6 "hop limit exceeded" error. Protocol: For ICMPv6 (58) changed to ICMP (1), otherwise Next Header field copied from IPv6 header. Header Checksum: Computed once the IPv4 header has been created. Source Address: In stateless mode, which is to say that if the IPv6 source address is within the range of the IPv6 stateless translation prefix, the IPv4 source address is derived from the IPv6 address. Note that the original IPv6 source address is the IPv4-translatable address. In stateful mode, which is to say that if the IPv6 source address is not within the range of the IPv6 stateless translation prefix, the IPv4 source address and transport layer source port corresponding to the IPv4-related IPv6 source address and source port are derived from the database reflecting current session state in the translator. Database maintenance is described in [I-D.ietf-behave-v6v4-xlate-stateful]. Destination Address: The IPv4 destination address is derived from the IPv6 destination address of the datagram being translated. Note that the original IPv6 destination address is the IPv4- converted address. If the destination address is in the multicast range, the multicast address mapping method should be applied. If any of an IPv6 hop-by-hop options header, destination options header, or routing header with the Segments Left field equal to zero are present in the IPv6 packet, they are ignored i.e., there is no Li, et al. Expires June 20, 2010 [Page 17] Internet-Draft IPv4/IPv6 Translation December 2009 attempt to translate them. However, the Total Length field and the Protocol field is adjusted to "skip" these extension headers. If a routing header with a non-zero Segments Left field is present then the packet MUST NOT be translated, and an ICMPv6 "parameter problem/erroneous header field encountered" (Type 4/Code 0) error message, with the Pointer field indicating the first byte of the Segments Left field, SHOULD be returned to the sender. If the IPv6 packet contains a Fragment header the header fields are set as above with the following exceptions: Total Length: Payload length value from IPv6 header, minus 8 for the Fragment header, plus the size of the IPv4 header. Identification: Copied from the low-order 16-bits in the Identification field in the Fragment header. Flags: The More Fragments flag is copied from the M flag in the Fragment header. The Don't Fragments flag is set to zero allowing this packet to be fragmented by IPv4 routers. Fragment Offset: Copied from the Fragment Offset field in the Fragment header. Protocol: For ICMPv6 (58) changed to ICMP (1), otherwise Next Header field copied from Fragment header. 3.2. Translating ICMPv6 Headers into ICMPv4 Headers All ICMP messages that are to be translated require that the ICMP checksum field be updated as part of the translation since ICMPv6 (unlike ICMPv4) includes a pseudo-header in the checksum just like UDP and TCP. In addition all ICMP packets need to have the Type value translated and, for ICMP error messages, the included IP header also needs translation. Note that the IPv6 addresses in the IPv6 header may not be the IPv4-translatable addresses and there will be no corresponding IPv4 addresses. In this case, a special block of the IPv4 address can be used to indicate this phenomenon. The actions needed to translate various ICMPv6 messages are: ICMPv6 informational messages: Li, et al. Expires June 20, 2010 [Page 18] Internet-Draft IPv4/IPv6 Translation December 2009 Echo Request and Echo Reply (Type 128 and 129) Adjust the type to 8 and 0, respectively, and adjust the ICMP checksum both to take the type change into account and to exclude the ICMPv6 pseudo-header. MLD Multicast Listener Query/Report/Done (Type 130, 131, 132) Single hop message. Silently drop. Neighbor Discover messages (Type 133 through 137) Single hop message. Silently drop. Unknown informational messages Silently drop. ICMPv6 error messages: Destination Unreachable (Type 1) Set the Type field to 3. Translate the code field as follows: Code 0 (no route to destination): Set Code to 1 (host unreachable). Code 1 (communication with destination administratively prohibited): Set Code to 10 (communication with destination host administratively prohibited). Code 2 (beyond scope of source address): Set Code to 1 (host unreachable). Note that this error is very unlikely since the IPv4-translatable source address is considered to have global scope. Code 3 (address unreachable): Set Code to 1 (host unreachable). Code 4 (port unreachable): Set Code to 3 (port unreachable). Packet Too Big (Type 2) Translate to an ICMPv4 Destination Unreachable with code 4. The MTU field needs to 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_t4, MTU_t6-20) Time Exceeded (Type 3) Set the Type to 11. The Code field is unchanged. Li, et al. Expires June 20, 2010 [Page 19] Internet-Draft IPv4/IPv6 Translation December 2009 Parameter Problem (Type 4) Translate the type and code field as follows: Code 1 (unrecognized Next Header type encountered): Translate this to an ICMPv4 protocol unreachable (Type 3, Code 2). Code 0 (erroneous header field encountered): Set Type 12, Code 0 and update the pointer as defined in Appendix A. Code 2 (unrecognized IPv6 option encountered): Silently drop. Unknown error messages Silently drop. ICMP Error Payload If the received ICMPv6 packet contains an ICMP Extension [RFC4884], the translation of the ICMPv6 packet will cause the ICMPv6 packet to change length. When this occurs, the ICMPv6 Extension length attribute MUST be adjusted accordingly (e.g., shorter due to the translation from IPv6 to IPv4). For extensions not defined in [RFC4884], the translator passes the extensions as opaque bit strings and those containing IPv6 address literals will not have those addresses translated to IPv4 address literals; this is likely to cause problems with processing of those ICMP extensions. 3.3. Translating ICMPv6 Error Messages into ICMPv4 There are some differences between the IPv4 and the IPv6 ICMP error message formats as detailed above. In addition, the ICMP error messages contain the IP header for the packet in error, which needs to be translated just like a normal IP header. The translation of this "packet in error" is likely to change the length of the datagram thus the Total Length field in the outer IPv4 header might need to be updated. Li, et al. Expires June 20, 2010 [Page 20] Internet-Draft IPv4/IPv6 Translation December 2009 +-------------+ +-------------+ | IPv6 | | IPv4 | | Header | | Header | +-------------+ +-------------+ | ICMPv6 | | ICMPv4 | | Header | | Header | +-------------+ +-------------+ | IPv6 | ===> | IPv4 | | Header | | Header | +-------------+ +-------------+ | Partial | | Partial | | Transport | | Transport | | Layer | | Layer | | Header | | Header | +-------------+ +-------------+ Figure 5: IPv6-to-IPv4 ICMP Error Translation The translation of the inner IP header can be done by recursively invoking the function that translated the outer IP headers. Note that the IPv6 addresses in the IPv6 header may not be the IPv4- translatable addresses and there will be no corresponding IPv4 addresses. In this case, a special block of the IPv4 address can be used to indicate this phenomenon. 3.4. Translator sending ICMPv6 error message If the packet is discarded, then the translator SHOULD be able to send back an ICMPv6 message to the original sender of the packet, unless the discarded packet is itself an ICMPv6 message. The ICMPv6 message, if sent, has a type of 1 (Destination Unreachable) and a code of 1 (Communication with destination administratively prohibited). The translator device MUST allow configuring whether the ICMPv6 error messages are sent, rate-limited or not sent. 3.5. Transport-layer Header Translation If the address translation algorithm is not checksum neutral, the recalculation and updating of the transport-layer headers MUST be performed. 3.6. Knowing when to Translate If the IP/ICMP translator is implemented in a router providing both translation and normal forwarding, and the address is reachable by a more specific route without translation, the router MUST forward it without translating it. When an IP/ICMP translator receives an IPv6 datagram addressed to a destination towards the IPv4 domain, the Li, et al. Expires June 20, 2010 [Page 21] Internet-Draft IPv4/IPv6 Translation December 2009 packet will be translated to IPv4. 4. IANA Considerations This memo adds no new IANA considerations. Note to RFC Editor: This section will have served its purpose if it correctly tells IANA that no new assignments or registries are required, or if those assignments or registries are created during the RFC publication process. From the author's perspective, it may therefore be removed upon publication as an RFC at the RFC Editor's discretion. 5. Security Considerations The use of stateless IP/ICMP translators does not introduce any new security issues beyond the security issues that are already present in the IPv4 and IPv6 protocols and in the routing protocols that are used to make the packets reach the translator. There are potential issues that might arise by extracting an IPv4 address from the IPv6 address - particularly addresses like broadcast or loopback addresses and the non IPv4-translatable IPv6 addresses, etc. Special action SHOULD be taken to avoid security problems. As the Authentication Header [RFC4302] is specified to include the IPv4 Identification field and the translating function is not able to always preserve the Identification field, it is not possible for an IPv6 endpoint to verify the AH on received packets that have been translated from IPv4 packets. Thus AH does not work through a translator. Packets with ESP can be translated since ESP does not depend on header fields prior to the ESP header. Note that ESP transport mode is easier to handle than ESP tunnel mode; in order to use ESP tunnel mode, the IPv6 node needs to be able to generate an inner IPv4 header when transmitting packets and remove such an IPv4 header when receiving packets. 6. Acknowledgements This is under development by a large group of people. Those who have posted to the list during the discussion include Andrew Sullivan, Andrew Yourtchenko, Brian Carpenter, Dan Wing, Dave Thaler, Ed Jankiewicz, Hiroshi Miyata, Iljitsch van Beijnum, Jari Arkko, Jerry Li, et al. Expires June 20, 2010 [Page 22] Internet-Draft IPv4/IPv6 Translation December 2009 Huang, John Schnizlein, Kentaro Ebisawa, Kevin Yin, Magnus Westerlund, Marcelo Bagnulo Braun, Margaret Wasserman, Masahito Endo, Phil Roberts, Philip Matthews, Remi Denis-Courmont, Remi Despres, Senthil Sivakumar, Simon Perreault and Zen Cao. 7. Appendix A: Translating pointer in Parameter Problem * Translating from IPv4 to IPv6: | Original IPv4 Pointer | Translated IPv6 Pointer Vaule | +--------------------------------+--------------------------------+ | 0 | Version/IHL | 0 | Version/Traffic Class | | 1 | Type Of Service | 0or1| Traffic Class/Flow Label | | 2,3 | Total Length | 4,5 | Payload Length | | 4,5 | Identification | - | | | 6 | Flags/Fragment Offset | - | | | 7 | Fragment Offset | - | | | 8 | Time to Live | 7 | Hop Limit | | 9 | Protocol | 6 | Next Header | |10,11| Header Checksum | - | | |12-15| Source Address | 8-23| Source Address | |16-19| Destination Address |24-39| Destination Address | +--------------------------------+--------------------------------+ * Translating from IPv6 to IPv4: | Original IPv6 Pointer | Translated IPv4 Pointer Vaule | +--------------------------------+--------------------------------+ | 0 | Version/Traffic Class | 0or1| Version/IHL, Type Of Ser | | 1 | Traffic Class/Flow Label | 1 | Type Of Service | | 2,3 | Flow Label | - | | | 4,5 | Payload Length | 2,3 | Total Length | | 6 | Next Header | 9 | Protocol | | 7 | Hop Limit | 8 | Time to Live | | 8-23| Source Address |12-15| Source Address | |24-39| Destination Address |16-19| Destination Address | +--------------------------------+--------------------------------+ Figure 6 8. References Li, et al. Expires June 20, 2010 [Page 23] Internet-Draft IPv4/IPv6 Translation December 2009 8.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. [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. [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, February 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. 8.2. Informative References [Dongjin] Lee, D., "Email to the behave mailing list", Sept 2009. [I-D.ietf-behave-address-format] Huitema, C., Bao, C., Bagnulo, M., Boucadair, M., and X. Li, "IPv6 Addressing of IPv4/IPv6 Translators", draft-ietf-behave-address-format-02 (work in progress), December 2009. Li, et al. Expires June 20, 2010 [Page 24] Internet-Draft IPv4/IPv6 Translation December 2009 [I-D.ietf-behave-v6v4-framework] Baker, F., Li, X., Bao, C., and K. Yin, "Framework for IPv4/IPv6 Translation", draft-ietf-behave-v6v4-framework-03 (work in progress), October 2009. [I-D.ietf-behave-v6v4-xlate-stateful] Bagnulo, M., Matthews, P., and I. Beijnum, "NAT64: Network Address and Protocol Translation from IPv6 Clients to IPv4 Servers", draft-ietf-behave-v6v4-xlate-stateful-05 (work in progress), December 2009. [I-D.venaas-behave-v4v6mc-framework] Venaas, S., Li, X., and C. Bao, "Framework for IPv4/IPv6 Multicast Translation", draft-venaas-behave-v4v6mc-framework-01 (work in progress), October 2009. [I-D.xli-behave-ivi] Li, X., Bao, C., Chen, M., Zhang, H., and J. Wu, "The CERNET IVI Translation Design and Deployment for the IPv4/ IPv6 Coexistence and Transition", draft-xli-behave-ivi-05 (work in progress), December 2009. [Miller] Miller, G., "Email to the ngtrans mailing list", March 1999. [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. [RFC3171] Albanna, Z., Almeroth, K., Meyer, D., and M. Schipper, "IANA Guidelines for IPv4 Multicast Address Assignments", BCP 51, RFC 3171, August 2001. [RFC3307] Haberman, B., "Allocation Guidelines for IPv6 Multicast Li, et al. Expires June 20, 2010 [Page 25] Internet-Draft IPv4/IPv6 Translation December 2009 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. [RFC4213] Nordmark, E. and R. Gilligan, "Basic Transition Mechanisms for IPv6 Hosts and Routers", RFC 4213, October 2005. [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, December 2005. 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 Li, et al. Expires June 20, 2010 [Page 26]