Quick guide to IPv6 Unicast addresses

Goals

This is a very quick guide of IPv6 Unicast Addresses. Please note that this is my understanding of IPV6 and might not be fully correct (please comment below if you want to improve this post). Please note that this post only talks about Unicast IPv6 addresses, not Anycast or Multicast. This post assumes that you have a good understanding of IPv4.

IPv6 Format

IPv6 addresses have a size of 128 bits (compared to the IPv4 32 bits) and are written in hexadecimal format. Since even in hexadecimal format IPv6 address can be very long there are some rules to shorten them:

Rule:1 Discard leading Zero(es)

Rule:2 If two of more blocks contains consecutive zeroes, omit them all and replace with double colon sign ::

IPv4 “equivalents”

Although not entirely correct, I found it useful to compare the scope of IPv4 addresses to IPv6 Unicast addresses:

IPv4 scope IPv4 example IPv6 IPv6 example Notes
Link Local169.254.0.0/16 Link Local fe80::/64 This would be your Windows APIPA, Linux Avahi or Apple Zeroconf IPv4. IPv6 Link Local addresses start with FE80:
Private address 192.168.0.0/16,10.0.0.0/8 or 172.16.0.0/12 Unique Local FD00::/8 Local IPv6 address are really FC00::/7, since the 8th bit or Local “L” flag is not defined the first eight bits become FD
Public Address 8.8.8.8 Global Unicast 2001:4860:4860::8888 Globally routable and reachable Internet addresses

IPv6 uses in most cases a version of the device’s hardware MAC address in the address itself using the Modified EUI-64 interface identifier. So let’s start with the nitty-gritty.

How to get the Modified EUI-64:

Start with the MAC address of the interface and stick the 16 bit hex value of 0xFFFE to get the EUI-64 and invert the 7th most significant bit to get the Modified EUI-64.

For example if the MAC address is:

00:CE:39:CD:7F:20

Stick FF:FE in the middle to get the EUI-64 notation:

00:CE:39:FF:FE:CD:7F:20

The first eight bits, the 00 in hex form, would be:

0000 0000

and invert the most significant 7th bit to get the first eight bits:

0000 0010

Going back to hex notation the first eight bits would be:

02

So the Modified EUI-64 would be:

02:CE:39:FF:FE:CD:7F:20

I have not found an online tool that just does this part of an IPv6 address, the closest I coudl find was this site, just use everything after FE80::.

You will need the Modified EUI-64 to build your different IPv6 addresses.

Link-Local

Scope: Link Local

Hexadecimal format:

FE80: 0000:0000:000 Modified EUI-64
16 bits 48 bits 64 bits

For example if the MAC address is:

00:CE:39:CD:7F:20

The link local address would be:

FE80: 0000:0000:0000: 02CE:39FF:FECD:7F20
16 bits 48 bits 64 bits

or

fe80:0000:0000:0000:02ce:39ff:fecd:7f20

shortened using IPv6 shortening rules to:

fe80::02ce:39ff:fecd:7f20

Unique Local

Scope: Organizational or Site

Hexadecimal format:

FD Global ID Subnet ID Modified EUI-64
7 bits + “L” bit (not defined yet) 40 bits 16 bits 64 bits

Unique Local IPv6 addresses are meant to be private to an organization but they still need to be unique, so the Global ID portion must be “random”. Using a random process you can generate a Global ID that statistically very unlikely to be duplicated. IETF has a suggested method (RFC4193) to generate unique addresses that is worthy a Nerd Pulitzer (no disrespect meant, just read the process at the end of RFC4193 to get an idea).

Fortunately there is a website for that, go to:

https://cd34.com/rfc4193/

and input your MAC address, for example:

00:CE:39:CD:7F:20

The results will be:

“Your Private IPv6 network is:

fd5c:0e7f:1e67::/48

giving you access to the to the following /64s:

fd5c:0e7f:1e67:0::/64 through fd5c:0e7f:1e67:ffff::/64“

In expanded form your network will be:

FD5C:0E7F:1E67:0000:0000:0000:0000:0000

The above means that your Global ID is:

5c:e7f:1e67

and you can make your the Subnet ID whatever are your requirements for your network, say, very creatively, 0000

The Unique Local address would be:

FD 5c:e7f:1e67 0000: 02CE:39FF:FECD:7F20
7 bits + “L” bit (not defined yet) 40 bits 16 bits 64 bits

or

FD5c:e7f:1e67:0000:02CE:39FF:FECD:7F20

shortened using IPv6 shortening rules to:

fd5c:e7f:1e67:0:2ce:39ff:fecd:7f20

Global Unicast

Scope: Global

Hexadecimal format:

Global Routing Prefix Subnet ID Modified EUI-64
48 bits 16 bits 64 bits

For example if the MAC address is:

00:CE:39:CD:7F:20

The Global Routing Prefix is:

2603:B9C0:9CC6

The Subnet ID is:

25AC:

The Global Unicast address would be:

2603:B9C0:9CC6: 25AC: 02CE:39FF:FECD:7F20
48 bits 16 bits 64 bits

or

2603:B9C0:9CC6:25AC:02CE:39FF:FECD:7F20

shortened using IPV6 shortening rules to:

2603:b9c0:9cc6:25ac:2ce:39ff:fecd:7f20

Final Thoughts

I hope that this post was useful and made your life easier, if not, please leave a comment and I will try to answer if I can, but I cannot guarantee that I will, since I have a job, a family and several money-sucking hobbies. If you would like commercial support, please contact me privately.

References:

https://www.tutorialspoint.com/ipv6/ipv6_address_types.htm

https://ben.akrin.com/?p=1347

https://www.ultratools.com/ipv6Tools

https://www.vultr.com/resources/mac-converter/

https://cd34.com/rfc4193/

Leave a Reply