IPv6 Fundamentals, Addressing, and Routing
Introduction & Numbering Systems
- Concept: IPv6 was developed to solve IPv4 address exhaustion. IPv4 provides ~4.3 billion addresses (32-bit), while IPv6 provides 2^128 addresses (128-bit).
- Details:
- IANA (Internet Assigned Numbers Authority) distributes addresses to RIRs (Regional Internet Registries: AFRINIC, APNIC, ARIN, LACNIC, RIPE NCC). Most RIRs have exhausted IPv4 pools.
- IPv5: Internet Stream Protocol (experimental, used version field 5, never public).
- Numbering Systems:
- Binary (Base 2): Prefix
0b. Digits: 0, 1. - Decimal (Base 10): Prefix
0d. Digits: 0-9. - Hexadecimal (Base 16): Prefix
0x. Digits: 0-9, A-F. 1 hex digit = 4 bits.
- Binary (Base 2): Prefix
Things to note: Memorize hex conversions for 10-15 (A=10, B=11, C=12, D=13, E=14, F=15). Every additional bit doubles the address space.
IPv6 Addressing Basics
- Concept: IPv6 addresses are 128 bits long, written as 32 hexadecimal characters divided into 8 groups of 4 (quartets) separated by colons.
- Details:
- Prefix Length: Uses slash notation (e.g.,
/64) directly in the CLI. No dotted-decimal subnet masks. - RFC 5952 (Standard Representation):
- Leading zeros in a quartet MUST be removed.
- Double colon (
::) MUST be used for the longest consecutive string of all-0 quartets. - If there is a tie for the longest string, use
::on the left-most string. - Hexadecimal letters (A-F) MUST be lowercase.
- Shortening Rules:
- Remove leading zeros (e.g.,
01->1). - Replace consecutive all-0 quartets with
::. Can only be done ONCE per address.
- Remove leading zeros (e.g.,
- Expanding Rules:
- Add leading zeros to ensure every quartet has 4 characters.
- Replace
::with enough0000quartets to equal exactly 8 total quartets.
- Prefix Length: Uses slash notation (e.g.,
Things to note: You cannot use :: twice. If you have two sets of consecutive zeros, use :: for the longest set (or left-most if tied), and just drop leading zeros for the other set.
Finding the IPv6 Network Prefix
- Concept: Similar to IPv4, change all host bits to
0to find the network prefix. - Details:
- If prefix length is a multiple of 4 (e.g.,
/64,/56): Simply change all hex characters after the prefix boundary to0. - If prefix length is NOT a multiple of 4 (e.g.,
/93): You must convert the boundary hex digit to binary, zero out the host bits, and convert back to hex.- Example:
/93ends in the middle of the 24th hex digit. Convert that hex digit to 4 binary bits, keep the first bit (network), change the remaining 3 bits to0, and convert back to hex.
- Example:
- If prefix length is a multiple of 4 (e.g.,
IPv6 Address Types
| Address Type | Prefix / Range | Scope / Routing | Description |
|---|---|---|---|
| Global Unicast (GUA) | 2000::/3 (Originally), now all unassigned |
Routable over Internet | Public addresses. Requires registration. |
| Unique Local (ULA) | FC00::/7 (Usually FD) |
Routable internally, dropped by ISP | Private addresses. No registration needed. |
| Link-Local | FE80::/10 (Usually FE80) |
Non-routable (Local subnet only) | Auto-generated. Used for routing protocols/NDP. |
| Multicast | FF00::/8 |
Varies by scope | One-to-many. Replaces IPv4 Broadcast. |
| Anycast | Any Unicast range | Routable | One-to-one-of-many. Nearest router responds. |
| Unspecified | ::/0 |
N/A | All zeros. Used when device doesn’t know its IP. |
| Loopback | ::1/128 |
Local device only | Tests protocol stack. Equivalent to 127.0.0.1. |
Global Unicast Address (GUA) Structure
- Global Routing Prefix: Typically
/48assigned by ISP. - Subnet Identifier: Typically 16 bits (allows 65,536 subnets).
- Interface Identifier: 64 bits (Host portion).
- Total Prefix: Usually
/64.
Unique Local Address (ULA) Structure
- FD: Indicates ULA.
- Global ID: 40 bits. Must be randomly generated to prevent overlaps if companies merge.
- Subnet ID: 16 bits.
- Interface ID: 64 bits.
Multicast Scopes
| Scope | Prefix | Description |
|---|---|---|
| Interface-Local | FF01:: |
Stays within the local device (node-local). |
| Link-Local | FF02:: |
Stays within the local subnet. Not routed. |
| Site-Local | FF05:: |
Limited to a single physical site/WAN boundary. |
| Organization-Local | FF08:: |
Wider scope, across multiple sites in an org. |
| Global | FF0E:: |
Routable across the public Internet. |
Important Multicast Addresses:
FF02::1: All Nodes (All Hosts) - Functions like a broadcast.FF02::2: All Routers.FF02::5: All OSPF Routers (IPv4:224.0.0.5).FF02::A: All EIGRP Routers (IPv4:224.0.0.10).
EUI-64 & SLAAC
- Concept: Methods to automatically generate the 64-bit Interface ID (host portion) of an IPv6 address.
- EUI-64 (Extended Unique Identifier): Converts a 48-bit MAC address into a 64-bit Interface ID.
- Split the MAC address in half.
- Insert
FFFEin the middle. - Invert the 7th bit (the Universal/Local or U/L bit). If it’s
0, make it1. If1, make it0.
- SLAAC (Stateless Address Autoconfiguration): Hosts automatically learn the IPv6 prefix from the local router and generate their own Interface ID (via EUI-64 or random generation) without a server.
Things to note: The 7th bit inversion in EUI-64 reverses the meaning of the U/L bit. In MAC addresses, 0 = Universally Administered (UAA). In EUI-64, 0 means it was derived from a Locally Administered Address (LAA).
Neighbor Discovery Protocol (NDP) & ICMPv6
- Concept: NDP replaces ARP in IPv6. It uses ICMPv6 messages and multicast to discover neighbors, routers, and detect duplicate addresses.
- Details:
- Solicited-Node Multicast Address: Calculated from a unicast address. Format:
FF02::1:FF+ last 6 hex digits of the unicast address. Used to make NDP highly efficient (multicast instead of broadcast). - DAD (Duplicate Address Detection): When an interface initializes or gets an IP, it sends a Neighbor Solicitation to its own solicited-node multicast address. If no reply is received, the IP is unique.
- Solicited-Node Multicast Address: Calculated from a unicast address. Format:
| ICMPv6 Type | Message Name | Function | Destination |
|---|---|---|---|
| 133 | Router Solicitation (RS) | Host asks for routers on the link. | FF02::2 (All Routers) |
| 134 | Router Advertisement (RA) | Router announces presence, prefix, etc. | FF02::1 (All Nodes) |
| 135 | Neighbor Solicitation (NS) | Asks for a neighbor’s MAC address (Replaces ARP Request). | Target’s Solicited-Node Multicast |
| 136 | Neighbor Advertisement (NA) | Replies with MAC address (Replaces ARP Reply). | Requester’s Unicast IP |
sequenceDiagram
participant R1
participant R2
R1->>R2: NS (ICMPv6 135) to R2's Solicited-Node Multicast
Note over R1,R2: "What is your MAC address?"
R2->>R1: NA (ICMPv6 136) to R1's Unicast IP
Note over R1,R2: "My MAC is XX:XX:XX..."
IPv6 Header
- Concept: The IPv6 header is simplified and has a fixed size of 40 bytes (unlike IPv4’s variable 20-60 bytes), improving router processing efficiency.
- Fields:
- Version (4 bits): Always
6(binary0110). - Traffic Class (8 bits): Used for QoS (Quality of Service).
- Flow Label (20 bits): Identifies specific traffic flows (e.g., server-client interaction).
- Payload Length (16 bits): Length of the Layer 4 segment in bytes.
- Next Header (8 bits): Indicates the encapsulated protocol (TCP, UDP, etc.). Equivalent to IPv4’s Protocol field.
- Hop Limit (8 bits): Decremented by 1 at each router. Packet dropped at 0. Equivalent to IPv4’s TTL.
- Source Address (128 bits): Sender’s IPv6 address.
- Destination Address (128 bits): Receiver’s IPv6 address.
- Version (4 bits): Always
IPv6 Static Routing
- Concept: IPv6 routing uses a separate routing table from IPv4. IPv6 routing is disabled by default and must be enabled globally.
- Details:
- Route Types:
- Recursive: Specifies only the next-hop IP. Requires two lookups (destination -> next-hop -> exit interface).
- Directly Attached: Specifies only the exit interface. WARNING: Does NOT work on Ethernet interfaces in IPv6! (Works on Serial).
- Fully Specified: Specifies both exit interface and next-hop IP. Required when using a Link-Local address as the next hop.
- Floating Static Route: A backup route with a manually increased Administrative Distance (AD). Must be higher than the primary routing protocol’s AD (e.g., >110 for OSPF, >90 for EIGRP).
- Route Codes in
show ipv6 route:- Connected network routes are added automatically.
- Local host routes (
/128) are added for configured interface IPs. - Link-local addresses do not appear in the routing table.
- Route Types:
graph TD
A[Packet Arrives] --> B{Lookup Destination in IPv6 Routing Table}
B --> C[Most Specific Match Wins]
C --> D[Forward out Exit Interface to Next-Hop]
Things to note: If your IPv6 config looks perfect but traffic isn’t routing, you almost certainly forgot ipv6 unicast-routing. Also, remember that directly attached static routes fail silently on GigabitEthernet interfaces in IPv6.
Command Reference Summary
Global Configuration
Router(config)# ipv6 unicast-routing
! Enables IPv6 routing globally (DISABLED BY DEFAULT)
Interface Configuration
Router(config-if)# ipv6 address <ipv6-address>/<prefix-length>
! Configures a static IPv6 address (e.g., 2001:db8:0:1::1/64)
Router(config-if)# ipv6 address <ipv6-prefix>/<prefix-length> eui-64
! Generates Interface ID automatically from the interface's MAC address
Router(config-if)# ipv6 address autoconfig
! Enables SLAAC (learns prefix from Router Advertisements)
Router(config-if)# ipv6 enable
! Enables IPv6 on the interface and auto-generates a Link-Local address only
Router(config-if)# ipv6 address <ipv6-address>/<prefix-length> anycast
! Configures an Anycast address (usually with /128)
Router(config-if)# no shutdown
! Activates the interface
Static Routing
Router(config)# ipv6 route <prefix>/<prefix-length> <next-hop-ip>
! Recursive static route
Router(config)# ipv6 route <prefix>/<prefix-length> <exit-interface> <next-hop-ip>
! Fully specified static route (REQUIRED for link-local next-hops)
Router(config)# ipv6 route <prefix>/<prefix-length> <next-hop-ip> <AD>
! Floating static route (e.g., AD 120 for OSPF backup)
Verification & Troubleshooting
Router# show ipv6 interface brief
! Displays IPv6 addresses (including auto-generated Link-Local) and status
Router# show ipv6 interface <interface>
! Shows detailed IPv6 info, including joined multicast groups
Router# show ipv6 route
! Displays the IPv6 routing table
Router# show ipv6 neighbor
! Displays the NDP neighbor table (equivalent to show ip arp)
Router# ping ipv6 <destination-ip>
! Tests IPv6 connectivity