When is the hybrid IP notation ::ffff:192.168.1.4 appropriate?

前端 未结 3 1441
眼角桃花
眼角桃花 2020-12-10 10:33

Put another way, if an address is IPv4, why bother to express it as IPv6 at all?

3条回答
  •  -上瘾入骨i
    2020-12-10 11:01

    It's appropriate to use that form with V4MAPPED addresses.

    The V4MAPPED addresses aren't supposed to appear in actual IPv6 headers transmitted in the network. They're only supposed to be used by applications that use dual-stack IPv4/IPv6 host implementations where a single transport endpoint can communicate using both IPv4 and IPv6 concurrently.

    If you open a TCP connection using the IPv6 protocol family without requiring the endpoint to be IPv6-only [which may be the default on your system] and you specify the destination address in V4MAPPED form, then the operating system will connect over IPv4, and when you call the moral equivalent of getsockname on your system, you will get back a V4MAPPED address.

提交回复
热议问题