How NAT64 Translates IPv6 to IPv4: Stateful vs Stateless, Packet by Packet
This walkthrough uses captures from the late Nick Russo's free packet-capture library, preserved by the Internet Archive. They are in the NAT archive, nat_pcap.zip, under nat_pcap/: nat64_pat_udp.pcapng, nat64_pat_icmp.pcapng, and nat64_stateless_udp.pcapng, with nat64_pool_udp.pcapng, nat64_pool_icmp.pcapng, nat44_pat_udp.pcapng, and nat44_pat_icmp.pcapng for comparison. The rest of the library is listed on his job aid page. We decoded the captures with VisualEther, which turns a Wireshark PCAP into a sequence diagram with a plain-English caption on every message.
An IPv6-only host can't talk to an IPv4-only server directly: the two protocols have different headers and different address sizes, and neither side understands the other's packets. NAT64 (Network Address Translation from IPv6 to IPv4) is a router function that bridges the gap. The host sends an ordinary IPv6 packet to an IPv6 address that stands for the IPv4 server. The NAT64 router rebuilds that packet with an IPv4 header, sends it to the server, and translates the reply back to IPv6.
Most explanations of NAT64 stop at a diagram. These captures show the same packet on both sides of the translator, so you can see exactly which fields the router rewrites and which it leaves alone. The lab has two IPv6-only clients, one NAT64 router, and one IPv4 server, 198.51.100.2. This article follows the lab through three captures:
- Stateful NAT64 with PAT, UDP. Both clients share one IPv4 address, and the router rewrites a port to tell them apart.
- Stateful NAT64 with PAT, ping. ICMPv6 Echo becomes ICMP Echo, and the echo identifier plays the role of the port.
- Stateless NAT64, UDP. Each client's IPv6 address has an IPv4 address built in, so the router needs no table at all.
Each capture is drawn as an annotated sequence diagram. Each participant gets a lane, each message is an arrow numbered as in Wireshark, and each carries a caption saying what it does. Every diagram comes as an interactive viewer, an HTML page, and a printable PDF. In the viewer and the HTML page, clicking any message opens its full Wireshark field tree.
๐ก Read the walkthrough and a diagram side by side: open the interactive diagram in a split-screen window, or open the HTML version in a new tab and snap the two windows side by side. Each section below links its own diagram.
What is NAT64?
NAT64 is a translator that lets IPv6-only hosts reach IPv4-only servers by converting each packet between IPv6 and IPv4 headers. It sits at the edge of an IPv6-only network, on the path to the IPv4 Internet. The payload, such as a UDP datagram or a ping, passes through unchanged apart from its checksum.
Several related terms appear throughout:
- NAT and PAT. NAT (Network Address Translation) rewrites IP addresses as packets cross a router. PAT (Port Address Translation, also called overloading) lets many inside hosts share one outside address, told apart by their transport ports. Home routers do NAT44 with PAT: IPv4 to IPv4.
- SIIT (Stateless IP/ICMP Translation). The header-translation algorithm itself: how to turn an IPv6 header into an IPv4 header and back, and how to convert ICMPv6 messages to ICMP and back. RFC 7915 defines it; it replaced RFC 6145 in June 2016.
- Stateful NAT64. SIIT plus a table of mappings, like NAT44 with PAT: many IPv6 hosts share a few IPv4 addresses (RFC 6146).
- Stateless NAT64. SIIT with addresses mapped by arithmetic alone: each IPv6 host gets its own IPv4 address, written into its IPv6 address.
- ICMP and ICMPv6. The control-message protocols of IPv4 and IPv6, carrying ping (Echo Request and Echo Reply) and error reports. They do the same jobs with different type numbers.
- DNS64. A DNS server that makes up IPv6 addresses for IPv4-only names, so that applications find the NAT64 path (RFC 6147). More on DNS64 below.
RFC 6144 describes the overall framework.
What is 64:ff9b::/96?
64:ff9b::/96 is the NAT64 Well-Known Prefix: an IPv6 prefix reserved for representing IPv4 addresses inside IPv6 (RFC 6052 section 2.1). With a /96 prefix, the IPv4 address fills the last 32 bits (section 2.2). The clients in the stateful captures reach 198.51.100.2 by sending to 64:ff9b::c633:6402:
| Part | Bits | Value |
|---|---|---|
| Well-Known Prefix | 0โ95 | 64:ff9b:: |
| IPv4 address, in hex | 96โ127 | c633:6402 = c6.33.64.02 = 198.51.100.2 |
The client needs no NAT64 support. It sends to 64:ff9b::c633:6402 like any IPv6 address, and the network routes 64:ff9b::/96 to the NAT64 router. RFC 6052 calls an address like this, which stands for an IPv4 host, an IPv4-converted address.
An operator can also use a network-specific prefix from their own address space, as the stateless capture does with fc00:6464::/96. Two rules decide the choice:
- The Well-Known Prefix may represent only global IPv4 addresses. RFC 6052 section 3.1 forbids it for private and special-purpose addresses and says translators must drop such packets. The lab's
198.51.100.2is a documentation address, which is on that forbidden list, so read it as a stand-in for a real public server. RFC 6052's own examples do the same. The Cisco router in the lab translated it anyway. - To reach private IPv4 addresses, use a network-specific prefix or
64:ff9b:1::/48, which RFC 8215 reserves for local translation and exempts from that rule.
How were the captures made?
Each capture holds both sides of the translator. The pcapng file header shows that Wireshark merged it from two captures, 1.pcapng and 2.pcapng, taken on the same Windows host. The MAC addresses show the two sides: the clients' IPv6 frames run from aa:bb:cc:00:01:20 to the router's aa:bb:cc:00:03:20, and the IPv4 frames from the router's aa:bb:cc:00:03:30 to the server's aa:bb:cc:00:02:30. The aa:bb:cc addresses are typical of Cisco IOS images running in an emulator.
Both source captures used one host clock, so the frame order across the translator is real. The gaps between a packet and its translation on the other side, 36 to 348 ยตs in the three main captures, are an emulated router's timing on a merged file. Treat them as "well under a millisecond", not as a translation benchmark.
Both "clients" send from the same MAC address, so they are two addresses on one lab device. To the translator they are separate IPv6 hosts, which is what matters here.
Why does the diagram show a NAT64 router lane?
The translator owns no address that appears in these packets. On the IPv6 side, the clients address their packets to the server's synthesized address, 64:ff9b::c633:6402. On the IPv4 side, the packets come from the NAT address, 203.0.113.44. Drawn literally, the IPv6 arrows would end at a "server" lane, and the IPv4 arrows would start from a separate "NAT" lane.
The diagrams instead map both addresses to one NAT64 router lane between the clients and the server, because that is where the packets physically go: every IPv6 frame is addressed to the router's MAC, and every IPv4 frame leaves from it. The captions and the address fields beside each arrow keep the real addresses in view.
Capture 1: stateful NAT64 with PAT (UDP)
Capture 1 has eight frames over 2.6 seconds. Each client sends one 16-byte UDP datagram from port 4001 to the server's port 5001, and the server echoes it back. The router translates every packet both ways and puts both clients behind one IPv4 address, 203.0.113.44.
How does NAT64 translate an IPv6 packet to IPv4?
The router replaces the 40-byte IPv6 header with a 20-byte IPv4 header, takes the IPv4 destination from the last 32 bits of the IPv6 destination, and substitutes one of its own IPv4 addresses for the source. The UDP ports and data pass through; the UDP checksum is recomputed. Frames 1 and 2 are the same datagram before and after:
| Field | Frame 1 (IPv6, from Client 1) | Frame 2 (IPv4, to the server) | Why |
|---|---|---|---|
| Source address | 2001:db8:1:4::1 | 203.0.113.44 | Stateful mapping, stored in the router's table |
| Destination address | 64:ff9b::c633:6402 | 198.51.100.2 | Last 32 bits of the IPv6 address (RFC 6052) |
| Source port | 4001 | 4001 | Free, so the router kept it |
| Hop limit / TTL | 64 | 63 | The translator is a router: one decrement (RFC 7915 section 5.1) |
| Header size | 40 bytes | 20 bytes | Payload length 24 becomes total length 44 |
| Identification | none in IPv6 | 0 | The translator's choice; see below |
| Don't Fragment (DF) | none in IPv6 | set | The translator's choice; see below |
| Traffic class / TOS | 0 | 0 | Copied |
| UDP checksum | 0x7dcc | 0x6f5e | Its pseudo-header includes the IP addresses |
Expand the IPv6 header and the UDP header in frame 1. Wireshark recognizes the Well-Known Prefix and shows the embedded IPv4 address:
frame : Frame 1: Packet, 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface -, id 0
Interface id : 0 (-)
eth : Ethernet II, Src: aa:bb:cc:00:01:20, Dst: aa:bb:cc:00:03:20
Destination : aa:bb:cc:00:03:20
Source : aa:bb:cc:00:01:20
ipv6 : Internet Protocol Version 6, Src: 2001:db8:1:4::1, Dst: 64:ff9b::c633:6402
.... 0000 0000 .... .... .... .... .... = Traffic Class : 0x00 (DSCP: CS0, ECN: Not-ECT)
Source Address : 2001:db8:1:4::1
Special-Purpose Allocation : Documentation
Source or Destination Address : 2001:db8:1:4::1
Special-Purpose Allocation : Documentation
Destination Address : 64:ff9b::c633:6402
Special-Purpose Allocation : IPv4-IPv6 Translat.
Source or Destination Address : 64:ff9b::c633:6402
Special-Purpose Allocation : IPv4-IPv6 Translat.
udp : User Datagram Protocol, Src Port: 4001, Dst Port: 5001
Timestamps
fake-field-wrapper : fake-field-wrapper
data
Frame 2 shows the same datagram after translation. Compare the addresses, the TTL, the flags, and the checksum:
frame : Frame 2: Packet, 58 bytes on wire (464 bits), 58 bytes captured (464 bits) on interface -, id 0
Interface id : 0 (-)
eth : Ethernet II, Src: aa:bb:cc:00:03:30, Dst: aa:bb:cc:00:02:30
Destination : aa:bb:cc:00:02:30
Source : aa:bb:cc:00:03:30
ip : Internet Protocol Version 4, Src: 203.0.113.44, Dst: 198.51.100.2
Differentiated Services Field : 0x00 (DSCP: CS0, ECN: Not-ECT)
010. .... = Flags : 0x2, Don't fragment
udp : User Datagram Protocol, Src Port: 4001, Dst Port: 5001
Timestamps
fake-field-wrapper : fake-field-wrapper
data
The UDP checksum is the only change inside the datagram. UDP computes its checksum over a pseudo-header that includes the source and destination IP addresses, so new addresses mean a new checksum even when no byte of the payload changes. RFC 6146 section 3.7 requires the update.
The reply, frames 3 and 4, runs the other way. The router looks up 203.0.113.44:4001 in its table, finds [2001:db8:1:4::1]:4001, and rebuilds an IPv6 packet from 64:ff9b::c633:6402, the same address the client sent to. The server's TTL 255 becomes hop limit 254, and the flow label is 0, as RFC 7915 section 4.1 requires. The client sees an ordinary IPv6 reply, 530 ยตs after its request.
What state does a stateful NAT64 router keep?
For each mapping, the router remembers an IPv6 address and port, and the IPv4 address and port it chose for them. RFC 6146 section 3.1 calls this table the Binding Information Base (BIB) and keeps one for TCP, one for UDP, and one for ICMP. Section 3.2 adds session tables that also record the remote end. After frame 2, the UDP BIB holds:
| IPv6 side | IPv4 side |
|---|---|
[2001:db8:1:4::1]:4001 | 203.0.113.44:4001 |
The table is why only the IPv6 side can start a conversation (RFC 6146 section 1.1). An IPv4 packet that arrives for 203.0.113.44 with no matching entry has nowhere to go, unless an operator has configured a static mapping.
A UDP mapping lasts at least 2 minutes after the last packet, and RFC 6146 recommends a default of at least 5 minutes (section 3.5.1).
Why did port 4001 become 1024?
Because 203.0.113.44:4001 was already taken. Client 2 also sent from port 4001 (frame 5). Two clients can't share one IPv4 address and port, or the router couldn't tell their replies apart. The router gave Client 2 port 1024 instead (frame 6), and the table gained a second entry, [2001:db8:1:4::2]:4001 โ 203.0.113.44:1024. The reply to port 1024 (frame 7) goes back to Client 2 at port 4001 (frame 8). Client 2 never learns its port was rewritten.
RFC 6146 section 3.5.1.1 leaves the choice of port to the router, with two recommendations: stay in the same range as the original port (1024โ65535 here, which 1024 is), and keep its parity, odd or even. Because 4001 is odd and 1024 is even, this router ignores the parity advice. Keeping the original port when it is free is the router's own behavior, not a requirement.
The NAT44 comparison capture shows the pattern the other way around: there, the first client got 1024, and the second kept 4001. Both captures fit "keep the port if it is free; otherwise take the lowest free port from 1024 up", but two samples can't prove the rule. Perhaps something else was holding 4001 when the NAT44 capture began.
Capture 2: ping through stateful NAT64
Capture 2 uses the same lab and the same PAT address, 203.0.113.44. Each client sends one ping with 52 bytes of data; the capture has eight frames over 1.2 seconds.
How does NAT64 handle ping (ICMP)?
It translates the message, not just the header. ICMPv6 and ICMP use different type numbers for the same messages, so the router changes Echo Request type 128 to type 8 on the way out, and Echo Reply type 0 to type 129 on the way back (RFC 7915 sections 5.2 and 4.2). It also recomputes the checksum, for a reason specific to ICMP:
- The ICMPv6 checksum covers a pseudo-header with the IPv6 source and destination addresses, like UDP.
- The ICMP checksum for IPv4 covers only the ICMP message.
So the router must take the addresses out of the checksum going to IPv4 and put them back going to IPv6. The checksums in the capture show the arithmetic:
| Frame | Message | Checksum | Change from the request |
|---|---|---|---|
| 1 | ICMPv6 Echo Request (128) | 0x7a55 | |
| 2 | ICMP Echo Request (8) | 0x4ac1 | Pseudo-header removed, type changed |
| 3 | ICMP Echo Reply (0) | 0x52c1 | +0x0800: type 8 became 0 |
| 4 | ICMPv6 Echo Reply (129) | 0x7955 | โ0x0100 from frame 1: type 128 became 129 |
Frames 3 and 4 differ from their requests only by the type byte. Swapping source and destination doesn't change the pseudo-header's sum, so the type is the only thing left to move the checksum.
What does NAT64 use instead of a port for ping?
The echo identifier. Ping has no ports, so RFC 6146 section 3.1 keeps a separate ICMP table that maps an (IPv6 address, identifier) pair to an (IPv4 address, identifier) pair. Client 1 pings with identifier 0x2098 and Client 2 with 0x0391. Both leave as 203.0.113.44, and the identifier tells their replies apart.
The two identifiers didn't collide, so the router kept both. RFC 6146 section 3.5.3 lets the router choose any free identifier. Had both clients picked the same one, it would have rewritten one, just as it rewrote port 4001 in capture 1.
ICMP mappings are short-lived: the default lifetime is 60 seconds (RFC 6146 section 3.5.3), against at least 2 minutes for UDP.
The translated pings carry TTL 63, Identification 0, and DF set, like the UDP datagrams in capture 1. The server's echo replies carry Identification 0 and DF set too, but for a different reason: the server built each reply from the request's header. Its UDP replies in capture 1 use a running Identification and DF clear.
Capture 3: stateless NAT64
Capture 3 repeats the UDP exchange of capture 1, eight frames over 3.1 seconds, with the router configured for stateless translation. What changes on the wire is the clients' IPv6 addresses: each now has an IPv4 address built in.
Both clients' addresses sit under the network-specific prefix fc00:6464::/96, and each ends in an IPv4 address:
| IPv6 address | Last 32 bits | IPv4 address | Role |
|---|---|---|---|
fc00:6464::cb00:7101 | cb.00.71.01 | 203.0.113.1 | Client 1 |
fc00:6464::cb00:7102 | cb.00.71.02 | 203.0.113.2 | Client 2 |
fc00:6464::c633:6402 | c6.33.64.02 | 198.51.100.2 | The server, as seen from IPv6 |
RFC 6052 calls the clients' addresses IPv4-translatable: IPv6 addresses given to IPv6 hosts so that a stateless translator can map them to IPv4. To translate, the router strips the prefix from both addresses. On the way back, it restores the prefix. It never consults a table, and it would give the same answer after a reboot.
Wireshark shows no embedded IPv4 address for these packets: it recognizes only the Well-Known Prefix, not a network-specific one.
The rest of the header translation is identical to capture 1: TTL 63, Identification 0, DF set, new UDP checksum (0xaebe to 0x6f89). The ports are not touched. Client 2 also sends from port 4001, but it leaves as 203.0.113.2:4001, because it doesn't share an address with anyone.
What is the difference between stateful and stateless NAT64?
Stateful NAT64 keeps a table and lets many IPv6 hosts share a few IPv4 addresses. Stateless NAT64 keeps no table, but gives every IPv6 host its own IPv4 address. The header translation (SIIT) is the same in both; only the address mapping differs.
| Stateful NAT64 | Stateless NAT64 | |
|---|---|---|
| Specification | RFC 6146 (uses SIIT for headers) | RFC 7915 (SIIT) |
| IPv6 host addresses | Any IPv6 address | IPv4-translatable: an IPv4 address embedded under the prefix |
| IPv4 source chosen by | A table entry made from the first packet | The last 32 bits of the IPv6 source |
| Saves IPv4 addresses | Yes, with PAT: many hosts per address | No: one IPv4 address per host |
| Port rewriting | Yes, when ports collide (capture 1, frame 6) | Never (capture 3, frame 6) |
| Who can start a conversation | IPv6 side only, unless static mappings exist | Either side (RFC 6144 section 3.2.1) |
| Router restart or failover | Loses the table unless it is synchronized to a standby; open conversations break | Nothing lost |
Stateless translation suits IPv6-only servers or devices, such as those in an IPv6-only data center, that must be reachable from IPv4, where there are enough IPv4 addresses to give each one its own. Stateful translation suits the common case: many IPv6-only clients reaching the IPv4 Internet through a handful of public addresses.
The captures side by side
The table compares the three published captures with the pool and NAT44 captures from the same archive. Client 1 and Client 2 are separated by a slash.
| Capture | IPv6 source โ destination | IPv4 source โ destination | Port or echo ID, before โ after | What produced the IPv4 source |
|---|---|---|---|---|
| Stateful PAT, UDP (capture 1) | 2001:db8:1:4::1 / ::2 โ 64:ff9b::c633:6402 | 203.0.113.44 / 203.0.113.44 โ 198.51.100.2 | 4001 โ 4001 / 4001 โ 1024 | RFC 6146 UDP table, one shared address |
| Stateful PAT, ping (capture 2) | 2001:db8:1:4::1 / ::2 โ 64:ff9b::c633:6402 | 203.0.113.44 / 203.0.113.44 โ 198.51.100.2 | ID 0x2098 / 0x0391, both kept | RFC 6146 ICMP table, identifier as the port |
Stateful pool, UDP (nat64_pool_udp) | 2001:db8:1:4::1 / ::2 โ 64:ff9b::c633:6402 | 203.0.113.2 / 203.0.113.3 โ 198.51.100.2 | 4001 kept / 4001 kept | RFC 6146 table, one pool address per client |
Stateful pool, ping (nat64_pool_icmp) | 2001:db8:1:4::1 / ::2 โ 64:ff9b::c633:6402 | 203.0.113.3 / 203.0.113.2 โ 198.51.100.2 | ID 0x08b5 / 0x060c, both kept | RFC 6146 table, one pool address per client |
| Stateless, UDP (capture 3) | fc00:6464::cb00:7101 / ::cb00:7102 โ fc00:6464::c633:6402 | 203.0.113.1 / 203.0.113.2 โ 198.51.100.2 | 4001 kept / 4001 kept | RFC 7915 and RFC 6052: last 32 bits of the IPv6 source |
NAT44 PAT, UDP (nat44_pat_udp) | (IPv4 inside: 10.1.4.1 / 10.1.4.2) | 203.0.113.44 / 203.0.113.44 โ 198.51.100.2 | 4001 โ 1024 / 4001 โ 4001 | NAT44 table, one shared address |
The pool rows show why pool translation doesn't need its own diagram. On the IPv4 side it looks like stateless translation: each client gets its own IPv4 address and keeps its port. The difference is inside the router, which picks a free pool address and stores the mapping. Nor is the assignment order fixed: Client 1 got 203.0.113.2 in the UDP capture and 203.0.113.3 in the ping capture.
In every NAT64 capture, the destination was produced the same way, by taking the last 32 bits of the IPv6 destination.
Why are translated packets sent with DF set and Identification 0?
Because this router follows RFC 6145, the translation standard that RFC 7915 replaced in 2016. Every IPv4 packet the router built from IPv6 carries Identification 0 and the Don't Fragment (DF) flag set. RFC 6145 section 5.1 specified exactly that for small packets: Identification "All zero", and DF "set to one". (It allowed an exception only for packets between 88 and 1280 bytes, and these are 44 and 80 bytes.)
RFC 7915 section 5.1 reverses both rules. DF must be clear for any translated packet of 1260 bytes or less, and the Identification comes from a generator at the translator. Section 5 makes the DF rule a MUST. A translator following RFC 7915 would send these packets with DF clear and a nonzero Identification.
The reason for the change is fragmentation. With DF set, an IPv4 router whose next link has a smaller MTU must drop the packet and send back an ICMP "Fragmentation Needed" error. If a firewall blocks that error, the packet silently disappears. Clearing DF on small packets lets IPv4 routers fragment them instead, and the generated Identification lets the receiver reassemble the pieces.
In the other direction, the same router behaves like RFC 7915. The server's UDP replies have DF clear, and the translated IPv6 replies carry no Fragment Header: their payload length, 24, is the UDP datagram alone. RFC 6145 section 4 said a translator SHOULD add a Fragment Header whenever DF is clear, while allowing an option to omit it on unfragmented packets. RFC 7915 section 4 adds one only when the packet is already fragmented or too large for IPv6's 1280-byte minimum MTU.
RFC 6146, the stateful NAT64 standard, still points to RFC 6145 for header translation, because it predates RFC 7915. When you compare a router's behavior with the RFCs, check which one its documentation follows.
Why does NAT64 need DNS64?
Because applications look up names, not addresses, and an IPv4-only server has no IPv6 address in DNS. A query for its AAAA record (the IPv6 address record) comes back empty, so an IPv6-only client has nothing to connect to. DNS64 fills the gap. When a name has no AAAA record but has an A record (the IPv4 address record), the DNS64 server builds an AAAA record from it by placing the IPv4 address under the NAT64 prefix (RFC 6147 section 5.1.6). A lookup of a server at 198.51.100.2 returns 64:ff9b::c633:6402, and the client's packets flow to the NAT64 router.
DNS64 synthesizes nothing when a real AAAA record exists (section 5.1.1), so dual-stack servers are reached over native IPv6.
These captures contain no DNS traffic. The clients were told to send to 64:ff9b::c633:6402 and fc00:6464::c633:6402 directly, the job DNS64 does in a real network. To see how DNS resolution itself works, from root servers to the final answer, see DNS Recursive Resolution, Packet by Packet.
DNS64 can't help an application that uses an IPv4 address literal, such as http://198.51.100.2/, or that opens only IPv4 sockets. For those, RFC 6877 describes 464XLAT: a stateless translator on the host or home router (the CLAT) turns the application's IPv4 packets into IPv6, and the provider's stateful NAT64 (the PLAT) turns them back into IPv4. Mobile networks commonly use it to run IPv6-only.
NAT64 vs NAT44
NAT44, the NAT in nearly every home router, translates an IPv4 address to another IPv4 address. NAT64 translates between IPv6 and IPv4. The nat44_pat_udp comparison capture runs the same UDP test through NAT44 with PAT, from the IPv4 clients 10.1.4.1 and 10.1.4.2 to the same server:
On the IPv4 side, NAT44 and NAT64 produce the same UDP datagrams. NAT44's frame 2 and NAT64's frame 6 both leave 203.0.113.44:1024 for 198.51.100.2:5001 with checksum 0x7aff and identical data. NAT44's frame 6 matches NAT64's frame 2 the same way, with checksum 0x6f5e. The server can't tell which kind of client is behind the address. Only the IPv4 headers differ:
| NAT44 PAT | NAT64 PAT | |
|---|---|---|
| Inside packets | IPv4 | IPv6 |
| Destination the client uses | The server's real address, 198.51.100.2 | A synthesized address, 64:ff9b::c633:6402 |
| What the router rewrites | Source address and port | The whole IP header, plus the source port when needed |
| Outside TTL | 254 (client sent 255) | 63 (client sent hop limit 64) |
| Outside DF | Clear, as the client sent it | Set, the translator's choice |
| Checksums | UDP updated for the new address and port; ICMP untouched | UDP updated; ICMP rebuilt for the new type and pseudo-header |
| Needs DNS help | No | Yes, DNS64, unless clients use the prefix directly |
The ICMP difference shows in the nat44_pat_icmp capture: its translated pings keep their checksums, because ICMP for IPv4 covers no addresses and the router kept the identifiers. For how NAT44 affects other protocols, such as IPsec, see IPsec ESP Transport vs Tunnel Mode, and NAT Traversal.
Troubleshooting: why can't an IPv6-only host reach an IPv4 server?
First make sure the host has an IPv6 address, a default route, and a DNS server; DHCPv6 vs SLAAC covers where each comes from. Then work along the path the packet takes:
- Does the name resolve to a NAT64 address? Query the AAAA record through the client's resolver. No answer means DNS64 is missing or not in use. An answer outside your NAT64 prefix means a real AAAA exists, and the problem is native IPv6, not NAT64.
- Is the prefix routed to the translator? The client's network needs a route for
64:ff9b::/96(or your network-specific prefix) toward the NAT64 router. A capture on the IPv6 side should show the packets reaching the router's MAC, as frame 1 does here. - Is the IPv4 address allowed under that prefix? A conforming translator drops Well-Known Prefix packets for private or special-purpose IPv4 addresses (RFC 6052 section 3.1). Use a network-specific prefix or
64:ff9b:1::/48for those. - Does the translated packet leave? Capture on the IPv4 side, as these captures do. No packet there means the router didn't translate the IPv6 packet: check the NAT64 configuration, the rule that selects which IPv6 sources to translate, and whether the pool or PAT address is exhausted.
- Does the reply come back to the NAT address? The server's reply must route to the PAT or pool address (
203.0.113.44here). If it routes elsewhere, the mapping is never used. - Is the mapping still alive? Long-idle UDP or ping flows lose their entries (at least 2 minutes for UDP, 60 seconds by default for ICMP). A reply after that has nowhere to go.
- Do large packets fail while small ones work? Look for ICMP "Fragmentation Needed" or ICMPv6 "Packet Too Big" errors and check DF on the translated packets. A translator that sets DF on everything, as this one does, depends on those errors reaching the sender.
Frequently asked questions
Is NAT64 the same as NAT-PT? No. NAT-PT (RFC 2766) was an earlier IPv6-to-IPv4 translator with its own DNS handling built in. RFC 4966 documented its problems, including that built-in DNS handling, and moved it to historic status; NAT64 with DNS64 replaced it.
Does the IPv6 client need to support NAT64? No. With DNS64, the client sees an ordinary IPv6 address and sends ordinary IPv6 packets. The network does the rest: it routes the prefix to the translator.
Can an IPv4 host start a connection to an IPv6 host through NAT64? With stateful NAT64, only through a static mapping, because a dynamic mapping exists only after the IPv6 side sends first. With stateless NAT64, yes: every IPv6 host has a fixed IPv4 address.
Why is the hop limit 64 but the TTL 63? The translator is a router, so it decrements the hop count once as it forwards the packet (RFC 7915 section 5.1). The same happens on the way back: TTL 255 becomes hop limit 254.
What happens to the IPv6 flow label? It has no IPv4 equivalent, so it is dropped going to IPv4 and set to 0 coming back (RFC 7915 section 4.1).
Does NAT64 work for TCP? Yes. TCP is handled like UDP: a TCP table maps addresses and ports, and the checksum is updated. These captures use UDP and ping only.
What is the difference between 64:ff9b::/96 and 64:ff9b:1::/48? 64:ff9b::/96 is the global Well-Known Prefix, for public IPv4 addresses only. 64:ff9b:1::/48 is reserved for local translation inside one network and can represent private IPv4 addresses (RFC 8215).
Takeaways
- NAT64 rebuilds the IP header and leaves the payload alone. Addresses, TTL, flags, lengths, and checksums change. The data crosses unchanged, and so do the ports unless PAT must resolve a collision.
- The destination is arithmetic; the source is a choice. The IPv4 destination is always the last 32 bits of the IPv6 destination. The IPv4 source comes from a table in stateful NAT64, and from the host's own address in stateless NAT64.
- PAT tells clients apart by port, and ping by echo identifier. Two clients sending from port 4001 left as ports 4001 and 1024.
- Checksums change even when the payload doesn't. UDP and ICMPv6 checksums cover the IP addresses; ICMP for IPv4 doesn't, so ping checksums are rebuilt in both directions.
- Stateless NAT64 saves no IPv4 addresses. It trades the table for one IPv4 address per IPv6 host and lets either side start.
- Check which RFC your translator follows. This router sets DF and Identification 0 on every translated packet, as RFC 6145 said. RFC 7915, the current standard, says to clear DF on packets of 1260 bytes or less.
- DNS64 makes NAT64 usable. Without it, applications never learn the synthesized address. Use 464XLAT for applications that need IPv4 itself.