Linux – Does Linux support IPv4 mapped IPv6 addresses

ipv4ipv6linuxping

I work in a mixed IPv4 / IPv6 environment. I read that IPv4 addresses can be mapped into the IPv6 space with this syntax

::ffff:1.2.3.4 (1.2.3.4 is the IPv4 address)

Does Linux support this notation ? All these fail on my server:

ping6 ::ffff:1.2.3.4 # to the server IP
ping6 ::ffff:127.0.0.1

Best Answer

Rather than using ping6, try ssh'ing to ::ffff:127.0.0.1.

I think the specific failure here is related to ping6, not the IP4 mapped addresses.

Aren't IPv4 mapped IPv6 addresses actually using IPv4, and hence, not suitable for ping6?

Linux has a socket option, IPV6_V6ONLY which prevents some applications using IPv4 mapped addresses. However, I think for ping6 the specific issue is the way it works internally.

This is from netbsd, but I think it covers the issue.

You should be aware that IPv4 mapped IPv6 is still IPv4 - it's only presented in a IPv6-resembling text format (or actually, when calling your operating system's libraries or kernel, binary socket address format.)

For dual-protocol applications this is no problem - they know how to switch (implicitly, when using the right (modern) library calls).

Related Topic