Difference between revisions of "IPv4-Mapped IPv6 Address"

From Teknologisk videncenter
Jump to: navigation, search
m (IP Addresses with a Dual-Stack Socket)
m (IP Addresses with a Dual-Stack Socket)
 
Line 23: Line 23:
 
If the underlying protocol is actually IPv4, then the IPv4 address is mapped into an IPv4-mapped IPv6 address format. That is the, family field in the SOCKADDR structure indicates AF_INET6, but an IPv4-mapped IPv6 address is encoded in the IPv6 address structure. For a dual-stack socket in listening mode, this means that any accepted IPv4 connections will return an IPv4-mapped IPv6 address. For a dual-stack socket that is connecting to an IPv4 destination, the SOCKADDR structure passed to connect must be an IPv4-mapped IPv6 address. Applications must take care to handle these IPv4-mapped IPv6 addresses appropriately and only use them with dual stack sockets. If an IP address is to be passed to a regular IPv4 socket, the address must be a regular IPv4 address not a IPv4-mapped IPv6 address.<ref>http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx</ref>
 
If the underlying protocol is actually IPv4, then the IPv4 address is mapped into an IPv4-mapped IPv6 address format. That is the, family field in the SOCKADDR structure indicates AF_INET6, but an IPv4-mapped IPv6 address is encoded in the IPv6 address structure. For a dual-stack socket in listening mode, this means that any accepted IPv4 connections will return an IPv4-mapped IPv6 address. For a dual-stack socket that is connecting to an IPv4 destination, the SOCKADDR structure passed to connect must be an IPv4-mapped IPv6 address. Applications must take care to handle these IPv4-mapped IPv6 addresses appropriately and only use them with dual stack sockets. If an IP address is to be passed to a regular IPv4 socket, the address must be a regular IPv4 address not a IPv4-mapped IPv6 address.<ref>http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx</ref>
  
 +
=Examples=
 +
Only seen working application using IPv4-mapped IPv6 addresses is Windows 7 ping!!!
 
<source lang=cli>
 
<source lang=cli>
 
<input>
 
<input>
Line 57: Line 59:
 
</input>
 
</input>
 
</source>
 
</source>
 +
=References=
 
<references/>
 
<references/>
 
{{source cli}}
 
{{source cli}}

Latest revision as of 08:29, 25 November 2011

IPv4 Mapped
IPv6 Address Type: IPv4 Mapped
Prefix:  ::ffff/96
Local Routeable: Yes
Global Routeable: Yes
Global Unique: Yes
Example:  ::ffff:83.90.47.30
IPv4 Equivalent: None
Described in: rfc4291
rfc4038 section 4.2
Explanation

These addresses are used to embed IPv4 addresses in an IPv6 address. One use for this is in a dual stack transition scenario where IPv4 addresses can be mapped into an IPv6 address.

See RFC 4038 for more details

IPv4-mapped IPv6 addresses are used in scenarios where IPv6 an IPv6-only application need to communicate with an IPv4 only application using IPv4 packets.

IPv4-mapped address

The IPv4-mapped address, 0:0:0:0:0:FFFF:w.x.y.z or ::FFFF:w.x.y.z, is used to represent an IPv4-only node to an IPv6 node. It is used only for internal representation. The IPv4-mapped address is never used as a source or destination address for an IPv6 packet. The IPv6 protocol does not support the use of IPv4-mapped addresses.[1]

IP Addresses with a Dual-Stack Socket

Dual-stack sockets always require IPv6 addresses. The ability to interact with an IPv4 address requires the use of the IPv4-mapped IPv6 address format. Any IPv4 addresses must be represented in the IPv4-mapped IPv6 address format which enables an IPv6 only application to communicate with an IPv4 node. The IPv4-mapped IPv6 address format allows the IPv4 address of an IPv4 node to be represented as an IPv6 address. The IPv4 address is encoded into the low-order 32 bits of the IPv6 address, and the high-order 96 bits hold the fixed prefix 0:0:0:0:0:FFFF. The IPv4-mapped IPv6 address format is specified in RFC 4291. For more information, see www.ietf.org/rfc/rfc4291.txt. The IN6ADDR_SETV4MAPPED macro in Mstcpip.h can be used to convert an IPv4 address to the required IPv4-mapped IPv6 address format.

If the underlying protocol is actually IPv4, then the IPv4 address is mapped into an IPv4-mapped IPv6 address format. That is the, family field in the SOCKADDR structure indicates AF_INET6, but an IPv4-mapped IPv6 address is encoded in the IPv6 address structure. For a dual-stack socket in listening mode, this means that any accepted IPv4 connections will return an IPv4-mapped IPv6 address. For a dual-stack socket that is connecting to an IPv4 destination, the SOCKADDR structure passed to connect must be an IPv4-mapped IPv6 address. Applications must take care to handle these IPv4-mapped IPv6 addresses appropriately and only use them with dual stack sockets. If an IP address is to be passed to a regular IPv4 socket, the address must be a regular IPv4 address not a IPv4-mapped IPv6 address.[2]

Examples

Only seen working application using IPv4-mapped IPv6 addresses is Windows 7 ping!!!

<input>
C:\Users\Henrik thomsen><notice>ping ::ffff:192.168.139.50</notice>

Pinging 192.168.139.50 with 32 bytes of data:
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62

Ping statistics for 192.168.139.50:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

</input>

or same as

<input>
C:\Users\Henrik thomsen><notice>ping ::ffff:c0a8:8b32</notice>

Pinging 192.168.139.50 with 32 bytes of data:
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62
Reply from 192.168.139.50: bytes=32 time<1ms TTL=62

Ping statistics for 192.168.139.50:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
</input>

References