IPv6 NAT64 IPv4
IPv4 & IPv6

How Does an IPv6-Only Server Reach an IPv4-Only API?

BYOIP.info Editorial4 December 2026 5 min read Last technically reviewed 4 December 2026

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.

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::20 running in an IPv6-only subnet with no IPv4 address configured.
  • Target API hostname (example): api.example.net, which publishes only an IPv4 A record pointing to 192.0.2.80 and has no AAAA record.
  • 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:

  1. DNS64 (RFC 6147) synthesizes the IPv6 destination: The IPv6-only server asks its DNS64-enabled resolver for an AAAA record for api.example.net. Authoritative DNS returns no AAAA record, so the DNS64 resolver queries for an A record, receives 192.0.2.80, and embeds those 32 bits into the configured prefix 64:ff9b::/96. The server receives the synthesized IPv6 address 64:ff9b::192.0.2.80 (hex notation 64:ff9b::c000:250).
  2. Routing directs 64:ff9b::/96 to the NAT64 gateway: A route in the Virtual Private Cloud (VPC) steers packets destined for 64:ff9b::/96 to the NAT64 gateway. Without this route, the synthesized DNS answer still succeeds, yet packets have nowhere to cross into IPv4.
  3. Stateful NAT64 (RFC 6146) translates both directions: The gateway strips the 64:ff9b::/96 prefix to recover destination IPv4 192.0.2.80, opens the IPv4 connection using its configured NAT IPv4 address 198.51.100.25 and an allocated source port, and records that binding in its translation state table. When the API replies to 198.51.100.25, the gateway looks up the binding and translates the reply back to an IPv6 packet from 64:ff9b::192.0.2.80 to 2001: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:

PhaseIPv6-only server side (example)IPv4 API side (example)Result
1. DNS answerQueries AAAA for api.example.net; DNS64 returns synthesized 64:ff9b::192.0.2.80Authoritative DNS serves only A 192.0.2.80 (no API traffic yet)Server now has an IPv6 destination address to dial
2. Outbound translationSrc 2001:db8:10::20 -> Dst 64:ff9b::192.0.2.80 reaches NAT64 gatewayNAT64 opens IPv4 connection: Src 198.51.100.25 -> Dst 192.0.2.80API sees example NAT IPv4 198.51.100.25 as the client source
3. API replyNAT64 delivers Src 64:ff9b::192.0.2.80 -> Dst 2001:db8:10::20API replies Src 192.0.2.80 -> Dst 198.51.100.25Gateway matches its translation state and completes the request
Route to translator offDNS64 still returns 64:ff9b::192.0.2.80, but packets drop before reaching NAT64No IPv4 request arrives at 192.0.2.80DNS 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/v1 bypass DNS64 synthesis completely on an IPv6-only host.

FAQ

When a Website Has IPv4 and IPv6, Which One Does Your Browser Use?
What Is NAT, and How Does It Work?
What Is DNS? How Domain Names Connect to IP Addresses
What Is IP Allowlisting?
Google Cloud - Connect IPv6-only workloads to IPv4-only services (DNS64 and NAT64)
RFC 6147 - DNS64: DNS Extensions for Network Address Translation from IPv6 Clients to IPv4 Servers
RFC 6146 - Stateful NAT64: Network Address and Protocol Translation from IPv6 Clients to IPv4 Servers

Ready to see where BYOIP is supported?

Continue the series