Search code examples
network-programmingipv6

IPv6 zero compression


When using zero-compression on the following IPv6 address

2001:0DB8:0000:CD30:0000:0000:0000:0000/60

Why is this not correct:

2001:DB8::CD30::/60

... while this is:

2001:DB8:0:CD30::/60

Solution

  • Zero compression can only be made once. The reason for this is, that the IPv6 address is not unique any more otherwise.

    Take your example 2001:DB8::CD30::/60 will it expand to

    2001:0DB8:0000:0000:0000:CD30:0000:0000/60
    

    or

    2001:0DB8:0000:0000:CD30:0000:0000:0000/60
    

    or

    2001:0DB8:0000:CD30:0000:0000:0000:0000/60
    

    ...?

    If only one "::" is used, the result will always be unique as there is only one possible fixed number of zeros to be inserted.