1

IPv6 allows you to shorten one set of consecutive 0000s. I'm curious as to why the IETF (which I think decided this) didn't instead go for just dropping the 0000 and keeping the colons.

For instance, 2001:0000:0000:03de:0000:04ff:0000:ab03 could have been abbreviated as 2001:::03de::04ff::ab03 which is much shorter than actually allowed 2001::03de:0000:04ff:0000:ab03.

Conversely, 2001:0000:0000:0000:03de:04ff:0000:ab03 becoming 2001::03de:04ff:0000:ab03 doesn't seem much better than 2001::::03de:04ff::ab03.

Any thoughts on this?

Edit: in fact, that would have been the natural extension of the leading zeros abbreviating; you could consider 0000 as 4 leading 0s and shorten :0000: to ::.

0

2 Answers 2

2

As IPv6 addresses are organized, a sequence of consecutive :0000: is more common than distributed ones. Additionally, ::, ::: or even longer are not easy to distinguish visually. Also, you can shorten each :0000: to :0:.

2001:::3de::4ff::ab03 as proposed by you isn't even much shorter than

2001::3de:0:4ff:0:ab03 which is easier to read.

1
  • Yes, I think the fact that :0000: can be shortened to :0: is what I hadn't thought about. Thanks.
    – Will1v
    Commented Jun 2 at 21:01
1

It is because you cannot determine how many sets of zero fields each :: represents if there are more than one in an address text representation.

For example, the address:

2001:db8:0000:0000:1234:0000:0000:0000

written as:

2001:db8::1234::

is ambiguous, and it could be interpreted in various ways:

2001:db8:0000:1234:0000:0000:0000:0000
2001:db8:0000:0000:1234:0000:0000:0000
2001:db8:0000:0000:0000:1234:0000:0000
2001:db8:0000:0000:0000:0000:1234:0000

Where RFC 4291, IP Version 6 Addressing Architecture defined three valid test representations for IPv6 in Section 2.2, Text Representation of Addresses, RFC 5251, A Recommendation for IPv6 Address Text Representation takes it a step further in Section 4, A Recommendation for IPv6 Text Representation:

4. A Recommendation for IPv6 Text Representation

A recommendation for a canonical text representation format of IPv6 addresses is presented in this section. The recommendation in this document is one that complies fully with RFC4291, is implemented by various operating systems, and is human friendly. The recommendation in this section SHOULD be followed by systems when generating an address to be represented as text, but all implementations MUST accept and be able to handle any legitimate RFC4291 format. It is advised that humans also follow these recommendations when spelling an address.

4.1. Handling Leading Zeros in a 16-Bit Field

Leading zeros MUST be suppressed. For example, 2001:0db8::0001 is not acceptable and must be represented as 2001:db8::1. A single 16-bit 0000 field MUST be represented as 0.

4.2. "::" Usage

4.2.1. Shorten as Much as Possible

The use of the symbol "::" MUST be used to its maximum capability. For example, 2001:db8:0:0:0:0:2:1 must be shortened to 2001:db8::2:1. Likewise, 2001:db8::0:1 is not acceptable, because the symbol "::" could have been used to produce a shorter representation 2001:db8::1.

4.2.2. Handling One 16-Bit 0 Field

The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field. For example, the representation 2001:db8:0:1:1:1:1:1 is correct, but 2001:db8::1:1:1:1:1 is not correct.

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.

4.3. Lowercase

The characters "a", "b", "c", "d", "e", and "f" in an IPv6 address MUST be represented in lowercase.

3
  • 2
    The OP proposed to shorten :0000: to ::, or :0000:0000: to ::: which wouldn't be ambiguous as it omits no colons. It's just not practical either.
    – Zac67
    Commented Jun 2 at 14:47
  • 1
    @Zac67, I was answering the question of why the IETF chose to do it the way they did it. That was the discussion and reasoning for why it is the way it is in the RFCs. The whole premise of any compression of address text representation was for clarity, and a specific way to do it enshrined in an RFC would prevent multiple methods from popping up and confusing people. The multiple methods still led to confusion, so RFC 5952 was published to further clarify the way it should be.
    – Ron Maupin
    Commented Jun 2 at 18:06
  • 5952 is some serious "Karen" BS. Most of those MUST's are SHOULD's in the Real World(tm)... any v6 address parser will not care about leading zeros or case. colon-colon handling has always been messy because it's a variable length zero. I agree with 5952 for humans. (v4 has a similar Pile Of Stupid(tm) w.r.t. parsing vs. how to write a human readable address.)
    – Ricky
    Commented Jun 2 at 21:11

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