RFC 5952

A Recommendation for IPv6 Address Text Representation

πŸ“… published August 2010, from ietf

A Recommendation for IPv6 Address Text Representation ✨

  • Body: Internet Engineering Task Force (IETF) 🌸
  • RFC: 5952
  • Authors: S. Kawamura (NEC BIGLOBE, Ltd.) and M. Kawashima (NEC AccessTechnica, Ltd.) 🫢
  • Category: Standards Track πŸ‘‘
  • Date: August 2010
  • Updates: RFC 4291 πŸ¦‹
  • ISSN: 2070-1721

okay bestie, so this one is a Standards Track doc from the IETF, written by S. Kawamura and M. Kawashima in August 2010. It updates RFC 4291, which is the one with the flexible IPv6 text format we're about to get obsessed with πŸ’…


Abstract πŸ’–

As IPv6 deployment grows, we're going to see a dramatic increase in the need to write IPv6 addresses as text. RFC 4291 Section 2.2 gives a very flexible model for how an IPv6 address can be written, but honestly that flexibility has been causing chaos for operators, system engineers, and users 😭 This document defines a canonical textual representation format. It does not define a format for internal storage, like inside an application or database 🧚 It is expected that the canonical format will be followed by humans and systems when they write IPv6 addresses as text, but all implementations must accept and be able to handle any legitimate RFC 4291 format.


Status of This Memo πŸ“œ

This is an Internet Standards Track document.

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc5952.


Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.


Table of Contents πŸ—ΊοΈ

1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
  1.1.  Requirements Language  . . . . . . . . . . . . . . . . . .  4
2.  Text Representation Flexibility of RFC 4291  . . . . . . . . .  4
  2.1.  Leading Zeros in a 16-Bit Field  . . . . . . . . . . . . .  4
  2.2.  Zero Compression . . . . . . . . . . . . . . . . . . . . .  5
  2.3.  Uppercase or Lowercase . . . . . . . . . . . . . . . . . .  6
3.  Problems Encountered with the Flexible Model . . . . . . . . .  6
  3.1.  Searching  . . . . . . . . . . . . . . . . . . . . . . . .  6
    3.1.1.  General Summary  . . . . . . . . . . . . . . . . . . .  6
    3.1.2.  Searching Spreadsheets and Text Files  . . . . . . . .  6
    3.1.3.  Searching with Whois . . . . . . . . . . . . . . . . .  6
    3.1.4.  Searching for an Address in a Network Diagram  . . . .  7
  3.2.  Parsing and Modifying  . . . . . . . . . . . . . . . . . .  7
    3.2.1.  General Summary  . . . . . . . . . . . . . . . . . . .  7
    3.2.2.  Logging  . . . . . . . . . . . . . . . . . . . . . . .  7
    3.2.3.  Auditing: Case 1 . . . . . . . . . . . . . . . . . . .  8
    3.2.4.  Auditing: Case 2 . . . . . . . . . . . . . . . . . . .  8
    3.2.5.  Verification . . . . . . . . . . . . . . . . . . . . .  8
    3.2.6.  Unexpected Modifying . . . . . . . . . . . . . . . . .  8
  3.3.  Operating  . . . . . . . . . . . . . . . . . . . . . . . .  8
    3.3.1.  General Summary  . . . . . . . . . . . . . . . . . . .  8
    3.3.2.  Customer Calls . . . . . . . . . . . . . . . . . . . .  9
    3.3.3.  Abuse  . . . . . . . . . . . . . . . . . . . . . . . .  9
  3.4.  Other Minor Problems . . . . . . . . . . . . . . . . . . .  9
    3.4.1.  Changing Platforms . . . . . . . . . . . . . . . . . .  9
    3.4.2.  Preference in Documentation  . . . . . . . . . . . . .  9
    3.4.3.  Legibility . . . . . . . . . . . . . . . . . . . . . .  9
4.  A Recommendation for IPv6 Text Representation  . . . . . . . . 10
  4.1.  Handling Leading Zeros in a 16-Bit Field . . . . . . . . . 10
  4.2.  "::" Usage . . . . . . . . . . . . . . . . . . . . . . . . 10
    4.2.1.  Shorten as Much as Possible  . . . . . . . . . . . . . 10
    4.2.2.  Handling One 16-Bit 0 Field  . . . . . . . . . . . . . 10
    4.2.3.  Choice in Placement of "::"  . . . . . . . . . . . . . 10
  4.3.  Lowercase  . . . . . . . . . . . . . . . . . . . . . . . . 10
5.  Text Representation of Special Addresses . . . . . . . . . . . 11
6.  Notes on Combining IPv6 Addresses with Port Numbers  . . . . . 11
7.  Prefix Representation  . . . . . . . . . . . . . . . . . . . . 12
8.  Security Considerations  . . . . . . . . . . . . . . . . . . . 12
9.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 12
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12
  10.1. Normative References . . . . . . . . . . . . . . . . . . . 12
  10.2. Informative References . . . . . . . . . . . . . . . . . . 13
Appendix A.  For Developers  . . . . . . . . . . . . . . . . . . . 14

1. Introduction ✨

okay so one IPv6 address can be written in a bunch of different ways 🀯 Here are some examples:

2001:db8:0:0:1:0:0:1

2001:0db8:0:0:1:0:0:1

2001:db8::1:0:0:1

2001:db8::0:1:0:0:1

2001:0db8::1:0:0:1

2001:db8:0:0:1::1

2001:db8:0000:0:1::1

2001:DB8:0:0:1::1

All of the above examples represent the same IPv6 address. This flexibility has caused a lot of problems for operators, systems engineers, and customers πŸ’€ The problems are noted in Section 3. A canonical representation format to avoid these problems is introduced in Section 4. It's giving main character glow-up 🌈

1.1. Requirements Language πŸ“

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].


2. Text Representation Flexibility of RFC 4291 πŸŽ€

Here are the examples of flexibility from Section 2.2 of [RFC4291], explained bestie-style.

2.1. Leading Zeros in a 16-Bit Field 🌸

RFC 4291 says:

'It is not necessary to write the leading zeros in an individual field.'

Conversely, it is also not necessary to omit leading zeros. So you can pick from representations like the ones in the following example. The final 16-bit field is different, but all of these addresses represent the same address 🧁

2001:db8:aaaa:bbbb:cccc:dddd:eeee:0001

2001:db8:aaaa:bbbb:cccc:dddd:eeee:001

2001:db8:aaaa:bbbb:cccc:dddd:eeee:01

2001:db8:aaaa:bbbb:cccc:dddd:eeee:1

2.2. Zero Compression πŸ¦‹

RFC 4291 says:

'A special syntax is available to compress the zeros. The use of "::" indicates one or more groups of 16 bits of zeros.'

It is possible to choose whether or not to omit just one 16-bit 0 field πŸ€”

2001:db8:aaaa:bbbb:cccc:dddd::1

2001:db8:aaaa:bbbb:cccc:dddd:0:1

In cases where there is more than one field of only zeros, there is a choice of how many fields can be shortened πŸ™ˆ

2001:db8:0:0:0::1

2001:db8:0:0::1

2001:db8:0::1

2001:db8::1

In addition, Section 2.2 of [RFC4291] notes,

'The "::" can only appear once in an address.'

This gives you a choice of where in a single address to compress the zeros 🧩

2001:db8::aaaa:0:0:1

2001:db8:0:0:aaaa::1

2.3. Uppercase or Lowercase πŸ” 

[RFC4291] does not mention any preference of uppercase or lowercase. So all of these are fair game ✨

2001:db8:aaaa:bbbb:cccc:dddd:eeee:aaaa

2001:db8:aaaa:bbbb:cccc:dddd:eeee:AAAA

2001:db8:aaaa:bbbb:cccc:dddd:eeee:AaAa

3. Problems Encountered with the Flexible Model 😭

Okay, this is where the drama starts. The flexible model is cute in theory and chaotic in real life πŸ’…

3.1. Searching πŸ”

3.1.1. General Summary

ngl searching for an IPv6 address through a UNIX system is usually case sensitive, and extended options that allow regular expression use will come in handy. However, there are many applications on the Internet today that do not provide this capability. When searching for an IPv6 address in such systems, the system engineer will have to try each and every possibility to search for an address 😩 This has critical impacts, especially when trying to deploy IPv6 over an enterprise network.

3.1.2. Searching Spreadsheets and Text Files πŸ“Š

Spreadsheet applications and text editors on GUI systems rarely have the ability to search for text using regular expressions. Moreover, there are many non-engineers (who are not aware of case sensitivity and regular expression use) who use these applications to manage IP addresses. This has worked quite well with IPv4, since text representation in IPv4 has very little flexibility. There is no incentive to encourage these non-engineers to change their tool or learn regular expressions when they decide to go dual-stack. If the entry in the spreadsheet reads 2001:db8::1:0:0:1, but the search was conducted as 2001:db8:0:0:1::1, this will show a result of no match πŸ₯² One example where this will cause a problem is when the search is being conducted to assign a new address from a pool, and a check is being done to see if it is not in use. This may cause problems for the end-hosts or end-users. This type of address management is very often seen in enterprise networks and ISPs.

3.1.3. Searching with Whois 🧾

The "whois" utility is used by a wide range of people today. When a record is set in a database, one will likely check the output to see if the entry is correct. If an entity was recorded as 2001:db8::/48, but the whois output showed 2001:0db8:0000::/48, most non-engineers would think their input was wrong, and they will likely retry several times or make a frustrated call to the database hostmaster πŸ“ž If there was a need to register the same prefix on different systems, and each system showed a different text representation, this would confuse people even more πŸ˜΅β€πŸ’« Although this document focuses on addresses rather than prefixes, it is worth mentioning the prefix problems, because the problems encountered with addresses and prefixes are mostly equal.

3.1.4. Searching for an Address in a Network Diagram πŸ—ΊοΈ

Network diagrams and blueprints often show which IP addresses are assigned to a system's devices. In times of trouble shooting, there may be a need to search through a diagram to find the point of failure (for example, if a traceroute stopped at 2001:db8::1, one would search the diagram for that address). This is a technique quite often used in enterprise networks and managed services. Again, the different flavors of text representation will result in a time-consuming search, leading to longer mean times to restoration (MTTR) in times of trouble 🚨

3.2. Parsing and Modifying 🧠

3.2.1. General Summary

With all the possible methods of text representation, each application must include a module, object, link, etc. to a function that will parse IPv6 addresses in a manner such that no matter how an address is represented, they will mean the same address. Many system engineers who integrate complex computer systems for corporate customers will have difficulties finding that their favorite tool does not have this function, or they will encounter difficulties such as having to rewrite their macros or scripts for their customers πŸ₯Ί

3.2.2. Logging πŸ“

okay so imagine logging an address in full, like 2001:0db8:0000:0000:1111:2222:3333:4444 😭 the output would be highly unreadable compared to IPv4, bestie. the address would have to be parsed and reformed before a human can actually use it πŸ’€ sometimes critical systems mirror the same traffic to two different systems, and care must be taken so that no matter what the log output is, the logs should be parsed so they are equivalent 🫢 that's a lot of pressure on the logging team, ngl.

3.2.3. Auditing: Case 1 πŸ”

when a router or any other network appliance machine configuration gets audited, there are a bunch of ways to compare a node's config info. sometimes people just compare the changes made each day. so say 2001:db8::1 gets changed to 2001:0db8:0000:0000:0000:0000:0000:0001 just because the new engineer on the block felt it was better πŸ™„ a simple diff will show that a different address was configured, and that's giving chaos. if this happens on a wide scale network, people will be focusing on 'why the extra zeros were put in' instead of doing any real auditing 😩 lots of tools are just plain diffs that do not take into account address representation rules, which is so not it.

3.2.4. Auditing: Case 2 🧾

node configurations will be matched against an information system that manages IP addresses. if the output notation is different, there will need to be a script to cover for this πŸ› οΈ the result of an SNMP GET operation, converted to text and compared to a textual address written by a human, is highly unlikely to match on the first try. literally no one's first try, periodt.

3.2.5. Verification πŸ•΅οΈβ€β™€οΈ

some protocols require certain data fields to be verified, and X.509 certificates are a big example. if an IPv6 address field in a certificate got verified by converting it to text and doing a simple textual comparison to some other address, the certificate may get mistakenly shown as invalid just because the text representation is different 😭 a difference in how it's written, not in the address itself. main character drama, fr.

3.2.6. Unexpected Modifying πŸͺ„

sometimes a system will take an address and modify it as a little convenience. like, it might take 2001:0db8:0::1 as input and spit out 2001:db8::1 as the output ✨ if the zeros were input for a reason, the outcome may be somewhat unexpected, and that's a vibe nobody asked for.


3.3. Operating βš™οΈ

3.3.1. General Summary πŸ’‘

when an operator sets an IPv6 address on a system as 2001:db8:0:0:1:0:0:1, the system may take it and show the config result as 2001:DB8::1:0:0:1 πŸ™ƒ someone who knows IPv6 address representation will know the right address is set, but not everyone may understand this, and that's the tea.

3.3.2. Customer Calls πŸ“ž

when a customer calls to ask about a suspected outage, IPv6 address representation should be handled with care 🫧 not all customers are engineers, and they don't all have the same skill level in IPv6. the network operations center will have to take extra steps to parse the address by hand, so they don't have to explain to customers that 2001:db8:0:1::1 is the same as 2001:db8::1:0:0:0:1 😭 this is one thing that will never happen in IPv4, because IPv4 addresses cannot be abbreviated. lucky IPv4 girlies, honestly.

3.3.3. Abuse 🚨

network abuse reports generally include the abusing IP address πŸ“£ this 'reporting' could take any shape or form of the flexible model. a team that handles network abuse must be able to tell the difference between 2001:db8::1:0:1 and 2001:db8:1::0:1, because mistakes in the placement of the "::" will result in a critical situation πŸ’€ a system that handles these incidents should be able to handle any type of input and parse it correctly. also, incidents get reported over the phone πŸ“± it is unnecessary to report if a letter is uppercase or lowercase, but when a letter is spelled uppercase, people tend to specify that it's uppercase, which is unnecessary info. it's giving over-explaining, bestie.


3.4. Other Minor Problems 🧸

3.4.1. Changing Platforms πŸ”

when an engineer changes the platform of a running service, the same code may not work as expected because of the difference in IPv6 text representation πŸ₯² usually a platform change (Unix to Windows, Cisco to Juniper, etc.) means a major code change anyway, but the flexibility in address representation will increase the workload, so extra mess.

3.4.2. Preference in Documentation πŸ“š

a document that gets edited by more than one author may become harder to read 🫠 the vibe shifts every paragraph, and it's giving group project.

3.4.3. Legibility πŸ‘€

capital D and 0 can be quite often misread πŸ™ˆ capital B and 8 can also be misread. squint responsibly, babes.


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 here 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, so we're all on the same page 🫢

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. clean girl aesthetic, literally.

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 the shorter representation 2001:db8::1. why would you leave extra zeros on the table, honestly πŸ’…

4.2.2. Handling One 16-Bit 0 Field πŸ™…β€β™€οΈ

the symbol "::" MUST NOT be used to shorten just one 16-bit 0 field 🚫 the representation 2001:db8:0:1:1:1:1:1 is correct, but 2001:db8::1:1:1:1:1 is not correct. one zero field is not worth the drama, bestie.

4.2.3. Choice in Placement of "::" 🧩

when there's an alternative choice in where the "::" goes, 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 consecutive 16-bit 0 fields are equal in length (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 the correct representation πŸ¦‹

4.3. Lowercase πŸ”‘

the characters "a", "b", "c", "d", "e", and "f" in an IPv6 address MUST be represented in lowercase πŸ’œ no caps lock energy here, not even a little.


5. Text Representation of Special Addresses 🧚

addresses such as IPv4-Mapped IPv6 addresses, ISATAP [RFC5214], and IPv4-translatable addresses [ADDR-FORMAT] have IPv4 addresses embedded in the low-order 32 bits of the address 🌈 these addresses have a special representation that may mix hexadecimal and dot decimal notations, and the decimal notation may be used only for the last 32 bits of the address. for these addresses, mixed notation is RECOMMENDED if the following condition is met: the address can be distinguished as having IPv4 addresses embedded in the lower 32 bits solely from the address field, through the use of a well-known prefix. such prefixes are defined in [RFC4291] and [RFC2765] at the time of this writing. if it is known by some external method that a given prefix is used to embed IPv4, it MAY be represented as mixed notation. tools that provide options to specify prefixes that are (or are not) to be represented as mixed notation may be useful πŸ› οΈ

there's a trade-off here πŸ₯Ή a recommendation to get an exact match in a search (no dot decimals whatsoever) and a recommendation to help the readability of an address (dot decimal whenever possible) don't land on the same solution. the recommendation above tries to fix the representation as much as possible, while leaving room for future well-known prefixes to be shown in a human-friendly way as tools adjust to newly assigned prefixes ✨

the text representation method noted in Section 4 should be applied for the leading hexadecimal part (i.e., ::ffff:192.0.2.1 instead of 0:0:0:0:0:ffff:192.0.2.1) πŸ’…


6. Notes on Combining IPv6 Addresses with Port Numbers πŸ”Œ

there are lots of different ways to combine IPv6 addresses and port numbers in text, so here are some examples 🌷

  • [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 isn't much different in IPv4, but the most ambiguous case with IPv6 is the second bullet πŸ™ƒ that's because of the "::" usage in IPv6 addresses. this style is NOT RECOMMENDED because of its ambiguity 🚫 the [] style as expressed in [RFC3986] SHOULD be employed, and it 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 bracket style is the one to use, bestie. the second bullet is the one that causes the most confusion, so be careful.

7. Prefix Representation πŸ“

problems with prefixes are the same as the problems encountered with addresses πŸ™Œ the text representation method of IPv6 prefixes should be no different from that of IPv6 addresses. same rules, same slay.


8. Security Considerations πŸ”

this document notes some examples where IPv6 addresses are compared in text format, and it is serious business. the example in Section 3.2.5 is one that may cause a security risk if used for access control πŸ’€ the common practice of comparing X.509 data is done in binary format, so don't skip that step.

9. Acknowledgements πŸ’œ

the authors would like to thank Jan Zorz, Randy Bush, Yuichi Minami, and Toshimitsu Matsuura for their generous and helpful comments in kick starting this document 🫢 we also would like to thank Brian Carpenter, Akira Kato, Juergen Schoenwaelder, Antonio Querubin, Dave Thaler, Brian Haley, Suresh Krishnan, Jerry Huang, Roman Donchenko, Heikki Vatiainen, Dan Wing, and Doug Barton for their input 🌸 and a very special thanks to Ron Bonica, Fred Baker, Brian Haberman, Robert Hinden, Jari Arkko, and Kurt Lindqvist for their support in bringing this document to light in IETF working groups πŸ‘‘


10. References πŸ“–

10.1. Normative References

  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [RFC2765] Nordmark, E., "Stateless IP/ICMP Translation Algorithm (SIIT)", RFC 2765, February 2000.
  • [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.
  • [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, February 2006.

10.2. Informative References

  • [ADDR-FORMAT] Bao, C., "IPv6 Addressing of IPv4/IPv6 Translators", Work in Progress, July 2010.
  • [RFC4038] Shin, M-K., Hong, Y-G., Hagino, J., Savola, P., and E. Castro, "Application Aspects of IPv6 Transition", RFC 4038, March 2005.
  • [RFC5214] Templin, F., Gleeson, T., and D. Thaler, "Intra-Site Automatic Tunnel Addressing Protocol (ISATAP)", RFC 5214, March 2008.

Appendix A. For Developers πŸŽ€

Okay bestie, this is the dev tips bit πŸ’… We recommend that developers use display routines that follow these rules, so your output stays consistent 🫢 For example, calling getnameinfo() with the NI_NUMERICHOST flags argument in FreeBSD 7.0 gives conforming output, except for the special address notes in Section 5 🌸 The inet_ntop() function in FreeBSD 7.0 is a good C code reference, but it should not be called directly ✨ See [RFC4038] for details πŸ¦‹


Authors' Addresses 🧚

Seiichi Kawamura

Seiichi Kawamura
NEC BIGLOBE, Ltd.
14-22, Shibaura 4-chome
Minatoku, Tokyo  108-8558
JAPAN

Phone: +81 3 3798 6085
EMail: kawamucho@mesh.ad.jp

Masanobu Kawashima

Masanobu Kawashima
NEC AccessTechnica, Ltd.
800, Shimomata
Kakegawa-shi, Shizuoka  436-8501
JAPAN

Phone: +81 537 23 9655
EMail: kawashimam@necat.nec.co.jp
πŸ“¦ where this page comes from