IPv6 interface identifier

The second part of an IPv6 unicast or anycast address is typically a 64-bit interface identifier used to identify a host’s network interface. A 64-bit interface ID is created by inserting the hex value of 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 (if the 7th bit is set to 0 it means that the MAC address is a burned-in MAC address). When this is done, the interface ID is commonly called the modified extended unique identifier 64 (EUI-64).

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, first we need to 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

We need to flip the seventh bit:

binary 0000 0010 1011 1011 1100 1100 1101 1101 0001 0001 0010 0010

Now we have this address in hex:

hex 02BBCCDD1122

Next we need to insert FFFD in the middle of the address listed above:

hex 02BBCCFFFEDD1122

So, the interface ID is now 02BB:CCFF:FEDD:1122.

Another example, this time with the MAC address of 00000C432A35.

1. Convert to binary and flip the seventh bit to one:

binary: 0000 0010 0000 0000 0000 1100 0100 0011 0010 1010 0011 0101

2. Convert back to hex:

hex: 02000C432A35

3. Insert FFFT in the middle:

interface ID: 02000CFFFE432A35