IPv4-Mapped IPv6 Addresses (::ffff:0:0/96)
Learn about IPv4-mapped IPv6 addresses like ::ffff:192.168.1.1. Understand how dual-stack systems use them to handle IPv4 connections through IPv6 sockets.
IPv6 Transition
Detailed Explanation
IPv4-Mapped IPv6 Addresses
IPv4-mapped IPv6 addresses embed an IPv4 address within the IPv6 address format using the prefix ::ffff:. They are used by dual-stack systems to represent IPv4 addresses in an IPv6 context.
Format
::ffff:a.b.c.d
Examples:
::ffff:192.168.1.1 (192.168.1.1 in IPv6 format)
::ffff:10.0.0.1 (10.0.0.1 in IPv6 format)
::ffff:127.0.0.1 (loopback in IPv6 format)
Expanded Form
::ffff:192.168.1.1
Expanded:
0000:0000:0000:0000:0000:ffff:c0a8:0101
Where c0a8:0101 = 192.168.1.1 in hex:
192 = 0xc0, 168 = 0xa8, 1 = 0x01, 1 = 0x01
Binary Representation
80 bits of zeros | 16 bits of ones | 32-bit IPv4 address
0000...0000 : ffff : c0a8:0101
(80 zeros) (16 ones) (IPv4 in hex)
How Dual-Stack Uses Them
When an application creates an IPv6 socket:
1. Client connects via IPv4 to server
2. OS maps incoming IPv4 address to ::ffff:x.x.x.x
3. Application receives the IPv4-mapped address
4. Application can handle both IPv4 and IPv6 through one socket
Programming Example
// Node.js server on IPv6 socket receives IPv4 connection:
server.on('connection', (socket) => {
console.log(socket.remoteAddress);
// "::ffff:192.168.1.100" for IPv4 clients
// "2001:db8::1" for native IPv6 clients
});
Important Notes
- IPv4-mapped addresses are not sent on the wire — they are an internal OS representation
- The actual network traffic uses standard IPv4 packets
- Some applications strip the
::ffff:prefix when displaying addresses
Use Case
A Node.js web server running on an IPv6 dual-stack socket logs client IPs as ::ffff:203.0.113.50 for IPv4 visitors and 2001:db8::1 for IPv6 visitors, requiring the developer to normalize addresses for rate limiting.