DEV Community

IPYE
IPYE

Posted on

Floating Static Routes as a Fallback Path Inside Your Free /48 Network

Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end.

Not every redundant path needs a routing protocol. Between a small branch router and two edges, or between a server and two gateways, a pair of static routes with different preferences often does the job: the preferred route carries traffic, and the second one, called a floating static route, takes over when the first disappears. The trick is understanding exactly when a static route disappears, because that is where most floating static designs fail. This guide covers it on Linux and FRR inside a network numbered from a free IPv6 /48 from IPYE.

The setup

A branch router reaches the rest of the /48 through two upstream routers:

  • primary: 2001:db8:100:ff01::0 on link eth0
  • backup: 2001:db8:100:ff02::0 on link eth1

The branch needs a route for 2001:db8:100::/48 and a default route, each preferring the primary.

Linux: metrics

ip -6 route add 2001:db8:100::/48 via 2001:db8:100:ff01::0 dev eth0 metric 100
ip -6 route add 2001:db8:100::/48 via 2001:db8:100:ff02::0 dev eth1 metric 200
ip -6 route add default via 2001:db8:100:ff01::0 dev eth0 metric 100
ip -6 route add default via 2001:db8:100:ff02::0 dev eth1 metric 200
Enter fullscreen mode Exit fullscreen mode

The kernel uses the route with the lowest metric. ip -6 route get 2001:db8:100:10::20 shows which one is active.

When does the primary disappear?

This is the important part. The kernel ignores the primary route only when it considers the next hop unusable. That reliably happens when the interface goes down, for example when the cable is unplugged or the link partner powers off. It does not happen when the link stays up but the primary router stops forwarding, a switch in between fails silently, or a virtual link breaks somewhere you cannot see.

Linux has a sysctl that makes it skip routes over interfaces whose carrier is lost, rather than merely down:

sysctl -w net.ipv6.conf.all.ignore_routes_with_linkdown=1
Enter fullscreen mode Exit fullscreen mode

That helps with physical link failures but still not with a router that is up and broken. For those failures, the route must depend on a reachability check.

FRR: administrative distance and BFD

In FRR, static routes take an optional distance. Lower wins:

ipv6 route 2001:db8:100::/48 2001:db8:100:ff01::0 10
ipv6 route 2001:db8:100::/48 2001:db8:100:ff02::0 200
ipv6 route ::/0 2001:db8:100:ff01::0 10
ipv6 route ::/0 2001:db8:100:ff02::0 200
Enter fullscreen mode Exit fullscreen mode

Recent FRR versions can tie a static route to a BFD session, so the route is withdrawn when BFD declares the path down:

ipv6 route ::/0 2001:db8:100:ff01::0 10 bfd
!
bfd
 peer 2001:db8:100:ff01::0
Enter fullscreen mode Exit fullscreen mode

With BFD running on both ends, a silent failure on the primary path removes the primary route within about a second, and the floating route takes over. Static route BFD support is relatively recent, so check your FRR version. Without BFD, FRR behaves like the kernel: the route stays until the interface goes down.

A simple script as a last resort

On hosts without FRR, a small health check can do the same job: ping the primary next hop every few seconds and, after several failures, raise the primary route's metric above the backup's, or delete it. Restore it when pings succeed again. Run it under systemd and log every change, so failovers are visible later.

Make the return path match

Floating static routes on the branch only control outbound traffic. The upstream routers also need to know how to reach the branch subnets, and the backup router must not attract return traffic while the primary is healthy. Common solutions:

  • the primary router holds a normal static route to the branch /56, and the backup a route with a worse distance or metric
  • both upstream routers learn the branch routes through an interior protocol, and the floating statics exist only at the branch

If the return path does not follow the same failover logic, traffic flows out through the backup and back through a dead primary, which looks like a total outage.

Test the failover

Schedule a test: shut down the primary path in a way that keeps the interface up, for example by blocking forwarding on the primary router with a firewall rule. Watch ip -6 route on the branch and run a continuous ping to an address behind the edge. If traffic never moves to the backup, the design only covers link-down failures, and you need BFD or a health check.

When to use a routing protocol instead

Once you have more than a couple of branches or paths, static routes and scripts become hard to keep consistent. An interior routing protocol such as OSPFv3 or IS-IS, or BGP inside the network, handles failures and return paths automatically.

The /48 at the edge

All of these routes stay inside your network. The edges announce only the /48 to their upstreams, backed by the LOA from the IPYE client portal and the ROA that IPYE creates.

Next step

Claim a free /48, set up a primary and a floating static route for your first branch, and test a failure that keeps the link up. Questions: ipye@turnel.com.

About IPYE

IPYE (https://ipye.com) leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. ASN and region changes apply automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS; WHOIS is editable on IPv6 /44 and larger. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. Claim your free /48: https://my.ipye.com/products/ipv6-rental. Questions: ipye@turnel.com.

Disclosure: I run IPYE

Top comments (0)