IPv6 Address Representation
Summary
This topic explain how IPv6 addresses are represented. Start learning CCNA 200-301 for free right now!!
Table of Contents
IPv6 Addressing Formats
The first step to learning about IPv6 in networks is to understand the way an IPv6 address is written and formatted. IPv6 addresses are much larger than IPv4 addresses, which is why we are unlikely to run out of them.
IPv6 addresses are 128 bits in length and written as a string of hexadecimal values. Every four bits is represented by a single hexadecimal digit; for a total of 32 hexadecimal values, as shown in the figure. IPv6 addresses are not case-sensitive and can be written in either lowercase or uppercase.
16-bit Segments or Hextets
Preferred Format
The previous figure also shows that the preferred format for writing an IPv6 address is x:x:x:x:x:x:x:x, with each “x” consisting of four hexadecimal values. The term octet refers to the eight bits of an IPv4 address. In IPv6, a hextet is the unofficial term used to refer to a segment of 16 bits, or four hexadecimal values. Each “x” is a single hextet which is 16 bits or four hexadecimal digits.
Preferred format means that you write IPv6 address using all 32 hexadecimal digits. It does not necessarily mean that it is the ideal method for representing the IPv6 address. In this module, you will see two rules that help to reduce the number of digits needed to represent an IPv6 address.
These are examples of IPv6 addresses in the preferred format.
2001 : 0db8 : 0000 : 1111 : 0000 : 0000 : 0000: 0200 2001 : 0db8 : 0000 : 00a3 : abcd : 0000 : 0000: 1234 2001 : 0db8 : 000a : 0001 : c012 : 9aff : fe9a: 19ac 2001 : 0db8 : aaaa : 0001 : 0000 : 0000 : 0000: 0000 fe80 : 0000 : 0000 : 0000 : 0123 : 4567 : 89ab: cdef fe80 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000: 0001 fe80 : 0000 : 0000 : 0000 : c012 : 9aff : fe9a: 19ac fe80 : 0000 : 0000 : 0000 : 0123 : 4567 : 89ab: cdef 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000: 0001 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000: 0000
Rule 1 – Omit Leading Zeros
The first rule to help reduce the notation of IPv6 addresses is to omit any leading 0s (zeros) in any hextet. Here are four examples of ways to omit leading zeros:
- 01ab can be represented as 1ab
- 09f0 can be represented as 9f0
- 0a00 can be represented as a00
- 00ab can be represented as ab
This rule only applies to leading 0s, NOT to trailing 0s, otherwise the address would be ambiguous. For example, the hextet “abc” could be either “0abc” or “abc0”, but these do not represent the same value.
Omitting Leading 0s
Type | Format |
---|---|
Preferred |
2001 : 0db8 : 0000 : 1111 : 0000 : 0000 : 0000 : 0200 |
No leading 0s |
2001 : db8 : 0 : 1111 : 0 : 0 : 0 : 200 |
Preferred |
2001 : 0db8 : 0000 : 00a3 : ab00 : 0ab0 : 00ab : 1234 |
No leading 0s |
2001 : db8 : 0 : a3 : ab00 : ab0 : ab : 1234 |
Preferred |
2001 : 0db8 : 000a : 0001 : c012 : 90ff : fe90 : 0001 |
No leading 0s |
2001 : db8 : a : 1 : c012 : 90ff : fe90 : 1 |
Preferred |
2001 : 0db8 : aaaa : 0001 : 0000 : 0000 : 0000 : 0000 |
No leading 0s |
2001 : db8 : aaaa : 1 : 0 : 0 : 0 : 0 |
Preferred |
fe80 : 0000 : 0000 : 0000 : 0123 : 4567 : 89ab : cdef |
No leading 0s |
fe80 : 0 : 0 : 0 : 123 : 4567 : 89ab : cdef |
Preferred |
fe80 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001 |
No leading 0s |
fe80 : 0 : 0 : 0 : 0 : 0 : 0 : 1 |
Preferred |
0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001 |
No leading 0s |
0 : 0 : 0 : 0 : 0 : 0 : 0 : 1 |
Preferred |
0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 |
No leading 0s |
0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 |
Rule 2 – Double Colon
The second rule to help reduce the notation of IPv6 addresses is that a double colon (::) can replace any single, contiguous string of one or more 16-bit hextets consisting of all zeros. For example, 2001:db8:cafe:1:0:0:0:1 (leading 0s omitted) could be represented as 2001:db8:cafe:1::1. The double colon (::) is used in place of the three all-0 hextets (0:0:0).
The double colon (::) can only be used once within an address, otherwise there would be more than one possible resulting address. When used with the omitting leading 0s technique, the notation of IPv6 address can often be greatly reduced. This is commonly known as the compressed format.
Here is an example of the incorrect use of the double colon: 2001:db8::abcd::1234.
The double colon is used twice in the example above. Here are the possible expansions of this incorrect compressed format address:
- 2001:db8::abcd:0000:0000:1234
- 2001:db8::abcd:0000:0000:0000:1234
- 2001:db8:0000:abcd::1234
- 2001:db8:0000:0000:abcd::1234
If an address has more than one contiguous string of all-0 hextets, best practice is to use the double colon (::) on the longest string. If the strings are equal, the first string should use the double colon (::).
Omitting Leading 0s and All 0 Segments
Type | Format |
---|---|
Preferred |
2001 : 0db8 : 0000 : 1111 : 0000 : 0000 : 0000 : 0200 |
Compressed/spaces |
2001 : db8 : 0 : 1111 : : 200 |
Compressed |
2001:db8:0:1111::200 |
Preferred |
2001 : 0db8 : 0000 : 0000 : ab00 : 0000 : 0000 : 0000 |
Compressed/spaces |
2001 : db8 : 0 : 0 : ab00 :: |
Compressed |
2001:db8:0:0:ab00:: |
Preferred |
2001 : 0db8 : aaaa : 0001 : 0000 : 0000 : 0000 : 0000 |
Compressed/spaces |
2001 : db8 : aaaa : 1 :: |
Compressed |
2001:db8:aaaa:1:: |
Preferred |
fe80 : 0000 : 0000 : 0000 : 0123 : 4567 : 89ab : cdef |
Compressed/spaces |
fe80 : : 123 : 4567 : 89ab : cdef |
Compressed |
fe80::123:4567:89ab:cdef |
Preferred |
fe80 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001 |
Compressed/spaces |
fe80 : : 1 |
Compressed |
fe80::0 |
Preferred |
0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001 |
Compressed/spaces |
:: 1 |
Compressed |
::1 |
Preferred |
0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 |
Compressed/spaces |
:: |
Compressed |
:: |
Ready to go! Keep visiting our networking course blog, give Like to our fanpage; and you will find more tools and concepts that will make you a networking professional.