idnits 2.17.1 draft-ietf-behave-v6v4-xlate-stateful-08.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Sep 2009 rather than the newer Notice from 28 Dec 2009. (See https://trustee.ietf.org/license-info/) Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 4 instances of lines with non-RFC3849-compliant IPv6 addresses in the document. If these are example addresses, they should be changed. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If a V6 SYN is received with incoming tuple with source transport address (X',x) and destination transport address (Y',y). The lifetime of the TCP session table entry is set to at least to the maximum session lifetime. The value for the maximum session lifetime MAY be configurable but it MUST not be less than TCP_EST (the established connection idle timeout as defined in [RFC5382]). The default value for the maximum session lifetime SHOULD be set to TCP_EST. The packet is translated and forwarded. The state is moved to ESTABLISHED. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If a V4 SYN is received (with or without the ACK flag set), with an incoming tuple with source IPv4 transport address (Y,y) and destination IPv4 transport address (X,x), then the state is moved to ESTABLISHED. The lifetime of the TCP session table entry is set to at least to the maximum session lifetime. The value for the maximum session lifetime MAY be configurable but it MUST not be less than TCP_EST (the established connection idle timeout as defined in [RFC5382]). The default value for the maximum session lifetime SHOULD be set to TCP_EST. The packet is translated and forwarded. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If any other packet is received, the packet is translated and forwarded. The lifetime of the TCP session table entry is set to at least to the maximum session lifetime. The value for the maximum session lifetime MAY be configurable but it MUST not be less than TCP_EST (the established connection idle timeout as defined in [RFC5382]). The default value for the maximum session lifetime SHOULD be set to TCP_EST. The state remains unchanged as ESTABLISHED. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If any packet other than the V6 FIN is received, the packet is translated and forwarded. The lifetime of the TCP session table entry is set to at least to the maximum session lifetime. The value for the maximum session lifetime MAY be configurable but it MUST not be less than TCP_EST (the established connection idle timeout as defined in [RFC5382]). The default value for the maximum session lifetime SHOULD be set to TCP_EST. The state remains unchanged as V4 FIN RCV. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If any packet other than the V4 FIN is received, the packet is translated and forwarded. The lifetime of the TCP session table entry is set to at least to the maximum session lifetime. The value for the maximum session lifetime MAY be configurable but it MUST not be less than TCP_EST (the established connection idle timeout as defined in [RFC5382]). The default value for the maximum session lifetime SHOULD be set to TCP_EST. The state remains unchanged as V6 FIN RCV. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If a packet other than a RST packet is received, the lifetime of the TCP session table entry is set to at least to the maximum session lifetime. The value for the maximum session lifetime MAY be configurable but it MUST not be less than TCP_EST (the established connection idle timeout as defined in [RFC5382]). The default value for the maximum session lifetime SHOULD be set to TCP_EST. The state is moved to ESTABLISHED. == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (January 21, 2010) is 5208 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC1035' is defined on line 1940, but no explicit reference was found in the text == Unused Reference: 'RFC2766' is defined on line 1978, but no explicit reference was found in the text == Unused Reference: 'RFC4966' is defined on line 1993, but no explicit reference was found in the text == Unused Reference: 'I-D.penno-behave-64-analysis' is defined on line 2012, but no explicit reference was found in the text == Outdated reference: A later version (-23) exists of draft-ietf-behave-v6v4-xlate-05 == Outdated reference: A later version (-10) exists of draft-ietf-behave-address-format-04 == Outdated reference: A later version (-11) exists of draft-ietf-behave-dns64-05 -- Obsolete informational reference (is this intentional?): RFC 793 (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 2766 (Obsoleted by RFC 4966) == Outdated reference: A later version (-10) exists of draft-ietf-behave-v6v4-framework-04 == Outdated reference: A later version (-06) exists of draft-penno-behave-64-analysis-02 Summary: 1 error (**), 0 flaws (~~), 18 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 BEHAVE WG M. Bagnulo 3 Internet-Draft UC3M 4 Intended status: Standards Track P. Matthews 5 Expires: July 25, 2010 Alcatel-Lucent 6 I. van Beijnum 7 IMDEA Networks 8 January 21, 2010 10 Stateful NAT64: Network Address and Protocol Translation from IPv6 11 Clients to IPv4 Servers 12 draft-ietf-behave-v6v4-xlate-stateful-08 14 Abstract 16 This document describes stateful NAT64 translation, which allows 17 IPv6-only clients to contact IPv4 servers using unicast UDP, TCP, or 18 ICMP. The public IPv4 address can be shared among several IPv6-only 19 clients. When the stateful NAT64 is used in conjunction with DNS64 20 no changes are usually required in the IPv6 client or the IPv4 21 server. 23 Status of this Memo 25 This Internet-Draft is submitted to IETF in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF), its areas, and its working groups. Note that 30 other groups may also distribute working documents as Internet- 31 Drafts. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 The list of current Internet-Drafts can be accessed at 39 http://www.ietf.org/ietf/1id-abstracts.txt. 41 The list of Internet-Draft Shadow Directories can be accessed at 42 http://www.ietf.org/shadow.html. 44 This Internet-Draft will expire on July 25, 2010. 46 Copyright Notice 48 Copyright (c) 2010 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (http://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the BSD License. 61 This document may contain material from IETF Documents or IETF 62 Contributions published or made publicly available before November 63 10, 2008. The person(s) controlling the copyright in some of this 64 material may not have granted the IETF Trust the right to allow 65 modifications of such material outside the IETF Standards Process. 66 Without obtaining an adequate license from the person(s) controlling 67 the copyright in such materials, this document may not be modified 68 outside the IETF Standards Process, and derivative works of it may 69 not be created outside the IETF Standards Process, except to format 70 it for publication as an RFC or to translate it into languages other 71 than English. 73 Table of Contents 75 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 76 1.1. Features of stateful NAT64 . . . . . . . . . . . . . . . . 5 77 1.2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 6 78 1.2.1. Stateful NAT64 solution elements . . . . . . . . . . . 6 79 1.2.2. Stateful NAT64 Behaviour Walkthrough . . . . . . . . . 8 80 1.2.3. Filtering . . . . . . . . . . . . . . . . . . . . . . 10 81 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 11 82 3. Stateful NAT64 Normative Specification . . . . . . . . . . . . 13 83 3.1. Binding Information Bases . . . . . . . . . . . . . . . . 14 84 3.2. Session Tables . . . . . . . . . . . . . . . . . . . . . . 15 85 3.3. Packet Processing Overview . . . . . . . . . . . . . . . . 16 86 3.4. Determining the Incoming tuple . . . . . . . . . . . . . . 17 87 3.5. Filtering and Updating Binding and Session Information . . 19 88 3.5.1. UDP Session Handling . . . . . . . . . . . . . . . . . 20 89 3.5.1.1. Rules for Allocation of IPv4 Transport 90 Addresses for UDP . . . . . . . . . . . . . . . . 22 91 3.5.2. TCP Session Handling . . . . . . . . . . . . . . . . . 23 92 3.5.2.1. State definition . . . . . . . . . . . . . . . . . 23 93 3.5.2.2. State machine for TCP processing in the NAT64 . . 24 94 3.5.2.3. Rules for allocation of IPv4 transport 95 addresses for TCP . . . . . . . . . . . . . . . . 31 96 3.5.3. ICMP Query Session Handling . . . . . . . . . . . . . 32 97 3.5.4. Generation of the IPv6 Representations of IPv4 98 Addresses . . . . . . . . . . . . . . . . . . . . . . 35 99 3.6. Computing the Outgoing Tuple . . . . . . . . . . . . . . . 35 100 3.6.1. Computing the Outgoing 5-tuple for TCP and UDP . . . . 36 101 3.6.2. Computing the Outgoing 3-tuple for ICMP Query 102 Messages . . . . . . . . . . . . . . . . . . . . . . . 36 103 3.7. Translating the Packet . . . . . . . . . . . . . . . . . . 37 104 3.8. Handling Hairpinning . . . . . . . . . . . . . . . . . . . 37 105 4. Protocol Constants . . . . . . . . . . . . . . . . . . . . . . 38 106 5. Security Considerations . . . . . . . . . . . . . . . . . . . 38 107 5.1. Implications on end-to-end security . . . . . . . . . . . 38 108 5.2. Filtering . . . . . . . . . . . . . . . . . . . . . . . . 38 109 5.3. Attacks on NAT64 . . . . . . . . . . . . . . . . . . . . . 40 110 5.4. Avoiding hairpinning loops . . . . . . . . . . . . . . . . 40 111 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 41 112 7. Contributors . . . . . . . . . . . . . . . . . . . . . . . . . 41 113 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 42 114 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 42 115 9.1. Normative References . . . . . . . . . . . . . . . . . . . 42 116 9.2. Informative References . . . . . . . . . . . . . . . . . . 43 117 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 44 119 1. Introduction 121 This document specifies stateful NAT64, a mechanism for IPv4-IPv6 122 transition and co-existence. Together with DNS64 123 [I-D.ietf-behave-dns64], these two mechanisms allow a IPv6-only 124 client to initiate communications to an IPv4-only server. They also 125 enable peer-to-peer communication between an IPv4 and an IPv6 node, 126 where the communication can be initiated by either end using 127 existing, NAT-traversing, peer-to-peer communication techniques, such 128 as ICE [I-D.ietf-mmusic-ice]. Stateful NAT64 also supports IPv4- 129 initiated communications to a subset of the IPv6 hosts through 130 statically configured bindings in the stateful NAT64. 132 Stateful NAT64 is a mechanism for translating IPv6 packets to IPv4 133 packets and vice-versa. The translation is done by translating the 134 packet headers according to the IP/ICMP Translation Algorithm defined 135 in [I-D.ietf-behave-v6v4-xlate]. The IPv4 addresses of IPv4 hosts 136 are algorithmically translated to and from IPv6 addresses by using 137 the algorithm defined in [I-D.ietf-behave-address-format] and a 138 prefix assigned to the stateful NAT64 for this specific purpose. The 139 IPv6 addresses of IPv6 hosts are translated to and from IPv4 140 addresses by installing mappings in the normal NAT manner. The 141 current specification only defines how stateful NAT64 translates 142 packets carrying TCP and UDP traffic. Other protocols, including 143 SCTP, DCCP and IPsec are out of the scope of this specification and 144 will be specified somewhere else. 146 DNS64 is a mechanism for synthesizing AAAA resource records (RR) from 147 A RR. The IPv6 address contained in the synthetic AAAA RR is 148 algorithmically generated from the IPv4 address and the IPv6 prefix 149 assigned to a NAT64 device by using the same algorithm defined in 150 [I-D.ietf-behave-address-format]. 152 Together, these two mechanisms allow an IPv6-only client (i.e. either 153 a host with only IPv6 stack, or a host with both IPv4 and IPv6 stack, 154 but only with IPv6 connectivity or a host running an IPv6 only 155 application) to initiate communications to an IPv4-only server 156 (analogous meaning to the IPv6-only host above). 158 These mechanisms are expected to play a critical role in the IPv4- 159 IPv6 transition and co-existence. Due to IPv4 address depletion, it 160 is likely that in the future, many IPv6-only clients will want to 161 connect to IPv4-only servers. The stateful NAT64 and DNS64 162 mechanisms are easily deployable, since they require no changes to 163 either the IPv6 client nor the IPv4 server. For basic functionality, 164 the approach only requires the deployment of the stateful NAT64 165 function in the devices connecting an IPv6-only network to the IPv4- 166 only network, along with the deployment of a few DNS64-enabled name 167 servers accessible to the IPv6-only hosts. An analysis of the 168 application scenarios can be found in 169 [I-D.ietf-behave-v6v4-framework]. 171 For brevity, in the rest of the document, we will refer to the 172 stateful NAT64 either as stateful NAT64 or simply as NAT64. 174 1.1. Features of stateful NAT64 176 The features of NAT64 are: 178 o NAT64 is compliant with the recommendations for how NATs should 179 handle UDP [RFC4787], TCP [RFC5382], and ICMP [RFC5508]. As such, 180 NAT64 only supports Endpoint-Independent mappings and supports 181 both Endpoint-Independent and Address-Dependent Filtering. 182 Because of the compliance with the aforementioned requirements, 183 NAT64 is compatible with current NAT traversal techniques, such as 184 ICE [I-D.ietf-mmusic-ice] and compatible with other non-IETF- 185 standard NAT traversal techniques. 187 o In the absence of any state in NAT64, only IPv6 nodes can initiate 188 sessions to IPv4 nodes. This works for roughly the same class of 189 applications that work through IPv4-to-IPv4 NATs. 191 o Depending on the filtering policy used (Endpoint-Independent, or 192 Address-Dependent), IPv4-nodes might be able to initiate sessions 193 to a given IPv6 node, if the NAT64 somehow has an appropriate 194 mapping (i.e.,state) for an IPv6 node, via one of the following 195 mechanisms: 197 * The IPv6 node has recently initiated a session to the same or 198 another IPv4 node. this is also the case if the IPv6 node has 199 used a NAT-traversal technique (such as ICE) . 201 * If a statically configured mapping exists for the IPv6 node. 203 o IPv4 address sharing: NAT64 allows multiple IPv6-only nodes to 204 share an IPv4 address to access the IPv4 Internet. This helps 205 with IPv4 forthcoming exhaustion. 207 o As currently defined in this NAT64 specification, only TCP/UDP/ 208 ICMP are supported. Support for other protocols such as other 209 transport protocols and IPsec are to be defined in separated 210 documents. 212 1.2. Overview 214 This section provides a non-normative introduction to NAT64. This is 215 achieved by describing the NAT64 behavior involving a simple setup, 216 that involves a single NAT64 device, a single DNS64 and a simple 217 network topology. The goal of this description is to provide the 218 reader with a general view of NAT64. It is not the goal of this 219 section to describe all possible configurations nor to provide a 220 normative specification of the NAT64 behavior. So, for the sake of 221 clarity, only TCP and UDP are described in this overview; the details 222 of ICMP, fragmentation, and other aspects of translation are 223 purposefully avoided in this overview. The normative specification 224 of NAT64 is provided in Section 3. 226 The NAT64 mechanism is implemented in a device which has (at least) 227 two interfaces, an IPv4 interface connected to the IPv4 network, and 228 an IPv6 interface connected to the IPv6 network. Packets generated 229 in the IPv6 network for a receiver located in the IPv4 network will 230 be routed within the IPv6 network towards the NAT64 device. The 231 NAT64 will translate them and forward them as IPv4 packets through 232 the IPv4 network to the IPv4 receiver. The reverse takes place for 233 packets generated by hosts connected to the IPv4 network for an IPv6 234 receiver. NAT64, however, is not symmetric. In order to be able to 235 perform IPv6-IPv4 translation, NAT64 requires state, binding an IPv6 236 address and TCP/UDP port (hereafter called an IPv6 transport address) 237 to an IPv4 address and TCP/UDP port (hereafter called an IPv4 238 transport address). 240 Such binding state is either statically configured in the NAT64 or it 241 is created when the first packet flowing from the IPv6 network to the 242 IPv4 network is translated. After the binding state has been 243 created, packets flowing in both directions on that particular flow 244 are translated. The result is that, in the general case, NAT64 only 245 supports communications initiated by the IPv6-only node towards an 246 IPv4-only node. Some additional mechanisms (like ICE) or static 247 binding configuration, can be used to provide support for 248 communications initiated by an IPv4-only node to an IPv6-only node. 250 1.2.1. Stateful NAT64 solution elements 252 In this section we describe the different elements involved in the 253 NAT64 approach. 255 The main component of the proposed solution is the translator itself. 256 The translator has essentially two main parts, the address 257 translation mechanism and the protocol translation mechanism. 259 Protocol translation from IPv4 packet header to IPv6 packet header 260 and vice-versa is performed according to the IP/ICMP Translation 261 Algorithm [I-D.ietf-behave-v6v4-xlate]. 263 Address translation maps IPv6 transport addresses to IPv4 transport 264 addresses and vice-versa. In order to create these mappings the 265 NAT64 has two pools of addresses: an IPv6 address pool (to represent 266 IPv4 addresses in the IPv6 network) and an IPv4 address pool (to 267 represent IPv6 addresses in the IPv4 network). 269 The IPv6 address pool is one or more IPv6 prefixes assigned to the 270 translator itself (hereafter we will call the IPv6 address pool as 271 Pref64::/n, in the case there are more than one prefix assigned to 272 the NAT64, the comments made about Pref64::/n apply to each of them). 273 Pref64::/n will be used by the NAT64 to construct IPv4-Converted IPv6 274 addresses as defined in [I-D.ietf-behave-address-format]. Due to the 275 abundance of IPv6 address space, it is possible to assign one or more 276 Pref64::/n, each of them being equal to or even bigger than the size 277 of the whole IPv4 address space. This allows each IPv4 address to be 278 mapped into a different IPv6 address by simply concatenating a 279 Pref64::/n with the IPv4 address being mapped and a suffix. The 280 provisioning of the Pref64::/n as well as the address format are 281 defined in [I-D.ietf-behave-address-format]. 283 The IPv4 address pool is a set of IPv4 addresses, normally a small 284 prefix assigned by the local administrator. Since IPv4 address space 285 is a scarce resource, the IPv4 address pool is small and typically 286 not sufficient to establish permanent one-to-one mappings with IPv6 287 addresses. So, except for the static/manually created ones, mappings 288 using the IPv4 address pool will be created and released dynamically. 289 Moreover, because of the IPv4 address scarcity, the usual practice 290 for NAT64 is likely to be the binding of IPv6 transport addresses 291 into IPv4 transport addresses, instead of IPv6 addresses into IPv4 292 addresses directly, enabling a higher utilization of the limited IPv4 293 address pool. 295 Because of the dynamic nature of the IPv6 to IPv4 address mapping and 296 the static nature of the IPv4 to IPv6 address mapping, it is far 297 simpler to allow communications initiated from the IPv6 side toward 298 an IPv4 node, whose address is algorithmically mapped into an IPv6 299 address, than communications initiated from IPv4-only nodes to an 300 IPv6 node in which case an IPv4 address needs to be associated with 301 the IPv6 node's address dynamically. 303 Using DNS64, an IPv6 client obtains an IPv6 address that embeds the 304 IPv4 address of the IPv4 server, and sends a packet to that IPv6 305 address. The packets are intercepted by the NAT64 device, which 306 associates an IPv4 transport address of its IPv4 pool to the IPv6 307 transport address of the initiator, creating binding state, so that 308 reply packets can be translated and forwarded back to the initiator. 309 The binding state is kept while packets are flowing. Once the flow 310 stops, and based on a timer, the IPv4 transport address is returned 311 to the IPv4 address pool so that it can be reused for other 312 communications. 314 To allow an IPv6 initiator to do a DNS lookup to learn the address of 315 the responder, DNS64 [I-D.ietf-behave-dns64] is used to synthesize 316 AAAA RRs from the A RRs. The IPv6 addresses contained in the 317 synthetic AAAA RRs contain the Pref64::/n assigned to the NAT64 and 318 the real IPv4 address of the responder. The synthetic AAAA RRs are 319 passed back to the IPv6 initiator, which will initiate an IPv6 320 communication with an IPv6 address associated to the IPv4 receiver. 321 The packet will be routed to the NAT64 device, which will create the 322 IPv6 to IPv4 address mapping as described before. 324 1.2.2. Stateful NAT64 Behaviour Walkthrough 326 In this section we provide a simple example of the NAT64 behaviour. 327 We consider an IPv6 node located in an IPv6-only site that initiates 328 a TCP connection to an IPv4-only node located in the IPv4 network. 330 The scenario for this case is depicted in the following figure: 332 +---------------------+ +---------------+ 333 |IPv6 network | | IPv4 | 334 | | +-------------+ | Network | 335 | |--| Name server |--| | 336 | | | with DNS64 | | +----+ | 337 | +----+ | +-------------+ | | H2 | | 338 | | H1 |---| | | +----+ | 339 | +----+ | +-------+ | 192.0.2.1 | 340 |2001:DB8::1|------| NAT64 |----| | 341 | | +-------+ | | 342 | | | | | 343 +---------------------+ +---------------+ 345 The figure above shows an IPv6 node H1 with an IPv6 address 2001: 346 DB8::1 and an IPv4 node H2 with IPv4 address 192.0.2.1. H2 has 347 h2.example.com as FQDN. 349 A NAT64 connects the IPv6 network to the IPv4 network. This NAT64 350 uses the Well-Know Prefix 64:FF9B::/96 defined 351 [I-D.ietf-behave-address-format] to represent IPv4 addresses in the 352 IPv6 address space and a single IPv4 address 203.0.113.1 assigned to 353 its IPv4 interface. The routing is configured in such a way that the 354 IPv6 packets addressed to a destination address in 64:FF9B::/96 are 355 routed to the IPv6 interface of the NAT64 device. 357 Also shown is a local name server with DNS64 functionality. The 358 local name server uses the Well-Know prefix 64:FF9B::/96 to create 359 the IPv6 addresses in the synthetic RRs. 361 For this example, assume the typical DNS situation where IPv6 hosts 362 have only stub resolvers and the local name server does the recursive 363 lookups. 365 The steps by which H1 establishes communication with H2 are: 367 1. H1 performs a DNS query for h2.example.com and receives the 368 synthetic AAAA RR from the local name server that implements the 369 DNS64 functionality. The AAAA record contains an IPv6 address 370 formed by the Well-Known Prefix and the IPv4 address of H2 (i.e. 371 64:FF9B::192.0.2.1). 373 2. H1 sends a TCP SYN packet to H2. The packet is sent from a 374 source transport address of (2001:DB8::1,1500) to a destination 375 transport address of (64:FF9B::192.0.2.1,80), where the ports are 376 set by H1. 378 3. The packet is routed to the IPv6 interface of the NAT64 (since 379 IPv6 routing is configured that way). 381 4. The NAT64 receives the packet and performs the following actions: 383 * The NAT64 selects an unused port e.g. 2000 on its IPv4 address 384 203.0.113.1 and creates the mapping entry (2001:DB8::1,1500) 385 <--> (203.0.113.1,2000) 387 * The NAT64 translates the IPv6 header into an IPv4 header using 388 the IP/ICMP Translation Algorithm 389 [I-D.ietf-behave-v6v4-xlate]. 391 * The NAT64 includes (203.0.113.1,2000) as source transport 392 address in the packet and (192.0.2.1.,80) as destination 393 transport address in the packet. Note that 192.0.2.1. is 394 extracted directly from the destination IPv6 address of the 395 received IPv6 packet that is being translated. The 396 destination port 80 of the translated packet is the same as 397 the destination port of the received IPv6 packet. 399 5. The NAT64 sends the translated packet out its IPv4 interface and 400 the packet arrives at H2. 402 6. H2 node responds by sending a TCP SYN+ACK packet with destination 403 transport address (203.0.113.1,2000) and source transport address 404 (192.0.2.1.,80). 406 7. Since the IPv4 address 203.0.113.1 is assigned to the IPv4 407 interface of the NAT64 device, the packet is routed to the NAT64 408 device, which will look for an existing mapping containing 409 (203.0.113.1,2000). Since the mapping (2001:DB8::1,1500) <--> 410 (203.0.113.1,2000) exists, the NAT64 performs the following 411 operations: 413 * The NAT64 translates the IPv4 header into an IPv6 header using 414 the IP/ICMP Translation Algorithm 415 [I-D.ietf-behave-v6v4-xlate]. 417 * The NAT64 includes (2001:DB8::1,1500) as destination transport 418 address in the packet and (64:FF9B::192.0.2.1,80) as source 419 transport address in the packet. Note that 192.0.2.1. is 420 extracted directly from the source IPv4 address of the 421 received IPv4 packet that is being translated. The source 422 port 80 of the translated packet is the same as the source 423 port of the received IPv4 packet. 425 8. The translated packet is sent out the IPv6 interface to H1. 427 The packet exchange between H1 and H2 continues and packets are 428 translated in the different directions as previously described. 430 It is important to note that the translation still works if the IPv6 431 initiator H1 learns the IPv6 representation of H2's IPv4 address 432 (i.e., 64:FF9B::192.0.2.1) through some scheme other than a DNS 433 look-up. This is because the DNS64 processing does NOT result in any 434 state installed in the NAT64 and because the mapping of the IPv4 435 address into an IPv6 address is the result of concatenating the Well- 436 Known Prefix to the original IPv4 address. 438 1.2.3. Filtering 440 NAT64 may do filtering, which means that it only allows a packet in 441 through an interface if the appropriate permission exists. The NAT64 442 can do filtering of IPv6 packets based on the administrative rules to 443 create entries in the binding and session tables. The filtering can 444 be flexible enough and broad enough but the idea of the filtering is 445 to provide the administrators necessary control to avoid DoS attacks 446 that would result in exhaustion of the NAT64's IPv4 address, port, 447 memory and CPU resources. Filtering techniques of incoming IPv6 448 packets are not specific to the NAT64 and therefore is not described 449 in this specification. 451 Filtering of IPv4 packets on the other hand is tightly coupled to the 452 NAT64 state and therefore is described in this specification. In 453 this document, we consider that the NAT64 may do no filtering, or it 454 may filter incoming IPv4 packets. 456 NAT64 filtering of incoming IPv4 packets is consistent with the 457 recommendations of [RFC4787], and the ones of [RFC5382]. Because of 458 that, the NAT64 as specified in this document, supports both 459 Endpoint-Independent Filtering and Address-Dependent Filtering, both 460 for TCP and UDP. 462 If a NAT64 performs Endpoint-Independent Filtering of incoming IPv4 463 packets, then an incoming IPv4 packet is dropped unless the NAT64 has 464 state for the destination transport address of the incoming IPv4 465 packet. 467 If a NAT64 performs Address-Dependent Filtering of incoming IPv4 468 packets, then an incoming IPv4 packet is dropped unless the NAT64 has 469 state involving the destination transport address of the IPv4 470 incoming packet and the particular source IP address of the incoming 471 IPv4 packet. 473 2. Terminology 475 This section provides a definitive reference for all the terms used 476 in this document. 478 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 479 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 480 document are to be interpreted as described in RFC 2119 [RFC2119]. 482 The following additional terms are used in this document: 484 3-Tuple: The tuple (source IP address, destination IP address, ICMP 485 Identifier). A 3-tuple uniquely identifies an ICMP Query session. 486 When an ICMP Query session flows through a NAT64, each session has 487 two different 3-tuples: one with IPv4 addresses and one with IPv6 488 addresses. 490 5-Tuple: The tuple (source IP address, source port, destination IP 491 address, destination port, transport protocol). A 5-tuple 492 uniquely identifies a UDP/TCP session. When a UDP/TCP session 493 flows through a NAT64, each session has two different 5-tuples: 494 one with IPv4 addresses and one with IPv6 addresses. 496 BIB: Binding Information Base. A table of mappings kept by a NAT64. 497 Each NAT64 has three BIBs, one for TCP, one for UDP and one for 498 ICMP Queries. 500 Endpoint-Independent Mapping: In NAT64, using the same mapping for 501 all the sessions involving a given IPv6 transport address of an 502 IPv6 host (irrespectively of the transport address of the IPv4 503 host involved in the communication). Endpoint-independent Mapping 504 is important for peer-to-peer communication. See [RFC4787] for 505 the definition of the different types of mappings in IPv4-to-IPv4 506 NATs. 508 Filtering, Endpoint-Independent: The NAT64 filters out only incoming 509 IPv4 packets not destined to a transport address for which there 510 is not state in the NAT64, regardless of the source IPv4 transport 511 address. The NAT forwards any packets destined to any transport 512 address for which it has state. In other words, having state for 513 a given transport address is sufficient to allow any packets back 514 to the internal endpoint. See [RFC4787] for the definition of the 515 different types of filtering in IPv4-to-IPv4 NATs. 517 Filtering, Address-Dependent: The NAT64 filters out incoming IPv4 518 packets not destined to a transport address for which there is no 519 state (similar to the Endpoint-Independent Filtering). 520 Additionally, the NAT64 will filter out incoming IPv4 packets 521 coming from a given IPv4 address X and destined for a transport 522 address that it has state for if the NAT64 has not sent packets to 523 X previously (independently of the port used by X). In other 524 words, for receiving packets from a specific IPv4 endpoint, it is 525 necessary for the IPv6 endpoint to send packets first to that 526 specific IPv4 endpoint's IP address. 528 Hairpinning: Having a packet do a "U-turn" inside a NAT and come 529 back out the same side as it arrived on. If the destination IPv6 530 address and its embedded IPv4 address are both assigned to the 531 NAT64 itself, then the packet is being sent to another IPv6 host 532 connected to the same NAT64. Such a packet is called a 'hairpin 533 packet'. A NAT64 that forwards hairpin packets, back to the IPv6 534 host are defined as supporting "hairpinning". Hairpinning support 535 is important for peer-to-peer applications, as there are cases 536 when two different hosts on the same side of a NAT can only 537 communicate using sessions that hairpin through the NAT. Hairpin 538 packets packets can be either TCP or UDP. More detailed 539 explanation of hairpinning and examples for the UDP case can be 540 found in [RFC4787]. 542 Mapping or Binding: A mapping between an IPv6 transport address and 543 a IPv4 transport address or a mapping between an (IPv6 address, 544 ICMPv6 Identifier) pair and an (IPv4 address, ICMPv4 Identifier) 545 pair. Used to translate the addresses and ports/Query Identifiers 546 of packets flowing between the IPv6 host and the IPv4 host. In 547 NAT64, the IPv4 address and port/ICMPv4 Identifier is always one 548 assigned to the NAT64 itself, while the IPv6 address and port/ 549 ICMPv6 Identifier belongs to some IPv6 host. 551 Session: A TCP, UDP or ICMP Query session. In other words, the bi- 552 directional flow of packets between two different hosts. In 553 NAT64, typically one host is an IPv4 host, and the other one is an 554 IPv6 host. However, due to hairpinning, both hosts might be IPv6 555 hosts. 557 Session table: A table of sessions kept by a NAT64. Each NAT64 has 558 three session tables, one for TCP, one for UDP and one for ICMP 559 Queries. 561 Stateful NAT64: A function that has per-flow state which translates 562 IPv6 packets to IPv4 packets and vice-versa, for TCP, UDP, and 563 ICMP. The NAT64 uses binding state to perform the translation 564 between IPv6 and IPv4 addresses. In this document we also refer 565 to stateful NAT64 simply as NAT64. 567 Stateful NAT64 device: The device where the NAT64 function is 568 executed. In this document we also refer to stateful NAT64 device 569 simply as NAT64 device. 571 Transport Address: The combination of an IPv6 or IPv4 address and a 572 port. Typically written as (IP address, port)- e.g. (192.0.2.15, 573 8001). 575 Tuple: Refers to either a 3-Tuple or a 5-tuple as defined above. 577 For a detailed understanding of this document, the reader should also 578 be familiar with NAT terminology [RFC4787]. 580 3. Stateful NAT64 Normative Specification 582 A NAT64 is a device with at least one IPv6 interface and at least one 583 IPv4 interface. Each NAT64 device MUST have at least one unicast /n 584 IPv6 prefix assigned to it, denoted Pref64::/n. Additional 585 considerations about the Pref64::/n are presented in Section 3.5.4. 586 A NAT64 MUST have one or more unicast IPv4 addresses assigned to it. 588 A NAT64 uses the following conceptual dynamic data structures: 590 o UDP Binding Information Base 592 o UDP Session Table 594 o TCP Binding Information Base 596 o TCP Session Table 598 o ICMP Query Binding Information Base 600 o ICMP Query Session Table 602 These tables contain information needed for the NAT64 processing. 603 The actual division of the information into six tables is done in 604 order to ease the description of the NAT64 behaviour. NAT64 605 implementations are free use different data structures but they MUST 606 store all the required information and the externally visible outcome 607 MUST be the same as the one described in this document. 609 The notation used is the following: upper case letters are IPv4 610 addresses; upper case letters with a prime(') are IPv6 addresses; 611 lower case letters are ports; prefixes of length n are indicated by 612 "P::/n", mappings are indicated as "(X,x) <--> (Y',y)". 614 3.1. Binding Information Bases 616 A NAT64 has three Binding Information Bases (BIBs): one for TCP, one 617 for UDP and one for ICMP Queries. In the case of UDP and TCP BIBs, 618 each BIB entry specifies a mapping between an IPv6 transport address 619 and an IPv4 transport address: 621 (X',x) <--> (T,t) 623 where X' is some IPv6 address, T is an IPv4 address, and x and t are 624 ports. T will always be one of the IPv4 addresses assigned to the 625 NAT64. The BIB has then two columns: the BIB IPv6 transport address 626 and the BIB IPv4 transport address. A given IPv6 or IPv4 transport 627 address can appear in at most one entry in a BIB: for example, (2001: 628 db8::17, 4) can appear in at most one TCP and at most one UDP BIB 629 entry. TCP and UDP have separate BIBs because the port number space 630 for TCP and UDP are distinct. This implementation of the BIBs 631 ensures Endpoint-Independent Mappings in the NAT64. The information 632 in the BIBs is also used to implement Endpoint-Independent Filtering. 633 (Address-Dependent Filtering is implemented using the session tables 634 described below.) 636 In the case of the ICMP Query BIB, each ICMP Query BIB entry 637 specifies a mapping between an (IPv6 address, ICMPv6 Identifier) pair 638 and an (IPv4 address, ICMPv4 Identifier) pair. 640 (X',I1) <--> (T,I2) 642 where X' is some IPv6 address, T is an IPv4 address, I1 is an ICMPv6 643 Identifier and I2 is an ICMPv4 Identifier. T will always be one of 644 the IPv4 addresses assigned to the NAT64. A given (IPv6 or IPv4 645 address, ICMPv6 or ICMPv4 Identifier) pair can appear in at most one 646 entry in the ICMP Query BIB. 648 Entries in any of the three BIBs can be created dynamically as the 649 result of the flow of packets as described in Section 3.5 but they 650 can also be created manually by an administrator. NAT64 651 implementations SHOULD support manually configured BIB entries for 652 any of the three BIBs. Dynamically-created entries are deleted from 653 the corresponding BIB when the last session associated with the BIB 654 entry is removed from the session table. Manually-configured BIB 655 entries are not deleted when there is no corresponding session table 656 entry and can only be deleted by the administrator. 658 3.2. Session Tables 660 A NAT64 also has three session tables: one for TCP sessions, one for 661 UDP sessions, and one for ICMP Query sessions. Each entry keeps 662 information on the state of the corresponding session. In the TCP 663 and UDP session tables, each entry specifies a mapping between a pair 664 of IPv6 transport addresses and a pair of IPv4 transport addresses: 666 (X',x),(Y',y) <--> (T,t),(Z,z) 668 where X' and Y' are IPv6 addresses, T and Z are IPv4 addresses, and 669 x, y, z and t are ports. T will always be one of the IPv4 addresses 670 assigned to the NAT64. Y' is always the IPv6 representation of the 671 IPv4 address Z, so Y' is obtained from Z using the algorithm applied 672 by the NAT64 to create IPv6 representations of IPv4 addresses. y will 673 always be equal to z. 675 For each TCP or UDP Session Table Entry (STE), there are then five 676 columns: 678 The STE source IPv6 transport address, (X',x) in the example 679 above, 681 The STE destination IPv6 transport address, (Y',y) in the example 682 above, 684 The STE source IPv4 transport address, (T,t) in the example above, 685 and, 686 The STE destination IPv4 transport address, (Z,z) in the example 687 above. 689 The STE lifetime. 691 The terminology used for the session table entry columns is from the 692 perspective of an incoming IPv6 packet being translated into an 693 outgoing IPv4 packet. 695 In the ICMP query session table, each entry specifies a mapping 696 between a 3-tuple of IPv6 source address, IPv6 destination address 697 and ICMPv6 Identifier and a 3-tuple of IPv4 source address, IPv4 698 destination address and ICMPv4 Identifier: 700 (X',Y',I1) <--> (T,Z,I2) 702 where X' and Y' are IPv6 addresses, T and Z are IPv4 addresses, I1 is 703 an ICMPv6 Identifier and I2 is an ICMPv4 Identifier. T will always 704 be one of the IPv4 addresses assigned to the NAT64. Y' is always the 705 IPv6 representation of the IPv4 address Z, so Y' is obtained from Z 706 using the algorithm applied by the NAT64 to create IPv6 707 representations of IPv4 addresses. 709 For each ICMP Query Session Table Entry (STE), there are then seven 710 columns: 712 The STE source IPv6 address, X' in the example above, 714 The STE destination IPv6 address, Y' in the example above, 716 The STE ICMPv6 Identifier, I1 in the example above, 718 The STE source IPv4 address, T in the example above, 720 The STE destination IPv4 address, Z in the example above, and, 722 The STE ICMPv4 Identifier, I2 in the example above. 724 The STE lifetime. 726 3.3. Packet Processing Overview 728 The NAT64 uses the session state information to determine when the 729 session is completed, and also uses session information for Address- 730 Dependent Filtering. A session can be uniquely identified by either 731 an incoming tuple or an outgoing tuple. 733 For each TCP or UDP session, there is a corresponding BIB entry, 734 uniquely specified by either the source IPv6 transport address (in 735 the IPv6 --> IPv4 direction) or the destination IPv4 transport 736 address (in the IPv4 --> IPv6 direction). For each ICMP Query 737 session, there is a corresponding BIB entry, uniquely specified by 738 either the source IPv6 address and ICMPv6 Identifier (in the IPv6 --> 739 IPv4 direction) or the destination IPv4 address and the ICMPv4 740 Identifier (in the IPv4 --> IPv6 direction). However, for all the 741 BIBs, a single BIB entry can have multiple corresponding sessions. 742 When the last corresponding session is deleted, if the BIB entry was 743 dynamically created, the BIB entry is deleted. 745 The NAT64 will receive packets through its interfaces. These packets 746 can be either IPv6 packets or IPv4 packets and they may carry TCP 747 traffic, UDP traffic or ICMP traffic. The processing of the packets 748 will be described next. In the case that the processing is common to 749 all the aforementioned types of packets, we will refer to the packet 750 as the incoming IP packet in general. In case that the processing is 751 specific to IPv6 packets, we will refer to the incoming IPv6 packet 752 and similarly to the IPv4 packets. 754 The processing of an incoming IP packet takes the following steps: 756 1. Determining the incoming tuple 758 2. Filtering and updating binding and session information 760 3. Computing the outgoing tuple 762 4. Translating the packet 764 5. Handling hairpinning 766 The details of these steps are specified in the following 767 subsections. 769 This breakdown of the NAT64 behavior into processing steps is done 770 for ease of presentation. A NAT64 MAY perform the steps in a 771 different order, or MAY perform different steps, but the externally 772 visible outcome MUST be the same as the one described in this 773 document. 775 3.4. Determining the Incoming tuple 777 This step associates an incoming tuple with every incoming IP packet 778 for use in subsequent steps. In the case of TCP, UDP and ICMP error 779 packets, the tuple is a 5-tuple consisting of source IP address, 780 source port, destination IP address, destination port, transport 781 protocol. In case of ICMP Queries, the tuple is a 3-tuple consisting 782 of the source IP address, destination IP address and ICMP Identifier. 784 If the incoming IP packet contains a complete (un-fragmented) UDP or 785 TCP protocol packet, then the 5-tuple is computed by extracting the 786 appropriate fields from the received packet. 788 If the incoming packet is a complete (un-fragmented) ICMP query 789 message (i.e., an ICMPv4 Query message or an ICMPv6 Informational 790 message), the 3-tuple is the source IP address, the destination IP 791 address and the ICMP Identifier. 793 If the incoming IP packet contains a complete (un-fragmented) ICMP 794 error message containing a UDP or a TCP packet, then the 5-tuple is 795 computed by extracting the appropriate fields from the IP packet 796 embedded inside the ICMP error message. However, the role of source 797 and destination is swapped when doing this: the embedded source IP 798 address becomes the destination IP address in the 5-tuple, the 799 embedded source port becomes the destination port in the 5-tuple, 800 etc. If it is not possible to determine the 5-tuple (perhaps because 801 not enough of the embedded packet is reproduced inside the ICMP 802 message), then the incoming IP packet MUST be silently discarded. 804 If the incoming IP packet contains a complete (un-fragmented) ICMP 805 error message containing a ICMP error message, then the packet is 806 silently discarded. 808 If the incoming IP packet contains a complete (un-fragmented) ICMP 809 error message containing an ICMP Query message, then the 3-tuple is 810 computed by extracting the appropriate fields from the IP packet 811 embedded inside the ICMP error message. However, the role of source 812 and destination is swapped when doing this: the embedded source IP 813 address becomes the destination IP address in the 3-tuple, the 814 embedded destination IP address becomes the source address in the 815 3-tuple and the embedded ICMP Identifier is used as the ICMP 816 Identifier of the 3-tuple. If it is not possible to determine the 817 3-tuple (perhaps because not enough of the embedded packet is 818 reproduced inside the ICMP message), then the incoming IP packet MUST 819 be silently discarded. 821 If the incoming IP packet contains a fragment, then more processing 822 may be needed. This specification leaves open the exact details of 823 how a NAT64 handles incoming IP packets containing fragments, and 824 simply requires that the external behavior of the NAT64 is compliant 825 with the following conditions: 827 The NAT64 MUST handle fragments. In particular, NAT64 MUST handle 828 fragments arriving out-of-order , conditioned on the following: 830 * The NAT64 MUST limit the amount of resources devoted to the 831 storage of fragmented packets in order to protect from DoS 832 attacks. 834 * As long as the NAT64 has available resources, the NAT64 MUST 835 allow the fragments to arrive over a time interval. The time 836 interval SHOULD be configurable and the default value MUST be 837 of at least FRAGMENT_MIN. 839 * The NAT64 MAY require that the UDP, TCP, or ICMP header be 840 completely contained within the fragment that contains OFFSET 841 equal to zero. 843 For incoming packets carrying TCP or UDP fragments with non-null 844 checksum, NAT64 MAY elect to queue the fragments as they arrive 845 and translate all fragments at the same time. In this case, the 846 incoming tuple is determined as documented above to the un- 847 fragmented packets. Alternatively, a NAT64 MAY translate the 848 fragments as they arrive, by storing information that allows it to 849 compute the 5-tuple for fragments other than the first. In the 850 latter case, subsequent fragments may arrive before the first and 851 the rules about how the NAT64 handles (out-of-order) fragments 852 described in the bulleted list above apply. 854 For incoming IPv4 packets carrying UDP packets with null checksum, 855 if the NAT64 has enough resources, the NAT64 MUST reassemble the 856 packets and MUST calculate the checksum. If the NAT64 does not 857 have enough resources, then it MUST silently discard the packets. 859 Implementers of NAT64 should be aware that there are a number of 860 well-known attacks against IP fragmentation; see [RFC1858] and 861 [RFC3128]. Implementers should also be aware of additional issues 862 with reassembling packets at high rates, described in [RFC4963]. 864 3.5. Filtering and Updating Binding and Session Information 866 This step updates binding and session information stored in the 867 appropriate tables. This step may also filter incoming packets, if 868 desired. 870 Irrespective of the transport protocol used, the NAT64 MUST silently 871 discard all incoming IPv6 packets containing a source address that 872 contains the Pref64::/n. This is required in order to prevent 873 hairpinning loops as described in Section 5. In addition, the NAT64 874 MUST only process incoming IPv6 packets that contain a destination 875 address that contains Pref64::/n. Likewise, the NAT64 MUST only 876 process incoming IPv4 packets that contain a destination address that 877 belong to the IPv4 pool assigned to the NAT64. 879 The details of this step depend on the protocol (UDP, TCP or ICMP 880 Query). 882 3.5.1. UDP Session Handling 884 The following state information is stored for a UDP session: 886 Binding:(X',x),(Y',y) <--> (T,t),(Z,z) 888 Lifetime: a timer that tracks the remaining lifetime of the TCP 889 session. When the timer expires, the UDP session is deleted. If 890 all the UDP sessions corresponding to a dynamically created UDP 891 BIB entry are deleted, then the UDP BIB entry is also deleted. 893 An IPv6 incoming packet with an incoming tuple with source transport 894 address (X',x) and destination transport address (Y',y) is processed 895 as follows: 897 The NAT64 searches for a UDP BIB entry that contains the BIB IPv6 898 transport address that matches the IPv6 source transport address 899 (X',x). If such an entry does not exist, the NAT64 tries to 900 create a new entry (if resources and policy permit). The source 901 IPv6 transport address of the packet (X',x) is used as BIB IPv6 902 transport address, and the BIB IPv4 transport address is set to 903 (T,t) which is allocated using the rules defined in 904 Section 3.5.1.1. The result is a BIB entry as follows: (X',x) 905 <--> (T,t). 907 The NAT64 searches for the session table entry corresponding to 908 the incoming 5-tuple. If no such entry is found, the NAT64 tries 909 to create a new entry (if resources and policy permit). The 910 information included in the session table is as follows: 912 * The STE source IPv6 transport address is set to (X',x), the 913 source IPv6 transport addresses contained in the received IPv6 914 packet, 916 * The STE destination IPv6 transport address is set to (Y',y), 917 the destination IPv6 transport addresses contained in the 918 received IPv6 packet, 920 * The STE source IPv4 transport address is extracted from the 921 corresponding UDP BIB entry i.e. it is set to (T,t), 923 * The STE destination IPv4 transport is set to (Z(Y'),y), y being 924 the same port as the STE destination IPv6 transport address and 925 Z(Y') being algorithmically generated from the IPv6 destination 926 address (i.e. Y') using the reverse algorithm as specified in 927 Section 3.5.4. 929 The result is a Session table entry as follows: (X',x),(Y',y) <--> 930 (T,t),(Z(Y'),y) 932 The NAT64 sets (or resets) the timer in the Session Table Entry to 933 maximum session lifetime. The maximum session lifetime MAY be 934 configurable and the default SHOULD be at least UDP_DEFAULT. The 935 maximum session lifetime MUST NOT be less than UDP_MIN. The 936 packet is translated and forwarded as described in the following 937 sections. 939 An IPv4 incoming packet, with an incoming tuple with source IPv4 940 transport address (Y,y) and destination IPv4 transport address (X,x) 941 is processed as follows: 943 The NAT64 searches for a UDP BIB entry that contains the BIB IPv4 944 transport address matching (Y,y), (i.e., the IPv4 destination 945 transport address in the incoming IPv4 packet). If such an entry 946 does not exist, the packet MUST be dropped. An ICMP error message 947 with type of 3 (Destination Unreachable) MAY be sent to the 948 original sender of the packet, unless the discarded packet is 949 itself an ICMP error message. 951 If the NAT64 applies Address-Dependent Filters on its IPv4 952 interface, then the NAT64 checks to see if the incoming packet is 953 allowed according to the Address-Dependent Filtering rule. To do 954 this, it searches for a session table entry with an STE source 955 IPv4 transport address equal to (X,x), (i.e., the destination IPv4 956 transport address in the incoming packet) and STE destination IPv4 957 address equal to Y, (i.e., the source IPv4 address in the incoming 958 packet). If such an entry is found (there may be more than one), 959 packet processing continues. Otherwise, the packet is discarded. 960 If the packet is discarded, then an ICMP error message MAY be sent 961 to the original sender of the packet, unless the discarded packet 962 is itself an ICMP message. The ICMP error message, if sent, has a 963 type of 3 (Destination Unreachable) and a code of 13 964 (Communication Administratively Prohibited). 966 In case the packet is not discarded in the previous processing 967 (either because the NAT64 is not filtering or because the packet 968 is compliant with the Address-Dependent Filtering rule), then the 969 NAT64 searches for the session table entry corresponding 970 containing the STE source IPv4 transport address equal to (X,x) 971 and the STE destination IPv4 transport address equal to (Y,y). If 972 no such entry is found, the NAT64 tries to create a new entry (if 973 resources and policy permit). In case a new UDP session table 974 entry is created, it contains the following information: 976 * The STE source IPv6 transport address is extracted from the 977 corresponding UDP BIB entry. 979 * The STE destination IPv6 transport address is set to (Z'(Y),y), 980 y being the same port y than the destination IPv4 transport 981 address and Z'(Y) being the IPv6 representation of Y, generated 982 using the algorithm described in Section 3.5.4. 984 * The STE source IPv4 transport address is set to (X,x) the 985 destination IPv4 transport addresses contained in the received 986 IPv4 packet. 988 * The STE destination IPv4 transport is set to (Y,y), the source 989 IPv4 transport addresses contained in the received IPv4 packet. 991 The NAT64 sets (or resets) the timer in the Session Table Entry to 992 maximum session lifetime. The maximum session lifetime MAY be 993 configurable and the default SHOULD be at least UDP_DEFAULT. The 994 maximum session lifetime MUST NOT be less than UDP_MIN. The 995 packet is translated and forwarded as described in the following 996 sections. 998 3.5.1.1. Rules for Allocation of IPv4 Transport Addresses for UDP 1000 When a new UDP BIB entry is created for a source transport address of 1001 (S',s), then the NAT64 allocates an IPv4 transport address for this 1002 BIB entry as follows: 1004 If there exists some other BIB entry containing S' as the IPv6 1005 address and mapping it to some IPv4 address T, then the NAT64 1006 SHOULD use T as the IPv4 address. Otherwise, use any IPv4 address 1007 of the IPv4 pool assigned to the NAT64 to be used for translation. 1009 If the port s is in the Well-Known port range 0-1023, and the 1010 NAT64 has an available port t in the same port range, then the 1011 NAT64 SHOULD allocate the port t. If the NAT64 does not have a 1012 port available in the same range, the NAT64 MAY assign a port t 1013 from other range where it has an available port. (this behavior is 1014 recommended in REQ 3-a of [RFC4787]) 1016 If the port s is in the range 1024-65535, and the NAT64 has an 1017 available port t in the same port range, then the NAT64 SHOULD 1018 allocate the port t. If the NAT64 does not have a port available 1019 in the same range, the NAT64 MAY assign a port t from other range 1020 where it has an available port. (this behavior is recommended in 1021 REQ 3-a of [RFC4787]) 1022 The NAT64 SHOULD preserve the port parity (odd/even), as per 1023 Section 4.2.2 of [RFC4787]). 1025 In all cases, the allocated IPv4 transport address (T,t) MUST NOT 1026 be in use in another entry in the same BIB, but MAY be in use in 1027 the other BIB (referring to the UDP and TCP BIBs). 1029 If it is not possible to allocate an appropriate IPv4 transport 1030 address or create a BIB entry, then the packet is discarded. The 1031 NAT64 SHOULD send an ICMPv6 Destination Unreachable/Address 1032 unreachable (Code 3) message. 1034 3.5.2. TCP Session Handling 1036 In this section we describe how the TCP BIB and Session table are 1037 populated. We do so by defining the state machine of the NAT64 uses 1038 for TCP. We first describe the states and the information contained 1039 in them and then we describe the actual state machine and state 1040 transitions. 1042 3.5.2.1. State definition 1044 The following state information is stored for a TCP session: 1046 Binding:(X',x),(Y',y) <--> (T,t),(Z,z) 1048 Lifetime: a timer that tracks the remaining lifetime of the TCP 1049 session. When the timer expires, the TCP session is deleted. If 1050 all the TCP sessions corresponding to a TCP BIB entry are deleted, 1051 then the dynamically created TCP BIB entry is also deleted. 1053 TCP sessions are expensive, because their inactivity lifetime is set 1054 to at least 2 hours and 4 min (as per [RFC5382]), so it is important 1055 that each TCP session table entry corresponds to an existent TCP 1056 session. In order to do that, for each TCP session established 1057 through it, it tracks the corresponding state machine as follows. 1059 The states are the following ones: 1061 CLOSED: Analogous to [RFC0793], CLOSED is a fictional state 1062 because it represents the state when there is no state for this 1063 particular 5-tuple, and therefore, no connection. 1065 V4 SYN RCV: An IPv4 packet containing a TCP SYN was received by 1066 the NAT64, implying that a TCP connection is being initiated from 1067 the IPv4 side. The NAT64 is now waiting for a matching IPv6 1068 packet containing the TCP SYN in the opposite direction. 1070 V6 SYN RCV: An IPv6 packet containing a TCP SYN was received by 1071 the NAT64, implying that a TCP connection is being initiated from 1072 the IPv6 side. The NAT64 is now waiting for a matching IPv4 1073 packet containing the TCP SYN in the opposite direction. 1075 ESTABLISHED: Represents an open connection, with data able to flow 1076 in both directions. 1078 V4 FIN RCV: An IPv4 packet containing a TCP FIN was received by 1079 the NAT64, data can still flow in the connection, and the NAT64 is 1080 waiting for a matching TCP FIN in the opposite direction. 1082 V6 FIN RCV: An IPv6 packet containing a TCP FIN was received by 1083 the NAT64, data can still flow in the connection, and the NAT64 is 1084 waiting for a matching TCP FIN in the opposite direction. 1086 V6 FIN + V4 FIN RCV: Both an IPv4 packet containing a TCP FIN and 1087 an IPv6 packet containing an TCP FIN for this connection were 1088 received by the NAT64. The NAT64 keeps the connection state alive 1089 and forwards packet in both directions for a short period of time 1090 to allow remaining packets (in particular the ACKs) to be 1091 delivered. 1093 4MIN: The lifetime of the state for the connection is set to 4 1094 minutes either because a packet containing a TCP RST was received 1095 by the NAT64 for this connection or simply because the lifetime of 1096 the connection has decreased and there are only 4 minutes left. 1097 The NAT64 will keep the state for the connection for a short time 1098 and if no other data packets for that connection are received, the 1099 state for this connection is then terminated. 1101 3.5.2.2. State machine for TCP processing in the NAT64 1103 The state machine used by the NAT64 for the TCP session processing is 1104 depicted next. The described state machine handles all TCP segments 1105 received through the IPv6 and IPv4 interface. There is one state 1106 machine per TCP connection that is potentially established through 1107 the NAT64. After bootstrapping of the NAT64 device, all TCP sessions 1108 are in CLOSED state. As we mention above, the CLOSED state is a 1109 fictional state when is no state for that particular connection in 1110 the NAT64. It should be noted that there is one state machine per 1111 connection, so only packets belonging to a given connection are 1112 inputs to the state machine associated to that connection. In other 1113 words, when in the state machine below we state that a packet is 1114 received, it is implicit that the incoming 5-tuple of the data packet 1115 matches to the one of the state machine. 1117 A TCP segment with the SYN flag set that is received through the IPv6 1118 interface is called a V6 SYN, similarly, V4 SYN, V4 FIN, V6 FIN, V6 1119 FIN + V4 FIN, V6 RST and V4 RST. 1121 +-----------------------------+ 1122 | | 1123 V | 1124 V6 +------+ V4 | 1125 +----SYN------|CLOSED|-----SYN------+ | 1126 | +------+ | | 1127 | ^ | | 1128 | |4min T.O. | | 1129 V | V | 1130 +-------+ +-------+ +-------+ | 1131 |V6 SYN | | 4MIN | |V4 SYN | | 1132 | RCV | +-------+ | RCV | | 1133 +-------+ | ^ +-------+ | 1134 | data pkt | | | 1135 | | V4 or V6 RST | | 1136 | | 2 hr. T.O. | | 1137 V4 SYN V | V6 SYN | 1138 | +--------------+ | | 1139 +--------->| ESTABLISHED |<---------+ | 1140 +--------------+ | 1141 | | | 1142 V4 FIN V6 FIN | 1143 | | | 1144 V V | 1145 +---------+ +----------+ | 1146 | V4 FIN | | V6 FIN | | 1147 +---------+ +----------+ | 1148 | | | 1149 V6 FIN V4 FIN 4 min 1150 | | T.O. 1151 V V | 1152 +-------------------+ | 1153 | V4 FIN + V6 FIN |----------------------+ 1154 +-------------------+ 1156 We next describe the state information and the transitions. 1158 *** CLOSED *** 1160 If a V6 SYN is received with an incoming tuple with source transport 1161 address (X',x) and destination transport address (Y',y) (this is the 1162 case of a TCP connection initiated from the IPv6 side), the 1163 processing is as follows: 1165 1. The NAT64 searches for a TCP BIB entry that matches the IPv6 1166 source transport address (X',x). 1168 If such an entry does not exist, the NAT64 tries to create a 1169 new BIB entry (if resources and policy permit). The BIB IPv6 1170 transport address is set to (X',x) (i.e., the source IPv6 1171 transport address of the packet). The BIB IPv4 transport 1172 address is set to an IPv4 transport address allocated using 1173 the rules defined in Section 3.5.2.3 The processing of the 1174 packet continues as described in bullet 2. 1176 If the entry already exists, then the processing continues as 1177 described in bullet 2. 1179 2. Then the NAT64 tries to create a new TCP session entry in the TCP 1180 session table (if resources and policy permit). The information 1181 included in the session table is as follows: 1183 The STE source IPv6 transport address is set to (X',x) (i.e. 1184 the source transport address contained in the received V6 SYN 1185 packet, 1187 The STE destination IPv6 transport address is set to (Y',y) 1188 (i.e. the destination transport address contained in the 1189 received V6 SYN packet. 1191 The STE source IPv4 transport address is set to the BIB IPv4 1192 transport address of the corresponding TCP BIB entry. 1194 The STE destination IPv4 transport address contains the port y 1195 (i.e., the same port as the IPv6 destination transport 1196 address) and the IPv4 address that is algorithmically 1197 generated from the IPv6 destination address (i.e. Y') using 1198 the reverse algorithm as specified in Section 3.5.4. 1200 The lifetime of the TCP session table entry is set to at least 1201 to TCP_TRANS (the transitory connection idle timeout as 1202 defined in [RFC5382]). 1204 3. The state of the session is moved to V6 SYN RCV. 1206 4. The NAT64 translates and forwards the packet as described in the 1207 following sections 1209 If a V4 SYN packet is received with an incoming tuple with source 1210 IPv4 transport address (Y,y) and destination IPv4 transport address 1211 (X,x) (this is the case of a TCP connection initiated from the IPv4 1212 side), the processing is as follows: 1214 If the security policy requires silently dropping externally 1215 initiated TCP connections, then the packet is silently discarded, 1216 else, 1218 If the destination transport address contained in the incoming V4 1219 SYN (i.e., X,x) is not in use in the TCP BIB, then: 1221 The NAT64 tries to create a new session table entry in the TCP 1222 session table (if resources and policy permit), containing the 1223 following information: 1225 + The STE source IPv4 transport address is set to (X,x) (i.e. 1226 the destination transport address contained in the V4 SYN) 1228 + The STE destination IPv4 transport address is set to (Y,y) 1229 (i.e. the source transport address contained in the V4 SYN) 1231 + The STE transport IPv6 source address is left unspecified 1232 and may be populated by other protocols out of the scope of 1233 this specification. 1235 + The STE destination IPv6 transport address contains the port 1236 y (i.e. the same port than the destination IPv4 transport 1237 address) and the IPv6 representation of Y (i.e. the IPv4 1238 address of the destination IPv4 transport address), 1239 generated using the algorithm described in Section 3.5.4. 1241 The state is moved to V4 SYN RCV. 1243 The lifetime of the STE entry is set to TCP_INCOMING_SYN as per 1244 [RFC5382] and the packet is stored. The motivation for 1245 creating the session table entry and storing the packet 1246 (instead of simply dropping the packet based on the filtering) 1247 is to support simultaneous open of TCP connections. 1249 If the destination transport address contained in the incoming V4 1250 SYN (i.e., X,x) is in use in the TCP BIB, then: 1252 The NAT64 tries to create a new session table entry in the TCP 1253 session table (if resources and policy permit), containing the 1254 following information: 1256 + The STE source IPv4 transport address is set to (X,x) (i.e. 1257 the destination transport address contained in the V4 SYN) 1259 + The STE destination IPv4 transport address is set to (Y,y) 1260 (i.e. the source transport address contained in the V4 SYN) 1262 + The STE transport IPv6 source address is set to the IPv6 1263 transport address contained in the corresponding TCP BIB 1264 entry. 1266 + The STE destination IPv6 transport address contains the port 1267 y (i.e. the same port than the destination IPv4 transport 1268 address) and the IPv6 representation of Y (i.e. the IPv4 1269 address of the destination IPv4 transport address), 1270 generated using the algorithm described in Section 3.5.4. 1272 The state is moved to V4 SYN RCV. 1274 If the NAT64 is performing Address-Dependent Filtering, the 1275 lifetime of the STE entry is set to TCP_INCOMING_SYN as per 1276 [RFC5382] and the packet is stored. The motivation for 1277 creating the session table entry and storing the packet 1278 (instead of simply dropping the packet based on the filtering) 1279 is to support simultaneous open of TCP connections. 1281 If the NAT64 is not performing Address-Dependent Filtering, the 1282 lifetime of the STE is set to at least to TCP_TRANS (the 1283 transitory connection idle timeout as defined in [RFC5382]) and 1284 it translates and forwards the packet as described in the 1285 following sections. 1287 For any other packet belonging to this connection: 1289 If there is a corresponding entry in the TCP BIB other packets 1290 SHOULD be translated and forwarded if the security policy allows 1291 to do so. The state remains unchanged. 1293 If there is no corresponding entry in the TCP BIB the packet is 1294 silently discarded. 1296 *** V4 SYN RCV *** 1298 If a V6 SYN is received with incoming tuple with source transport 1299 address (X',x) and destination transport address (Y',y). The 1300 lifetime of the TCP session table entry is set to at least to the 1301 maximum session lifetime. The value for the maximum session lifetime 1302 MAY be configurable but it MUST not be less than TCP_EST (the 1303 established connection idle timeout as defined in [RFC5382]). The 1304 default value for the maximum session lifetime SHOULD be set to 1305 TCP_EST. The packet is translated and forwarded. The state is moved 1306 to ESTABLISHED. 1308 If the lifetime expires, an ICMP Port Unreachable error (Type 3, Code 1309 3) containing the IPv4 SYN packet stored is sent back to the source 1310 of the v4 SYN, the session table entry is deleted and, the state is 1311 moved to CLOSED. 1313 For any other packet, other packets SHOULD be translated and 1314 forwarded if the security policy allows to do so. The state remains 1315 unchanged. 1317 *** V6 SYN RCV *** 1319 If a V4 SYN is received (with or without the ACK flag set), with an 1320 incoming tuple with source IPv4 transport address (Y,y) and 1321 destination IPv4 transport address (X,x), then the state is moved to 1322 ESTABLISHED. The lifetime of the TCP session table entry is set to 1323 at least to the maximum session lifetime. The value for the maximum 1324 session lifetime MAY be configurable but it MUST not be less than 1325 TCP_EST (the established connection idle timeout as defined in 1326 [RFC5382]). The default value for the maximum session lifetime 1327 SHOULD be set to TCP_EST. The packet is translated and forwarded. 1329 If the lifetime expires, the session table entry is deleted and the 1330 state is moved to CLOSED. 1332 For any other packet, other packets SHOULD be translated and 1333 forwarded if the security policy allows to do so. The state remains 1334 unchanged. 1336 *** ESTABLISHED *** 1338 If a V4 FIN packet is received, the packet is translated and 1339 forwarded. The state is moved to V4 FIN RCV. 1341 If a V6 FIN packet is received, the packet is translated and 1342 forwarded. The state is moved to V6 FIN RCV. 1344 If a V4 RST or a V6 RST packet is received, the packet is translated 1345 and forwarded. The lifetime is set to TCP_TRANS and the state is 1346 moved to 4MIN. (Since the NAT64 is uncertain whether the peer will 1347 accept the RST packet, instead of moving the state to CLOSED, it 1348 moves to 4MIN, which has a shorter lifetime. If no other packets are 1349 received for this connection during the short timer, the NAT64 1350 assumes that the peer has accepted the RST packet and moves to 1351 CLOSED. If packets keep flowing, the NAT64 assumes that the peer has 1352 not accepted the RST packet and moves back to the ESTABLISHED state. 1353 This is described below in the 4MIN state processing description.) 1355 If any other packet is received, the packet is translated and 1356 forwarded. The lifetime of the TCP session table entry is set to at 1357 least to the maximum session lifetime. The value for the maximum 1358 session lifetime MAY be configurable but it MUST not be less than 1359 TCP_EST (the established connection idle timeout as defined in 1360 [RFC5382]). The default value for the maximum session lifetime 1361 SHOULD be set to TCP_EST. The state remains unchanged as 1362 ESTABLISHED. 1364 If the lifetime expires then the NAT64 SHOULD send a probe packet (as 1365 defined next) to al least one of the endpoints of the TCP connection. 1366 The probe packet is a TCP segment for the connection with no data. 1367 The sequence number and the acknowledgment number are set to zero. 1368 All flags but the ACK flag are reset. 1370 Upon the reception of this probe packet, the endpoint will reply 1371 with an ACK containing the expected sequence number for that 1372 connection. It should be noted that, for an active connection, 1373 each of these probe packets will generate one packet from each end 1374 involved in the connection, since the reply of the first point to 1375 the probe packet will generate a reply from the other endpoint. 1377 The state is moved to 4MIN. 1379 *** V4 FIN RCV *** 1381 If a V6 FIN packet is received, the packet is translated and 1382 forwarded. The lifetime is set to TCP_TRANS. The state is moved to 1383 V6 FIN + V4 FIN RCV. 1385 If any packet other than the V6 FIN is received, the packet is 1386 translated and forwarded. The lifetime of the TCP session table 1387 entry is set to at least to the maximum session lifetime. The value 1388 for the maximum session lifetime MAY be configurable but it MUST not 1389 be less than TCP_EST (the established connection idle timeout as 1390 defined in [RFC5382]). The default value for the maximum session 1391 lifetime SHOULD be set to TCP_EST. The state remains unchanged as V4 1392 FIN RCV. 1394 If the lifetime expires, the session table entry is deleted and the 1395 state is moved to CLOSED. 1397 *** V6 FIN RCV *** 1399 If a V4 FIN packet is received, the packet is translated and 1400 forwarded. The lifetime is set to TCT_TRANS. The state is moved to 1401 V6 FIN + V4 FIN RCV. 1403 If any packet other than the V4 FIN is received, the packet is 1404 translated and forwarded. The lifetime of the TCP session table 1405 entry is set to at least to the maximum session lifetime. The value 1406 for the maximum session lifetime MAY be configurable but it MUST not 1407 be less than TCP_EST (the established connection idle timeout as 1408 defined in [RFC5382]). The default value for the maximum session 1409 lifetime SHOULD be set to TCP_EST. The state remains unchanged as V6 1410 FIN RCV. 1412 If the lifetime expires, the session table entry is deleted and the 1413 state is moved to CLOSED. 1415 *** V6 FIN + V4 FIN RCV *** 1417 All packets are translated and forwarded. 1419 If the lifetime expires, the session table entry is deleted and the 1420 state is moved to CLOSED. 1422 *** 4MIN *** 1424 If a packet other than a RST packet is received, the lifetime of the 1425 TCP session table entry is set to at least to the maximum session 1426 lifetime. The value for the maximum session lifetime MAY be 1427 configurable but it MUST not be less than TCP_EST (the established 1428 connection idle timeout as defined in [RFC5382]). The default value 1429 for the maximum session lifetime SHOULD be set to TCP_EST. The state 1430 is moved to ESTABLISHED. 1432 If the lifetime expires, the session table entry is deleted and the 1433 state is moved to CLOSED. 1435 3.5.2.3. Rules for allocation of IPv4 transport addresses for TCP 1437 When a new TCP BIB entry is created for a source transport address of 1438 (S',s), then the NAT64 allocates an IPv4 transport address for this 1439 BIB entry as follows: 1441 If there exists some other BIB entry containing S' as the IPv6 1442 address and mapping it to some IPv4 address T, then use SHOULD T 1443 as the IPv4 address. Otherwise, use any IPv4 address of the IPv4 1444 pool assigned to the NAT64 to be used for translation. 1446 If the port s is in the Well-Known port range 0-1023, and the 1447 NAT64 has an available port t in the same port range, then the 1448 NAT64 SHOULD allocate the port t. If the NAT64 does not have a 1449 port available in the same range, the NAT64 MAY assign a port t 1450 from another range where it has an available port. 1452 If the port s is in the range 1024-65535, and the NAT64 has an 1453 available port t in the same port range, then the NAT64 SHOULD 1454 allocate the port t. If the NAT64 does not have a port available 1455 in the same range, the NAT64 MAY assign a port t from another 1456 range where it has an available port. 1458 In all cases, the allocated IPv4 transport address (T,t) MUST NOT 1459 be in use in another entry in the same BIB, but MAY be in use in 1460 the other BIB (referring to the UDP and TCP BIBs). 1462 If it is not possible to allocate an appropriate IPv4 transport 1463 address or create a BIB entry, then the packet is discarded. The 1464 NAT64 SHOULD send an ICMPv6 Destination Unreachable/Address 1465 unreachable (Code 3) message. 1467 3.5.3. ICMP Query Session Handling 1469 The following state information is stored for an ICMP Query session 1470 in the ICMP Query session table: 1472 Binding:(X',Y',I1) <--> (T,Z,I2) 1474 Lifetime: a timer that tracks the remaining lifetime of the ICMP 1475 Query session. When the timer expires, the session is deleted. 1476 If all the ICMP Query sessions corresponding to a dynamically 1477 created ICMP Query BIB entry are deleted, then the ICMP Query BIB 1478 entry is also deleted. 1480 An incoming ICMPv6 Informational packet with IPv6 source address X', 1481 IPv6 destination address Y' and ICMPv6 Identifier I1, is processed as 1482 follows: 1484 If the local security policy determines that ICMPv6 Informative 1485 packets are to be filtered, the packet is silently discarded. 1486 Else, the NAT64 searches for an ICMP Query BIB entry that matches 1487 the (X',I1) pair. If such entry does not exist, the NAT64 tries 1488 to create a new entry (if resources and policy permit) with the 1489 following data: 1491 * The BIB IPv6 address is set to X' (i.e. the source IPv6 address 1492 of the IPv6 packet). 1494 * The BIB ICMPv6 Identifier is set to I1 (i.e. the ICMPv6 1495 Identifier). 1497 * If there exists another BIB entry containing the same IPv6 1498 address X' and mapping it to an IPv4 address T, then use T as 1499 the BIB IPv4 address for this new entry. Otherwise, use any 1500 IPv4 address assigned to the IPv4 interface. 1502 * As the BIB ICMPv4 Identifier use any available value i.e. any 1503 identifier value for which no other entry exists with the same 1504 (IPv4 address, ICMPv4 Identifier) pair. 1506 The NAT64 searches for an ICMP query session table entry 1507 corresponding to the incoming 3-tuple (X',Y',I1). If no such 1508 entry is found, the NAT64 tries to create a new entry (if 1509 resources and policy permit). The information included in the new 1510 session table entry is as follows: 1512 * The STE IPv6 source address is set to the X' (i.e. the address 1513 contained in the received IPv6 packet), 1515 * The STE IPv6 destination address is set to the Y' (i.e. the 1516 address contained in the received IPv6 packet), 1518 * The STE ICMPv6 Identifier is set to the I1 (i.e. the identifier 1519 contained in the received IPv6 packet), 1521 * The STE IPv4 source address is set to the IPv4 address 1522 contained in the corresponding BIB entry, 1524 * The STE ICMPv4 Identifier is set to the IPv4 identifier 1525 contained in the corresponding BIB entry, 1527 * The STE IPv4 destination address is algorithmically generated 1528 from Y' using the reverse algorithm as specified in 1529 Section 3.5.4. 1531 The NAT64 sets (or resets) the timer in the session table entry to 1532 the maximum session lifetime. By default, the maximum session 1533 lifetime is ICMP_DEFAULT. The maximum lifetime value SHOULD be 1534 configurable. The packet is translated and forwarded as described 1535 in the following sections. 1537 An incoming ICMPv4 Query packet with source IPv4 address Y, 1538 destination IPv4 address X and ICMPv4 Identifier I2 is processed as 1539 follows: 1541 The NAT64 searches for an ICMP Query BIB entry that contains X as 1542 IPv4 address and I2 as the ICMPv4 Identifier. If such an entry 1543 does not exist, the packet is dropped. An ICMP error message MAY 1544 be sent to the original sender of the packet, unless the discarded 1545 packet is itself an ICMP error message. The ICMP error message, 1546 if sent, has a type of 3 (Destination Unreachable). 1548 If the NAT64 filters on its IPv4 interface, then the NAT64 checks 1549 to see if the incoming packet is allowed according to the Address- 1550 Dependent Filtering rule. To do this, it searches for a session 1551 table entry with an STE source IPv4 address equal to X, an STE 1552 ICMPv4 Identifier equal to I2 and a STE destination IPv4 address 1553 equal to Y. If such an entry is found (there may be more than 1554 one), packet processing continues. Otherwise, the packet is 1555 discarded. If the packet is discarded, then an ICMP message MAY 1556 be sent to the original sender of the packet, unless the discarded 1557 packet is itself an ICMP message. The ICMP message, if sent, has 1558 a type of 3 (Destination Unreachable) and a code of 13 1559 (Communication Administratively Prohibited). 1561 In case the packet is not discarded in the previous processing 1562 steps (either because the NAT64 is not filtering or because the 1563 packet is compliant with the Address-dependent Filtering rule), 1564 then the NAT64 searches for a session table entry with an STE 1565 source IPv4 address equal to X, an STE ICMPv4 Identifier equal to 1566 I2 and a STE destination IPv4 address equal to Y. If no such entry 1567 is found, the NAT64 tries to create a new entry (if resources and 1568 policy permit) with the following information: 1570 * The STE source IPv4 address is set to X, 1572 * The STE ICMPv4 Identifier is set to I2, 1574 * The STE destination IPv4 address is set to Y, 1576 * The STE source IPv6 address is set to the IPv6 address of the 1577 corresponding BIB entry, 1579 * The STE ICMPv6 Identifier is set to the ICMPv6 Identifier of 1580 the corresponding BIB entry, and, 1582 * The STE destination IPv6 address is set to the IPv6 1583 representation of the IPv4 address of Y, generated using the 1584 algorithm described in Section 3.5.4. 1586 * The NAT64 sets (or resets) the timer in the session table entry 1587 to the maximum session lifetime. By default, the maximum 1588 session lifetime is ICMP_DEFAULT. The maximum lifetime value 1589 SHOULD be configurable. The packet is translated and forwarded 1590 as described in the following sections. 1592 3.5.4. Generation of the IPv6 Representations of IPv4 Addresses 1594 NAT64 supports multiple algorithms for the generation of the IPv6 1595 representation of an IPv4 address. The constraints imposed on the 1596 generation algorithms are the following: 1598 The algorithm MUST be reversible, i.e. it MUST be possible to 1599 derive the original IPv4 address from the IPv6 representation. 1601 The input for the algorithm MUST be limited to the IPv4 address, 1602 the IPv6 prefix (denoted Pref64::/n) used in the IPv6 1603 representations and optionally a set of stable parameters that are 1604 configured in the NAT64 (such as fixed string to be used as a 1605 suffix). 1607 If we note n the length of the prefix Pref64::/n, then n MUST 1608 the less or equal than 96. If a Pref64::/n is configured 1609 through any means in the NAT64 (such as manually configured, or 1610 other automatic mean not specified in this document), the 1611 default algorithm MUST use this prefix. If no prefix is 1612 available, the algorithm SHOULD use the Well-Known Prefix (64: 1613 FF9B::/96) defined in [I-D.ietf-behave-address-format] 1615 NAT64 MUST support the algorithm for generating IPv6 representations 1616 of IPv4 addresses defined in Section 2.1 of 1617 [I-D.ietf-behave-address-format]. The aforementioned algorithm 1618 SHOULD be used as default algorithm. 1620 3.6. Computing the Outgoing Tuple 1622 This step computes the outgoing tuple by translating the IP addresses 1623 and port numbers or ICMP Identifier in the incoming tuple. 1625 In the text below, a reference to a BIB means either the TCP BIB the 1626 UDP BIB or the ICMP Query BIB as appropriate. 1628 NOTE: Not all addresses are translated using the BIB. BIB entries 1629 are used to translate IPv6 source transport addresses to IPv4 1630 source transport addresses, and IPv4 destination transport 1631 addresses to IPv6 destination transport addresses. They are NOT 1632 used to translate IPv6 destination transport addresses to IPv4 1633 destination transport addresses, nor to translate IPv4 source 1634 transport addresses to IPv6 source transport addresses. The 1635 latter cases are handled applying the algorithmic transformation 1636 described in Section 3.5.4. This distinction is important; 1637 without it, hairpinning doesn't work correctly. 1639 3.6.1. Computing the Outgoing 5-tuple for TCP and UDP 1641 The transport protocol in the outgoing 5-tuple is always the same as 1642 that in the incoming 5-tuple. 1644 When translating in the IPv6 --> IPv4 direction, let the incoming 1645 source and destination transport addresses in the 5-tuple be (S',s) 1646 and (D',d) respectively. The outgoing source transport address is 1647 computed as follows: if the BIB contains a entry (S',s) <--> (T,t), 1648 then the outgoing source transport address is (T,t). 1650 The outgoing destination address is computed algorithmically from D' 1651 using the address transformation described in Section 3.5.4. 1653 When translating in the IPv4 --> IPv6 direction, let the incoming 1654 source and destination transport addresses in the 5-tuple be (S,s) 1655 and (D,d) respectively. The outgoing source transport address is 1656 computed as follows: 1658 The outgoing source transport address is generated from S using 1659 the address transformation algorithm described in Section 3.5.4. 1661 The BIB table is searched for an entry (X',x) <--> (D,d), and if 1662 one is found, the outgoing destination transport address is set to 1663 (X',x). 1665 3.6.2. Computing the Outgoing 3-tuple for ICMP Query Messages 1667 When translating in the IPv6 --> IPv4 direction, let the incoming 1668 source and destination addresses in the 3-tuple be S' and D' 1669 respectively and the ICMPv6 Identifier be I1. The outgoing source 1670 address is computed as follows: the BIB contains an entry (S',I1) 1671 <--> (T,I2), then the outgoing source address is T and the ICMPv4 1672 Identifier is I2. 1674 The outgoing IPv4 destination address is computed algorithmically 1675 from D' using the address transformation described in Section 3.5.4. 1677 When translating in the IPv4 --> IPv6 direction, let the incoming 1678 source and destination addresses in the 3-tuple be S and D 1679 respectively and the ICMPv4 Identifier is I2. The outgoing source 1680 address is generated from S using the address transformation 1681 algorithm described in Section 3.5.4. The BIB is searched for an 1682 entry containing (X',I1) <--> (D,I2) and if found the outgoing 1683 destination address is X' and the outgoing ICMPv6 Identifier is I1. 1685 3.7. Translating the Packet 1687 This step translates the packet from IPv6 to IPv4 or vice-versa. 1689 The translation of the packet is as specified in Section 3 and 1690 Section 4 of the IP/ICMP Translation Algorithm 1691 [I-D.ietf-behave-v6v4-xlate], with the following modifications: 1693 o When translating an IP header (Sections 3.1 and 4.1), the source 1694 and destination IP address fields are set to the source and 1695 destination IP addresses from the outgoing tuple as determined in 1696 Section 3.6. 1698 o When the protocol following the IP header is TCP or UDP, then the 1699 source and destination ports are modified to the source and 1700 destination ports from the outgoing 5-tuple. In addition, the TCP 1701 or UDP checksum must also be updated to reflect the translated 1702 addresses and ports; note that the TCP and UDP checksum covers the 1703 pseudo-header which contains the source and destination IP 1704 addresses. An algorithm for efficiently updating these checksums 1705 is described in [RFC3022]. 1707 o When the protocol following the IP header is ICMP and it is an 1708 ICMP Query message, the ICMP Identifier is set to the one from the 1709 outgoing 3-tuple as determined in Section 3.6.2. 1711 o When the protocol following the IP header is ICMP (Sections 3.4 1712 and 4.4) and it is an ICMP error message, the source and 1713 destination transport addresses in the embedded packet are set to 1714 the destination and source transport addresses from the outgoing 1715 5-tuple (note the swap of source and destination). 1717 The size of outgoing packets as well and the potential need for 1718 fragmentation is done according to the behavior defined in the IP/ 1719 ICMP Translation Algorithm [I-D.ietf-behave-v6v4-xlate] 1721 3.8. Handling Hairpinning 1723 If the destination IP address is an IPv4 address assigned to the 1724 NAT64 itself then the packet is a hairpin packet. Hairpin packets 1725 are processed as follows: 1727 o The outgoing 5-tuple becomes the incoming 5-tuple, and, 1729 o the packet is treated as if it was received on the outgoing 1730 interface. 1732 o Processing of the packet continues at step 2 - Filtering and 1733 updating binding and session information described in Section 3.5. 1735 4. Protocol Constants 1737 UDP_MIN 2 minutes (as defined in [RFC4787]) 1739 UDP_DEFAULT 5 minutes (as defined in [RFC4787]) 1741 TCP_TRANS 4 minutes (as defined in [RFC5382]) 1743 TCP_EST 2 hours (the minimum lifetime for an established TCP session 1744 defined in [RFC5382] is 2 hrs and 4 minutes, which is achieved adding 1745 the 2 hours with this timer and the 4 minutes with the TCP_TRANS 1746 timer) 1748 TCP_INCOMING_SYN 6 seconds (as defined in [RFC5382]) 1750 FRAGMENT_MIN 2 seconds 1752 ICMP_DEFAULT 60 seconds (as defined in [RFC5508]) 1754 5. Security Considerations 1756 5.1. Implications on end-to-end security 1758 Any protocols that protect IP header information is essentially 1759 incompatible with NAT64. This implies that end-to-end IPsec 1760 verification will fail when AH is used (both transport and tunnel 1761 mode) and when ESP is used in transport mode. This is inherent in 1762 any network-layer translation mechanism. End-to-end IPsec protection 1763 can be restored, using UDP encapsulation as described in [RFC3948]. 1764 The actual extensions to support IPsec are out of the scope of this 1765 document. 1767 5.2. Filtering 1769 NAT64 creates binding state using packets flowing from the IPv6 side 1770 to the IPv4 side. In accordance with the procedures defined in this 1771 document following the guidelines defined in [RFC4787] a NAT64 must 1772 offer "Endpoint-Independent Filtering". This means: 1774 for any IPv6 packet with source (S'1,s1) and destination (Pref64:: 1775 D1,d1) that creates an external mapping to (S1,s1), (D1,d1), 1776 for any subsequent external connection from S'1 to (D2,d2) within 1777 a given binding timer window, 1779 (S1,s1) = (S2,s2) for all values of D2,d2 1781 Implementations may also provide support for "Address-Dependent 1782 Mapping" as also defined in this document and following the 1783 guidelines defined in [RFC4787]. 1785 The security properties however are determined by which packets the 1786 NAT64 filter allows in and which it does not. The security 1787 properties are determined by the filtering behavior and filtering 1788 configuration in the filtering portions of the NAT64, not by the 1789 address mapping behavior. For example, 1791 Without filtering - When "Endpoint-Independent Filtering" is used 1792 in NAT64, once a binding is created in the IPv6 ---> IPv4 1793 direction, packets from any node on the IPv4 side destined to the 1794 IPv6 transport address will traverse the NAT64 gateway and be 1795 forwarded to the IPv6 transport address that created the binding. 1796 However, 1798 With filtering - When "Endpoint-Independent Filtering" is used in 1799 NAT64, once a binding is created in the IPv6 ---> IPv4 direction, 1800 packets from any node on the IPv4 side destined to the IPv6 1801 transport address will first be processed against the filtering 1802 rules. If the source IPv4 address is permitted, the packets will 1803 be forwarded to the IPv6 transport address. If the source IPv4 1804 address is explicitly denied -- or the default policy is to deny 1805 all addresses not explicitly permitted -- then the packet will be 1806 discarded. A dynamic filter may be employed where by the filter 1807 will only allow packets from the IPv4 address to which the 1808 original packet that created the binding was sent. This means 1809 that only the IPv4 addresses to which the IPv6 host has initiated 1810 connections will be able to reach the IPv6 transport address, and 1811 no others. This essentially narrows the effective operation of 1812 the NAT64 device to an "Address-Dependent Filtering" behavior, 1813 though not by its mapping behavior, but instead by its filtering 1814 behavior. 1816 As currently specified, the NAT64 only requires filtering traffic 1817 based on the 5-tuple. In some cases (e.g., statically configured 1818 mappings), this may make it easy for an attacker to guess. An 1819 attacker need not be able to guess other fields, e.g. the TCP 1820 sequence number, to get a packet through the NAT64. While such 1821 traffic might be dropped by the final destination, it does not 1822 provide additional mitigations against bandwidth/CPU attacks 1823 targeting the internal network. To avoid these type of abuse, some 1824 NAT64 MAY keep track the sequence number of TCP packets in order to 1825 verify that proper sequencing of exchanged segments, in particular, 1826 the SYNs and the FINs. 1828 5.3. Attacks on NAT64 1830 The NAT64 device itself is a potential victim of different types of 1831 attacks. In particular, the NAT64 can be a victim of DoS attacks. 1832 The NAT64 device has a limited number of resources that can be 1833 consumed by attackers creating a DoS attack. The NAT64 has a limited 1834 number of IPv4 addresses that it uses to create the bindings. Even 1835 though the NAT64 performs address and port translation, it is 1836 possible for an attacker to consume all the IPv4 transport addresses 1837 by sending IPv6 packets with different source IPv6 transport 1838 addresses. This attack can only be launched from the IPv6 side, 1839 since IPv4 packets are not used to create binding state. DoS attacks 1840 can also affect other limited resources available in the NAT64 such 1841 as memory or link capacity. For instance, it is possible for an 1842 attacker to launch a DoS attack on the memory of the NAT64 device by 1843 sending fragments that the NAT64 will store for a given period. If 1844 the number of fragments is high enough, the memory of the NAT64 could 1845 be exhausted. NAT64 devices MUST implement proper protection against 1846 such attacks, for instance allocating a limited amount of memory for 1847 fragmented packet storage as specified in Section 3.4. 1849 Another consideration related to NAT64 resource depletion refers to 1850 the preservation of binding state. Attackers may try to keep a 1851 binding state alive forever by sending periodic packets that refresh 1852 the state. In order to allow the NAT64 to defend against such 1853 attacks, the NAT64 MAY choose not to extend the session entry 1854 lifetime for a specific entry upon the reception of packets for that 1855 entry through the external interface. As described in the Framework 1856 document [I-D.ietf-behave-v6v4-framework], the NAT64 can be deployed 1857 in multiple scenarios, some of which the external side is the IPv6 1858 one and some of which the external side is the IPv4 one. It is then 1859 important to properly set which is the external side of the NAT64 in 1860 each specific configuration. 1862 5.4. Avoiding hairpinning loops 1864 If an IPv6-only client can guess the IPv4 binding address that will 1865 be created, it can use the IPv6 representation of it as source 1866 address for creating this binding. Then any packet sent to the 1867 binding's IPv4 address could loop in the NAT64. This is prevented in 1868 the current specification by filtering incoming packets containing 1869 Pref64::/n in the source address as described next. 1871 Consider the following example: 1873 Suppose that the IPv4 pool is 192.0.2.0/24 1875 Then the IPv6-only client sends this to NAT64: 1877 Source: [Pref64::192.0.2.1]:500 1879 Destination: whatever 1881 The NAT64 allocates 192.0.2.1:500 as IPv4 binding address. Now 1882 anything sent to 192.0.2.1:500, be it a hairpinned IPv6 packet or an 1883 IPv4 packet, could loop. 1885 It is not hard to guess the IPv4 address that will be allocated. 1886 First the attacker creates a binding and use e.g. STUN to learn its 1887 external IPv4 address. New bindings will always have this address. 1888 Then it uses a source port in the range 1-1023. This will increase 1889 the chances to 1/512 (since range and parity must be preserved in 1890 UDP). 1892 In order to address this vulnerability, the NAT64 MUST drop IPv6 1893 packets whose source address is in Pref64::/n as defined in 1894 Section 3.5. 1896 6. IANA Considerations 1898 This document contains no actions for IANA. 1900 7. Contributors 1902 George Tsirtsis 1904 Qualcomm 1906 tsirtsis@googlemail.com 1908 Greg Lebovitz 1910 Juniper 1912 gregory.ietf@gmail.com 1914 Simon Parreault 1916 Viagenie 1917 simon.perreault@viagenie.ca 1919 8. Acknowledgements 1921 Dave Thaler, Dan Wing, Alberto Garcia-Martinez, Reinaldo Penno, 1922 Ranjana Rao, Lars Eggert, Senthil Sivakumar, Zhen Cao, Xiangsong Cui, 1923 Mohamed Boucadair, Dong Zhang, Bryan Ford and Joao Damas reviewed the 1924 document and provided useful comments to improve it. 1926 The content of the draft was improved thanks to discussions with 1927 Christian Huitema, Fred Baker and Jari Arkko. 1929 Marcelo Bagnulo and Iljitsch van Beijnum are partly funded by 1930 Trilogy, a research project supported by the European Commission 1931 under its Seventh Framework Program. 1933 9. References 1935 9.1. Normative References 1937 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1938 Requirement Levels", BCP 14, RFC 2119, March 1997. 1940 [RFC1035] Mockapetris, P., "Domain names - implementation and 1941 specification", STD 13, RFC 1035, November 1987. 1943 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 1944 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 1945 RFC 4787, January 2007. 1947 [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. 1948 Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, 1949 RFC 5382, October 2008. 1951 [RFC5508] Srisuresh, P., Ford, B., Sivakumar, S., and S. Guha, "NAT 1952 Behavioral Requirements for ICMP", BCP 148, RFC 5508, 1953 April 2009. 1955 [I-D.ietf-behave-v6v4-xlate] 1956 Li, X., Bao, C., and F. Baker, "IP/ICMP Translation 1957 Algorithm", draft-ietf-behave-v6v4-xlate-05 (work in 1958 progress), December 2009. 1960 [I-D.ietf-behave-address-format] 1961 Huitema, C., Bao, C., Bagnulo, M., Boucadair, M., and X. 1962 Li, "IPv6 Addressing of IPv4/IPv6 Translators", 1963 draft-ietf-behave-address-format-04 (work in progress), 1964 January 2010. 1966 9.2. Informative References 1968 [I-D.ietf-behave-dns64] 1969 Bagnulo, M., Sullivan, A., Matthews, P., and I. Beijnum, 1970 "DNS64: DNS extensions for Network Address Translation 1971 from IPv6 Clients to IPv4 Servers", 1972 draft-ietf-behave-dns64-05 (work in progress), 1973 December 2009. 1975 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 1976 RFC 793, September 1981. 1978 [RFC2766] Tsirtsis, G. and P. Srisuresh, "Network Address 1979 Translation - Protocol Translation (NAT-PT)", RFC 2766, 1980 February 2000. 1982 [RFC1858] Ziemba, G., Reed, D., and P. Traina, "Security 1983 Considerations for IP Fragment Filtering", RFC 1858, 1984 October 1995. 1986 [RFC3128] Miller, I., "Protection Against a Variant of the Tiny 1987 Fragment Attack (RFC 1858)", RFC 3128, June 2001. 1989 [RFC3022] Srisuresh, P. and K. Egevang, "Traditional IP Network 1990 Address Translator (Traditional NAT)", RFC 3022, 1991 January 2001. 1993 [RFC4966] Aoun, C. and E. Davies, "Reasons to Move the Network 1994 Address Translator - Protocol Translator (NAT-PT) to 1995 Historic Status", RFC 4966, July 2007. 1997 [I-D.ietf-mmusic-ice] 1998 Rosenberg, J., "Interactive Connectivity Establishment 1999 (ICE): A Protocol for Network Address Translator (NAT) 2000 Traversal for Offer/Answer Protocols", 2001 draft-ietf-mmusic-ice-19 (work in progress), October 2007. 2003 [RFC4963] Heffner, J., Mathis, M., and B. Chandler, "IPv4 Reassembly 2004 Errors at High Data Rates", RFC 4963, July 2007. 2006 [I-D.ietf-behave-v6v4-framework] 2007 Baker, F., Li, X., Bao, C., and K. Yin, "Framework for 2008 IPv4/IPv6 Translation", 2009 draft-ietf-behave-v6v4-framework-04 (work in progress), 2010 December 2009. 2012 [I-D.penno-behave-64-analysis] 2013 Penno, R., Saxena, T., and D. Wing, "Analysis of 64 2014 Translation", draft-penno-behave-64-analysis-02 (work in 2015 progress), January 2010. 2017 [RFC3948] Huttunen, A., Swander, B., Volpe, V., DiBurro, L., and M. 2018 Stenberg, "UDP Encapsulation of IPsec ESP Packets", 2019 RFC 3948, January 2005. 2021 Authors' Addresses 2023 Marcelo Bagnulo 2024 UC3M 2025 Av. Universidad 30 2026 Leganes, Madrid 28911 2027 Spain 2029 Phone: +34-91-6249500 2030 Fax: 2031 Email: marcelo@it.uc3m.es 2032 URI: http://www.it.uc3m.es/marcelo 2034 Philip Matthews 2035 Alcatel-Lucent 2036 600 March Road 2037 Ottawa, Ontario 2038 Canada 2040 Phone: +1 613-592-4343 x224 2041 Fax: 2042 Email: philip_matthews@magma.ca 2043 URI: 2045 Iljitsch van Beijnum 2046 IMDEA Networks 2047 Avda. del Mar Mediterraneo, 22 2048 Leganes, Madrid 28918 2049 Spain 2051 Email: iljitsch@muada.com