---
name: ipv6-runtime-config
description: >
  Use when setting JVM, Node, .NET, container, or OS resolver flags that affect
  address family preference; when Java needs preferIPv6Addresses; when diagnosing
  "AAAA exists but the app still uses IPv4"; or when editing gai.conf, systemd
  listen units, or health-check curl -4/-6. Covers runtime and process
  configuration, not application listen/bind code (see ipv6-localhost-bind).
---

# IPv6 runtime and process configuration

Code can be family-agnostic and still fail because the **process, JVM, or host
resolver** prefers IPv4, suppresses a family, or probes the wrong literal.
Fix configuration before rewriting sockets.

## Instructions

1. Inventory effective overrides: JVM `-D` / `JAVA_TOOL_OPTIONS`, container
   `ENV`, systemd `Environment=`, Kubernetes env, wrapper scripts, golden images.
2. Remove or replace IPv4-forcing flags. Prefer OS Happy Eyeballs / RFC 6724
   ordering unless you have a measured reason to bias a family.
3. Qualify each runtime on dual-stack **and** IPv6-Only-Strict (and NAT64 when
   in scope). A dual-stack laptop does not prove the JVM flags for IPv6-only CI.
4. Keep listen address and health-check family aligned (`ipv6-localhost-bind`).
5. Do not treat `/etc/gai.conf` as a substitute for within-family load
   spreading (`ipv6-destination-selection`).

## Common overrides

| Runtime | Prefer / allow IPv6 | Avoid / audit |
| --- | --- | --- |
| Java / JVM | Omit `preferIPv4Stack`; set `-Djava.net.preferIPv6Addresses=true` when dual-stack must prefer AAAA; use `InetAddress.getAllByName()` | `-Djava.net.preferIPv4Stack=true` (host or app); `getByName()`-only paths |
| Node.js | Default Happy Eyeballs / `autoSelectFamily` where available; `dns.setDefaultResultOrder('verbatim')` or `ipv6first` when you must not force IPv4-first | `--dns-result-order=ipv4first` / `NODE_OPTIONS` that force IPv4-first without a ticket |
| .NET | Dual-stack sockets; ensure IPv6 is not disabled at OS or process level | `DOTNET_SYSTEM_NET_DISABLEIPV6`, OS "IPv6 disabled" policies |
| Go | Default `net.Dialer` is usually fine | Custom resolvers that drop AAAA; forced `tcp4` / `Listen("tcp4", …)` in config |
| Python | Prefer `getaddrinfo`; rarely needs process flags | Env wrappers that force IPv4-only tools around the app |
| curl / probes | Match listener family (`curl -6`, `http://[::1]/…`) | Habitual `curl -4` in IPv6-only health checks |
| glibc hosts | Understand `/etc/gai.conf` precedence | Assuming gai.conf disables Rule 9 or replaces client load balancing |

Java note: the JVM resolver stack is **independent** of `/etc/gai.conf`. A host
that prefers IPv6 in libc can still look "IPv6 broken" under
`java.net.preferIPv4Stack=true`.

## Gotchas

- Golden images and CI base images often carry old `JAVA_TOOL_OPTIONS` or
  `preferIPv4Stack` "for stability." Search the inheritance chain, not only the
  service repo.
- Stub resolvers may omit A or AAAA based on connectivity detection
  (`ipv6-name-resolution`). Wrong host config (VPN, link-local-only routes)
  changes which records the app ever sees.
- `/etc/resolv.conf` with only IPv6 nameserver addresses can break runtimes that
  still bootstrap DNS over IPv4. Qualify resolver reachability per runtime.
- Documentation prefixes (`2001:db8::/32`, `3fff::/20`) in examples; do not
  teach RFC1918 as the only "IP" shape in runbooks.

## Sibling skills

- `ipv6-ready-coding`
- `ipv6-name-resolution`
- `ipv6-localhost-bind`
- `ipv6-app-testing`
- `ipv6-code-review`

## Source

- Hub: https://www.peachymango.org/ipv6
- Draft anchors: `#runtime-resolution`, `#language-runtimes`, `#address-selection`
- https://datatracker.ietf.org/doc/draft-martin-deploying-ipv6-data-center/
- https://datatracker.ietf.org/doc/draft-ietf-v6ops-ipv6-app-testing/ (destination selection / filtering failure modes)
