IPv6

IPv6 and also IPv4 are both connectionless, unreliable datagram protocols. They are used for addressing and routing packets between hosts.

IPv6  uses a 128 bit address space, which is divided into 8 blocks or quartets. Each block contains 16 bits separated with colon (:). These 16 bits are represented in the hexadecimal format at the end the address would result to be in the below given format.
Binary format:

0010000111011010000000001101001100000000000000000010111100111011
0000001010101010000000001111111111111110001010001001110001011010

divide them in to 8 equal parts of 16 bits each :

0010000111011010    0000000011010011    0000000000000000    0010111100111011
0000001010101010    0000000011111111    1111111000101000    1001110001011010

Hexadecimal format of the above address:

 Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Hexa
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

To convert to hexadecimal format divide the block to 4 parts:          0010 0001 1101 1010
Now convert them into hexadecimal values as per the above table: 2 1 D A
By doing this to all the 8 blocks we get:-            21DA:00D3:0000:2F3B:02AA:00FF:FE28:9C5A

Further we can remove the consecutive zeros like xxxx:0000:0000:yyyy and represent them with two colons “::”and we can do this only once in an address. 

The reason for doing only once is because if an address has two compressed zero representations, it would be difficult to identify how many blocks were compressed in each representation “::”. 

For  example:-
 2001:0000:0000:2F3B:0000:0000:0000:9C5A
 If we compressed it to
00F8::2F3B::9C5A
The above representation can be any one of these addresses,
2001:0000:2F3B:0000:0000:0000:0000:9C5A
2001:0000:0000:2F3B:0000:0000:0000:9C5A
2001:0000:0000:0000:2F3B:0000:0000:9C5A
2001:0000:0000:0000:0000:2F3B:0000:9C5A
The correct way of representing is:
            2001::2F3B:0:0:0:9C5A                     or
            2001:0:0:2F3B::9C5A
Also we can remove leading zeros in any block, like ‘000A’ can be written as ‘A’ so by trimming continuous zeros and leading zeros  the address 21DA:00D3:0000:2F3B:02AA:00FF:FE28:9C5A would look like 21DA:D3::2F3B:2AA:FF:FE28:9C5A.

Prefixes
Internet Corporation for Assigned Network Number (ICANN) owns the IPv6 process, and Internet Assigned Numbers Authority (IANA) manages the process of assigning the addresses geographically (North America, South/Central America, Europe, Asia/Pacific, Africa). All these are called Regional Internet Registries (RIR’s).

These RIR’s subdivided their assigned address space and assign them to the ISP’s and Smaller RIR’s.

These ISP’s subdivided their address space and assign them to the customers.


Higher order bits are called prefix they specify the network and the rest of the bits specify the hosts interface ID. All the addresses in a network have the same prefix, they are denoted by /N.

Prefix
Host (Interface ID)

If a network has 32 bit prefix we write it as
2001:0db8::/32
The specific address in the above network is written as
2001:db8::6:1
There isn’t any need of mentioning prefix, because we wrote the complete address.

We can also express IPv6 address with the prefix notation as we do with the IPv4 addresses. For example
 FE80::/10, FD00::/8,2000::/3 etc.

IPv6 prefixes and their meanings:
            xxx0::/12, Registry prefix, allocated by IANA to RIR.
xxx0::/32, route prefix or isp prefix, allocated by an RIR to an ISP.
xxx0::/48, site prefix or global routing prefix, allocated by an ISP to a customer(site).
xxx0::/64, subnet prefix, assigned by enterprise engineer to an individual link.

In the above prefixes, an RIR can allot addresses to 1,048,560 ISP’s.
Each ISP can allot addresses to 65,536 companies.
Each company (site) can allot addresses to 65536 individual links.

How to calculate?
An RIR is represented by first 12 bits, so they are fixed. The prefix of an ISP is /32, so an RIR has the option of using
32-12=20 bits, to allot to any ISP,
2 to the power of 20 is equal to 1,048,560.
So, there are 1,048,560 /32 subnets in a /12 network.

 They can be:
xxx0:0000::/32
xxx0:0001::/32
xxx0:0002::/32
………
xxxy:yyyy::/32
xxxf:ffff::/32
NOTE: xxx is an RIR prefix.

An ISP’s prefix is /32, which represent an ISP. So the first 32 bits are fixed in the prefix. And the site prefix is /48.
            48 – 32 = 16 bits, to allot to any company,
 2 to the power of 16 is equal to 65,536.
There are 65,536 /48 subnets in /32 network.

Example:
xxxy:yyyy:0000::/48

xxxy:yyyy is the ISP Prefix.

No comments: