IPv4 Address Mapped on Same Interface



  • Is it valid to configure the following IPv4 and IPv6 static addresses on the same interface?  Or will it create a conflict?

    
    LAN (em0):
    IPv4        192.168.2.1 / 24
    IPv6 ::ffff:192.168.2.1 / 96 (IPv4 mapped)
    
    


  • Can't create an IP conflict with two diff IP protocols, that's fine.



  • Except that that IPv6 address isn't really an IPv6 address… it's intended to be a way to access or reference an IPv4 host using an IPv6 address (also acceptable would be ::ffff:c0a8:201, if you want the real IPv6 look). A little more depth from a post in the Hurricane Electric forums...

    [It] is an "IPv4-Mapped IPv6 Address".  It's another transition thing that is used to represent v4 addresses in a v6.  It's mainly used as an OS API thing to allow applications to do IPv4 via the IPv6 networking APIs (sockets, etc).  That way, when you write an application and want to do both IPv6 and IPv4, you can use the same calls and structures, etc, for both IPv6 and IPv4.  Without such a mechanism, an application such as a web server would have to reserve a socket and do a separate listen on both an IPv4 and IPv6 socket, manage them separately, etc.  With this mechanism, the application need only do a listen using the IPv6 API, and it can accept both IPv4 and IPv6 connections through the same API.  Doing a TCP connect also works similarly.  If the destination address in the sockaddr structure is a mapped address, it'll go through the IPv4 stack, otherwise it'll use the IPv6 stack.

    Reference: https://forums.he.net/index.php?topic=635.msg2820#msg2820

    So I would expect that using that IPv6 address would create a conflict, if not cause other issues.

    Additional reference:
    RFC 4291, Section 2.5.5.2 - IPv6 Addressing Architecture, IPv4-Mapped IPv6 Address