RFC 5952 – A Recommendation for IPv6 Address Text Representation

Writing out IPv6 addresses wasn’t very well explained in the original RFC4291 and left a few ambiguities in the defining a absolute definition way to write out addresses.

RFC 5592 – A Recommendation for IPv6 Address Text Representation in the on the Standards Track (but with Errata at time of writing) to help fix those problems.

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.

Too right, you MUST drop the zeros. Less typing.

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.

Good, no more stupid IPv6 ambiguous question on Cisco tests.

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.

Not sure about this one, but it helps with parsing of scripts I believe.

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.

Good, now I don’t need the shift key or the caps lock key anymore.

And this is one of my favourites:

Notes on Combining IPv6 Addresses with Port Numbers

There are many different ways to combine IPv6 addresses and port numbers that are represented in text. Examples are shown below.

[2001:db8::1]:80
2001:db8::1:80
2001:db8::1.80
2001:db8::1 port 80
2001:db8::1p80
2001:db8::1#80

The situation is not much different in IPv4, but the most ambiguous case with IPv6 is the second bullet. This is due to the “::”usage in IPv6 addresses. This style is NOT RECOMMENDED because of its ambiguity. The [] style as expressed in [RFC3986] SHOULD be employed, and is the default unless otherwise specified. Other styles are acceptable when there is exactly one style for the given context and cross-platform portability does not become an issue. For URIs containing IPv6 address literals, [RFC3986] MUST be followed, as well as the rules defined in this document.

The EtherealMind View

Good. Nice, tidy, rules driven.

Thankyou for listening.

About Greg Ferro

Greg Ferro is a Network Engineer/Architect, mostly focussed on Data Centre, Security Infrastructure, and recently Virtualization. He has over 20 years in IT, in wide range of employers working as a freelance consultant including Finance, Service Providers and Online Companies. He is CCIE#6920 and has a few ideas about the world, but not enough to really count.

He is a host on the Packet Pushers Podcast, blogger at EtherealMind.com and on Twitter @etherealmind and Google Plus

  • dlw1001

    When dealing with port numbers, this example could be ambiguous without additional rules:
    2001:db8::1:80 -> The address being 2001:db8::1 and the port being 80.

    Couldn’t this be expanded to:
    2001:0db8:0000:0000:0000:0000:0000:0001 –OR– 2001:0db8:0000:0000:0000:0000:0001:0080

    Also Man.. I hate having to use the shift key to type out a colon in an IP address.

    • http://etherealmind.com Greg Ferro

      I agree about the colon. It’s a PITA.

      The RFC recommends writing the syntax [2001:db8::1]:80 because anything else is too hard to read. I agree with this.

  • http://www.network-janitor.net Kurt Bales

    One of the things that annoys me is that there isn’t an accepted name for the 16-bit fields. In IPv4 we call the groupings octets for obvious reasons, there is no accepted name in v6. This usually results in calling them by various names and spending far longer trying to describe them than you do actually working on IPv6

    I do a bit of IPv6 consulting and so a colleague (Nathan Ward @ Braintrust) and I decided to use our own name to end the battle once and for all – Chazwazza! (http://www.urbandictionary.com/define.php?term=chazwazza)

    This has certainly streamlined conversations, and we have both used it several times in presentations at various conferences. It started off as an in joke, and then other people started using the term as well.

    PS – The name comes from an episode of The Simpsons when they were debating about what to call something.