Most everyone knows how to write an IPv4 ip address, and is easy and simple to understand.
As the world migrates to a new internet addressing system, which is known as IPv6, writing out the address becomes difficult. The difficulty is that there are multiple ways of writing an IPv6 address. As a consequence, when people need to perform text searches, no matches may result because the way in which it was searched doesn't match the way in which it was written.
A new document has been authored entitled A Recommendation for IPv6 Address Text Representation which helps to standardize the process of writing an IPv6 address.
In a nutshell, the recommendation is:
- 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.
- The use of symbol "::" MUST be used to its maximum capability. For example, 2001:db8::0:1 is not acceptable, because the symbol "::" could have been used to produce a shorter representation 2001:db8::1.
- 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.
- 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.
- The characters "a", "b", "c", "d", "e", "f" in an IPv6 address MUST be represented in lower case.
- When writing port numbers with an IPv6 address, the [] style as expressed in [RFC3986] SHOULD be employed, and is the default unless otherwise specified -- [2001:db8::1]:80