1

Given IPv6 address 2001:0000:0000:0000:1111:0000:0000:0000, should it be abbreviated as: 2001::1111:0:0:0 or 2001:0:0:0:1111::? It seems I didn't see any specification talking about it.

4

From RFC5952 - IPv6 Text Representation

4.2.3.  Choice in Placement of "::"

   When there is an alternative choice in the placement of a "::", the
   longest run of consecutive 16-bit 0 fields MUST be shortened (i.e.,
   the sequence with three consecutive zero fields is shortened in 2001:
   0:0:1:0:0:0:1).  When the length of the consecutive 16-bit 0 fields
   are equal (i.e., 2001:db8:0:0:1:0:0:1), the first sequence of zero
   bits MUST be shortened.  For example, 2001:db8::1:0:0:1 is correct
   representation.

In short: 2001::1111:0:0:0 is correct.

|improve this answer|||||
  • 1
    Well, both are correct, it's just that one notation is recommended :) All the given notations work equally well – Sander Steffann Mar 5 '16 at 15:17
  • 2
    Well, that depends a little on how much you're interested in following the RFC 5952 standard. The MUST doesn't give you a choice when doing a proper implementation - as RFC 2119 says about the use of keywords like MUSTin RFC documents ;) All this doesn't mean that some device or software might not accept an incorrectly abbreviated address. – xpac Mar 5 '16 at 15:23
  • 3
    From the first paragraph of RFC 5952: "..., but all implementations must accept and be able to handle any legitimate RFC 4291 format.". The only addresses that are abbreviated incorrectly are those that don't follow RFC 4291. Everything that does must be accepted. – Sander Steffann Mar 5 '16 at 15:56
  • 2
    Agreed. Unless you claim your system/document/whatever being RFC 5952-compliant, this is just a recommendation ;) – xpac Mar 5 '16 at 16:59
  • 5
    @SanderSteffann, the way it was explained to me is that, yes, your implementation needs to accept any RFC 4291 format as input, but because RFC 5952 is a Standards Track RFC, you should only output addresses in RFC 5952 format. – Ron Maupin Mar 5 '16 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.