Addressing & Routing

IPv4 to IPv6 Conversion — Mapped, Compatible and Embedded Forms

This converts an IPv4 address into its various IPv6 representations and back: the mapped form used when an IPv6 socket accepts an IPv4 connection, the older compatible form, and the embedded forms used by translation mechanisms. Each exists for a different purpose and they are not interchangeable.

Why run it

Because dual-stack systems display addresses in whichever form they received them, and that breaks matching. A firewall rule written for an IPv4 address does not match its mapped form; a log analysis tool counts the same client twice; an allowlist silently fails for connections arriving over a dual-stack socket. The symptom is a rule that demonstrably exists and demonstrably does not apply, which is a frustrating thing to debug without knowing this is a possibility.

Why automate it

Wherever addresses are compared programmatically, normalising them first is the fix, and applying that consistently across log processing, allowlists and access rules is a systems job rather than a manual one. The failures caused by mixed representations are partial and intermittent — the rule works for clients that connected over IPv4 and not for those that did not — which makes them far harder to notice than a rule that simply never works.

What it gives you

Correct handling of the same address in the several forms a dual-stack network will present it, and a fix for access rules that appear correct and apply inconsistently.

Related checks in Addressing & Routing