ABC of IPv6 Addressing

IPv6 is defined to eventually replace IPv4. As far as the purpose is concerned both IPv4 and IPv6 are here to define logical address in IP network. It is required to uniquely identify the host and deliver the right content to the right recipient. 

The most obvious and recognizable difference between IPv4 and IPv6 is the IPv6 address. An IPv4 address is 32 bits and expressed in dotted-decimal notation, whereas an IPv6 address is 128 bits in length and written in hexadecimal. 

Just as an IPv4 address is divided into two parts, IPv6 address also has two parts. First 64-bits are known as the network/subnet and last 64-bits are for interface id or host. As you probably know this is required to locate a host in an IP network to correctly send the request/response.

Representation of IPv6 Address
IPv6 addresses are 128 bits in length and written as a string of hexadecimal digits. Every 4 bits can be represented by a single hexadecimal digit, for a total of 32 hexadecimal values. Configuring or working with IPv6 address is difficult as it a very long hexadecimal value. 

This can be solved as there are various ways where this address can be trimmed down. We’ll see it soon but before that it is worth to know that the alphanumeric characters used in hexadecimal are not case sensitive; therefore, uppercase and lowercase characters are equivalent. 

The longest representation of an IPv6 address includes a total of 32 hexadecimal values. Colons separate the groups of 4-bit hexadecimal digits. For example – 

Address 1 - fe80:0000:0000:0000:a299:9bff:fe18:50d1  
Address 2 - 2001:0db8:cafe:0001:0000:0000:0000:0100

This looks overwhelming, now let’s follow some standard rules that helps us to simplify the address – 
1. Omit leading 0s
2. Omit all 0s 
3. Use rule 1 and 2 same time

Rule 1 – Omit leading 0s: Omit the leading 0 from the 16-bits section. This rule applies only to leading 0s and not to trailing 0s.

Address 1 Original format - fe80:0000:0000:0000:a299:9bff:fe18:50d1 
Address 2 after Rule 1 – fe80:0:0:0:a299:9bff:fe18:50d1
Address 2 Original format - 2001:0db8:cafe:0001:0000:0000:0000:0100
Address 2 after Rule 1 – 2001:db8:1:0:0:0:100

Rule 2 – Omit all 0s : The second rule for shortening IPv6 addresses is that you can use a double colon (::) to represent any single, contiguous string of two or more hextets (16-bit segments) consisting of all 0s.

Address 1 Original Format - fe80:0000:0000:0000:a299:9bff:fe18:50d1 
Address 1 after Rule 2 – fe80::a299:9bff:fe18:50d1
Address 2 - 2001:0db8:cafe:0001:0000:0000:0000:0100
Address 2 after Rule 2 – 2001:0db8:café:0001::0100

Rule 3 – Use rule 1 and rule 2 same time – yes, both the rules stated above can be used same time as follows:

Address 1 Original Format - fe80:0000:0000:0000:a299:9bff:fe18:50d1 
Address 1 after Rule 2 – fe80::a299:9bff:fe1850d1
Address 2 - 2001:0db8:cafe:0001:0000:0000:0000:0100
Address 2 after Rule 2 – 2001:db8:café:1::100

Refer to Figure 1, it depicts the IPv6 network. There are two IPv6 network – 2001:db8:a:a::/64 and 2001:db8:d::/64. There are two host sharing the same network ID “2001:db8:a:a::/64” as part of the IPv6 address assigned to them – PC 1 IPv6 Address: 2001:db8:a:a::10, and PC2 IPv6 Address: 2001:db8:a:a::20 pointing to default gateway in the same network subnet.

Fig 1.1- IPv6 addressing

When a host wants to communicate to another host, it compares it network id with destination host network id. If both are same, communication between these two hosts will be based on the MAC address. If they do not match it means the destination host is on the different network and the packet is sent to the default gateway. 

For example PC 1 wants to send the traffic to the web-server and come to know that the network ID is different one that is configured on its own interface. Therefore packets to different network are forwarded to default gateway in this case g0/0 interface on router 1.

You can verify the IPv6 address on the PC using the ipconfig command.

Windows IP Configuration
Ethernet adapter Local Area Connection:
 Connection-specific DNS Suffix . :
 IPv6 Address. . . . . . . . . . .: 2001:db8:a:a::10
 Link-local IPv6 Address . . . . .: fe80::a00:27ff:fe5d:6d6%11
 IPv4 Address. . . . . . . . . . .:
 Subnet Mask . . . . . . . . . . .:
 Default Gateway . . . . . . . . .: 2001:db8:a:a::1

As already explained that IPv6 address is 128-bit long and divided into two parts network and interface/ host ID. Host id is usually long and sometimes preferred to be configured automatically for global unicast address IEEE EUI-64 is a standard format for this purpose.
EUI-64 takes the MAC address of the host which is 48-bits long, split it in half and adds the hex-value “fffe” in the middle. 

In addition to this it also takes the seventh bit and flips it. I mean if it is 0 it changes it to 1 and if it 1 then change it to 0. Don’t worry let’s understand it step by step.
Let’s take the example of link local IPv6 Address from our above output: fe80::a00:27ff:fe5d:6d6. The subnet Id is fe80:: and the interface id is a00:27ff:fe5d:6d6. If we expand this address, it will look like this – 0a00:27ff:fe5d:06d6 this is EUI format as there is “fffe” in the middle. 

The physical address of the PC-1 is 08-00-27-5D-06-D6. Split it in half and add fffe in between – 00-00-27-ff-fe-5d-06-d6 and now group them in 4 hex value replacing “-“ with colon “:”.  0800:27ff:fe5d:06d6. It looks close to what is mentioned in our ipconfig output but not the exact same as there is one more step to flip the 7th bit from left. 

Let’s convert first two value of the MAC address to binary format which looks like this – 00001000 and flip the 7th bit from 0 to 1. New binary value will be 00001010 now the equivalent hex-decimal value is “A” and new address looks exactly the same as per the output above – 0a00:27ff:fe5d:06d6.

By default routers use EUI-64 format when generating the interface id of the link local address of an interface. Modern PCs generate the interface portion of link-local and global unicast address when automatic IP configuration is selected. However this can be changed to EUI-64 format

 Show IPv6 interface command is used to verify the IPv6 address on the Cisco router.

Hope this was informative considering you are journey to IPv6 learning. Soon will come back with “DEF of IPv6 addressing”. Good Luck stays safe!

No comments