from IPv4 to IPv6, a 128-bit IP notation.

IPv6

Packet

IPv4 IPv6
Header Length 20~60 Bytes 40 Bytes
Protocol Next Header
Datagram Length Payload Length
TTL TTL Hop Limit
Flow Label, Priority
IPsec disable by default enable by default

EUI-64

EUI, stands for Extended Unique Identifier, is a method which allow automatically configure IPv6 addresses with the MAC address of the network interface to generate a unique 64-bit id value.

example

Assume there is a 48-bit MAC address: 04:cd:ae:3b:d0:e6,

Step 1. Split the MAC address into 24-bit from the middle: 04:cd:ae & 3b:d0:e6, as known as, OUI (Organizationally Unique Identifier) & NIC (Network Interface Card)

Step 2. Concat 16-bit fffe [1] between the 2 values, the result goes: 04:cd:aefffe3b:d0:e6

Step 3. Reformat with : & 4 char as a group, result: 04cd:aeff:fe3b:d0e6

Step 4. Modify the 7th bit with 2'complement
- which located in 04 from the above example, then tranform to 0000 0100 as binary
- switch the binary value of the 3rd index -> 00000 01'0'0 to 00000 01'1'0
- tranform back to heximal is 06, so now the result is 06cd:aeff:fe3b:d0e6

So far, the 64-bit unique interface ID is generated.

Step 5. Add the prefix as the beginning 64-bit, see the table below, for more detail: https://www.jannet.hk/ip-address-version-6-ipv6-zh-hant/

prefix
Link-Local FE80::/10
Unique-Local FC00::/7
Global Aggregatable [2] 2000::/3
Stateless Address Autoconfiguration (SLAAC) Auto-configure w/ IPv6 Router

[1]: IEEE has chosen FFFE as a reserved value which can only appear in EUI-64 generated from the an EUI-48 MAC address
[2]: Global Aggregatable: 2002::/16 is used for 6to4 Tunnel

ref: https://networklessons.com/ipv6/ipv6-eui-64-explained
ref: https://www.jannet.hk/ip-address-version-6-ipv6-zh-hant/
ref: https://community.cisco.com/t5/networking-knowledge-base/understanding-ipv6-eui-64-bit-address/ta-p/3116953