Static IPv6 routing with link-local next hops and a floating backup
Cisco IOSWorking
Tasks
- Enable IPv6 routing on both routers and address the LANs.
- Give both inter-router links fixed link-local addresses and no global addresses.
- On each router, add a static route to the other LAN via the primary link, using the link-local next hop.
- Add a floating static route via the backup link with administrative distance 200.
- Verify the routes, test reachability, then fail the primary link and check the backup takes over.
Solution
1R1 interfacesR1
R1 on Cisco IOS ipv6 unicast-routing ! interface GigabitEthernet0/0/0 ipv6 address 2001:db8:acad:10::1/64 no shutdown ! interface GigabitEthernet0/0/1 description Primary to R2 ipv6 address fe80::1 link-local no shutdown ! interface GigabitEthernet0/0/2 description Backup to R2 ipv6 address fe80::1 link-local no shutdownThe same link-local address on two interfaces is legal, because each one is unique only on its own link. Configuring a link-local address enables IPv6 on the interface, so no global address is needed.
2R1 static routesR1
R1 on Cisco IOS ipv6 route 2001:db8:acad:20::/64 GigabitEthernet0/0/1 fe80::2 ipv6 route 2001:db8:acad:20::/64 GigabitEthernet0/0/2 fe80::2 200Both routes name
fe80::2. Only the exit interface tells them apart, which is exactly why IOS requires it.3R2 interfaces and routesR2
R2 on Cisco IOS ipv6 unicast-routing ! interface GigabitEthernet0/0/0 ipv6 address 2001:db8:acad:20::1/64 no shutdown ! interface GigabitEthernet0/0/1 description Primary to R1 ipv6 address fe80::2 link-local no shutdown ! interface GigabitEthernet0/0/2 description Backup to R1 ipv6 address fe80::2 link-local no shutdown ! ipv6 route 2001:db8:acad:10::/64 GigabitEthernet0/0/1 fe80::1 ipv6 route 2001:db8:acad:10::/64 GigabitEthernet0/0/2 fe80::1 200
Verify
R1# show ipv6 route static | begin ^S
S 2001:DB8:ACAD:20::/64 [1/0]
via FE80::2, GigabitEthernet0/0/1Only the primary route is installed. The floating route waits with distance 200.
R1# show ipv6 neighbors GigabitEthernet0/0/1
IPv6 Address Age Link-layer Addr State Interface
FE80::2 0 a0b4.3c22.1401 REACH Gi0/0/1R1 resolved R2's link-local address on the primary link.
R1# ping 2001:db8:acad:20::1 source GigabitEthernet0/0/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:ACAD:20::1, timeout is 2 seconds:
Packet sent with a source address of 2001:DB8:ACAD:10::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 msSourcing from the LAN proves both directions, since R2 needs its route back to 2001:db8:acad:10::/64.
R1# show ipv6 route static | begin ^S
S 2001:DB8:ACAD:20::/64 [200/0]
via FE80::2, GigabitEthernet0/0/2After shutdown on Gi0/0/1, the floating route with distance 200 is installed via the backup link.
Mistakes people make
- Writing
ipv6 route 2001:db8:acad:20::/64 fe80::2without the interface. IOS rejects it, since every link has fe80::/10. - Using an interface-only route on Ethernet (
ipv6 route 2001:db8:acad:20::/64 GigabitEthernet0/0/1). R1 then tries neighbor discovery for every destination and R2 does not answer for them. - Adding the backup only on R1. Return traffic still needs a path, so mirror the routes on R2.
- Expecting the floating route to take over when R2 dies but the link stays up. A static route only follows interface state; add BFD or IP SLA tracking for that case.
- Forgetting that traceroute through these links shows no global address for the transit hops. ICMPv6 errors are sourced from another interface's global address.
On other platforms
Junos uses qualified-next-hop to pair a link-local next hop with an interface and its own preference.
set routing-options rib inet6.0 static route 2001:db8:acad:20::/64 qualified-next-hop fe80::2 interface ge-0/0/1.0
set routing-options rib inet6.0 static route 2001:db8:acad:20::/64 qualified-next-hop fe80::2 interface ge-0/0/2.0 preference 200On Linux the device plays the role of the IOS exit interface, and a higher metric makes the backup.
ip -6 route add 2001:db8:acad:20::/64 via fe80::2 dev eth1 metric 100
ip -6 route add 2001:db8:acad:20::/64 via fe80::2 dev eth2 metric 200Say it in the interview
"Link-local next hops need the exit interface, because fe80::/10 exists on every link. That is why both of my routes can say fe80::2: the interface is what makes them different. The backup gets distance 200 so it only installs when the primary interface goes down. I verify with the static table, a sourced ping, then shut the primary and watch the 200 route take over."