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#80The 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.
