IPv4 in IPv6
IPv4-mapped addresses, 6to4, Teredo, and other IPv4-in-IPv6 transition mechanisms.
Why IPv4-in-IPv6?
During the transition from IPv4 to IPv6, several mechanisms were created to embed or reference IPv4 addresses within IPv6 addresses. These help with compatibility, tunneling, and gradual migration. Most of these are legacy mechanisms, but you'll still encounter them in network troubleshooting and configuration.
IPv4-in-IPv6 Mechanisms
::ffff:0:0/96
::ffff:w.x.y.z or ::ffff:wxyz (hex)
- Dual-stack socket programming
- Applications that need to handle both IPv4 and IPv6
- Internal system representation
::/96
::w.x.y.z
- Automatic tunneling (no longer used)
- Early IPv6 transition mechanisms
2002::/16
2002:wxyz::/48 (where wxyz is IPv4 in hex)
- Automatic IPv6 connectivity over IPv4
- Legacy transition mechanism
- 6to4 relay routers
2001:0::/32
2001:0:server:flags:cone:port:client:client
- Microsoft Windows IPv6 connectivity
- NAT traversal for IPv6
- Peer-to-peer applications
fe80::/64 or 2001:db8::/32
prefix::5efe:w.x.y.z
- Enterprise intranet IPv6 deployment
- Windows automatic tunneling
- Site-local IPv6 over IPv4
Variable
ISP-prefix:encoded-ipv4::/suffix-length
- ISP IPv6 service over IPv4 infrastructure
- Broadband IPv6 deployment
- Customer premises equipment
Quick Recognition Guide
Pattern | Meaning | What to Do |
---|---|---|
::ffff:x.x.x.x | IPv4-mapped address | Extract IPv4 from the end |
::x.x.x.x | IPv4-compatible (deprecated) | Avoid using |
2002:xxxx:xxxx:: | 6to4 address | Convert hex back to IPv4 |
2001:0:: | Teredo address | Complex encoding, use tools |
xxxx::5efe:x.x.x.x | ISATAP address | IPv4 follows :5efe: |
IPv4 to Hex Conversion Examples
To understand embedded addresses, you need to convert IPv4 addresses to hexadecimal:
IPv4 Address | Hex Equivalent | Breakdown |
---|---|---|
192.0.2.1 | c000:0201 | 192=c0, 0=00, 2=02, 1=01 |
10.0.0.1 | 0a00:0001 | 10=0a, 0=00, 0=00, 1=01 |
172.16.1.100 | ac10:0164 | 172=ac, 16=10, 1=01, 100=64 |
203.0.113.1 | cb00:7101 | 203=cb, 0=00, 113=71, 1=01 |
Modern Usage Guidelines
- IPv4-mapped addresses are still used in dual-stack applications
- 6to4 and Teredo are mostly disabled by default in modern systems
- New deployments should use native IPv6 or IPv4/IPv6 dual-stack
- Legacy mechanisms may appear in old configurations or troubleshooting
- Most transition mechanisms are being phased out as IPv6 adoption grows
Common Troubleshooting Issues
Cause: Dual-stack application treating IPv4 clients as IPv6
Solution: Normal behavior, indicates IPv4-mapped addressing
Cause: 6to4 infrastructure being deprecated
Solution: Switch to native IPv6 or other transition mechanisms
Cause: NAT or firewall blocking UDP 3544
Solution: Configure firewall or disable Teredo if not needed
Cause: Windows automatic tunneling enabled
Solution: Disable if not needed: netsh interface ipv6 set global randomizeidentifiers=disabled