Routing with IPv6
Open in the Padhaiko app4.1 Routing in the internet and CIDR
IPv6 routing preserves the fundamental principles of IPv4 Classless Inter-Domain Routing (CIDR): routers forward packets hop-by-hop based on the destination prefix using Longest Prefix Match (LPM), while hierarchical address allocation keeps global backbone routing tables compact.
Longest Prefix Match and Hierarchical Aggregation
- Longest Prefix Match (LPM): When a packet's destination IPv6 address matches multiple entries in a router's Forwarding Information Base (FIB), the router selects the route with the largest prefix length (most specific match, e.g.,
/64beats/48, which beats/32, which beats the default route::/0). - Route Aggregation (Supernetting): Combining multiple contiguous prefixes into a single shorter prefix reduces routing table size, lowers memory/CPU consumption, and limits BGP route-flap propagation across the Internet's Default-Free Zone (DFZ).
IPv6 Hierarchical Delegation Model
Because IPv6 offers 128 bits, RIRs (APNIC, ARIN, RIPE, LACNIC, AFRINIC) allocate large contiguous blocks so ISPs can summarize thousands of customers into a single BGP advertisement:
- RIR -> LIR / ISP: Typically
/32(or/29). - ISP -> Enterprise / Site: Typically
/48(65,536/64subnets) or/56for residential broadband (256/64subnets). - Subnet LAN Segment: Standard
/64(supports SLAAC and 2^64 interface IDs). - Point-to-Point Router Links:
/64,/126, or/127(RFC 6164 recommends/127on point-to-point links to prevent Neighbor Discovery cache exhaustion attacks).
4.2 Unicast and multicast routing concepts
Unicast Routing Concepts
Unicast routing delivers a packet from one source interface to a single destination interface along a best path determined either statically or dynamically:
- Static Routing: Manually configured routes (including IPv6 default route
::/0). Zero protocol overhead, suitable for stub networks, but does not adapt automatically to link failures. - Dynamic Routing: Routers exchange topology or reachability state automatically via Interior Gateway Protocols (IGPs) inside an Autonomous System (RIPng, OSPFv3, IS-IS for IPv6) or Exterior Gateway Protocols (EGPs) between Autonomous Systems (MP-BGP).
- Link-Local Next Hops: A distinct feature of IPv6 routing is that dynamic protocols almost always use the neighbor router's link-local address (
fe80::...)—never a global unicast address—as the routing next-hop, keeping forwarding immune to global prefix renumbering.
Multicast Routing Concepts
Multicast routing delivers a single stream from one source to multiple interested receivers simultaneously without duplicating packets at the sender or sending traffic to uninterested subnets.
Core Components of IPv6 Multicast Routing
- Multicast Listener Discovery (MLD): Replaces IPv4 IGMP, running inside ICMPv6 (
Types 130, 131, 132, 143) so hosts inform local multicast routers whichff00::/8groups they wish to join (MLDv1 for Any-Source Multicast; MLDv2 adds Source-Specific Multicast(S, G)filtering). - Reverse Path Forwarding (RPF) Check: Before forwarding a multicast packet received on interface
Ifrom sourceS, the router checks its unicast routing table: ifIis the exact interface used to reachSback toward the origin, the RPF check passes; otherwise the packet is dropped to prevent routing loops. - Distribution Trees:
- Source-Based Tree
(S, G): Builds a shortest-path tree rooted directly at sourceSfor groupG(optimal latency, higher router memory state). - Shared Tree
(*, G): Builds a single tree rooted at a central Rendezvous Point (RP) shared by all sources sending to groupG(lower state, slightly longer path via RP).
- Source-Based Tree
4.3 Unidirectional link routing
Standard IP routing protocols assume all network links are bidirectional (if Router A can send packets to Router B, Router B can send replies back to Router A over the same physical link). Certain physical media violate this assumption.
Unidirectional Links and UDLR (RFC 3077)
A Unidirectional Link (UDL) carries traffic in one physical direction only—from an upstream feed router to one or more downstream receive-only routers. Classic examples include satellite broadcast downlinks (DVB-S), cable broadcast channels, and asymmetric optical/RF links.
Why Standard Protocols Fail on UDLs
- NDP & Neighbor Resolution: The receiver hears Router Advertisements or packets from the feeder, but cannot transmit Neighbor Solicitations/Advertisements back over the receive-only link.
- Dynamic Routing Handshakes: OSPF Hello/DBDD exchanges require two-way neighbor confirmation (
2-Waystate); RIPng updates sent only one way never propagate downstream routes back to the feeder. - Multicast RPF Check: Even if downstream routers receive multicast via satellite, their unicast route back to the source goes through a terrestrial ISP link—so the RPF check fails and drops every satellite multicast packet!
How UDLR (RFC 3077) Solves the Problem
Unidirectional Link Routing (UDLR) uses a Link-Layer Tunneling Mechanism (LLTM) over an auxiliary bidirectional terrestrial path (such as a standard ISP connection):
- Downstream receivers open a tunnel back to the upstream feeder router across the terrestrial Internet.
- When a downstream router needs to send control traffic (OSPFv3 Hellos, RIPng updates, PIM Joins, or NDP messages) to the feeder, it encapsulates the packet through the reverse tunnel to the feeder.
- The feeder emulates a multi-access broadcast link across all receivers, forwarding multicast/unicast frames over the high-bandwidth UDL while receiving control replies via the reverse tunnel—making the UDL appear logically bidirectional to Layer 3 routing protocols.
4.4 Routing protocols: RIPng, OSPFv3 and BGP (Basic concepts for IPv6)
To support 128-bit prefixes and IPv6 link-local forwarding, traditional IPv4 routing protocols were upgraded to RIPng, OSPFv3, and MP-BGP.
1. RIPng (Routing Information Protocol Next Generation — RFC 2080)
- Algorithm & Metric: Distance-vector (Bellman-Ford) using hop count (max valid metric = 15; 16 = unreachable / infinity). Suitable only for small, simple topologies.
- Transport & Addressing: Runs over UDP port 521; sends updates to link-local multicast
ff02::9using the router's link-local (fe80::) source address. - Loop Prevention: Split Horizon, Poison Reverse, Route Poisoning, and Triggered Updates.
- Security: RIPng removed the authentication header option from the protocol packet itself; authentication and encryption rely on IPsec (AH/ESP).
2. OSPFv3 (Open Shortest Path First version 3 — RFC 5340)
OSPFv3 is a major redesign of OSPFv2 for IPv6 (and later multi-address-family support in RFC 5838):
- Algorithm & Metric: Link-state (Dijkstra SPF) using cumulative interface cost (
reference-bandwidth / interface-bandwidth). - Transport & Addressing: Encapsulated directly inside IPv6 with Next Header = 89; uses link-local multicast
ff02::5(AllSPFRouters) andff02::6(AllDRouters). - Per-Link Operation: Unlike OSPFv2 (which operates per IP subnet), OSPFv3 runs per-link, so two routers on the same physical link can form an adjacency even if they do not share a global prefix.
- Topology vs. Prefix Separation: OSPFv3 strips IP addresses out of Router-LSAs (Type 1) and Network-LSAs (Type 2) so they describe pure router/link topology; IPv6 prefixes are advertised separately in Link-LSAs (Type 8, link-local scope) and Intra-Area-Prefix-LSAs (Type 9, area scope).
- 32-Bit Router ID: OSPFv3 still requires a 32-bit Router ID written in IPv4 dotted-decimal format (e.g.,
1.1.1.1), configured manually if a router has no IPv4 interface addresses. - Security: Relies on IPsec (AH/ESP) rather than built-in MD5/plain-text OSPF fields.
3. MP-BGP (Multiprotocol BGP for IPv6 — RFC 4760 / RFC 2545)
BGP-4 is the Internet's path-vector Exterior Gateway Protocol running over TCP port 179. Multiprotocol Extensions (MP-BGP) allow a single BGP process to carry IPv6 routes cleanly:
- Address Family Signaling: Peers negotiate IPv6 Unicast capability (
AFI = 2,SAFI = 1) during BGPOPEN. - New Path Attributes: Rather than modifying the IPv4
NLRIheader, IPv6 routes are advertised insideMP_REACH_NLRI(Attribute Type 14) and withdrawn usingMP_UNREACH_NLRI(Attribute Type 15). - Next-Hop Rules (RFC 2545): For eBGP peers sharing a link,
MP_REACH_NLRIcan carry both a Global Unicast next-hop and a Link-Local (fe80::) next-hop (used for actual ICMPv6 redirects/forwarding on the shared link).
| Aspect | RIPng (RFC 2080) | OSPFv3 (RFC 5340) |
|---|---|---|
| Protocol Type | Distance-Vector (Bellman-Ford) | Link-State (Dijkstra SPF) |
| Metric | Hop count (1–15; 16 = infinity) | Interface bandwidth-based Cost |
| Encapsulation | UDP port 521 | Direct IPv6 (Next Header = 89) |
| Multicast Address | ff02::9 | ff02::5 (All routers), ff02::6 (DR/BDR) |
| Convergence & Scale | Slow convergence; small networks only | Fast convergence; hierarchical Areas (Area 0 backbone) |
| Authentication | External IPsec (AH/ESP) | External IPsec (AH/ESP) |
4.5 Multicast routing (PIM-SM overview)
Protocol Independent Multicast – Sparse Mode (PIM-SM, RFC 7761) is the standard inter- and intra-domain multicast routing protocol for IPv6. It is called "Protocol Independent" because it does not implement its own topology discovery—instead, it reads whichever unicast routing table already exists (RIPng, OSPFv3, IS-IS, or MP-BGP) to perform RPF checks and locate next hops.
PIM-SM Architecture and Operation
- Sparse Mode Assumption: Receivers are sparsely distributed across the network; therefore, routers do not flood multicast traffic everywhere by default. Traffic flows only to routers that explicitly Join a group.
- Rendezvous Point (RP): A designated router acting as the central meeting point (root of the
(*, G)Shared Tree) for multicast groupG. - Receiver Registration (
(*, G)Join): When a host sends an MLD Report to its local Designated Router (DR), the receiver's DR sends aPIM Join (*, G)hop-by-hop toward the RP, building the shared distribution tree branch. - Source Registration (PIM Register): When source
Sbegins transmitting toG, the source's first-hop DR encapsulates the initial multicast packets inside unicastPIM Registermessages sent to the RP. The RP decapsulates them and forwards down the(*, G)shared tree (and optionally joins(S, G)back to the source). - SPT Switchover
(S, G): Once data rate exceeds a threshold, the receiver's last-hop DR sends aPIM Join (S, G)directly toward sourceSalong the shortest unicast path (and prunes the RP shared tree), avoiding suboptimal "dog-leg" paths through the RP.
Worked Examples
1
An ISP is allocated the IPv6 block 2001:db8:4000::/34.
- How many
/48enterprise customer allocations can the ISP carve from this/34block? - An enterprise customer receives
2001:db8:4120::/48. How many/64LAN subnets can it create? - Suppose a router's FIB holds four routes:
::/0viafe80::12001:db8:4000::/34viafe80::22001:db8:4120::/48viafe80::32001:db8:4120:5::/64viafe80::4Which next-hop will be chosen for a packet destined to2001:db8:4120:0005::10, and why?
1. Calculating /48 Allocations from /34: Number of subnet bits available between /34 and /48 = 48 - 34 = 14 bits. Total /48 customer blocks = 2^14 = 16,384 blocks.
2. Calculating /64 LAN Subnets from /48: Number of subnet bits available between /48 and /64 = 64 - 48 = 16 bits. Total /64 LAN subnets = 2^16 = 65,536 subnets.
3. Applying Longest Prefix Match (LPM): All four entries match the destination 2001:db8:4120:0005::10 (note 0005 compresses to 5):
::/0matches 0 bits.2001:db8:4000::/34matches 34 bits (0x4000=0100 00...,0x4120=0100 0001...-> first 2 bits of 3rd hextet01match,32 + 2 = 34bits).2001:db8:4120::/48matches 48 bits.2001:db8:4120:5::/64matches 64 bits.
By Longest Prefix Match, the router selects fe80::4 (2001:db8:4120:5::/64).
- 16,384 customer
/48allocations. - 65,536 LAN
/64subnets. - Next-hop
fe80::4is selected because2001:db8:4120:5::/64has the longest matching prefix (64 bits).
2
An enterprise owns four contiguous /48 IPv6 prefixes and wants to summarize them into a single aggregate route for MP-BGP advertisement to its upstream ISP:
2001:db8:0010::/482001:db8:0011::/482001:db8:0012::/482001:db8:0013::/48
Compute the exact summarized IPv6 CIDR prefix.
Comparing Common Prefix Bits Across the Four Networks: The first two hextets (2001:0db8) are identical across all four prefixes (32 bits). Inspecting the third 16-bit hextet in binary:
0x0010=0000 0000 0001 00000x0011=0000 0000 0001 00010x0012=0000 0000 0001 00100x0013=0000 0000 0001 0011
Counting Matching Leading Bits: Only the final 2 bits vary across 00, 01, 10, 11 (0x0010 XOR 0x0013 = 0x0003, 2 bits wide), meaning the first 14 bits of the third hextet are identical across all four blocks. Total common prefix length = 32 + 14 = 46 bits (equivalently, summarizing 4 = 2^2 blocks reduces /48 by 2 bits to /46).
The single aggregate summary prefix is 2001:db8:10::/46.
3
An enterprise IPv6 network runs OSPFv3 with auto-cost reference-bandwidth 10000 (10,000 Mbps = 10 Gbps). A packet travels from R1 to R4 across three links:
R1 -> R2: 1 Gbps (1000 Mbps) EthernetR2 -> R3: 100 Mbps Fast EthernetR3 -> R4: 10 Gbps (10,000 Mbps) fiber uplink
- Compute the OSPFv3 cost of each link and the total end-to-end SPF path cost from
R1toR4. - State the destination IPv6 address and protocol number (
Next Header) used byR1when exchanging OSPFv3 Hellos withR2, and identify which address typeR1places in the routing table as the next hop towardR4.
1. Computing OSPFv3 Link Costs (Cost = Reference Bandwidth / Link Bandwidth):
R1 -> R2(1000 Mbps):10000 / 1000 = 10R2 -> R3(100 Mbps):10000 / 100 = 100R3 -> R4(10000 Mbps):10000 / 10000 = 1- Total SPF Path Cost:
10 + 100 + 1 = 111.
2. OSPFv3 Encapsulation, Multicast Addressing, and Next-Hop:
- OSPFv3 runs directly inside IPv6 using
Next Header = 89. - Hello packets on point-to-point or broadcast links are sent to the link-local AllSPFRouters multicast address
ff02::5usingR1's link-local (fe80::) source address. - In
R1's IPv6 routing table, the next-hop towardR4isR2's link-local address (fe80::...) on theR1–R2link.
- Link costs: 10 (
R1–R2), 100 (R2–R3), 1 (R3–R4); Total SPF cost = 111. - OSPFv3 uses
Next Header = 89, sends Hellos toff02::5, and installsR2's link-local (fe80::) address as the next-hop.
Exercises
Practice Exercises — Routing with IPv6
Explain the Longest Prefix Match (LPM) rule and CIDR route aggregation in IPv6. Why does IPv6 assign /48 or /56 blocks to sites and /64 to individual LANs rather than using variable subnet boundaries like /120?
LPM and Route Aggregation:
- LPM: When multiple routing table entries match a destination IPv6 address, the router forwards using the route with the highest prefix length (most specific network bits).
- Aggregation: RIRs assign large contiguous blocks (e.g.,
/32) to ISPs, who delegate/48or/56blocks to customers. The ISP advertises only one/32prefix into global BGP rather than thousands of individual customer routes, keeping DFZ tables compact.
Why /64 Is the Standard LAN Boundary:
- SLAAC Compatibility (RFC 4291 / 4862): Stateless Address Autoconfiguration requires a 64-bit Interface ID, so subnets must be
/64. - NDP Cache Protection: Huge 2^64 host spaces make off-link Neighbor Discovery exhaustion scanning infeasible.
- Abundant Subnet Bits: With a
/48site allocation, an organization still has 16 subnet bits (65,536/64LANs) without ever needing cramped variable masks.
LPM selects the matching route with the longest prefix length, while hierarchical CIDR aggregation summarizes many /48 or /56 customer allocations into a single /32 ISP route. LANs use /64 because SLAAC requires a 64-bit Interface ID and /48 sites still have 65,536 subnets available.
Summarize the eight contiguous IPv6 prefixes from 2001:db8:0028::/48 through 2001:db8:002f::/48 (0028, 0029, 002a, 002b, 002c, 002d, 002e, 002f) into a single optimal CIDR summary prefix.
Inspecting the Third Hextet in Binary:
0x0028=0000 0000 0010 10000x002f=0000 0000 0010 1111
Determining Common Prefix Length:
- The first two hextets (
2001:0db8) provide 32 common bits. - In the third hextet, the upper 13 bits (
0000 0000 0010 1) are identical across all 8 prefixes (0x0028 XOR 0x002f = 0x0007, varying across the last 3 bits000to111). - Total common prefix length =
32 + 13 = 45bits (48 - 3 = 45, because8 = 2^3).
The optimal aggregate summary prefix is 2001:db8:28::/45.
What is Unidirectional Link Routing (UDLR)? Explain three reasons why standard dynamic routing and multicast protocols fail over a unidirectional satellite link, and describe how RFC 3077 resolves them.
Why Standard Routing Fails Over UDLs: A unidirectional link (e.g., satellite downlink) only carries frames from the upstream feeder to downstream receivers; receivers have no reverse physical channel on that link. Consequently:
- Hello/Adjacency Failure: OSPFv3 cannot reach
2-Waystate and RIPng cannot receive downstream advertisements back over the UDL. - NDP Resolution Failure: Downstream nodes cannot send Neighbor Advertisements back to the feeder on the UDL.
- Multicast RPF Failure: Downstream routers' unicast route back to the source points out their terrestrial ISP link, causing RPF checks to drop incoming satellite multicast packets.
RFC 3077 (UDLR) Tunneling Solution: UDLR establishes a Link-Layer Tunneling Mechanism (LLTM) from each downstream receiver back to the feeder over a separate bidirectional terrestrial network. Control packets (NDP, OSPFv3 Hellos, PIM Joins) sent toward the feeder travel through this reverse tunnel, allowing the feeder to emulate a standard bidirectional multi-access link.
Standard routing fails on UDLs because two-way neighbor hellos, NDP replies, and multicast RPF checks break without a reverse channel. UDLR (RFC 3077) uses reverse link-layer tunnels over a terrestrial path so receivers can send control traffic back to the feeder, making the UDL appear logically bidirectional.
Compare RIPng, OSPFv3, and MP-BGP for IPv6 across five criteria: routing algorithm, transport/encapsulation, multicast/peer addressing, how IPv6 prefixes are carried, and authentication mechanism.
Protocol-by-Protocol Comparison:
- RIPng (RFC 2080): Distance-vector (Bellman-Ford, max 15 hops); runs over UDP 521; uses link-local multicast
ff02::9; carries 16-byte IPv6 prefixes in RTEs; relies on IPsec. - OSPFv3 (RFC 5340): Link-state (Dijkstra SPF, cost metric); runs directly on IPv6 (Next Header = 89); uses
ff02::5andff02::6; separates topology LSAs (Types 1/2) from prefix LSAs (Link-LSA Type 8 & Intra-Area-Prefix-LSA Type 9); relies on IPsec. - MP-BGP (RFC 4760/2545): Path-vector (policy/AS-PATH); runs over TCP 179 to configured unicast peers; carries IPv6 prefixes (
AFI=2, SAFI=1) inMP_REACH_NLRIandMP_UNREACH_NLRIattributes; uses TCP-AO / MD5 / IPsec.
RIPng uses Bellman-Ford over UDP 521 (ff02::9) with IPsec; OSPFv3 uses Dijkstra SPF directly over IPv6 NH=89 (ff02::5/ff02::6) with dedicated Type 8/9 prefix LSAs and IPsec; MP-BGP uses path-vector policies over TCP 179 advertising IPv6 routes via MP_REACH_NLRI/MP_UNREACH_NLRI (AFI=2).
Explain how PIM-SM (Protocol Independent Multicast – Sparse Mode) operates in an IPv6 network. Define the roles of MLDv2, the Rendezvous Point (RP), the (*, G) Shared Tree, RPF checks, and SPT Switchover (S, G).
PIM-SM Components and Packet Flow:
- MLDv2 (ICMPv6): Hosts report multicast group interest to their local Designated Router (DR).
- Shared Tree
(*, G)& RP: The receiver's DR sends aPIM Join (*, G)toward the Rendezvous Point (RP), building a shared distribution tree only where receivers exist. - Source Registration: The source's DR sends
PIM Registermessages to the RP so traffic reaches listeners on(*, G). - RPF Check: At every hop, routers verify incoming multicast packets arrive on the unicast shortest-path interface toward the source/RP to prevent loops.
- SPT Switchover
(S, G): To avoid suboptimal paths through the RP, the receiver's DR issues aPIM Join (S, G)directly toward the sourceSand prunes the RP branch.
In IPv6 PIM-SM, hosts join groups via MLDv2, receiver DRs build a (*, G) Shared Tree toward the RP, source DRs register traffic with the RP, routers enforce loop-free forwarding via RPF checks against the unicast table, and receiver DRs trigger SPT Switchover to an optimal (S, G) tree directly to the source.