Sunday, May 26, 2024

Cisco 117 - IPv6 Continued

EUI-64

EUI = Extended Unique Identifier
Method of converting a 48-bit MAC address into the *host* portion of a /64 IPv6 address

1) Divide the MAC address in half:
1234 5678 90AB --> 1234 56 | 78 90AB

2) Insert FFFE in the middle:
1234 56FF | FE78 90AB

3) Invert the 7th bit:
1234 56FF FE78 90AB
 ^

Recall that each hexadecimal digit is 4 bits.
[Sidenote: I always forget each hex decimal is 4 bits.  Here's why:
Hexadecimal F = Decimal 15.
Decimal 15 = Binary 1111
Notice there are 4 bits (ones) in Binary 1111.
Decimal 1 = Binary 0001
Still 4 bits.]


So the 7th bit is "buried in" the second hex digit.
Hexadecimal 12 = binary 0001 0010
Invert the 7th bit in the second group:
0010 --> 0000
Now convert the result back to hexadecimal
Binary 0000 --> 0
So the EUI becomes:
1034 56FF FE78 90AB
 ^


Doing the math in my head is a pain so memorize this table:


Given this network prefix: 2001:db8::

R1(config)#int g0/0
R1(config-if)#ipv6 address 2001:db8::/64 eui-64
R1(config-if)no shutdown

^ This will tell the router's interface to use EUI-64 rules to configure the interface.


Two more examples:
R1(config-if)#int g0/1
R1(config-if)#ipv6 address 2001:db8:0:1::/64 eui-64
R1(config-if)no shutdown

R1(config-if)#int g0/2
R1(config-if)#ipv6 address 2001:db8:0:2::/64 eui-64
R1(config-if)no shutdown

R1#show interfaces g0/0
^This will reveal MAC address of g0/0

Types of IPv6 addresses:

- Global unicast
    Public address; can be used over Internet. Must be registered.
    Originally defined as 2000::/3 (2000:: to 3FFF....FF)
    Now defined as all addresses not otherwise reserved for other purposes
    Example:
    2001:0DB8:8B00:0001:0000:0000:0000:0001/64
    
    The first three groups are the 48-bit 'global routing prefix' assigned by the ISP:
    2001:0DB8:8B00
    
    The fourth group is the 16-bit subnet identifier:
    0001
    
    Together, they make up the 64-bit (/64) IPv6 network prefix.
    
    The remaining four groups make up the 64-bit 'interface identifier' -- the host portion of the address.
    16 hexadecimal digits = 16 digits x 4 bits each = 64 bits
    
- Unique local
    Private IPv6 addresses which cannot be used over the Internet.
    Like IPv4 10, 172, 192...
    Try to make the addresses unique in case your organization merges with another.
    Defined as:
    FC00::/7
    (FC00:: to FDFF....FF)
    Later update forced them all to start with FD.
    Example:
    FD45:93AC:8A8F:0001:0000:000:0000:0001/64
    
    FD says unique local address
    
    Next 40 bits (45:93AC:8A8F) should be randomly generated for merger reasons.
    
    Last 4 groups are the 64-bit interface identifier.
    
- Link local
    Automatically generated on IPv6 enabled devices.
    R1(config-if)#ipv6 enable
    ^ Enables IPv6 on an interface without actually assigning an IP address.
    Typically the interface gets a link local IPv6 address in addition to the one you assign; in this case, it would only have a link local IPv6 address.
    Defined as:
    FE80::/10
    (FE80:: to FEBF:FFFF.....FF)
    However standard has a wrinkle that restricts them to begin with FE8.
    Interface ID is generated using EUI-64 rules.
    Link local = Used for communication within a single link (subnet).
    Routers will not forward packets with link-local destination IPv6 addresses.
    Commonly used for routing protocol peerings (OSPFv3) and next-hop address for static routes.
    
- Multicast
    Unicast addresses are 1-to-1
    Broadcast is from one source to all destinations
    Multicast is 1 to many destinations
    Defined as:
    FF00::/8
    (FF00:: to FFFF....FFFF)
    IPv6 does not broadcast like IPv4.
    But it has a multicast to all hosts in subnet that is like a broadcast.
    Common multicast addresses:



    Multicast address scope = How far multicast scope should be forwarded.
    FF01 = Interface-local (127.0.0.1 -- Stay on local device)
    FF02 = Link-local = Local subnet - Routers won't forward between subnets
    FF05 = Site-local - Limited to a single physical location (like a LAN).  Not forwarded over a WAN.  Defined by SysAdmin.
    FF08 = Organization-local - An entire company.
    FF0E = No boundaries. Can be routed over Internet.
    
- Anycast
    "One to one of many"
    Whereas multicast is one to all in that group (one to many), anycast is one to any one of multiple in a group.
    For example, multiple routers might be configured with the same IPv6 address.  The "nearest" (by routing metric) would receive the anycast.
    No specified range.
    R1(config-if)#ipv6 address 2001:db8:1:1::99/128 anycast
    ^ This assigns an IPv6 address to an interface and tells the interface it is an "anycast" address.  The /128 is like an IPv4 /32.
    
- Other IPv6 Addresses
    :: = Unspecified (such as when a device does not yet know its IPv6 address). IPv4 equivalent = 0.0.0.0
    ::1 = Loopback address (like 127.0.0.1/8)
    
Summary:
    FC & FD = Unique local = Private IP
    FE8 = Link local = Local subnet
    FF = Multicast
        FF01 = Interface-local (127.0.0.1)
        FF02 = Link-local = Local subnet - Routers don't route
        FF05 = Site-local = Single physical location like a LAN
        FF08 = Organization-local = An entire company
        FF0E = No boundaries. Can be routed over Internet.
    



[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]