Tuesday, February 28, 2017

A Complete Note on IPv6 Addressing

IP addressing format we use currently in most networks is IPv4 which uses 32 bit IP addresses written in dotted decimal format.
Each octet contains a 1 Byte (8 bits).  All the possible IP addresses in IPv4 are 232 = 4,294,967,296
Actually usable amount is much lesser than the above number because of the private address ranges and other reservations. Because the internet is running out of IP addresses, IPv6 was introduced.

IPv6 addressing format uses 128 bits for an IP address which is written in hexadecimal numbers separated by colons. Therefore the IP addresses available are 2128 = 3.4 x 1038
Address format is as following,


Where an "X" is a hexadecimal number.. Ex:- 1,2,3,4,5,6,7,8,9,A,B,C,D,E
There are 8 groups of 4 hexadecimal numbers..
Each group represents 16 bits (4 hexa digits x 4 bits)

Real world example address: 2001:034A:32D0:0000:0000:009C:0000:067F

You can simplify the address by eliminating all zero hex digit groups and replace them with double colon "::". But you can use it once for an address. Also you can eliminate leading zeros of a hexa digit group. So the above real world address can be written as following.


Prefix & Interface ID

Addresses are allocated based on the physical location. Jut like in IPv4 subnet mask, IPv6 also has prefix mask. The prefix includes the global routing information & the subnet address. More than one address can be assigned to an interface of a host.
An interface assigned IPv6 address has 64 bits for the prefix and the other 64 bits for the interface ID.

Normal addresses will be written as Address/Prefix-length. Prefix length is written in decimal.
If we take the above real world example address,  2001:34A:32D0::9C:0:67F/64 is how we normally
write it. Prefix is 2001:034A:32D0:0000 and the interface ID is 0000:009C:0000:067F

1st 3 hex-digits (1st 12 bits) represent Regional Internet Registrar (RIR)
Next 5 hex-digits (1st 32 bits) represent ISP
Next 4 hex-digits (1st 48 bits) represent the site
Next 4 hex-digits (1st 64 bits) represent the subnet

1st 12 hex-digits / 48 bits (RIR + ISP + Site ID) represent the global routing prefix. All the above 64 bits represent the prefix of an IPv6 address. Rest of the 16 hex-digits (64-bits) is the interface ID.

Following diagram explains how the real world IP 2001:034A:32D0:0000:0000:009C:0000:067F is assigned to a host with it's 64-bit prefix 2001:034A:32D0:0000::/64

IPv6 Address Types

Unicast : One-to-One (Global, Link Local, Unique Local)
This kind of addresses are destined for a single interface

Multicast : One-to-Many
This kind of addresses are destined for a set of interfaces
Delivered to a group of interfaces identified by that address
Broadcast of IPv4 is replaced by this..

Anycast : One-to-Nearest (Allocated from Unicast)
Delivered to the closest interface as determined by the IGP

A single interface may be assigned multiple IPv6 addresses from any of the types above..

IPv6 Unicast Address Scopes

Link Local Addresses

Only used for communications within the local subnet, routers do not forward packets with this scope..
It is configured automatically and used for neighbor discovery, router discovery etc by many routing protocols..
Starts from FE80 and has the /64 prefix..
Somewhat similar behavior to the 169.254.X.X in IPv4 which is self originated when the host cannot contact a DHCP server..
Interface ID is created using the 48-bit MAC address of the interface hardware which is then called an EUI-64 type interface ID..

To create an EUI-64 type interface ID from a 48-bit MAC address,
1) Invert the 7th most significant bit
2) Insert FF:FE in the middle

Ex:-  Let's go to a Cisco router and see how it calculates it's Link Local Addresses..

You can see the interface MAC address is AABB.CC00.1000
If we write the 1st group of hex-digits in binary format it will be like the following..

AABB = 1010 1010 1011 1011

Red colored bit is the 7th bit from the left which must be inverted..

1010 1000 1011 1011 = A8BB

So after the inversion, the MAC will be like A8BB.CC00.1000
After the FFFE is squeezed in to the middle, the EUI-64 format will be;


Now this will be assigned to the interface along with the IPv6 prefix FE80::/64..

Now let's enable IPv6 in interface e0/0 and see what the IPv6 Link Local Address will be..

Now let's see it in your Windows machine.. Enter ipconfig /all in command prompt..

You can see it also starts with FE80::/64 but the interface ID is completely different. This is because it does not use the EUI-64 format to assign the Link Local Addresses in windows.
Because the users can be tracked, sniffed by the well known EUI-64 format, Microsoft and other vendors has decided to use their own methods / algorithms to create theese IPv6 temporary Link Local Addresses..

Site Local Addresses (no longer used)

Starts with FEC0::/10
Originally designed as the equivalent for the IPv4 private address range.
Now these scope is no longer supported globally, therefore if you see an IP starting from "FECO" it is no longer a valid address.. Succeeded by the Unique Local Addresses..

Unique Local Addresses

It is like the private range of IPv4 Addresses (10.x.x.x, 172.16.x.x, 192.168.x.x)
Starts with FC00::/7
Likely unique but not routable via global BGP..
You have to use NAT if you are going to use this range..
Until you are applying for an IPv6 range,you can use these addresses in your design..

Global Unicast Addresses

All the other addresses in IPv6 are globally routable IPv6 Global Unicast Addresses..
Up to today the addresses with 2000::/3 which means any address starts with 2 or 3 are releasing to the public these days and can be found on the internet..


Side Note:-
Special Addresses used in IPv6 are stated in the following chart..

Special Addresses used in IPv6 multicast applications are stated in the following chart..


  • March 2, 2017 at 2:34 PM
    russel says:

    Good work Bro, very useful


Post a Comment