---
title: "IPv6 Egress and IPv4-Only Allowlists"
description: "Why a dual-stack app reaches an IPv4-only allowlist over IPv6 and gets blocked, how Happy Eyeballs decides, how to force IPv4, and what AWS and GCP do."
canonical: https://fixedmark.com/blog/ipv6-egress-and-ipv4-only-allowlists
updated: 2026-11-10
source: Fixedmark (https://fixedmark.com), BitMask LLP
---

Networking · 11 min read

# IPv6 Egress and IPv4-Only Allowlists

When the partner's hostname has both A and AAAA records and your host has a global IPv6 address, most clients connect over IPv6, so the partner sees an IPv6 source that is not on its IPv4-only allowlist. Fix it by forcing IPv4 in the client that makes the allowlisted call, or by sending that call through an egress path that only speaks IPv4.

## Why the partner sees an address you never registered

A TCP connection uses one address family end to end. If your client connects to the partner's IPv6 address, the source is your IPv6 address. Your static IPv4, your Elastic IP, and your NAT gateway play no part in that connection. The partner's firewall compares an IPv6 source against a list of IPv4 entries, finds no match, and rejects the call.

Three things must be true for this to happen. The destination hostname publishes an AAAA record. Your host has a global IPv6 address and a route to the internet over it. Your client chooses the IPv6 address. Take away any one of them and the call goes out over IPv4.

That is why the failure often arrives without a code change on your side. Common triggers are:

- The partner moves its API behind a dual-stack load balancer or CDN, and its hostname gains AAAA records. The allowlist check behind it still holds IPv4 entries only.
- Someone enables IPv6 on your VPC or subnet, or on the platform your code runs on.
- You upgrade a runtime whose address selection changed. Node.js, for example, stopped reordering DNS results to put IPv4 first in v17, and turned on family autoselection by default in v20.
- You move the code from a laptop to a server, or from a server to a home line with native IPv6.

Many partners still accept IPv4 only. Kotak Neo's broker API is one example covered in the [Kotak Neo guide](https://fixedmark.com/docs/brokers/kotak-neo). If you are chasing a rejected broker order, the [broker IP error guide](https://fixedmark.com/blog/fixing-ip-not-whitelisted-errors-on-broker-apis) covers the other causes too.

## How clients choose between IPv6 and IPv4

Two standards decide the order. [RFC 6724](https://www.rfc-editor.org/rfc/rfc6724.html) defines default address selection. Its policy table gives the IPv6 default prefix `::/0` precedence 40 and the IPv4-mapped prefix `::ffff:0:0/96` precedence 35, so a host prefers IPv6 when it has a usable IPv6 source address. A host with no global IPv6 address sorts IPv4 first, which is why the same code behaves differently on two machines.

[RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html), Happy Eyeballs version 2, then races the families. The client sends the AAAA query first and the A query right after it. If the A answer comes first, it waits a short Resolution Delay, 50 ms recommended, for the AAAA answer. It sorts the addresses with RFC 6724, interleaves the families, and starts the first connection attempt. If that attempt has not finished after the Connection Attempt Delay, 250 ms recommended with a 100 ms minimum and a 2 second maximum, it starts the next one in parallel. The first connection to complete wins.

Racing is good for users and bad for allowlists. On a healthy dual-stack network IPv6 usually wins. When the IPv6 path is slow for a moment, IPv4 wins instead. So one request passes and the next is blocked, with no change anywhere. An intermittent 403 from an allowlisted partner on a dual-stack host is a strong hint that the family is flipping.

A successor, [Happy Eyeballs version 3](https://datatracker.ietf.org/doc/draft-ietf-happy-happyeyeballs-v3/), is still an Internet-Draft as of November 2026. It adds SVCB and HTTPS DNS records to the race. It does not change the core problem for allowlists.

_Default family behaviour in common clients, November 2026_

| Client                    | Default behaviour                                                                                                                 | Force IPv4                                                           |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| curl                      | Happy Eyeballs, 200 ms default timeout per the [curl man page](https://curl.se/docs/manpage.html)                                 | `-4` or `--ipv4`                                                     |
| Node.js 20 and later      | `autoSelectFamily` on by default, alternates families starting with the first address DNS returns, DNS order `verbatim` since v17 | `family: 4` on the connection, or `ipv4first` with autoselection off |
| Go `net/http`             | Fast Fallback (RFC 6555), the first resolved family is primary, 300 ms default `FallbackDelay`                                    | Dial `tcp4` instead of `tcp`                                         |
| Python requests (urllib3) | Tries `getaddrinfo` results in order, no racing                                                                                   | Restrict urllib3's address family to `AF_INET`                       |
| Python httpx              | Allows both families by default                                                                                                   | `local_address="0.0.0.0"` on the transport                           |
| Java                      | `java.net.preferIPv6Addresses` is `false`, so IPv4 addresses come first                                                           | `-Djava.net.preferIPv4Stack=true`                                    |

Java is the outlier. Its [networking properties](https://docs.oracle.com/en/java/javase/21/core/java-networking.html) prefer IPv4 addresses by default for backward compatibility, unless someone set `preferIPv6Addresses` to `true` or `system`. Node's per-attempt timeout for autoselection is set by `net.setDefaultAutoSelectFamilyAttemptTimeout()`. Node 26 reports 500 ms from `net.getDefaultAutoSelectFamilyAttemptTimeout()`, so check the value on the version you run.

## Find out which family your calls use

Check the destination first. If the partner's hostname has no AAAA record, IPv6 is not your problem and you can stop here.

**Terminal**

```bash
# Does the partner publish IPv6?
dig +short A api.partner.example
dig +short AAAA api.partner.example

# Which address did curl actually connect to?
curl -s -o /dev/null -w '%{remote_ip}\n' https://api.partner.example/

# What source address does an echo service see, per family?
curl -4 -s -H 'Accept: application/json' https://fixedmark.com/api/ip
curl -6 -s -H 'Accept: application/json' https://fixedmark.com/api/ip
```

The echo endpoint returns your address and its `version`, 4 or 6. If the `-6` call succeeds, your host can reach the internet over IPv6, and any client that prefers IPv6 will use it against a dual-stack partner. The [What's my IP tool](https://fixedmark.com/tools/whats-my-ip) shows the same in a browser.

Then run the check from the code path that calls the partner, not only from a shell. A shell on the same host can use a different client with different defaults. Call the echo endpoint with the same agent, transport, or dialer your partner client uses, and log the `version` it returns. In Go, you can also log `conn.RemoteAddr()` from a custom dialer. Compare what you see with the address the partner reports in its rejection, if it reports one.

## Force IPv4 in the client that makes the call

The narrowest fix is to pin the family on the one client that talks to the allowlisted partner. Everything else in the process keeps normal dual-stack behaviour. Each snippet below pins IPv4 for that client only.

**Node.js**

```typescript
import { Agent, fetch } from "undici";

// Every connection this agent opens uses IPv4. Node ignores
// autoSelectFamily when family is not 0.
const ipv4Only = new Agent({ connect: { family: 4 } });

const res = await fetch("https://api.partner.example/v1/payouts", {
	method: "POST",
	dispatcher: ipv4Only,
	headers: { "content-type": "application/json" },
	body: JSON.stringify({ amount: 100 }),
});
console.log(res.status);
```

**Python httpx**

```python
import httpx

# Binding the local side to 0.0.0.0 makes every connection IPv4.
transport = httpx.HTTPTransport(local_address="0.0.0.0")

with httpx.Client(transport=transport, timeout=10) as client:
    res = client.post(
        "https://api.partner.example/v1/payouts",
        json={"amount": 100},
    )
    print(res.status_code)
```

**Python requests**

```python
import socket

import requests
import urllib3.util.connection as urllib3_connection

def _ipv4_only() -> socket.AddressFamily:
    return socket.AF_INET

# Process-wide: every urllib3 connection resolves A records only.
urllib3_connection.allowed_gai_family = _ipv4_only

res = requests.post(
    "https://api.partner.example/v1/payouts",
    json={"amount": 100},
    timeout=10,
)
print(res.status_code)
```

**Go**

```go
package main

import (
	"context"
	"fmt"
	"net"
	"net/http"
	"time"
)

func ipv4Client() *http.Client {
	dialer := &net.Dialer{Timeout: 10 * time.Second, KeepAlive: 30 * time.Second}
	transport := http.DefaultTransport.(*http.Transport).Clone()
	transport.DialContext = func(ctx context.Context, _, addr string) (net.Conn, error) {
		return dialer.DialContext(ctx, "tcp4", addr)
	}
	return &http.Client{Transport: transport, Timeout: 30 * time.Second}
}

func main() {
	res, err := ipv4Client().Get("https://api.partner.example/v1/status")
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	fmt.Println(res.Status)
}
```

Node's built-in `fetch` also accepts a `dispatcher` option, but the `undici` package you import and the copy bundled in Node can differ in version. Importing `fetch` from the same `undici` package as the `Agent` avoids that mismatch. The requests patch is global, because urllib3 reads `allowed_gai_family` from its module for every connection. Use httpx or a separate process if only one partner needs IPv4.

### Process-wide and host-wide switches

Sometimes you cannot reach the client, such as an SDK that builds its own agent. Then set the default for the whole process.

**Terminal**

```bash
# Node: IPv4 results first, and connect to the first result only
node --dns-result-order=ipv4first --no-network-family-autoselection server.js

# Java: IPv4-only sockets for the whole JVM
java -Djava.net.preferIPv4Stack=true -jar app.jar

# curl: one call over IPv4
curl -4 https://api.partner.example/v1/status
```

The two Node flags work together. `ipv4first` puts A records ahead of AAAA records, per the [dns module docs](https://nodejs.org/api/dns.html). Turning autoselection off means Node connects to that first address and does not race the other family. With `ipv4first` alone, Node still starts an IPv6 attempt if IPv4 has not connected within the attempt timeout. `dns.setDefaultResultOrder()` and `net.setDefaultAutoSelectFamily()` do the same from code.

On glibc systems, `/etc/gai.conf` changes how `getaddrinfo` sorts results for every program on the host. RFC 6724 section 10.3 shows the idea, raising the precedence of `::ffff:0:0/96` to 100 so IPv4 sorts first. This only reorders. A Happy Eyeballs client can still finish on IPv6 if IPv4 is slow. Disabling IPv6 on the host works too, but it also breaks IPv6-only destinations and is easy to undo by accident in the next image build. Pinning the client is safer.

## AWS dual-stack and IPv6-only subnets

On AWS the key fact is that a NAT gateway handles IPv4. IPv6 traffic takes a different route. The [egress-only internet gateway docs](https://docs.aws.amazon.com/vpc/latest/userguide/egress-only-internet-gateway.html) say it is for IPv6 traffic only and point to a NAT gateway for outbound IPv4. IPv6 addresses in a VPC are globally unique, so there is nothing to translate. Your instance's own IPv6 address is the source the partner sees.

That leads to a common surprise. You attach an Elastic IP to a NAT gateway, give the partner that address, and everything works. Later someone adds an IPv6 CIDR to the subnet and a `::/0` route to an egress-only gateway. Calls to dual-stack partners now leave over IPv6 from the instance, past the NAT gateway, and the allowlist rejects them.

_What a destination sees from AWS compute_

| Setup                                                                                        | Partner has only A                      | Partner has A and AAAA                 |
| -------------------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------- |
| IPv4-only subnet behind a NAT gateway                                                        | NAT gateway's Elastic IP                | NAT gateway's Elastic IP               |
| Dual-stack private subnet, `0.0.0.0/0` to a NAT gateway and `::/0` to an egress-only gateway | NAT gateway's Elastic IP                | Usually the instance's IPv6 address    |
| IPv6-only subnet with DNS64 and NAT64                                                        | NAT gateway's Elastic IP, through NAT64 | The instance's IPv6 address            |
| Lambda in a VPC, IPv6 not allowed (default)                                                  | NAT gateway's Elastic IP                | NAT gateway's Elastic IP               |
| Lambda in a VPC, `Ipv6AllowedForDualStack=true`                                              | NAT gateway's Elastic IP                | Can be an IPv6 address from the subnet |

### Lambda

Per the [Lambda VPC docs](https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html), outbound IPv6 is off by default. You turn it on with `--vpc-config Ipv6AllowedForDualStack=true`, and every subnet attached to the function must be dual-stack. Lambda does not support outbound IPv6 for functions outside a VPC or in IPv6-only subnets. So a Lambda function only meets this problem after someone flips that flag. If a partner check started failing right after a VPC change, look at it first.

### IPv6-only subnets with NAT64

The [DNS64 and NAT64 docs](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-nat64-dns64.html) explain the split. When a destination has only an A record, Route 53 Resolver synthesizes an address in `64:ff9b::/96`. The NAT gateway translates the packet to IPv4 and it leaves from the gateway's Elastic IP. So an IPv4-only allowlist keeps working. When the destination has a real AAAA record, the resolver returns it unchanged and the connection goes out over IPv6 with no translation. NAT64 does not save you from a dual-stack partner with an IPv4-only allowlist.

For the cost side of these choices, see the [NAT gateway alternatives post](https://fixedmark.com/blog/aws-nat-gateway-alternatives) and the [AWS public IPv4 charge](https://fixedmark.com/blog/aws-public-ipv4-charge-explained).

## Google Cloud dual-stack behaviour

Google Cloud works the same way in principle. A dual-stack or IPv6-only VM interface gets a `/96` range from its subnet, per the [subnets docs](https://docs.cloud.google.com/vpc/docs/subnets). If the subnet's IPv6 access type is external, those addresses are global unicast and routable on the internet. If it is internal, they come from a ULA range and cannot reach the internet at all.

Cloud NAT does not cover IPv6 traffic to IPv6 destinations. The [Cloud NAT overview](https://docs.cloud.google.com/nat/docs/overview) lists two translations, IPv4 to IPv4 and IPv6 to IPv4. NAT64 is for IPv6-only instances reaching IPv4 destinations, and needs DNS64 as well. A VM with an external IPv6 range that calls a dual-stack partner can leave from its own IPv6 address, not from the reserved IPv4 address on your Cloud NAT gateway.

Cloud Run joins this with Direct VPC egress. The [dual-stack subnet docs](https://docs.cloud.google.com/run/docs/configuring/vpc-dual-stack-subnet) let a service send IPv4 and IPv6 traffic into a dual-stack subnet with an internal or external IPv6 access type, and state that NAT64 is not supported there. If your Cloud Run service reaches a partner through Cloud NAT for a fixed IPv4 address, keep it on an IPv4-only subnet, or pin IPv4 in the client. Then confirm with the echo check above from inside the service. The [Cloud Run integration](https://fixedmark.com/integrations/google-cloud-run) covers the IPv4 path.

## IPv6 allowlist entries and dual-stack listeners

Sometimes the partner does accept IPv6 and you register one. That brings its own failure modes.

- Hosts on SLAAC networks often use temporary addresses for outgoing connections. [RFC 8981](https://www.rfc-editor.org/rfc/rfc8981.html) sets a default preferred lifetime of one day, so the address you registered stops being used within a day. Register a stable address or the prefix, and accept that a prefix admits every host on it.
- Home and mobile lines can change their delegated IPv6 prefix, just as they change IPv4 addresses. The [home vs VPS vs proxy post](https://fixedmark.com/blog/home-static-ip-vs-vps-vs-proxy-for-algo-trading) covers this for Indian ISPs.
- Serverless addresses are not yours. Lambda's docs say it may delete and recreate its network interfaces, so an IPv6 address seen from a function today is not a stable identity. Allowlisting the whole subnet range admits everything in that subnet, the same trap described in [cloud IP ranges are not an allowlist](https://fixedmark.com/blog/cloud-ip-ranges-are-not-an-allowlist).
- You registered an IPv6 address, but your calls leave over IPv4 because the partner has no AAAA record, or your platform has no IPv6 route. Check the destination with `dig AAAA` before you register anything.

### Your own allowlist on a dual-stack socket

If you run the allowlist, watch for IPv4-mapped addresses. A server that listens on `::` accepts IPv4 clients too, and reports their address in the `::ffff:0:0/96` form that [RFC 4291](https://www.rfc-editor.org/rfc/rfc4291.html) defines. A Node server started with `server.listen(port)` on a host with IPv6 reports an IPv4 caller at 203.0.113.7 as `::ffff:203.0.113.7`. A string comparison against `203.0.113.7` fails. Normalise before you compare.

**allowlist.ts**

```typescript
import { isIPv4 } from "node:net";

const ALLOWED = new Set(["203.0.113.7", "203.0.113.8"]);

/** Turns "::ffff:203.0.113.7" into "203.0.113.7"; leaves other addresses alone. */
export function normaliseIp(raw: string): string {
	const lower = raw.toLowerCase();
	if (lower.startsWith("::ffff:")) {
		const v4 = lower.slice("::ffff:".length);
		if (isIPv4(v4)) return v4;
	}
	return lower;
}

export function isAllowed(remoteAddress: string | undefined): boolean {
	return remoteAddress !== undefined && ALLOWED.has(normaliseIp(remoteAddress));
}
```

## Doing this with Fixedmark

A proxy moves the family decision off your host. Your client connects to the proxy, and the proxy opens the connection to the partner. The partner sees the proxy's address, whatever family your own network prefers. It does not matter whether the hop from your code to the proxy runs over IPv4 or IPv6.

Fixedmark's proxy connects to destinations over IPv4 only, as the [allowlists docs](https://fixedmark.com/docs/allowlists) state. Every allowlisted call leaves from your static IPv4 pair, even when the partner is dual-stack and your platform has IPv6. You give the partner two IPv4 addresses and nothing else.

- Send the hostname to the proxy. With HTTP CONNECT through `FIXEDMARK_PROXY_URL`, the proxy resolves the name. With SOCKS5, use `socks5h://` so the proxy resolves it. A client using plain `socks5://` may resolve locally and pick an IPv6 address, which an IPv4-only proxy cannot reach. The [socks5h post](https://fixedmark.com/blog/socks5-vs-socks5h-dns-resolution) explains the difference.
- A destination with no IPv4 address cannot be reached through the proxy. The call fails instead of leaving from an address nobody allowlisted, and the failure shows in your [connection logs](https://fixedmark.com/docs/logs).
- CIDR rules in a credential's [destination allowlist](https://fixedmark.com/docs/allowlists) take IPv4 ranges only.
- IPv6 egress is on the [roadmap](https://fixedmark.com/features), not built.

Fixedmark is in early access. To route only the partner calls through it and leave everything else alone, see [per-client proxy setup](https://fixedmark.com/blog/selective-proxying-no-proxy-and-per-client-agents) and [verify your egress IP](https://fixedmark.com/docs/verify-egress-ip) before you hand the addresses to the partner.

## Sources

Checked November 2026. Confirm current details on the vendor's site before you decide. Prices and limits change.

- [RFC 8305: Happy Eyeballs Version 2](https://www.rfc-editor.org/rfc/rfc8305.html)
- [RFC 6724: Default Address Selection for IPv6](https://www.rfc-editor.org/rfc/rfc6724.html)
- [IETF draft: Happy Eyeballs Version 3](https://datatracker.ietf.org/doc/draft-ietf-happy-happyeyeballs-v3/)
- [Node.js docs: net, autoSelectFamily](https://nodejs.org/api/net.html)
- [Node.js docs: dns.setDefaultResultOrder](https://nodejs.org/api/dns.html)
- [Go: net package, Dialer.FallbackDelay](https://pkg.go.dev/net)
- [Oracle: Java networking IPv4 and IPv6 properties](https://docs.oracle.com/en/java/javase/21/core/java-networking.html)
- [AWS Lambda: IPv6 support for VPC functions](https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html)
- [Amazon VPC: DNS64 and NAT64](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-nat64-dns64.html)
- [Amazon VPC: Egress-only internet gateways](https://docs.aws.amazon.com/vpc/latest/userguide/egress-only-internet-gateway.html)
- [Google Cloud: Cloud NAT overview](https://docs.cloud.google.com/nat/docs/overview)
- [Google Cloud Run: Dual-stack subnets](https://docs.cloud.google.com/run/docs/configuring/vpc-dual-stack-subnet)
- [RFC 8981: Temporary Address Extensions for SLAAC](https://www.rfc-editor.org/rfc/rfc8981.html)

Keep reading

## Related guides

- [Tool What's my IP See the address and IP version your connection uses.](https://fixedmark.com/tools/whats-my-ip)
- [Comparison AWS NAT Gateway The real monthly cost of a highly available AWS NAT Gateway, and when a static IP proxy is simpler.](https://fixedmark.com/compare/aws-nat-gateway)
- [Comparison Google Cloud NAT What a static outbound IP through Cloud NAT costs and involves on Google Cloud, and when a proxy is simpler.](https://fixedmark.com/compare/google-cloud-nat)
- [Integration AWS Lambda A fixed IP for Lambda without VPC, subnets, and two NAT Gateways.](https://fixedmark.com/integrations/aws-lambda)
- [Use case Partner API allowlisting Give Salesforce, SOAP vendors, and payment gateways one dedicated IP pair to allowlist, wherever your code runs.](https://fixedmark.com/use-cases/partner-api-allowlisting)

## Frequently asked questions

### Why does the allowlisted call work sometimes and fail other times?

Happy Eyeballs races IPv6 and IPv4 and keeps the first connection that completes. On a dual-stack host IPv6 usually wins, but a slow IPv6 path lets IPv4 win. The partner sees a different source family from one request to the next. Pin the family in the client to make it deterministic.

### Should I disable IPv6 on the server to fix this?

It works, but it is a blunt fix. It breaks IPv6-only destinations, and a later image or kernel change can turn IPv6 back on. Forcing IPv4 in the one client that calls the allowlisted partner is narrower and survives rebuilds.

### Does NAT64 keep an IPv4-only allowlist working on AWS?

Only for destinations with no AAAA record. DNS64 synthesizes an address only when the name has no IPv6 address, and then the NAT gateway translates the traffic to its Elastic IP. If the partner publishes an AAAA record, your IPv6-only workload connects over IPv6 directly.

### Can I ask the partner to allowlist my IPv6 address as well?

If they accept IPv6, register an address you control for the long term, such as a static address on a VM. Temporary SLAAC addresses rotate daily by default, and serverless network interfaces can be recreated. Registering a whole subnet prefix admits every host in it.

### Does Fixedmark support IPv6 egress?

Not yet. The proxy connects to destinations over IPv4 only, and IPv6 egress is on the roadmap. Your partners allowlist your IPv4 pair.
