Network Working Group | O. Troan, Ed. |
Internet-Draft | W. Dec |
Intended status: Standards Track | Cisco Systems |
Expires: February 13, 2014 | X. Li |
C. Bao | |
CERNET Center/Tsinghua University | |
S. Matsushima | |
SoftBank Telecom | |
T. Murakami | |
IP Infusion | |
T. Taylor, Ed. | |
Huawei Technologies | |
August 12, 2013 |
Mapping of Address and Port with Encapsulation (MAP)
draft-ietf-softwire-map-08
This document describes a mechanism for transporting IPv4 packets across an IPv6 network using IP encapsulation, and a generic mechanism for mapping between IPv6 addresses and IPv4 addresses and transport layer ports.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on February 13, 2014.
Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Mapping of IPv4 addresses in IPv6 addresses has been described in numerous mechanisms dating back to 1996 [RFC1933]. The Automatic tunneling mechanism described in RFC1933, assigned a globally unique IPv6 address to a host by combining the host's IPv4 address with a well-known IPv6 prefix. Given an IPv6 packet with a destination address with an embedded IPv4 address, a node could automatically tunnel this packet by extracting the IPv4 tunnel end-point address from the IPv6 destination address.
There are numerous variations of this idea, described in 6over4 [RFC2529], 6to4 [RFC3056], ISATAP [RFC5214], and 6rd [RFC5969].
The commonalities of all these IPv6 over IPv4 mechanisms are:
In phases of IPv4 to IPv6 migration, IPv6 only networks will be common, while there will still be a need for residual IPv4 deployment. This document describes a generic mapping of IPv4 to IPv6, and a mechanism for encapsulating IPv4 over IPv6.
Just as the IPv6 over IPv4 mechanisms referred to above, the residual IPv4 over IPv6 mechanism must be capable of:
The mapping scheme described here supports encapsulation of IPv4 packets in IPv6 in both mesh and hub and spoke topologies, including address mappings with full independence between IPv6 and IPv4 addresses.
This document describes delivery of IPv4 unicast service across an IPv6 infrastructure. IPv4 multicast is not considered further in this document.
The A+P (Address and Port) architecture of sharing an IPv4 address by distributing the port space is described in [RFC6346]. Specifically section 4 of [RFC6346] covers stateless mapping. The corresponding stateful solution DS-lite is described in [RFC6333]. The motivation for the work is described in [I-D.ietf-softwire-stateless-4v6-motivation].
A companion document defines a DHCPv6 option for provisioning of MAP [I-D.ietf-softwire-map-dhcp]. Other means of provisioning is possible. Deployment considerations are described in [I-D.ietf-softwire-map-deployment].
MAP relies on IPv6 and is designed to deliver production-quality dual-stack service while allowing IPv4 to be phased out within the SP network. The phasing out of IPv4 within the SP network is independent of whether the end user disables IPv4 service or not. Further, "Greenfield"; IPv6-only networks may use MAP in order to deliver IPv4 to sites via the IPv6 network.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
In accordance with the requirements stated above, the MAP mechanism can operate with shared IPv4 addresses, full IPv4 addresses or IPv4 prefixes. Operation with shared IPv4 addresses is described here, and the differences for full IPv4 addresses and prefixes are described below.
The MAP mechanism uses existing standard building blocks. The existing NAPT on the CE is used with additional support for restricting transport protocol ports, ICMP identifiers and fragment identifiers to the configured port set. For packets outbound from the private IPv4 network, the CE NAPT MUST translate transport identifiers (e.g. TCP and UDP port numbers) so that they fall within the CE's assigned port-range.
The NAPT MUST in turn be connected to a MAP aware forwarding function, that does encapsulation/ decapsulation of IPv4 packets in IPv6. MAP supports the encapsulation mode specified in [RFC2473]. In addition MAP specifies an algorithm to do "address resolution" from an IPv4 address and port to an IPv6 address. This algorithmic mapping is specified in Section 5.
The MAP architecture described here, restricts the use of the shared IPv4 address to only be used as the global address (outside) of the NAPT [RFC2663] running on the CE. A shared IPv4 address MUST NOT be used to identify an interface. While it is theoretically possible to make host stacks and applications port-aware, that is considered too drastic a change to the IP model [RFC6250].
For full IPv4 addresses and IPv4 prefixes, the architecture just described applies with two differences. First, a full IPv4 address or IPv4 prefix can be used as it is today, e.g., for identifying an interface or as a DHCP pool, respectively. Secondly, the NAPT is not required to restrict the ports used on outgoing packets.
This architecture is illustrated in Figure 1.
User N Private IPv4 | Network | O--+---------------O | | MAP CE | | +-----+--------+ | | NAPT44| MAP | | | +-----+ | | |\ ,-------. .------. | +--------+ | \ ,-' `-. ,-' `-. O------------------O / \ O---------O / Public \ / IPv6 only \ | MAP | / IPv4 \ ( Network --+ Border +- Network ) \ (MAP Domain) / | Relay | \ / O------------------O \ / O---------O \ / | MAP CE | /". ,-' `-. ,-' | +-----+--------+ | / `----+--' ------' | NAPT44| MAP | |/ | +-----+ | | | | +--------+ | O---.--------------O | User M Private IPv4 Network
Figure 1: Network Topology
The MAP BR is responsible for connecting external IPv4 networks to the IPv4 nodes in one or more MAP domains.
A MAP node is provisioned with one or more mapping rules.
Mapping rules are used differently depending on their function. Every MAP node must be provisioned with a Basic mapping rule. This is used by the node to configure its IPv4 address, IPv4 prefix or shared IPv4 address. This same basic rule can also be used for forwarding, where an IPv4 destination address and optionally a destination port is mapped into an IPv6 address. Additional mapping rules are specified to allow for multiple different IPv4 sub-nets to exist within the domain and optimize forwarding between them.
Traffic outside of the domain (i.e. When the destination IPv4 address does not match (using longest matching prefix) any Rule IPv4 prefix in the Rules database) is forwarded to the BR.
There are two types of mapping rules:
Both mapping rules share the same parameters:
A MAP node finds its Basic Mapping Rule by doing a longest match between the End-user IPv6 prefix and the Rule IPv6 prefix in the Mapping Rules table. The rule is then used for IPv4 prefix, address or shared address assignment.
A MAP IPv6 address is formed from the BMR Rule IPv6 prefix. This address MUST be assigned to an interface of the MAP node and is used to terminate all MAP traffic being sent or received to the node.
Port-aware IPv4 entries in the Rules table are installed for all the Forwarding Mapping Rules and an default route to the MAP BR (see section Section 5.4.
Forwarding rules are used to allow direct communication between MAP CEs, known as mesh mode. In hub and spoke mode, there are no forwarding rules, all traffic MUST be forwarded directly to the BR.
The port mapping algorithm is used in domains whose rules allow IPv4 address sharing.
The simplest way to represent a port range is using a notation similar to CIDR [RFC4632]. For example the first 256 ports are represented as port prefix 0.0/8. The last 256 ports as 255.0/8. In hexadecimal, 0x0000/8 (PSID = 0) and 0xFF00/8 (PSID = 0xFF). Using this technique, but wishing to avoid allocating the system ports [I-D.ietf-tsvwg-iana-ports] to the user, one would have to exclude the use of one or more PSIDs (e.g., PSIDs 0 to 3 in the example just given).
When the PSID is embedded in the End-user IPv6 prefix, then to minimise dependencies between the End-user IPv6 prefix and the assigned port set, it is desirable to minimize the restrictions of possible PSID values. This is achieved by using an infix representation of the port value. Using such a representation, the well-known ports are excluded by restrictions on the value of the high-order bitfield (A) rather than the PSID.
The infix algorithm allocates ports to a given CE as a series of contiguous ranges spaced at regular intervals throughout the complete range of possible port set values.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 +-----------+-----------+-------+ Ports in | A | PSID | M | the CE port set | > 0 | | | +-----------+-----------+-------+ | a bits | k bits |m bits |
Figure 2: Structure of a port-restricted port field
The Basic Mapping Rule is mandatory, used by the CE to provision itself with an IPv4 prefix, IPv4 address or shared IPv4 address. Recall from Section 5 that the BMR consists of the following parameters:
Figure 3 shows the structure of the complete MAP IPv6 address as specified in this document.
| n bits | o bits | s bits | 128-n-o-s bits | +--------------------+-----------+---------+-----------------------+ | Rule IPv6 prefix | EA bits |subnet ID| interface ID | +--------------------+-----------+---------+-----------------------+ |<--- End-user IPv6 prefix --->|
Figure 3: MAP IPv6 Address Format
The Rule IPv6 prefix is the part of the End-user IPv6 prefix that is common among all CEs using the same Basic Mapping Rule within the MAP domain. The EA bits encode the CE specific IPv4 address and port information. The EA bits, which are unique for a given Rule IPv6 prefix, can contain a full or part of an IPv4 address and, in the shared IPv4 address case, a Port-Set Identifier (PSID). An EA-bit length of 0 signifies that all relevant MAP IPv4 addressing information is passed directly in the BMR, and not derived from the End-user IPv6 prefix.
The MAP IPv6 address is created by concatenating the End-user IPv6 prefix with the MAP subnet identifier (if the End-user IPv6 prefix is shorter than 64 bits) and the interface identifier as specified in Section 6.
The MAP subnet identifier is defined to be the first subnet (all bits set to zero).
Define:
The length r MAY be zero, in which case the complete IPv4 address or prefix is encoded in the EA bits. If only a part of the IPv4 address/prefix is encoded in the EA bits, the Rule IPv4 prefix is provisioned to the CE by other means (e.g. a DHCPv6 option). To create a complete IPv4 address (or prefix), the IPv4 address suffix (p) from the EA bits, is concatenated with the Rule IPv4 prefix (r bits).
The offset of the EA bits field in the IPv6 address is equal to the BMR Rule IPv6 prefix length. The length of the EA bits field (o) is given by the BMR Rule EA-bits length, and can be between 0 and 48. A length of 48 means that the complete IPv4 address and port is embedded in the End-user IPv6 prefix (a single port is assigned). A length of 0 means that no part of the IPv4 address or port is embedded in the address. The sum of the Rule IPv6 Prefix length and the Rule EA-bits length MUST be less or equal than the End-user IPv6 prefix length.
If o + r < 32 (length of the IPv4 address in bits), then an IPv4 prefix is assigned. This case is shown in Figure 4.
IPv4 prefix:
| r bits | p bits | +-------------+---------------------+ | Rule IPv4 | IPv4 Address suffix | +-------------+---------------------+ | < 32 bits |
Figure 4: IPv4 prefix
If o + r is equal to 32, then a full IPv4 address is to be assigned. The address is created by concatenating the Rule IPv4 prefix and the EA-bits. This case is shown in Figure 5.
Complete IPv4 address:
| r bits | p bits | +-------------+---------------------+ | Rule IPv4 | IPv4 Address suffix | +-------------+---------------------+ | 32 bits |
Figure 5: Complete IPv4 address
If o + r is > 32, then a shared IPv4 address is to be assigned. The number of IPv4 address suffix bits (p) in the EA bits is given by 32 - r bits. The PSID bits are used to create a port-set. The length of the PSID bit field within EA bits is: q = o - p.
Shared IPv4 address:
| r bits | p bits | | q bits | +-------------+---------------------+ +------------+ | Rule IPv4 | IPv4 Address suffix | |Port-Set ID | +-------------+---------------------+ +------------+ | 32 bits |
Figure 6: Shared IPv4 address
The length of r MAY be 32, with no part of the IPv4 address embedded in the EA bits. This results in a mapping with no dependence between the IPv4 address and the IPv6 address. In addition the length of o MAY be zero (no EA bits embedded in the End-User IPv6 prefix), meaning that also the PSID is provisioned using e.g. the DHCP option.
See Appendix A for an example of the Basic Mapping Rule.
The Forwarding Mapping Rule is optional, and used in mesh mode to enable direct CE to CE connectivity.
On adding an FMR rule, an IPv4 route is installed in the Rules table for the Rule IPv4 prefix.
On forwarding an IPv4 packet, a best matching prefix look up is done in the Rules table and the correct FMR is chosen.
| 32 bits | | 16 bits | +--------------------------+ +-------------------+ | IPv4 destination address | | IPv4 dest port | +--------------------------+ +-------------------+ : : ___/ : | p bits | / q bits : +----------+ +------------+ |IPv4 sufx| |Port-Set ID | +----------+ +------------+ \ / ____/ ________/ \ : __/ _____/ \ : / / | n bits | o bits | s bits | 128-n-o-s bits | +--------------------+-----------+---------+------------+----------+ | Rule IPv6 prefix | EA bits |subnet ID| interface ID | +--------------------+-----------+---------+-----------------------+ |<--- End-user IPv6 prefix --->|
Figure 7: Deriving of MAP IPv6 address
See Appendix A for an example of the Forwarding Mapping Rule.
IPv4 traffic between MAP nodes that are all within one MAP domain is encapsulated in IPv6, with the senders MAP IPv6 address as the IPv6 source address and the receiving MAP node's MAP IPv6 address as the IPv6 destination address. To reach IPv4 destinations outside of the MAP domain, traffic is also encapsulated in IPv6, but the destination IPv6 address is set to the configured IPv6 address of the MAP BR.
On the CE, the path to the BR can be represented as a point to point IPv4 over IPv6 tunnel [RFC2473] with the source address of the tunnel being the CE's MAP IPv6 address and the BR IPv6 address as the remote tunnel address. When MAP is enabled, a typical CE router will install a default route to the BR.
The BR forwards traffic received from the outside to CE's using the normal MAP forwarding rules.
The Interface identifier format of a MAP node is described below.
| 128-n-o-s bits | | 16 bits| 32 bits | 16 bits| +--------+----------------+--------+ | 0 | IPv4 address | PSID | +--------+----+-----------+--------+
Figure 8
In the case of an IPv4 prefix, the IPv4 address field is right-padded with zeroes up to 32 bits. The PSID field is left-padded to create a 16 bit field. For an IPv4 prefix or a complete IPv4 address, the PSID field is zero.
If the End-user IPv6 prefix length is larger than 64, the most significant parts of the interface identifier is overwritten by the prefix.
For a given MAP domain, the BR and CE MUST be configured with the following MAP elements. The configured values for these elements are identical for all CEs and BRs within a given MAP domain.
In addition the MAP CE MUST be configured with the IPv6 address(es) of the MAP BR (Section 5.4).
The MAP elements are set to values that are the same across all CEs within a MAP domain. The values may be configured in a variety of manners, including provisioning methods such as the Broadband Forum's "TR-69" Residential Gateway management interface, an XML-based object retrieved after IPv6 connectivity is established, or manual configuration by an administrator. This document focuses on how to configure the necessary parameters via IPv6 DHCP. A CE that allows IPv6 configuration by DHCP SHOULD implement this option. Other configuration and management methods may use the format described by this option for consistency and convenience of implementation on CEs that support multiple configuration methods.
The only remaining provisioning information the CE requires in order to calculate the MAP IPv4 address and enable IPv4 connectivity is the IPv6 prefix for the CE. The End-user IPv6 prefix is configured as part of obtaining IPv6 Internet access.
The MAP provisioning parameters, and hence the IPv4 service itself, is tied to the End-user IPv6 prefix lease; thus, the MAP service is also tied to this in terms of authorization, accounting, etc. The MAP IPv4 address, prefix or shared IPv4 address and port set has the same lifetime as its associated End-user IPv6 prefix.
A single MAP CE MAY be connected to more than one MAP domain, just as any router may have more than one IPv4-enabled service provider facing interface and more than one set of associated addresses assigned by DHCP. Each domain a given CE operates within would require its own set of MAP configuration elements and would generate its own IPv4 address.
The MAP DHCP option is specified in [I-D.ietf-softwire-map-dhcp].
The MAP BR MUST be configured with the same MAP elements as the MAP CEs operating within the same domain.
For increased reliability and load balancing, the BR IPv6 address MAY be an anycast address shared across a given MAP domain. As MAP is stateless, any BR may be used at any time. If the BR IPv6 address is anycast the relay MUST use this anycast IPv6 address as the source address in packets relayed to CEs.
Since MAP uses provider address space, no specific routes need to be advertised externally for MAP to operate, neither in IPv6 nor IPv4 BGP. However, if anycast is used for the MAP IPv6 relays, the anycast addresses must be advertised in the service provider's IGP.
A MAP-E CE provisioned with only the IPv6 address of the BR, and with no IPv4 address and port range configured by other means, MUST disable its NAT44 functionality. This characteristic makes a MAP CE compatible with DS-Lite [RFC6333] AFTRs, whose addresses are configured as the MAP BR.
Figure 1 depicts the overall MAP architecture with IPv4 users (N and M) networks connected to a routed IPv6 network.
MAP supports Encapsulation mode as specified in [RFC2473].
For a shared IPv4 address, a MAP CE forwarding IPv4 packets from the LAN performs NAT44 functions first and creates appropriate NAT44 bindings. The resulting IPv4 packets MUST contain the source IPv4 address and source transport identifiers defined by MAP. The IPv4 packet is forwarded using the CE's MAP forwarding function. The IPv6 source and destination addresses MUST then be derived as per Section 5 of this draft.
A MAP CE receiving an IPv6 packet to its MAP IPv6 address sends this packet to the CE's MAP function where it is decapsulated. All other IPv6 traffic is forwarded as per the CE's IPv6 routing rules. The resulting IPv4 packet is then forwarded to the CE’s NAT44 function where the destination port number MUST be checked against the stateful port mapping session table and the destination port number MUST be mapped to its original value.
A MAP BR receiving IPv6 packets selects a best matching MAP domain rule based on a longest address match of the packets' source address against the BR's configured MAP BMR prefix(es), as well as a match of the packet destination address against the configured BR IPv6 address or FMR prefix(es). The selected MAP rule allows the BR to determine the EA-bits from the source IPv6 address. The BR MUST perform a validation of the consistency of the source IPv6 address and source port number for the packet using BMR. If the packets source port number is found to be outside the range allowed for this CE and the BMR, the BR MUST drop the packet and respond with an ICMPv6 "Destination Unreachable, Source address failed ingress/egress policy" (Type 1, Code 5).
In order to prevent spoofing of IPv4 addresses, the MAP node MUST validate the embedded IPv4 source address and transport layer port of the encapsulated IPv6 packet with the IPv4 source address and transport layer port it is encapsulated by according to the parameters of the matching mapping rule. If the two source addresses and transport layer ports do not match, the packet MUST be silently discarded and a counter incremented to indicate that a potential spoofing attack may be underway. Additionally, a CE MUST allow forwarding of packets sourced by the configured BR IPv6 address.
By default, the CE router MUST drop packets received on the MAP virtual interface (i.e., after decapsulation of IPv6) for IPv4 destinations not for its own IPv4 shared address, full IPv4 address or IPv4 prefix.
ICMP message should be supported in MAP domain. Hence, the NAT44 in MAP CE must implement the behavior for ICMP message conforming to the best current practice documented in [RFC5508].
If a MAP CE receives an ICMP message having ICMP identifier field in ICMP header, NAT44 in the MAP CE must rewrite this field to a specific value assigned from the port-set. BR and other CEs must handle this field similar to the port number in the TCP/UDP header upon receiving the ICMP message with ICMP identifier field.
If a MAP node receives an ICMP error message without the ICMP identifier field for errors that is detected inside a IPv6 tunnel, a node should relay the ICMP error message to the original source. This behavior should be implemented conforming to the section 8 of [RFC2473].
Due to the different sizes of the IPv4 and IPv6 header, handling the maximum packet size is relevant for the operation of any system connecting the two address families. There are three mechanisms to handle this issue: Path MTU discovery (PMTUD), fragmentation, and transport-layer negotiation such as the TCP Maximum Segment Size (MSS) option [RFC0897]. MAP uses all three mechanisms to deal with different cases.
Encapsulating an IPv4 packet to carry it across the MAP domain will increase its size (40 bytes). It is strongly recommended that the MTU in the MAP domain is well managed and that the IPv6 MTU on the CE WAN side interface is set so that no fragmentation occurs within the boundary of the MAP domain.
Fragmentation on MAP domain entry is described in section 7.2 of [RFC2473]
The use of an anycast source address could lead to any ICMP error message generated on the path being sent to a different BR. Therefore, using dynamic tunnel MTU Section 6.7 of [RFC2473] is subject to IPv6 Path MTU black-holes. A MAP BR SHOULD NOT by default use Path MTU discovery across the MAP domain.
Multiple BRs using the same anycast source address could send fragmented packets to the same CE at the same time. If the fragmented packets from different BRs happen to use the same fragment ID, incorrect reassembly might occur. See [RFC4459] for an analysis of the problem. Section 3.4 suggests solving the problem by fragmenting the inner packet.
Forwarding of an IPv4 packet received from the outside of the MAP domain requires the IPv4 destination address and the transport protocol destination port. The transport protocol information is only available in the first fragment received. As described in section 5.3.3 of [RFC6346] a MAP node receiving an IPv4 fragmented packet from outside has to reassemble the packet before sending the packet onto the MAP link. If the first packet received contains the transport protocol information, it is possible to optimize this behavior by using a cache and forwarding the fragments unchanged. A description of this algorithm is outside the scope of this document.
If two IPv4 host behind two different MAP CE's with the same IPv4 address sends fragments to an IPv4 destination host outside the domain. Those hosts may use the same IPv4 fragmentation identifier, resulting in incorrect reassembly of the fragments at the destination host. Given that the IPv4 fragmentation identifier is a 16 bit field, it could be used similarly to port ranges. A MAP CE SHOULD rewrite the IPv4 fragmentation identifier to be within its allocated port set.
The NAT44 implemented in the MAP CE SHOULD conform with the behavior and best current practice documented in [RFC4787], [RFC5508], and [RFC5382]. In MAP address sharing mode (determined by the MAP domain/rule configuration parameters) the operation of the NAT44 MUST be restricted to the available port numbers derived via the basic mapping rule.
This specification does not require any IANA actions.
[RFC6269] outlines general issues with IPv4 address sharing.
This document is the result of the IETF Softwire MAP design team effort and numerous previous individual contributions in this area:
Chongfeng Xie (China Telecom) Room 708, No.118, Xizhimennei Street Beijing 100035 CN Phone: +86-10-58552116 Email: xiechf@ctbri.com.cn
Qiong Sun (China Telecom) Room 708, No.118, Xizhimennei Street Beijing 100035 CN Phone: +86-10-58552936 Email: sunqiong@ctbri.com.cn
Gang Chen (China Mobile) 53A,Xibianmennei Ave. Beijing 100053 P.R.China Email: chengang@chinamobile.com
Yu Zhai CERNET Center/Tsinghua University Room 225, Main Building, Tsinghua University Beijing 100084 CN Email: jacky.zhai@gmail.com
Wentao Shang (CERNET Center/Tsinghua University) Room 225, Main Building, Tsinghua University Beijing 100084 CN Email: wentaoshang@gmail.com
Guoliang Han (CERNET Center/Tsinghua University) Room 225, Main Building, Tsinghua University Beijing 100084 CN Email: bupthgl@gmail.com
Rajiv Asati (Cisco Systems) 7025-6 Kit Creek Road Research Triangle Park NC 27709 USA Email: rajiva@cisco.com
This document is based on the ideas of many, including Masakazu Asama, Mohamed Boucadair, Gang Chen, Maoke Chen, Wojciech Dec, Xiaohong Deng, Jouni Korhonen, Tomasz Mrugalski, Jacni Qin, Chunfa Sun, Qiong Sun, and Leaf Yeh. The authors want in particular to recognize Remi Despres, who has tirelessly worked on generalized mechanisms for stateless address mapping.
The authors would like to thank Guillaume Gottard, Dan Wing, Jan Zorz, Necj Scoberne, Tina Tsou, Kristian Poscic, and especially Tom Taylor for the thorough review and comments of this document.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. |
[RFC2473] | Conta, A. and S. Deering, "Generic Packet Tunneling in IPv6 Specification", RFC 2473, December 1998. |
[I-D.ietf-softwire-map-dhcp] | Mrugalski, T., Troan, O., Dec, W., Bao, C., leaf.yeh.sdo@gmail.com, l. and X. Deng, "DHCPv6 Options for Mapping of Address and Port", Internet-Draft draft-ietf-softwire-map-dhcp-03, February 2013. |
Example 1 - Basic Mapping Rule
Given the MAP domain information and an IPv6 address of an endpoint: End-user IPv6 prefix: 2001:db8:0012:3400::/56 Basic Mapping Rule: {2001:db8:0000::/40 (Rule IPv6 prefix), 192.0.2.0/24 (Rule IPv4 prefix), 16 (Rule EA-bits length)} PSID length: (16 - (32 - 24) = 8. (Sharing ratio of 256) PSID offset: 6 (default) A MAP node (CE or BR) can via the BMR, or equivalent FMR, determine the IPv4 address and port-set as shown below: EA bits offset: 40 IPv4 suffix bits (p) Length of IPv4 address (32) - IPv4 prefix length (24) = 8 IPv4 address: 192.0.2.18 (0xc0000212) PSID start: 40 + p = 40 + 8 = 48 PSID length: o - p = (56 - 40) - 8 = 8 PSID: 0x34 Available ports (63 ranges) : 1232-1235, 2256-2259, ...... , 63696-63699, 64720-64723 The BMR information allows a MAP CE to determine (complete) its IPv6 address within the indicated IPv6 prefix. IPv6 address of MAP CE: 2001:db8:0012:3400:0000:c000:0212:0034
Example 2 - BR:
Another example can be made of a MAP BR, configured with the following FMR when receiving a packet with the following characteristics: IPv4 source address: 1.2.3.4 (0x01020304) IPv4 source port: 80 IPv4 destination address: 192.0.2.18 (0xc0000212) IPv4 destination port: 1232 Configured Forwarding Mapping Rule: {2001:db8::/40 (Rule IPv6 prefix), 192.0.2.0/24 (Rule IPv4 prefix), 16 (Rule EA-bits length)} IPv6 address of MAP BR: 2001:db8:ffff::1 The above information allows the BR to derive as follows the mapped destination IPv6 address for the corresponding MAP CE, and also the mapped source IPv6 address for the IPv4 source address. IPv4 suffix bits (p): 32 - 24 = 8 (18 (0x12)) PSID length: 8 PSID: 0x34 (1232) The resulting IPv6 packet will have the following key fields: IPv6 source address: 2001:db8:ffff::1 IPv6 destination address: 2001:db8:0012:3400:0000:c000:0212:0034
Example 3 - FMR:
An IPv4 host behind the MAP CE (addressed as per the previous examples) corresponding with IPv4 host 1.2.3.4 will have its packets encapsulated by IPv6 using the IPv6 address of the BR configured on the MAP CE as follows: IPv6 address of BR used by MAP CE: 2001:db8:ffff::1 IPv4 source address: 192.0.2.18 IPv4 destination address: 1.2.3.4 IPv4 source port: 1232 IPv4 destination port: 80 IPv6 source address of MAP CE: 2001:db8:0012:3400:0000:c000:0212:0034 IPv6 destination address: 2001:db8:ffff::1
Example 4 - Rule with no embedded address bits and no address sharing
End-User IPv6 prefix: 2001:db8:0012:3400::/56 Basic Mapping Rule: {2001:db8:0012:3400::/56 (Rule IPv6 prefix), 192.0.2.1/32 (Rule IPv4 prefix), 0 (Rule EA-bits length)} PSID length: 0 (Sharing ratio is 1) PSID offset: n/a A MAP node (CE or BR) can via the BMR or equivalent FMR, determine the IPv4 address and port-set as shown below: EA bits offset: 0 IPv4 suffix bits (p): Length of IPv4 address (32) - IPv4 prefix length (32) = 0 IPv4 address: 192.0.2.1 (0xc0000201) PSID start: 0 PSID length: 0 PSID: null The BMR information allows a MAP CE also to determine (complete) its full IPv6 address by combining the IPv6 prefix with the MAP interface identifier (that embeds the IPv4 address). IPv6 address of MAP CE: 2001:db8:0012:3400:0000:c000:0201:0000
Example 5 - Rule with no embedded address bits and address sharing (sharing ratio 256)
End-User IPv6 prefix: 2001:db8:0012:3400::/56 Basic Mapping Rule: {2001:db8:0012:3400::/56 (Rule IPv6 prefix), 192.0.2.1/32 (Rule IPv4 prefix), 0 (Rule EA-bits length)} PSID length: 8. (Provisioned with DHCP. Sharing ratio of 256) PSID offset: 6 (Default) PSID : 0x20 (Provisioned with DHCP.) A MAP node can via the BMR determine the IPv4 address and port-set as shown below: EA bits offset: 0 IPv4 suffix bits (p): Length of IPv4 address (32) - IPv4 prefix length (32) = 0 IPv4 address: 192.0.2.1 (0xc0000201) PSID offset: 6 PSID length: 8 PSID: 0x20 Available ports (63 ranges) : 1536-1551, 2560-2575, ...... , 64000-64015, 65024-65039 The BMR information allows a MAP CE also to determine (complete) its full IPv6 address by combining the IPv6 prefix with the MAP interface identifier (that embeds the IPv4 address and PSID). IPv6 address of MAP CE: 2001:db8:0012:3400:0000:c000:0212:0034 Note that the IPv4 address and PSID is not derived from the IPv6 prefix assigned to the CE, but provisioned separately using e.g. DHCP.
This Appendix describes how the port mapping algorithm described in Section 5.1 was derived. The algorithm is used in domains whose rules allow IPv4 address sharing.
The basic requirement for a port mapping algorithm is that the port sets it assigns to different MAP CEs MUST be non-overlapping. A number of other requirements guided the choice of the algorithm:
The two extreme cases that an algorithm satisfying those conditions might support are: (1) the port numbers are not contiguous for each PSID, but uniformly distributed across the allowed port range; (2) the port numbers are contiguous in a single range for each PSID. The port mapping algorithm proposed here is called the Generalized Modulus Algorithm (GMA) and supports both these cases.
(1) ... P = (R * M) * i + M * PSID + j
(2) ... PSID = trunc((P modulo (R * M)) / M)
For a given IPv4 address sharing ratio (R) and the maximum number of contiguous ports (M) in a port set, the GMA is defined as:
Formula (1) can be interpreted as follows. First, the available port space is divided into blocks of size R * M. Each block is divided into R individual ranges of length M. The index i in formula (1) selects a block, PSID selects a range within that block, and the index j selects a specific port value within the range. On the basis of this interpretation:
If R and M are powers of 2 (R = 2^k, M = 2^m), formula (1) translates to a computationally convenient structure for any port number represented as a 16-bit binary number. This structure is shown in Figure 9.
0 8 15 +---------------+----------+------+-------------------+ | P | ----------------+-----------------+-------------------+ | i | PSID | j | +---------------+----------+------+-------------------+ |<----a bits--->|<-----k bits---->|<------m bits----->|
Figure 9: Bit Representation of a Port Number
As shown in the figure, the index value i of formula (1) is given by the first a = 16 - k - m bits of the port number. The PSID value is given by the next k bits, and the index value j is given by the last m bits.
For any port number, the PSID can be obtained by a bit mask operation.
Note that when M and R are powers of 2, 65536 divides evenly by R * M. Hence the final block is complete and the upper bound on i is exactly 65536/(R * M) - 1. The lower bound on i is still the minimum required to ensure that the required set of ports is excluded. No port numbers are wasted through discarding of blocks at the lower end if block size R * M is a factor of N, the number of ports to be excluded.
As a final note, the number of blocks into which the range 0-65535 is being divided in the above representation is given by 2^a. Hence the case where a = 0 can be interpreted as one where the complete range has been divided into a single block, and individual port sets are contained in contiguous ranges in that block. We cannot throw away the whole block in that case, so port exclusion has to be achieved by putting a lower bound equal to ceil(N / M) on the allowed set of PSID values instead.
For example, for R = 256, PSID = 0, offset: a = 6 and PSID length: k = 8 bits
Available ports (63 ranges) : 1024-1027, 2048-2051, ...... , 63488-63491, 64512-64515
Example 1: with offset = 6 (a = 6)
For example, for R = 64, PSID = 0, a = 0 (PSID offset = 0 and PSID length = 6 bits), no port exclusion:
Available ports (1 range) : 0-1023
Example 2: with offset = 0 (a = 0) and N = 0