How to represent an IPv6 address properly

There are a number of RFC’s on this but the most recent, 5952, is the one that should be honored at this point.  Here’s a breakdown of what you should be doing when typing out IPv6 addresses in your config, servers, routers, documentation, etc.:

  1. Leading zeroes in a non-zero field MUST be left off.  This means if your 16-bit field is 0001, it needs to be written as simply 1 and cannot be written as 0001, 001 or 01.
  2. If you have adjacent fields of zero in the address, the LARGEST grouping MUST be shortened to :: and no other field shortened.  This means that if your address is 2001:db8:0:0:0:1:1:1 it should be represented as 2001:db8::1:1:1.  If your address were 2001:db8:0:0:1:0:0:0 then you do not get to do 2001:db8::1:0:0:0 or 2001:db8::1::, it MUST be represented as 2001:db8:0:0:1::.
  3. If there are multiple consecutive zero fields, the LEFTMOST field is the one that gets shortened.  So 2001:db8:0:0:1:0:0:1 can only be represented as 2001:db8::1:0:0:1.
  4. You CANNOT use the :: representation for a single field; so 2001:db8:0:1:0:1:0:1 cannot have :: replace one of the zero fields.
  5. Letters should ALWAYS be represented in lowercase.

Leave a Reply

Your email address will not be published. Required fields are marked *