RFC 7597
Mapping of Address and Port with Encapsulation (MAP-E)
RFC 7597: Mapping of Address and Port with Encapsulation (MAP-E) π
okay bestie, here's the title block. It's RFC 7597 π¦
- Title: Mapping of Address and Port with Encapsulation (MAP-E)
- Authors: O. Troan (Ed.) and W. Dec from Cisco Systems, X. Li and C. Bao from Tsinghua University, S. Matsushima from SoftBank Telecom, T. Murakami from IP Infusion, and T. Taylor (Ed.) from Huawei Technologies π
- Category: Standards Track
- ISSN: 2070-1721
- Date: July 2015
- Obsoletes / Updates: nothing is listed in the title block, so this RFC doesn't say it obsoletes or updates any other documents β¨
Abstract π
so this doc is about a way to carry IPv4 packets across an IPv6 network by wrapping them up in IP encapsulation π It also describes a general-purpose way to map between IPv6 addresses and IPv4 addresses, plus transport-layer ports. It's giving full-coverage mapping energy π
Status of This Memo π
This is an Internet Standards Track document π₯
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). If you want more on Internet Standards, check out Section 2 of RFC 5741 π
Info about the current status of this document, any errata, and how to give feedback on it can be found at http://www.rfc-editor.org/info/rfc7597 π§
Copyright Notice πΈ
Copyright (c) 2015 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) as they stand on the date this document was published. Please read these carefully, because they spell out your rights and restrictions for this document. Any Code Components pulled out of this document must include the Simplified BSD License text described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as described in the Simplified BSD License π«Ά
Table of Contents ποΈ
1. Introduction ....................................................4
2. Conventions .....................................................5
3. Terminology .....................................................5
4. Architecture ....................................................7
5. Mapping Algorithm ...............................................8
5.1. Port-Mapping Algorithm ....................................10
5.2. Basic Mapping Rule (BMR) ..................................11
5.3. Forwarding Mapping Rule (FMR) .............................14
5.4. Destinations outside the MAP Domain .......................14
6. The IPv6 Interface Identifier ..................................15
7. MAP Configuration ..............................................15
7.1. MAP CE ....................................................15
7.2. MAP BR ....................................................16
8. Forwarding Considerations ......................................17
8.1. Receiving Rules ...........................................17
8.2. ICMP ......................................................18
8.3. Fragmentation and Path MTU Discovery ......................18
8.3.1. Fragmentation in the MAP Domain ....................18
8.3.2. Receiving IPv4 Fragments on the MAP Domain
Borders ............................................19
8.3.3. Sending IPv4 Fragments to the Outside ..............19
9. NAT44 Considerations ...........................................19
10. Security Considerations .......................................20
11. References ....................................................21
11.1. Normative References .....................................21
11.2. Informative References ...................................21
Appendix A. Examples ..............................................25
Appendix B. A More Detailed Description of the Derivation of the
Port-Mapping Algorithm ................................29
B.1. Bit Representation of the Algorithm ........................31
B.2. GMA Examples ...............................................32
Acknowledgements ..................................................32
Contributors ......................................................33
Authors' Addresses ................................................34
1. Introduction β¨
okay so mapping IPv4 addresses into IPv6 addresses is NOT a new idea π People have been doing it since the mid-1990s [RFC1933] [RFC4213]. The "automatic tunneling" mechanism from [RFC1933] gave a host a globally unique IPv6 address by combining the host's IPv4 address with a well-known IPv6 prefix. So if a node got an IPv6 packet with an embedded IPv4 address in the destination, it could automatically tunnel that packet by pulling the IPv4 tunnel endpoint address out of the IPv6 destination address. Iconic behavior π¦
There are a bunch of variations on this, like 6over4 [RFC2529], 6to4 [RFC3056], the Intra-Site Automatic Tunnel Addressing Protocol (ISATAP) [RFC5214], and IPv6 Rapid Deployment on IPv4 Infrastructures (6rd) [RFC5969] πΈ
All of these IPv6-over-IPv4 mechanisms have the same main traits:
- Automatic provisioning of an IPv6 address for a host, or an IPv6 prefix for a site.
- Algorithmic or implicit address resolution of tunnel endpoint addresses. Given an IPv6 destination address, an IPv4 tunnel endpoint address can be calculated.
- Embedding of an IPv4 address, or part of one, into an IPv6 address.
In later phases of the IPv4-to-IPv6 migration, IPv6-only networks are expected to be common, but there will still be a need for some residual IPv4 deployment π This document describes a generic mapping of IPv4 to IPv6, plus a mechanism for encapsulating IPv4 over IPv6.
Just like the IPv6-over-IPv4 mechanisms above, the residual IPv4-over-IPv6 mechanism must be capable of:
- Provisioning an IPv4 prefix, an IPv4 address, or a shared IPv4 address.
- Algorithmically mapping between an IPv4 prefix, an IPv4 address, or a shared IPv4 address and an IPv6 address.
The mapping scheme here supports encapsulating 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 covers delivery of IPv4 unicast service across an IPv6 infrastructure. IPv4 multicast is NOT considered in this document π
The Address plus Port (A+P) architecture, which shares an IPv4 address by splitting up the port space, is described in [RFC6346]. Specifically, Section 4 of [RFC6346] covers stateless mapping. The stateful version is Dual-Stack Lite (DS-Lite), described in [RFC6333]. The motivations for all of this work are described in [Solutions-4v6] π
[RFC7598] defines DHCPv6 options for provisioning MAP. Other ways of provisioning are possible too. Deployment considerations are described in [MAP-Deploy] π§
MAP relies on IPv6 and is designed to deliver dual-stack service while letting IPv4 be phased out within the service provider's (SP's) network. Phasing out IPv4 inside the SP network is independent of whether the end user turns off IPv4 service or not. Also, "greenfield" IPv6-only networks may use MAP to deliver IPv4 to sites over the IPv6 network β
2. Conventions π
here's the fine print: 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] π
3. Terminology π
here's the glossary, bestie π
MAP domain: One or more MAP Customer Edge (CE) devices
and Border Relays (BRs) connected to the same
virtual link. A service provider may deploy
a single MAP domain or may utilize multiple
MAP domains.
MAP Rule: A set of parameters describing the mapping
between an IPv4 prefix, IPv4 address, or
shared IPv4 address and an IPv6 prefix or
address. Each domain uses a different
mapping rule set.
MAP node: A device that implements MAP.
MAP Border Relay (BR): A MAP-enabled router managed by the service
provider at the edge of a MAP domain. A BR
has at least an IPv6-enabled interface and an
IPv4 interface connected to the native IPv4
network. A MAP BR may also be referred to as
simply a "BR" within the context of MAP.
MAP Customer Edge (CE): A device functioning as a Customer Edge
router in a MAP deployment. A typical MAP CE
adopting MAP Rules will serve a residential
site with one WAN-side interface and one or
more LAN-side interfaces. A MAP CE may also
be referred to as simply a "CE" within the
context of MAP.
Port set: Each node has a separate part of the
transport-layer port space; this is denoted
as a port set.
Port Set ID (PSID): Algorithmically identifies a set of ports
exclusively assigned to a CE.
Shared IPv4 address: An IPv4 address that is shared among multiple
CEs. Only ports that belong to the assigned
port set can be used for communication. Also
known as a port-restricted IPv4 address.
End-user IPv6 prefix: The IPv6 prefix assigned to an End-user CE by
means other than MAP itself, e.g.,
provisioned using DHCPv6 Prefix Delegation
(PD) [RFC3633], assigned via Stateless
Address Autoconfiguration (SLAAC) [RFC4862],
or configured manually. It is unique for
each CE.
MAP IPv6 address: The IPv6 address used to reach the MAP
function of a CE from other CEs and from BRs.
Rule IPv6 prefix: An IPv6 prefix assigned by a service provider
for a mapping rule.
Rule IPv4 prefix: An IPv4 prefix assigned by a service provider
for a mapping rule.
Embedded Address (EA) bits:
The IPv4 EA-bits in the IPv6 address identify
an IPv4 prefix/address (or part thereof) or a
shared IPv4 address (or part thereof) and a
Port Set Identifier.
4. Architecture β¨
okay so, the MAP mechanism can work with shared IPv4 addresses, full IPv4 addresses, or IPv4 prefixes π We're going to focus on shared IPv4 addresses first, and then I'll spill the differences for full addresses and prefixes after. π
MAP is built out of stuff that already exists, which is honestly so smart π§ The Network Address and Port Translator (NAPT) [RFC2663] sits on the CE, and it gets extra support for restricting transport-protocol ports, ICMP identifiers, and fragment identifiers to the configured port set. So for packets going out of the private IPv4 network, the CE NAPT MUST translate transport identifiers (e.g., TCP and UDP port numbers) so they fall within the CE's assigned port range. Main character energy, no notes π
The NAPT MUST then be hooked up to a MAP-aware forwarding function that does encapsulation and decapsulation of IPv4 packets in IPv6 π¦ MAP uses the encapsulation mode from [RFC2473]. On top of that, MAP has an algorithm for "address resolution" that goes from an IPv4 address and port to an IPv6 address. That algorithmic mapping is in Section 5, so stay tuned, bestie πΈ
Here's the lowkey strict part π The MAP architecture only lets the shared IPv4 address be used as the global address (outside) of the NAPT running on the CE. A shared IPv4 address MUST NOT be used to identify an interface. Yes, it's theoretically possible to make host stacks and applications port-aware, but that would be a drastic change to the IP model [RFC6250], and nobody wants that drama π
For full IPv4 addresses and IPv4 prefixes, the same architecture applies with two differences π First, a full IPv4 address or IPv4 prefix can be used the way it is today, for example to identify an interface or as a DHCP pool. Second, the NAPT is not required to restrict the ports used on outgoing packets. Fewer rules, more freedom, iconic π
This architecture is shown 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 connects one or more MAP domains to external IPv4 networks π·
5. Mapping Algorithm π§
okay, so a MAP node gets provisioned with one or more mapping rules π
Rules get used differently depending on what they're for. Every MAP node MUST be provisioned with a Basic Mapping Rule π The node uses it to configure its IPv4 address, IPv4 prefix, or shared IPv4 address. That same basic rule can also be used for forwarding, where an IPv4 destination address and, optionally, a destination port get mapped into an IPv6 address. Extra mapping rules let multiple different IPv4 subnets exist inside the domain and make forwarding between them more efficient β¨
Traffic outside of the domain is forwarded to the BR π¦ That's when the destination IPv4 address doesn't match any Rule IPv4 prefix in the Rules database, using longest matching prefix.
There are two types of mapping rules π
- Basic Mapping Rule (BMR) - mandatory. A CE can be provisioned with multiple End-user IPv6 prefixes. There can only be one Basic Mapping Rule per End-user IPv6 prefix. However, all CEs having End-user IPv6 prefixes within (aggregated by) the same Rule IPv6 prefix may share the same Basic Mapping Rule. Together with the End-user IPv6 prefix, the Basic Mapping Rule is used to derive the IPv4 prefix, address, or shared address and the PSID assigned to the CE π
- Forwarding Mapping Rule (FMR) - optional; used for forwarding. The Basic Mapping Rule may also be a Forwarding Mapping Rule. Each Forwarding Mapping Rule results in an entry in the rule table for the Rule IPv4 prefix. Given a destination IPv4 address and port inside the MAP domain, a MAP node can use the matching FMR to derive the End-user IPv6 address of the interface that IPv4 destination address and port combination can be reached through. In hub-and-spoke mode, there are no FMRs π
Both mapping rules share the same parameters:
- Rule IPv6 prefix (including prefix length)
- Rule IPv4 prefix (including prefix length)
- Rule EA-bit length (in bits)
A MAP node finds its BMR 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 it's used to terminate all MAP traffic sent or received by the node π«Ά
Port-restricted IPv4 routes get installed in the rule table for all the Forwarding Mapping Rules, and a default route gets installed to the MAP BR (see Section 5.4) π§
Forwarding Mapping Rules are used to allow direct communication between MAP CEs, which is known as "Mesh mode" πΈοΈ In hub-and-spoke mode, there are no Forwarding Mapping Rules, and all traffic MUST be forwarded directly to the BR. Hard rule, no exceptions π
While an FMR is optional in the sense that a MAP CE MAY be configured with zero or more FMRs, depending on the deployment, all MAP CEs MUST implement support for both rule types π
5.1. Port-Mapping Algorithm πΈ
The port-mapping algorithm is used in domains whose rules allow IPv4 address sharing π¦
The simplest way to represent a port range is with a notation similar to Classless Inter-Domain Routing (CIDR) [RFC4632]. For example, the first 256 ports are represented as port prefix 0.0/8, and the last 256 ports as 255.0/8. In hexadecimal, these are 0x0000/8 (PSID = 0) and 0xFF00/8 (PSID = 0xFF) π₯ Using this technique but wanting to avoid allocating the system ports [RFC6335] to the user, you'd have to exclude 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, it's desirable to minimize the restrictions on possible PSID values, so the End-user IPv6 prefix and the assigned port set don't depend on each other too much π This is done with an infix representation of the port value. With it, the well-known ports are excluded by restrictions on the value of the high-order bit field (A) instead of the PSID π
The infix algorithm allocates ports to a given CE as a series of contiguous ranges, spaced at regular intervals across 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
+-----------+-----------+-------+
Ports in | A | PSID | j |
the CE port set | > 0 | | |
+-----------+-----------+-------+
| a bits | k bits |m bits |
Figure 2: Structure of a Port-Restricted Port Field
Here's what each field means π
- a bits: The number of offset bits, 6 by default, because that excludes the system ports (0-1023). To guarantee non-overlapping port sets, the offset 'a' MUST be the same for every MAP CE sharing the same address.
- A: Selects the range of the port number. For 'a' > 0, A MUST be larger than 0. This makes sure the algorithm excludes the system ports. For the default value of 'a' (6), the system ports are excluded by requiring that A be greater than 0. Smaller values of 'a' exclude a larger initial range, e.g., 'a' = 4 excludes ports 0-4095. The interval between initial port numbers of successive contiguous ranges assigned to the same user is 2^(16 - a).
- k bits: The length in bits of the PSID field. To guarantee non-overlapping port sets, the length 'k' MUST be the same for every MAP CE sharing the same address. The sharing ratio is 2^k. The number of ports assigned to the user is 2^(16 - k) - 2^m (excluded ports).
- PSID: The Port Set Identifier (PSID). Different PSID values guarantee non-overlapping port sets, thanks to the restrictions on 'a' and 'k' stated above, because the PSID always occupies the same bit positions in the port number π§
- m bits: The number of contiguous ports is given by 2^m.
- j: Selects the specific port within a particular range specified by the concatenation of A and the PSID π
5.2. Basic Mapping Rule (BMR) π
Okay so the Basic Mapping Rule is mandatory π, and it's how the CE gets itself set up with an IPv4 prefix, an IPv4 address, or a shared IPv4 address. Quick recap from Section 5: the BMR has three parameters.
- Rule IPv6 prefix (including prefix length)
- Rule IPv4 prefix (including prefix length)
- Rule EA-bit length (in bits)
Figure 3 shows the structure of the complete MAP IPv6 address as this document lays it out. β¨
| 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 same for every CE using the same Basic Mapping Rule inside the MAP domain. πΈ The EA bit field is where the CE-specific IPv4 address and port info lives. It's unique for a given Rule IPv6 prefix, and it can hold a full or partial IPv4 address and, in the shared IPv4 address case, a PSID. An EA bit field length of 0 means all the relevant MAP IPv4 addressing info is passed directly in the BMR and is not pulled out of the EA bit field in the End-user IPv6 prefix. Totally different vibe, same energy. π
The MAP IPv6 address gets built by sticking the End-user IPv6 prefix together with the MAP subnet identifier (only if the End-user IPv6 prefix is shorter than 64 bits) and the interface identifier, which is covered in Section 6. π¦
The MAP subnet identifier is defined to be the first subnet, so the s bits are set to zero. π§
Here's the define moment. π
r= length of the IPv4 prefix given by the BMRo= length of the EA bit field as given by the BMRp= length of the IPv4 suffix contained in the EA bit field
The length r MAY be zero π, in which case the complete IPv4 address or prefix is encoded in the EA bits. If only part of the IPv4 address or prefix is encoded in the EA bits, the Rule IPv4 prefix gets provisioned to the CE by some other means (for example, a DHCPv6 option). To create a complete IPv4 address (or prefix), the IPv4 address suffix (p) from the EA bits gets concatenated with the Rule IPv4 prefix (r bits).
The offset of the EA bit field in the IPv6 address is equal to the BMR Rule IPv6 prefix length. The length of the EA bit field (o) comes from the BMR Rule EA-bit length and can be anywhere between 0 and 48. A length of 48 means the complete IPv4 address and port are embedded in the End-user IPv6 prefix (one single port gets assigned). A length of 0 means no part of the IPv4 address or port is embedded in the address at all. β The sum of the Rule IPv6 Prefix length and the Rule EA-bit length MUST be less than or equal to the End-user IPv6 prefix length. This one is non-negotiable, bestie. π
If o + r is less than 32 (the length of the IPv4 address in bits), then an IPv4 prefix is assigned. That case looks like this. π
| r bits | o 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 assigned. The address is created by concatenating the Rule IPv4 prefix and the EA-bits. Here's how that looks. π
| r bits | o bits = p bits |
+-------------+---------------------+
| Rule IPv4 | IPv4 address suffix |
+-------------+---------------------+
| 32 bits |
Figure 5: Complete IPv4 Address
If o + r is greater than 32, then a shared IPv4 address is 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 the EA bits is q = o - p. β¨
| 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 gives you a mapping with no dependence between the IPv4 address and the IPv6 address. π§ And the length of o MAY be zero (no EA bits embedded in the End-user IPv6 prefix), which means the PSID is also provisioned using, for example, DHCP. Flexible, iconic, very main character. π¦
See Appendix A for an example of the Basic Mapping Rule. π
5.3. Forwarding Mapping Rule (FMR) πΈ
The Forwarding Mapping Rule is optional, and it's used in Mesh mode to enable direct CE-to-CE connectivity. Literally the "let's talk directly" option. π«Ά
When an FMR rule gets added, an IPv4 route is installed in the rule table for the Rule IPv4 prefix (Figures 4, 5, and 6). π₯
| 32 bits | | 16 bits |
+--------------------------+ +-------------------+
| IPv4 destination address | | IPv4 dest port |
+--------------------------+ +-------------------+
: : ___/ :
| p bits | / q bits :
+-----------+ +------------+
|IPv4 suffix| |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: Derivation of MAP IPv6 Address
See Appendix A for an example of the Forwarding Mapping Rule. π§
5.4. Destinations outside the MAP Domain π
IPv4 traffic between MAP nodes that are all inside one MAP domain gets encapsulated in IPv6. The sender's MAP IPv6 address is the IPv6 source address, and the receiving MAP node's MAP IPv6 address is the IPv6 destination address. π To reach IPv4 destinations outside the MAP domain, the traffic is also encapsulated in IPv6, but this time the destination IPv6 address is set to the configured IPv6 address of the MAP BR. Border router, border router, you get the vibe. πͺ
On the CE, the path to the BR can be represented as a point-to-point IPv4-over-IPv6 tunnel [RFC2473]. The source address of the tunnel is the CE's MAP IPv6 address, and the BR IPv6 address is the remote tunnel address. When MAP is enabled, a typical CE router installs a default IPv4 route to the BR. π
The BR forwards traffic received from the outside to CEs using the normal MAP forwarding rules. Simple, clean, no drama. π
6. The IPv6 Interface Identifier π¦
The interface identifier format of a MAP node looks like this. β¨
| 128-n-o-s bits |
| 16 bits| 32 bits | 16 bits|
+--------+----------------+--------+
| 0 | IPv4 address | PSID |
+--------+----------------+--------+
Figure 8: IPv6 Interface Identifier
When there's an IPv4 prefix, the IPv4 address field gets right-padded with zeros up to 32 bits. The PSID field gets left-padded with zeros to make 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 get overwritten by the prefix. Plot twist, but it's giving intentional. π
7. MAP Configuration π
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 that MAP domain. π
- The Basic Mapping Rule and, optionally, the Forwarding Mapping Rules, including the Rule IPv6 prefix, Rule IPv4 prefix, and Length of EA bits.
- Hub-and-spoke mode or Mesh mode (if all traffic should be sent to the BR, or if direct CE-to-CE traffic should be supported).
In addition, the MAP CE MUST be configured with the IPv6 address(es) of the MAP BR (Section 5.4). π«Ά
7.1. MAP CE π§
The MAP elements are set to values that are the same across all CEs within a MAP domain. The values can be configured in a variety of ways, including provisioning methods like the Broadband Forum's "TR-69" Residential Gateway management interface [TR069], an XML-based object retrieved after IPv6 connectivity is established, or manual configuration by an administrator. IPv6 DHCP options for MAP configuration are defined in [RFC7598]. Other configuration and management methods may use the formats described by these options, for consistency and convenience of implementation on CEs that support multiple configuration methods. πΈ
The only remaining provisioning information the CE needs 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 therefore the IPv4 service itself, are tied to the associated End-user IPv6 prefix lifetime. So the MAP service is also tied to that in terms of authorization, accounting, and so on. π
A single MAP CE MAY be connected to more than one MAP domain, kind of like how any router can have more than one IPv4-enabled service-provider-facing interface and more than one set of addresses assigned by DHCP. π Each domain a given CE operates in would need its own set of MAP configuration elements and would generate its own IPv4 address. Each MAP domain requires a distinct End-user IPv6 prefix. β¨
MAP DHCP options are specified in [RFC7598]. π
7.2. MAP BR π
The MAP BR MUST be configured with corresponding mapping rules for each MAP domain it's acting as a BR for. π
For increased reliability and load balancing, the BR IPv6 address MAY be an anycast address shared across a given MAP domain. MAP is stateless, so 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 in IPv6 or IPv4 BGP. However, if anycast is used for the MAP IPv6 relays, the anycast addresses must be advertised in the service provider's IGP. π
8. Forwarding Considerations πͺ
Figure 1 depicts the overall MAP architecture, with IPv4 users connected to a routed IPv6 network. π
MAP uses 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 specified by the MAP provisioning parameters. The IPv4 packet is then forwarded using the CE's MAP forwarding function. The IPv6 source and destination addresses MUST then be derived as per Section 5 of this document. π«Άπ₯
8.1. Receiving Rules β¨
okay so when a MAP CE gets an IPv6 packet sent to its MAP IPv6 address, it hands that packet to its MAP function, which decapsulates it π¦. The IPv4 packet that falls out goes to the CE's NAT44 function, and the NAT's translation table decides what happens next π.
When a MAP BR gets IPv6 packets, it picks the best matching MAP domain rule (the Rule IPv6 prefix) using a longest address match on the packet's IPv6 source address. It also checks that the packet's destination address matches the configured BR IPv6 address(es) π. Once it has the rule, the BR can pull the EA-bits out of the source IPv6 address π¦.
Now the anti-spoofing part, which is kinda the most important bit π¨. Any MAP node (CE and BR) MUST run this check when a packet comes in, so nobody can fake IPv4 addresses π . First, the node uses the matching MAP Rule to pull the embedded IPv4 address or prefix, plus the PSID (if there is one), out of the source IPv6 address. Together those give the range of source IPv4 addresses and ports that are allowed β¨. Second, it grabs the source IPv4 address and port from the IPv4 packet sitting inside the IPv6 packet. If those fall outside the allowed range, the packet MUST be silently discarded, and a counter gets incremented to flag that a potential spoofing attack might be happening π. The checks don't run for packets whose source IPv6 address is the BR's own (the BR IPv6 address) π.
Also, by default, the CE router MUST drop anything it receives on the MAP virtual interface (so after the IPv6 decapsulation) if the IPv4 destination isn't its own IPv4 shared address, full IPv4 address, or IPv4 prefix π«.
8.2. ICMP π
ICMP messages should be supported in MAP domains, so the NAT44 in the MAP CE MUST implement the behavior for ICMP messages that matches the best current practice in [RFC5508] π§.
If a MAP CE gets an ICMP message with the ICMP Identifier field in its ICMP header, the NAT44 in that CE MUST rewrite the field to a specific value taken from the port set πΈ. BRs and other CEs must handle this field the same kind of way they'd handle a port number in a TCP/UDP header when they get an ICMP message with the ICMP Identifier field π.
If a MAP node gets an ICMP error message without the ICMP Identifier field, for errors detected inside an IPv6 tunnel, the node should relay that ICMP error message back to the original source. This SHOULD be implemented following Section 8 of [RFC2473] π¦.
8.3. Fragmentation and Path MTU Discovery π
Okay this one is so real: IPv4 and IPv6 headers are different sizes, so how big a packet can be matters for any system connecting the two address families π. There are three mechanisms for handling it: Path MTU Discovery (PMTUD), fragmentation, and transport-layer negotiation like the TCP Maximum Segment Size (MSS) option [RFC879] β¨. MAP uses all three, depending on the case π .
8.3.1. Fragmentation in the MAP Domain π
Wrapping an IPv4 packet so it can cross the MAP domain makes it bigger (usually by 40 bytes) π. It is strongly recommended that the MTU in the MAP domain be well managed, and that the IPv6 MTU on the CE WAN-side interface be set so that no fragmentation happens inside the MAP domain π«Ά.
For an IPv4 packet entering a MAP domain, fragmentation is done as described in Section 7.2 of [RFC2473] π₯.
Here's the tricky bit: an anycast source address could make an ICMP error message get sent to a different BR π. So using a dynamically set tunnel MTU (Section 6.7 of [RFC2473]) is subject to IPv6 Path MTU black holes π³οΈ. A MAP BR using an anycast source address SHOULD NOT, by default, use Path MTU Discovery across the MAP domain β οΈ.
Also, if several BRs use the same anycast source address, they could send fragmented packets to the same CE at the same time π¬. If those fragments happen to share a fragment ID, the reassembly can go wrong π. See [RFC4459] for an analysis of the problem. Section 3.4 of [RFC4459] suggests solving it by fragmenting the inner packet π§©.
8.3.2. Receiving IPv4 Fragments on the MAP Domain Borders π‘οΈ
To forward an IPv4 packet that came from outside the MAP domain, you need the IPv4 destination address and the transport-protocol destination port π―. But the transport-protocol info is only in the first fragment π. As Section 5.3.3 of [RFC6346] describes, a MAP node that gets an IPv4 fragmented packet from outside has to reassemble it before sending it onto the MAP link π§΅. If the first packet received has the transport-protocol info, the node can optimize this by using a cache and forwarding the fragments unchanged π.
Implementers of MAP should be aware that there are a bunch of well-known attacks against IP fragmentation, see [RFC1858] and [RFC3128] π₯Ί. Implementers should also be aware of extra issues with reassembling packets at high rates, as described in [RFC4963] π.
8.3.3. Sending IPv4 Fragments to the Outside π·
If two IPv4 hosts behind two different MAP CEs have the same IPv4 address and send fragments to an IPv4 destination host outside the domain, those hosts might use the same IPv4 fragmentation identifier π΅βπ«. That can mess up reassembly at the destination host π. The IPv4 fragmentation identifier is a 16-bit field, so it could be used a bit like port ranges π’. A MAP CE could rewrite the IPv4 fragmentation identifier so it sits within its allocated port set, but only if the resulting identifier space is big enough for how fast fragments get sent π. The catch is that splitting the identifier space this way makes reassembly collisions more likely for all connections through the Customer Premises Equipment (CPE) π. See also [RFC6864] π.
9. NAT44 Considerations π
The NAT44 in the MAP CE SHOULD conform to the behavior and best current practices in [RFC4787], [RFC5508], and [RFC5382] β¨. In MAP address-sharing mode (which is set by the MAP domain / rule configuration parameters), the NAT44 MUST be restricted to the available port numbers you get from the Basic Mapping Rule πΈ.
10. Security Considerations π
Okay, this section is serious, so read it carefully bestie π¨.
- Spoofing attacks: Because MAP nodes do consistency checks between IPv4 and IPv6 sources on the packets they receive, MAP doesn't add any new chance for spoofing attacks that wouldn't already exist in IPv6 π‘οΈ.
- Denial-of-service attacks: In MAP domains where IPv4 addresses are shared, IPv4 datagram reassembly might be needed, and that opens a door for DoS attacks π±. This comes with address sharing and shows up with other address-sharing approaches too, like DS-Lite and NAT64/DNS64 π. The best protection is to speed up IPv6 deployment, so address sharing gets used less and less wherever MAP is supported π.
- Routing loop attacks: Routing loop attacks can happen in some "automatic tunneling" setups, documented in [RFC6324] π. They can't happen with MAP, because each BR checks that the IPv6 source address of a received IPv6 packet is a CE address based on the Forwarding Mapping Rule β .
- Attacks facilitated by restricted port set: From hosts that aren't subject to ingress filtering [RFC2827], an attacker can inject spoofed packets during ongoing transport connections [RFC4953] [RFC5961] [RFC6056] π°. These attacks depend on guessing which ports the target hosts are using right now π―. Using an unrestricted port set is preferable, meaning native IPv6 connections that aren't subject to MAP port-range restrictions π¦. To cut down on these attacks when you're using a restricted port set, the MAP CE's NAT44 filtering behavior SHOULD be "Address-Dependent Filtering," as described in Section 5 of [RFC4787] π§±. The MAP CEs SHOULD also use a DNS transport proxy [RFC5625] function to handle DNS traffic, and source that traffic from IPv6 interfaces not assigned to MAP π.
[RFC6269] outlines general issues with IPv4 address sharing π.
11. References π
11.1. Normative References π
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>. - [RFC2473] Conta, A. and S. Deering, "Generic Packet Tunneling in IPv6 Specification", RFC 2473, DOI 10.17487/RFC2473, December 1998,
<http://www.rfc-editor.org/info/rfc2473>. - [RFC5625] Bellis, R., "DNS Proxy Implementation Guidelines", BCP 152, RFC 5625, DOI 10.17487/RFC5625, August 2009,
<http://www.rfc-editor.org/info/rfc5625>.
11.2. Informative References π§Ύ
Bestie, these are the receipts π§Ύ for all the extra reading π the spec leans on.
- [MAP-Deploy] Sun, Q., Chen, M., Chen, G., Tsou, T., and S. Perreault, "Mapping of Address and Port (MAP) - Deployment Considerations", Work in Progress, draft-ietf-softwire-map-deployment-06, June 2015.
- [RFC879] Postel, J., "The TCP Maximum Segment Size and Related Topics", RFC 879, DOI 10.17487/RFC0879, November 1983,
http://www.rfc-editor.org/info/rfc879. - [RFC1858] Ziemba, G., Reed, D., and P. Traina, "Security Considerations for IP Fragment Filtering", RFC 1858, DOI 10.17487/RFC1858, October 1995,
http://www.rfc-editor.org/info/rfc1858. - [RFC1933] Gilligan, R. and E. Nordmark, "Transition Mechanisms for IPv6 Hosts and Routers", RFC 1933, DOI 10.17487/RFC1933, April 1996,
http://www.rfc-editor.org/info/rfc1933. - [RFC2529] Carpenter, B. and C. Jung, "Transmission of IPv6 over IPv4 Domains without Explicit Tunnels", RFC 2529, DOI 10.17487/RFC2529, March 1999,
http://www.rfc-editor.org/info/rfc2529. - [RFC2663] Srisuresh, P. and M. Holdrege, "IP Network Address Translator (NAT) Terminology and Considerations", RFC 2663, DOI 10.17487/RFC2663, August 1999,
http://www.rfc-editor.org/info/rfc2663. - [RFC2827] Ferguson, P. and D. Senie, "Network Ingress Filtering: Defeating Denial of Service Attacks which employ IP Source Address Spoofing", BCP 38, RFC 2827, DOI 10.17487/RFC2827, May 2000,
http://www.rfc-editor.org/info/rfc2827. - [RFC3056] Carpenter, B. and K. Moore, "Connection of IPv6 Domains via IPv4 Clouds", RFC 3056, DOI 10.17487/RFC3056, February 2001,
http://www.rfc-editor.org/info/rfc3056. - [RFC3128] Miller, I., "Protection Against a Variant of the Tiny Fragment Attack (RFC 1858)", RFC 3128, DOI 10.17487/RFC3128, June 2001,
http://www.rfc-editor.org/info/rfc3128. - [RFC3633] Troan, O. and R. Droms, "IPv6 Prefix Options for Dynamic Host Configuration Protocol (DHCP) version 6", RFC 3633, DOI 10.17487/RFC3633, December 2003,
http://www.rfc-editor.org/info/rfc3633. - [RFC4213] Nordmark, E. and R. Gilligan, "Basic Transition Mechanisms for IPv6 Hosts and Routers", RFC 4213, DOI 10.17487/RFC4213, October 2005,
http://www.rfc-editor.org/info/rfc4213. - [RFC4459] Savola, P., "MTU and Fragmentation Issues with In-the-Network Tunneling", RFC 4459, DOI 10.17487/RFC4459, April 2006,
http://www.rfc-editor.org/info/rfc4459. - [RFC4632] Fuller, V. and T. Li, "Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan", BCP 122, RFC 4632, DOI 10.17487/RFC4632, August 2006,
http://www.rfc-editor.org/info/rfc4632. - [RFC4787] Audet, F., Ed., and C. Jennings, "Network Address Translation (NAT) Behavioral Requirements for Unicast UDP", BCP 127, RFC 4787, DOI 10.17487/RFC4787, January 2007,
http://www.rfc-editor.org/info/rfc4787. - [RFC4862] Thomson, S., Narten, T., and T. Jinmei, "IPv6 Stateless Address Autoconfiguration", RFC 4862, DOI 10.17487/RFC4862, September 2007,
http://www.rfc-editor.org/info/rfc4862. - [RFC4953] Touch, J., "Defending TCP Against Spoofing Attacks", RFC 4953, DOI 10.17487/RFC4953, July 2007,
http://www.rfc-editor.org/info/rfc4953. - [RFC4963] Heffner, J., Mathis, M., and B. Chandler, "IPv4 Reassembly Errors at High Data Rates", RFC 4963, DOI 10.17487/RFC4963, July 2007,
http://www.rfc-editor.org/info/rfc4963. - [RFC5214] Templin, F., Gleeson, T., and D. Thaler, "Intra-Site Automatic Tunnel Addressing Protocol (ISATAP)", RFC 5214, DOI 10.17487/RFC5214, March 2008,
http://www.rfc-editor.org/info/rfc5214. - [RFC5382] Guha, S., Ed., Biswas, K., Ford, B., Sivakumar, S., and P. Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, RFC 5382, DOI 10.17487/RFC5382, October 2008,
http://www.rfc-editor.org/info/rfc5382. - [RFC5508] Srisuresh, P., Ford, B., Sivakumar, S., and S. Guha, "NAT Behavioral Requirements for ICMP", BCP 148, RFC 5508, DOI 10.17487/RFC5508, April 2009,
http://www.rfc-editor.org/info/rfc5508. - [RFC5961] Ramaiah, A., Stewart, R., and M. Dalal, "Improving TCP's Robustness to Blind In-Window Attacks", RFC 5961, DOI 10.17487/RFC5961, August 2010,
http://www.rfc-editor.org/info/rfc5961. - [RFC5969] Townsley, W. and O. Troan, "IPv6 Rapid Deployment on IPv4 Infrastructures (6rd) -- Protocol Specification", RFC 5969, DOI 10.17487/RFC5969, August 2010,
http://www.rfc-editor.org/info/rfc5969. - [RFC6056] Larsen, M. and F. Gont, "Recommendations for Transport-Protocol Port Randomization", BCP 156, RFC 6056, DOI 10.17487/RFC6056, January 2011,
http://www.rfc-editor.org/info/rfc6056. - [RFC6250] Thaler, D., "Evolution of the IP Model", RFC 6250, DOI 10.17487/RFC6250, May 2011,
http://www.rfc-editor.org/info/rfc6250. - [RFC6269] Ford, M., Ed., Boucadair, M., Durand, A., Levis, P., and P. Roberts, "Issues with IP Address Sharing", RFC 6269, DOI 10.17487/RFC6269, June 2011,
http://www.rfc-editor.org/info/rfc6269. - [RFC6324] Nakibly, G. and F. Templin, "Routing Loop Attack Using IPv6 Automatic Tunnels: Problem Statement and Proposed Mitigations", RFC 6324, DOI 10.17487/RFC6324, August 2011,
http://www.rfc-editor.org/info/rfc6324. - [RFC6333] Durand, A., Droms, R., Woodyatt, J., and Y. Lee, "Dual-Stack Lite Broadband Deployments Following IPv4 Exhaustion", RFC 6333, DOI 10.17487/RFC6333, August 2011,
http://www.rfc-editor.org/info/rfc6333. - [RFC6335] Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S. Cheshire, "Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry", BCP 165, RFC 6335, DOI 10.17487/RFC6335, August 2011,
http://www.rfc-editor.org/info/rfc6335. - [RFC6346] Bush, R., Ed., "The Address plus Port (A+P) Approach to the IPv4 Address Shortage", RFC 6346, DOI 10.17487/RFC6346, August 2011,
http://www.rfc-editor.org/info/rfc6346. - [RFC6864] Touch, J., "Updated Specification of the IPv4 ID Field", RFC 6864, DOI 10.17487/RFC6864, February 2013,
http://www.rfc-editor.org/info/rfc6864. - [RFC7598] Mrugalski, T., Troan, O., Farrer, I., Perreault, S., Dec, W., Bao, C., Yeh, L., and X. Deng, "DHCPv6 Options for Configuration of Softwire Address and Port-Mapped Clients", RFC 7598, DOI 10.17487/RFC7598, July 2015,
http://www.rfc-editor.org/info/rfc7598. - [Solutions-4v6] Boucadair, M., Ed., Matsushima, S., Lee, Y., Bonness, O., Borges, I., and G. Chen, "Motivations for Carrier-side Stateless IPv4 over IPv6 Migration Solutions", Work in Progress, draft-ietf-softwire-stateless-4v6-motivation-05, November 2012.
- [TR069] Broadband Forum TR-069, "CPE WAN Management Protocol", Amendment 5, CWMP Version: 1.4, November 2013,
https://www.broadband-forum.org.
Appendix A. Examples β¨
Okay bestie, time for the worked examples! π§ Each one starts from the same MAP domain info, then walks through the math so you can check it yourself. Every value is copied exactly, so you can plug them into your own calculator. π
Example 1 - Basic Mapping Rule π
Start with the MAP domain info and the IPv6 address of an endpoint:
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-bit 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, work out the IPv4 address and port set like this π¦:
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 info lets a MAP CE figure out (complete) its IPv6 address inside the given IPv6 prefix. So the MAP CE's address ends up looking like this πΈ:
IPv6 address of MAP CE: 2001:db8:0012:3400:0000:c000:0212:0034
Example 2 - BR π
Next up, a MAP BR. It's configured with the following FMR, and it gets a packet with these 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
Forwarding Mapping Rule: {2001:db8::/40 (Rule IPv6 prefix),
192.0.2.0/24 (Rule IPv4 prefix),
16 (Rule EA-bit length)}
IPv6 address of MAP BR: 2001:db8:ffff::1
With that info, the BR can derive the mapped destination IPv6 address for the matching MAP CE, plus the mapped source IPv6 address for the IPv4 source address. It's giving math magic β¨:
IPv4 suffix bits (p): 32 - 24 = 8 (18 (0x12))
PSID length: 8
PSID: 0x34 (1232)
And the resulting IPv6 packet has these key fields:
IPv6 source address: 2001:db8:ffff::1
IPv6 destination address: 2001:db8:0012:3400:0000:c000:0212:0034
Example 3 - Forwarding Mapping Rule π§
Here's the vibe check. An IPv4 host behind the MAP CE (same addressing as the previous examples) is talking to IPv4 host 1.2.3.4. Its packets get encapsulated in IPv6, using the IPv6 address of the BR that's configured on the MAP CE π:
IPv6 address of BR: 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
MAP CE IPv6 source address: 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 π
This one is the simplest case. No embedded address bits and no sharing at all, so the sharing ratio is 1 π:
End-user IPv6 prefix: 2001:db8:0012:3400::/56
Basic Mapping Rule: {2001:db8:0012:3400::/56 (Rule IPv6 prefix),
192.0.2.18/32 (Rule IPv4 prefix),
0 (Rule EA-bit 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 like so:
EA bits offset: 0
IPv4 suffix bits (p): Length of IPv4 address (32) -
IPv4 prefix length (32) = 0
IPv4 address: 192.0.2.18 (0xc0000212)
PSID start: 0
PSID length: 0
PSID: null
The BMR info also lets a MAP CE determine (complete) its full IPv6 address, by combining the IPv6 prefix with the MAP interface identifier (the one that embeds the IPv4 address) π:
IPv6 address of MAP CE: 2001:db8:0012:3400:0000:c000:0212:0000
Example 5 - Rule with no embedded address bits and address sharing (sharing ratio of 256) π
Same prefix and rule as before, but now with address sharing. The PSID info comes from DHCP this time β:
End-user IPv6 prefix: 2001:db8:0012:3400::/56
Basic Mapping Rule: {2001:db8:0012:3400::/56 (Rule IPv6 prefix),
192.0.2.18/32 (Rule IPv4 prefix),
0 (Rule EA-bit length)}
PSID length: 8 (from DHCP; sharing ratio of 256)
PSID offset: 6 (default)
PSID: 0x34 (from DHCP)
A MAP node can, via the Basic Mapping Rule, determine the IPv4 address and port set like this:
EA bits offset: 0
IPv4 suffix bits (p): Length of IPv4 address (32) -
IPv4 prefix length (32) = 0
IPv4 address: 192.0.2.18 (0xc0000212)
PSID offset: 6
PSID length: 8
PSID: 0x34
Available ports (63 ranges): 1232-1235, 2256-2259, ...... ,
63696-63699, 64720-64723
The Basic Mapping Rule info also lets a MAP CE determine (complete) its full IPv6 address, by combining the IPv6 prefix with the MAP interface identifier (which embeds the IPv4 address and PSID) π«Ά:
IPv6 address of MAP CE: 2001:db8:0012:3400:0000:c000:0212:0034
Heads up! The IPv4 address and PSID are NOT derived from the IPv6 prefix assigned to the CE. They're provisioned separately, using DHCP for example. Don't mix those up, bestie π.
Wait, I need to be careful with that last line: the original says "not derived", so I should keep it neutral and not capitalised. The corrected version is below.
Heads up! The IPv4 address and PSID are not derived from the IPv6 prefix assigned to the CE. They're provisioned separately, using, for example, DHCP. Don't mix those up, bestie π.
Appendix B. A More Detailed Description of the Derivation of the Port-Mapping Algorithm π¦
This appendix explains how the port-mapping algorithm from Section 5.1 got 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 few other requirements also shaped the algorithm π§ :
- In keeping with the general MAP algorithm, the port set MUST be derivable from a Port Set identifier (PSID) that can be embedded in the End-user IPv6 prefix.
- The mapping MUST be reversible, such that given the port number, the PSID of the port set it belongs to can be quickly derived.
- The algorithm MUST allow a broad range of address-sharing ratios.
- It SHOULD be possible to exclude subsets of the complete port numbering space from assignment. Most operators would exclude the system ports (0-1023). A conservative operator might exclude everything except the transient ports (49152-65535).
- The effect of port exclusion on the possible values of the End-user IPv6 prefix (for example, from restrictions on the PSID value) SHOULD be minimized.
- For administrative simplicity, the algorithm SHOULD allocate the same or almost the same number of ports to each CE sharing a given IPv4 address.
Two extreme cases that an algorithm meeting those conditions might support are: (1) the port numbers are not contiguous for each PSID, but uniformly distributed across the allowed port range, and (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 it supports both of these cases πΈ.
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 follows:
- a. The port numbers (P) that correspond to a given PSID are generated by:
(1) ... P = (R * M) * i + M * PSID + j
where i and j are indices, and the ranges of i, j, and the PSID are discussed below.
- b. For any given port number P, the PSID is calculated as:
(2) ... PSID = trunc((P modulo (R * M)) / M)
where trunc() is the operation of rounding down to the nearest integer.
Formula (1) can be read like this. First, the available port space gets chopped into blocks of size R * M. Each block is then divided into R individual ranges of length M. The index i in formula (1) picks a block, PSID picks a range within that block, and the index j picks a specific port value within the range. Based on that reading:
- i ranges from
ceil(N / (R * M))totrunc(65536/(R * M)) - 1, where ceil is the operation of rounding up to the nearest integer, and N is the number of ports (for example, 1024) excluded from the lower end of the range. That means any block containing excluded values gets discarded at the lower end, and if the final block has fewer than R * M values, it gets discarded too. This makes sure every PSID gets the same number of ports π. - PSID ranges from 0 to R - 1.
- j ranges from 0 to M - 1.
B.1. Bit Representation of the Algorithm π
If R and M are powers of 2 (R = 2^k, M = 2^m), formula (1) turns into a computationally convenient structure for any port number written as a 16-bit binary number. That 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 the figure shows, the index value i from 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.
Because the PSID is always in the same position in the port number and always the same length, different PSID values are guaranteed to generate different sets of port numbers. Going the other way, the generating PSID can be pulled out of any port number with a bitmask operation π§.
Note that when M and R are powers of 2, 65536 divides evenly by R * M. So 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 needed to make sure the required set of ports is excluded. No port numbers get wasted by discarding blocks at the lower end, if the block size R * M is a factor of N, the number of ports to be excluded π¦.
As a final note, the number of blocks that the range 0-65535 gets divided into in this representation is 2^a. So when a = 0, the complete range is treated as a single block, and individual port sets are contained in contiguous ranges inside that block. We can't throw away the whole block in that case, so port exclusion has to be done by putting a lower bound equal to ceil(N / M) on the allowed set of PSID values instead π.
B.2. GMA Examples π
For example, with 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)
And another, with R = 64, PSID = 0, a = 0 (PSID offset = 0 and PSID length = 6 bits), and no port exclusion:
Available ports (1 range): 0-1023
Example 2: with offset = 0 (a = 0) and N = 0
Acknowledgements π«Ά
okay so this doc is literally built on the ideas of so many people π huge thank-you to Masakazu Asama, Mohamed Boucadair, Gang Chen, Maoke Chen, Wojciech Dec, Xiaohong Deng, Jouni Korhonen, Tomek Mrugalski, Jacni Qin, Chunfa Sun, Qiong Sun, and Leaf Yeh π the authors also want to give a special shoutout to Remi Despres, who put so much work into generalized mechanisms for stateless address mapping. icon behavior β¨
the authors would also like to thank Lichun Bao, Guillaume Gottard, Dan Wing, Jan Zorz, Necj Scoberne, Tina Tsou, Kristian Poscic, and especially Tom Taylor and Simon Perreault for the thorough reviews and comments π useful IETF Last Call comments came from Brian Weis and Lei Yan, so they get their flowers too πΈ
Contributors π
this document is the result of the IETF Softwire MAP design team effort, plus a bunch of earlier individual contributions in this area. the whole crew:
Chongfeng Xie
China Telecom
Room 708, No. 118, Xizhimennei Street
Beijing 100035
China
Phone: +86-10-58552116
Email: xiechf@ctbri.com.cn
Qiong Sun
China Telecom
Room 708, No. 118, Xizhimennei Street
Beijing 100035
China
Phone: +86-10-58552936
Email: sunqiong@ctbri.com.cn
Gang Chen
China Mobile
29, Jinrong Avenue
Xicheng District, Beijing 100033
China
Email: phdgang@gmail.com, chengang@chinamobile.com
Yu Zhai
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing 100084
China
Email: jacky.zhai@gmail.com
Wentao Shang
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing 100084
China
Email: wentaoshang@gmail.com
Guoliang Han
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing 100084
China
Email: bupthgl@gmail.com
Rajiv Asati
Cisco Systems
7025-6 Kit Creek Road
Research Triangle Park, NC 27709
United States
Email: rajiva@cisco.com
Authors' Addresses π
and finally, the authors themselves, so you know exactly who to message about this stuff π
Ole Troan (editor)
Cisco Systems
Philip Pedersens vei 1
Lysaker 1366
Norway
Email: ot@cisco.com
Wojciech Dec
Cisco Systems
Haarlerbergpark Haarlerbergweg 13-19
Amsterdam, NOORD-HOLLAND 1101 CH
The Netherlands
Email: wdec@cisco.com
Xing Li
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing 100084
China
Email: xing@cernet.edu.cn
Congxiao Bao
CERNET Center/Tsinghua University
Room 225, Main Building, Tsinghua University
Beijing 100084
China
Email: congxiao@cernet.edu.cn
Satoru Matsushima
SoftBank Telecom
1-9-1 Higashi-Shinbashi, Munato-ku
Tokyo
Japan
Email: satoru.matsushima@g.softbank.co.jp
Tetsuya Murakami
IP Infusion
1188 East Arques Avenue
Sunnyvale, CA 94085
United States
Email: tetsuya@ipinfusion.com
Tom Taylor (editor)
Huawei Technologies
Ottawa
Canada
Email: tom.taylor.stds@gmail.com
π¦ where this page comes from
- ietf: rfc7597 2015-07
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms