Sunday, June 1, 2014

Beginning IPv6 - Understanding The Interface ID - Modified EUI64

Here is where I begin a series on understanding, configuring and analysing IPv6 protocol and communication.

This first post in this series, deals with understanding the interface ID part of the IPv6 address. The reason I choose to start with this is, I feel it is important to understand how the last 64 bits (Interface ID) is determined.
So without further ado, let's look at the IPv6 address format using RFC 4193 (Unique Local IPv6 Unicast Address)

 | 7 bits |1|  40 bits   |  16 bits  |          64 bits           |
 | Prefix |L| Global ID  | Subnet ID |        Interface ID        |
As we can see from the above, the IPv6 interface ID is 64 bits.

The value which becomes the interface ID is generated from the existing MAC address on your device's interface(s).

Let's get our system's MAC address
nik@securitynik:~$ ifconfig | grep HW
eth0      Link encap:Ethernet  HWaddr 08:00:27:4d:f7:d0

OK! So our MAC is 08:00:27:4d:f7:d0

The above MAC address is 48 bits or 6 bytes. To get this to Extended Unique Identifer (EUI64) we simply insert FF:FE between the Organizational Unique Identifer (OUI) and the local portion. From the above MAC address, the OUI is represented by the first 3 bytes moving from left to right. This would mean the OUI is 08:00:27. Next the local portion of the 48 bits MAC would be the next (last) 3 bytes. Which in this case would be 4d:f7:d0. If we now insert FF:FE between these two we get the EUI64 address.
So our EUI64 address is 08:00:27:FF:FE:4d:f7:d0

However, we do not finish here. The interface uses a modified EUI64 not the actual EUI64 address.

To get to the modified EUI64 address, we modify the first byte from the left of thie EUI64 address

So the current EUI64 address is 08:00:27:FF:FE:4d:f7:d0. The first byte of the above MAC is 08. In Binary this is 0000 1000

Now that we have the binary value, let's modify the 7th bit from the left. In binary 0000 1000 the 7th bit has a value of 0 We will now change this value to 1. If the current value is a 0 we change it to one, likewsie if it is a 1 we change it to 0
Binary 0000 1000 becomes 0000 1010 which is x0a. Now we have our modified EUI64 which is 0a:00:27:FF:FE:4d:f7:d0

So if we step back a bit, our original MAC was 08:00:27:4d:f7:d0. Now our Modified EUI64 is 0a:00:27:FF:FE:4d:f7:d0

Let's verify this on our interface

nik@securitynik:~$ ifconfig eth0 | grep -E HW\|inet6
eth0      Link encap:Ethernet  HWaddr 08:00:27:4d:f7:d0 
          inet6 addr: fe80::a00:27ff:fe4d:f7d0/64 Scope:Link
Awewsome!!! we should now understand how the Interface ID (Modified EUI64) is determined for our IPv6 Interface

References and additional readings

No comments:

Post a Comment