IPv6 forwarding and static routing
Apply longest-prefix match and equal-cost multipath (ECMP) to IPv6 forwarding decisions. Configure static routes with link-local and global next hops on FRR, Linux and MikroTik RouterOS. Use discard (blackhole) routes for aggregates and explain the loops they prevent. Build and verify a static-routed three-site network.
Take the quiz · pass mark 70% · 9 questions
Explanation
Level 4 moves from the LAN to the network between routers. Everything later in this level (OSPFv3, IS-IS, BGP) exists to fill the forwarding table. This lesson looks at that table directly and at the simplest way to fill it: static routes.
What a router does with a packet
For each packet an IPv6 router:
- checks the Hop Limit. If it is 1 or less, it drops the packet and sends ICMPv6 Time Exceeded. Otherwise it decrements it (RFC 8200).
- looks up the destination address in its forwarding table (FIB) using longest-prefix match
- resolves the next hop's link-layer address with Neighbor Discovery (L3.01) and sends the packet
IPv6 routers do not fragment (L4.08), do not recompute a header checksum (IPv6 has none), and do not forward packets with a link-local destination or source off the link.
Longest-prefix match
The FIB can contain overlapping prefixes. The most specific match wins, whatever the order in which routes were added and whatever their source (static, OSPF, BGP). The administrative distance (FRR) or distance (RouterOS) only decides between routes for the same prefix from different sources.
RFC 7608 (BCP 198) requires that forwarding works for any prefix length from /0 to /128. Software and hardware must not assume that routes stop at /64. Routers do carry /128 loopbacks, /127 links and /56 or /48 customer routes, and in hardware the long prefixes can use more table space than IPv4 routes, so check the FIB scale of your platform.
ECMP
When several best routes to the same prefix have equal cost, the router can use all of them. It must keep each flow on one path, or TCP sees reordering, so it hashes header fields:
- Layer 3: source and destination addresses, plus the flow label (RFC 6437 makes the flow label a per-flow value, and RFC 6438 describes using it for ECMP and in tunnels)
- Layer 4: the 5-tuple (addresses, next header, ports)
On Linux, net.ipv6.fib_multipath_hash_policy selects 0 (Layer 3 with flow label, the default) or 1 (Layer 4). ECMP with link-local next hops is normal: ip -6 route shows a route with several nexthop via fe80::... dev ... lines.
Next hops: link-local or global?
Routing protocols in IPv6 use link-local next hops (L4.02 to L4.04), and you can use them for static routes as well:
- They never change when you renumber global addresses.
- They always need the outgoing interface (
fe80::1exists on every link). - On point-to-point links you can configure a fixed, readable link-local address such as
fe80::1andfe80::2, so the static route stays valid when hardware is replaced.
A global next hop must be resolvable through a connected route. A recursive static route (next hop reached through another route) is possible, but harder to debug.
Discard routes for aggregates
If you advertise or summarise an aggregate (for example the enterprise's 2001:db8:3000::/44 or ictNetworks' 3fff:a00::/32), add a discard route for it:
ipv6 route 3fff:a00::/32 blackhole
Without it, a packet to an unused part of the aggregate matches the default route back towards the upstream, which sends it back to you because of your aggregate: a routing loop until the Hop Limit runs out. The discard route catches everything not covered by a more specific route and drops it locally. With reject instead of blackhole, the router also sends an ICMPv6 Destination Unreachable back (which code is used depends on the implementation), which makes troubleshooting easier but can be abused to generate traffic.
The same applies to the point-to-point link block: number links with /127s (RFC 6164) but reserve and route a /64 per link, and use a discard route for the whole link block so unused addresses do not loop.
Configuration examples
FRR (staticd):
ipv6 route 2001:db8:3002::/48 fe80::2 eth1
ipv6 route 2001:db8:3003::/48 2001:db8:3000:ff02::b
ipv6 route 2001:db8:3000::/44 blackhole
ipv6 route ::/0 fe80::1 eth0 250
The last number is the administrative distance; a high value makes a floating static route, used only when a better route (for example from BGP) disappears.
Linux (iproute2):
ip -6 route add 2001:db8:3002::/48 via fe80::2 dev eth1
ip -6 route add blackhole 2001:db8:3000::/44
ip -6 route add 2001:db8:f000::/48 nexthop via fe80::1 dev eth1 nexthop via fe80::1 dev eth2
MikroTik RouterOS v7:
/ipv6 route add dst-address=2001:db8:3002::/48 gateway=fe80::2%ether2
/ipv6 route add dst-address=2001:db8:3000::/44 blackhole
The %interface suffix gives the outgoing interface for a link-local gateway.
ictNetworks scenario
At ictNetworks the Proxmox hosts use static routes for customer VPSs: each VPS's routed /64 points at the VPS's link-local address on its bridge or tap interface, for example 3fff:a00:1003:12c::/64 via fe80::12c dev vmbr1 (L3.06). Each cluster's /48 is then advertised into the IGP (L4.02), and the border routers hold a discard route for 3fff:a00::/32 and announce the aggregate in BGP (L4.04).
Drawing diagram…
Worked examples
Example 1: Longest-prefix match
R1 has routes for ::/0, 2001:db8:3000::/44 (discard), 2001:db8:3002::/48 and 2001:db8:3002::/52. A packet arrives for 2001:db8:3002:10::25. All four match. The most specific is /52 (it covers 2001:db8:3002:0:: to 2001:db8:3002:fff:..., and 0010 is inside), so that route is used.
A packet for 2001:db8:3009::1 matches ::/0 and the /44 discard route, so it is dropped instead of being sent upstream.
Example 2: The aggregate for three sites
Sites 1 to 3 use 2001:db8:3001::/48, 2001:db8:3002::/48 and 2001:db8:3003::/48. The smallest single prefix covering all three is 2001:db8:3000::/46 (it also covers the unused 2001:db8:3000::/48). The enterprise's planned aggregate is the /44.
Example 3: Link numbering
Link 2 (R2–R3) has the reserved /64 2001:db8:3000:ff02::/64. R2 uses 2001:db8:3000:ff02::a/127 and R3 uses 2001:db8:3000:ff02::b/127, the other address in the same /127.
Lab
Goal: Build a static-routed three-site network with summary discard routes and ECMP.
You need: containerlab with three FRR nodes r1, r2, r3 in a triangle and one host per site (or three MikroTik CHRs on Proxmox). Addressing as in the diagram: site LANs 2001:db8:300s:1::/64, links from 2001:db8:3000:ff00::/56, loopbacks 2001:db8:3000::s/128.
- Configure the links with /127s and fixed link-local addresses (
fe80::aandfe80::bon each link) and verify withping fe80::b%eth1. - On each router, add static routes for the other two sites' /48s with link-local next hops, and a discard route for
2001:db8:3000::/44. Verify end to end withtraceroute -6between hosts. - Send a packet to an unused address in the /44 from a host (
ping 2001:db8:3009::1). Show it is dropped at the first router. Remove the discard route, add a default route on each router pointing at a neighbour, and show the loop (tracerouteshows the path bouncing; capture Time Exceeded). Restore the discard route. - Add a second, equal route from r1 to site 3 via r2 (so r1 has two paths: direct and via r2, with equal distance) and show ECMP in
ip -6 route. Generate several flows (iperf3 -P 8or different source ports) and show traffic on both links. Switchfib_multipath_hash_policybetween 0 and 1 and explain the difference. - Add a floating default route with distance 250 and show it in
show ipv6 routeas inactive while a better default exists.
What to submit: configurations, route tables, traceroutes, the loop capture and the ECMP evidence with your explanation.
Summary
- Routers decrement the Hop Limit, use longest-prefix match, resolve the next hop with ND, and never fragment.
- RFC 7608: forwarding must work for any prefix length. Distance only decides between equal prefixes.
- ECMP keeps flows on one path by hashing addresses and the flow label (Layer 3) or the 5-tuple (Layer 4).
- Link-local next hops need the interface and survive renumbering.
- Always add a discard route for aggregates you advertise, and for link blocks, to prevent loops.
- Next lesson (L4.02): OSPFv3.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.