How Does an IPv6-Only Server Reach an IPv4-Only API?
Key takeaways
- DNS64 synthesizes an IPv6 destination (such as 64:ff9b::192.0.2.80) when a hostname has an A record and no AAAA record.
- A working route to the NAT64 gateway is separate from DNS64: without that route, the synthesized DNS answer still appears while the API receives no request.
- Stateful NAT64 opens the IPv4 connection from its configured NAT IPv4 egress address and maps returning replies back to the IPv6-only server.
- API operators enforcing IP allowlists should allowlist the NAT64 gateway public IPv4 egress address rather than the server IPv6 address.
On this page
An IPv6-only server has no IPv4 interface of its own, yet it still needs to call partner APIs that publish only an IPv4 address. By pairing DNS64 with a stateful NAT64 gateway, your network can synthesize an IPv6 destination from the API’s A record, translate the packet to IPv4 at the gateway, and return the reply seamlessly.
Unlike a dual-stack browser that already has both IPv4 and IPv6 connectivity and races them side by side (see When a Website Has IPv4 and IPv6, Which One Does Your Browser Use?), an IPv6-only workload cannot fall back to a local IPv4 stack. Translation across address families has to happen in the network.
The starting setup and example addresses
Follow one outbound HTTPS call from an IPv6-only compute instance to an external IPv4-only API. All addresses below are documentation examples (RFC 3849 and RFC 5737) modeled on Google Cloud’s DNS64 and Public NAT (NAT64) walkthrough:
- IPv6-only server (example):
2001:db8:10::20running in an IPv6-only subnet with no IPv4 address configured. - Target API hostname (example):
api.example.net, which publishes only an IPv4Arecord pointing to192.0.2.80and has noAAAArecord. - DNS64 prefix (standard well-known prefix):
64:ff9b::/96, defined for IPv4-embedded IPv6 addresses in RFC 6147. - NAT64 gateway public IPv4 egress (example):
198.51.100.25, configured on Google Cloud Public NAT as the external IPv4 address for translated outbound connections.
How DNS64 and stateful NAT64 work together
Two separate components split the job:
- DNS64 (RFC 6147) synthesizes the IPv6 destination: The IPv6-only server asks its DNS64-enabled resolver for an
AAAArecord forapi.example.net. Authoritative DNS returns noAAAArecord, so the DNS64 resolver queries for anArecord, receives192.0.2.80, and embeds those 32 bits into the configured prefix64:ff9b::/96. The server receives the synthesized IPv6 address64:ff9b::192.0.2.80(hex notation64:ff9b::c000:250). - Routing directs
64:ff9b::/96to the NAT64 gateway: A route in the Virtual Private Cloud (VPC) steers packets destined for64:ff9b::/96to the NAT64 gateway. Without this route, the synthesized DNS answer still succeeds, yet packets have nowhere to cross into IPv4. - Stateful NAT64 (RFC 6146) translates both directions: The gateway strips the
64:ff9b::/96prefix to recover destination IPv4192.0.2.80, opens the IPv4 connection using its configured NAT IPv4 address198.51.100.25and an allocated source port, and records that binding in its translation state table. When the API replies to198.51.100.25, the gateway looks up the binding and translates the reply back to an IPv6 packet from64:ff9b::192.0.2.80to2001:db8:10::20.
In Google Cloud’s documented Public NAT setup (Connect IPv6-only workloads to IPv4-only services), Cloud DNS provides DNS64 resolution while Cloud NAT performs stateful NAT64 using allocated external IPv4 addresses (including static or BYOIP-backed external IPv4 pools when your organization needs stable egress).
Follow the request across DNS64 and NAT64
The table below tracks source and destination addresses across all three phases for example hostname api.example.net (A 192.0.2.80, no AAAA). All IP addresses are labeled examples:
| Phase | IPv6-only server side (example) | IPv4 API side (example) | Result |
|---|---|---|---|
| 1. DNS answer | Queries AAAA for api.example.net; DNS64 returns synthesized 64:ff9b::192.0.2.80 | Authoritative DNS serves only A 192.0.2.80 (no API traffic yet) | Server now has an IPv6 destination address to dial |
| 2. Outbound translation | Src 2001:db8:10::20 -> Dst 64:ff9b::192.0.2.80 reaches NAT64 gateway | NAT64 opens IPv4 connection: Src 198.51.100.25 -> Dst 192.0.2.80 | API sees example NAT IPv4 198.51.100.25 as the client source |
| 3. API reply | NAT64 delivers Src 64:ff9b::192.0.2.80 -> Dst 2001:db8:10::20 | API replies Src 192.0.2.80 -> Dst 198.51.100.25 | Gateway matches its translation state and completes the request |
| Route to translator off | DNS64 still returns 64:ff9b::192.0.2.80, but packets drop before reaching NAT64 | No IPv4 request arrives at 192.0.2.80 | DNS looks healthy while the outbound connection times out |
Step through each phase below and toggle the route to the NAT64 translator to inspect both sides of the packet:
DNS64 + NAT64 Request Walkthrough (Example Addresses)
Target api.example.net (example A 192.0.2.80, no AAAA) · example server 2001:db8:10::20 · example NAT IPv4 198.51.100.25.
NAT64 translates the outbound request to IPv4
Outbound translation succeeds. The API operator sees configured example NAT IPv4 198.51.100.25 as the client source to allowlist.
API sees example NAT IPv4 source 198.51.100.25.
IPv6-only server side (examples)
- Source
- 2001:db8:10::20 (example IPv6-only server)
- Destination
- 64:ff9b::192.0.2.80 (example synthesized IPv6)
The VPC route sends 64:ff9b::/96 traffic to the Google Cloud Public NAT (NAT64) gateway.
IPv4-only API side (examples)
- Source seen by API
- 198.51.100.25 (example configured NAT IPv4)
- Destination
- 192.0.2.80 (example IPv4-only API)
NAT64 strips 64:ff9b::/96 to recover 192.0.2.80, translates the source to example NAT IPv4 198.51.100.25, and stores the session in its translation table.
Which IP address the API operator should allowlist
If the external IPv4-only API restricts access by source IP, the API operator looks at the IPv4 egress address configured on the NAT64 gateway (198.51.100.25 in our example), not the IPv6-only server’s address (2001:db8:10::20).
Two practical checks help avoid allowlist surprises:
- Reserve static egress IPv4 addresses on the NAT64 gateway: Automatic ephemeral NAT addresses can change when capacity scales or gateways recreate. Pinning static external IPv4 addresses (or BYOIP addresses where supported) gives the partner API a stable allowlist target.
- Watch for literal IPv4 addresses in application code: DNS64 only helps when the client resolves a hostname. Hardcoded IPv4 literals such as
https://192.0.2.80/v1bypass DNS64 synthesis completely on an IPv6-only host.
FAQ
Related resources
Ready to see where BYOIP is supported?
Continue the series
Who Can Sign a Letter of Authorization for a BYOIP Prefix?
Your team leases a /24 and the new network asks for an LOA. Find out whose authority the letter must carry and what the provider checks.
6 min read · Updated 4 December 2026
Read articleHow Do You Take a BYOIP Range Back Out of AWS?
A workload has moved, but one Elastic IP is still allocated. Follow an EC2 /24 through the remaining steps before the range can leave AWS.
5 min read · Updated 4 December 2026
Read article