IPv6 EUI-64 calculation
The second part of an IPv6 unicast address (used to identify a host’s network interface) is usually a 64-bit interface identifier. An interface ID is created by inserting the hex number FFFE in the middle of the MAC address of the network card. Also, the 7th bit in the first byte is flipped to a binary 1. The interface ID created this way is known as the modified extended unique identifier 64 (EUI-64).
Here are the rules that a router uses to create the interface ID:
1. Split the MAC address in two halves (6 hex digits each).
2. Insert FFFE in between the two, making the interface ID.
3. Invert the seventh bit of the interface ID.
For example, if the MAC address of a nework card is 00:BB:CC:DD:11:22, the interface ID would be 02BBCCFFFEDD1122.
Why is that so?
Well, the router will first flip the seventh bit from 0 to 1. MAC addresses are in hex format. The binary format of the MAC address looks like this:
hex – 00BBCCDD1122
binary – 0000 0000 1011 1011 1100 1100 1101 1101 0001 0001 0010 0010
The router will flip the seventh bit:
binary – 0000 0010 1011 1011 1100 1100 1101 1101 0001 0001 0010 0010
This will result in the following hexadecimal address:
hex – 02BBCCDD1122
Next, the router will insert FFFE in the middle of the address listed above:
hex – 02BBCCFFFEDD1122
So, the interface ID will be 02BB:CCFF:FEDD:1122.