IPv6 has a method (as defined in RFC 4291) to generate a 64 bit interface part (host part) of the Global Unicast IPv6 Address from the interface MAC address. MAC Addresses are considered as Globally Unique addresses and therefore the IPv6 address derived from MAC address also should be Globally Unique. The EUI-64 method of generating an Global Unicast IPv6 Address involves selecting the 6 byte (48 bit) interface MAC address and the and then generating a Global Unicast IPv6 Address by expanding it into a 64 bit interface part (host part).
To make a Global Unicast IPv6 Address unique, IPv6 insert 2 bytes (16 bits) into the middle of the MAC address. The 48 bit MAC address is divided into two 3 byte parts a binary number 1111111111111110 (0xFFFE in hexadecimals) is inserted in between them to make complete 64 bits.
Also the 7th bit (from left) in the MAC address is flipped. Which means, if the 7th bit in the MAC address (from left) is 1, change it to 0 or if the 7th bit (from left) in the MAC address is 0, change it to 1.
The 7th bit (from left) in the MAC address is called as Universal/Local (U/L) bit. Universal/Local (U/L) bit is used to indicate whether the address is universally assigned or locally assigned. The Universal/Local (U/L) bit set to 0 means that it is IEEE assigned MAC address. The Universal/Local (U/L) bit set to 1, means that the MAC address is locally assigned.
The reason behind flipping the Universal/Local (U/L) bit is for better compressibility of IPv6 addresses.
Refer the screen shot given below.
|MAC Address with
0xFF:FE added in middle to make it 64 bits
|64 bit Host part||00AB:29FF:FE8C:3E00|
|64 bit Host part (in binaries)||0000000010101011:0010100111111111:1111111010001100:0011111000000000|
|64 bit Host part
in binaries and 7th bit flipped
|64 bit Host part
(in hexadecimals and 7th bit flipped)
|Global Unicast IPv6 address with network prefix 2001:db8:aaaa:1::/64 added
As shown in the above table, the EUI-64 Global Unicast IPv6 address 2001:db8:aaaa:1:2ab:29ff:fe8c:3e00/64 for the Ethernet interface eth0, is derived from the MAC address of that interface.
Well, everything looks good. But, what about an interface which does not has a MAC address? You may aware that a Serial Interface in a Cisco router does not has a MAC address. RFC 4291 states that if there is no MAC address available for a network interface, borrow a MAC address from another interface which has a MAC address. Good idea!!!