Customer selection by rule

Mapping of Address and Port (MAP) connects a customer’s shared public IPv4 address and Port Set Identifier (PSID) to its IPv6 addressing. The Border Relay (BR) uses mapping rules rather than a per-connection NAT table to identify the customer. Customer NAT still normally tracks private-host connections.

VersionCrossing the provider’s IPv6 network
MAP-EEncapsulation: IPv4 -> IPv4 inside IPv6 -> IPv4
MAP-TTranslation: IPv4 -> IPv6 -> IPv4

Customer routers perform NAT44 into their assigned public address/port set. E and T describe the additional transport operation, not whether ordinary customer NAT maintains state. BRs may share an anycast address/prefix to support multiple relay instances.

Port sets rather than one continuous range

A TCP/UDP port is 16 bits. MAP divides the bits:

[ A: a bits ][ PSID: k bits ][ j: m bits ]
a + k + m = 16

The customer keeps PSID fixed and varies A and j. In the source’s model A must be greater than zero, excluding the lowest port block. With PSID offset a=4 and k=8, the remaining j field has m=4 bits:

[ one hex digit ][ 33 ][ one hex digit ]

For PSID 0x33, ports 0x1330, 0x1331 and 0x8339 are allowed; 0x8349 has PSID 0x34 and is not. Here there are 15 * 16 = 240 allowed ports for this PSID under that exclusion rule. The allowed set is spread across ranges, not one continuous interval.

Source mapping example

The mapping rule supplies an IPv6 prefix, IPv4 prefix, embedded-address (EA) length and PSID offset:

Rule IPv6 prefix: 2001:1:1100::/40
Rule IPv4 prefix: 195.2.2.0/24
EA length:       16 bits
PSID offset:     4 bits
Customer IPv4:   195.2.2.4
PSID:            0x33

The /24 leaves 8 IPv4 suffix bits: 04. Of 16 EA bits, the other 8 hold PSID 33. Appending EA bytes 04 33 to the /40 IPv6 rule gives customer prefix 2001:1:1104:3300::/56. The source’s illustrated full address is:

2001:1:1104:3300:0000:c302:0204:0033

The lower portion carries the illustrated IPv4/PSID representation; c3 02 02 04 encodes 195.2.2.4. This is a rule-defined construction, not arbitrary string concatenation at colon boundaries.

Packet paths in the source

An internal connection to 5.5.5.5:80 first undergoes customer NAT:

192.168.6.6:0x7777 -> 5.5.5.5:80
195.2.2.4:0x8339  -> 5.5.5.5:80

In MAP-E, that IPv4 packet is enclosed in IPv6 addressed to BR 2001:1::1. The BR removes the outer header and forwards the already translated IPv4 packet.

In MAP-T, the packet becomes IPv6 with the mapped customer source and a translated outside destination. The source’s outside-address example uses BR prefix 2001:1::/64 and RFC 6052 embedding:

IPv4 destination: 5.5.5.5
IPv6 destination: 2001:1::5:505:500:0

For this /64 layout, an 8-bit reserved byte follows the prefix, then the 32 IPv4 bits and a zero suffix. Do not use the simple /96 concatenation rule here. At the BR, translation reconstructs IPv4. Return traffic uses public destination address plus destination port/PSID to select the customer.

Lecture 03a - IPv4 to IPv6 Transition, PDF pages 35-44. Address/port values follow the source; bit accounting, port-count calculation and intermediate prefix are added worked explanation. Architecture roles were checked against RFC 7597.