[odhcpd-RA] Prevent a dynamic IPv6 prefix from being announced

I have multiple routers in my LAN network, each with their own IPv6 WAN connections. For the sake of simplicity, let's assume 2 WAN routers.

  • The 2 routers are fairly distant and connected using a WiFi mesh interface, which is also bridged to their ethernet ports.
  • The 2 IPv6 WAN connections are from different ISPs and the prefix assigned by each ISP is temporary and lasts for about 24 hours before being reassigned a new one.
  • Both WAN routers have an RA server (odhcpd) used to announce their respective WAN prefix to the LAN, so that SLAAC can be performed by the other devices
  • DHCPv6 server (also odhcpd) is enabled only on router 1, for centrally managing the addresses of the entire network
  • The DNS server is not announced in RDNSS RA or DHCPv6 options of any router (just ignore the DNS implementation for the sake of simplicity)

What I want is when router 2's WAN is connected, its IPv6 prefix should be used by all devices in the network, else router 1's prefix should be used. This can be achieved using the ra_preference option, and once I figure out how to use a custom preferred_lifetime value in odhcpd's RA server (please reply in the other thread if you know how to make it work :upside_down_face:).

However, the limitation with the above configuration is that when either of the routers loses connectivity on the upstream IPv6 WAN, it will completely lose access to the IPv6 internet. To overcome this limitation, I added an additional lan6 interface on both the routers so that they can listen to the RAs of the other router and generate an address and default route for themselves irrespective of the status of their own WAN interface:

config interface lan6
	option device @lan    # same device as LAN
	option proto dhcpv6   # to listen to RAs of other router and perform SLAAC
	option iface_map 0
	option fakeroute 0
	option metric 9       # metric value higher than this router's own WAN interface

But this configuration caused more problems in my network because both the routers started announcing both prefixes in the network. And, as a result of router 2 having a higher ra_preference, the devices connected to router 1's ethernet port also started routing both prefixes through router 2 (which in turn sent it back to router 1). This additional hop is quite costly especially because it happens over the WiFi mesh link.

I tried to resolve this by setting both reqaddress and reqprefix to none and no, but that didn't change anything. I also tried adding list ip6class wan6 to the LAN interface, so that it receives prefixes only recieved from WAN6, but that too didn't work.

So, what will be the correct way to prevent odhcpd from (re-)announcing a prefix on the LAN, but continue announcing the one received from WAN? I have looked at the prefix_filter option but that is a numeric address filter which is of no use since all the prefix addresses are dynamic and always keep changing. Is there any way to use a source-interface based filter or ip6class-like filter for odhcpd RA server?

Cause you've asked in the other thread.

I'm not quiet sure but my initial way would be using (again) bird to be able to learn routes from the kernel and announce these routes and default route via radv.
Then I would configure keepalived on booth wan routers to

  • Using vrrp to set the default gateway on one of these routers
  • Using various checks to determine if the wan link is ok or not
  • Using keepalived ability to trigger scripts. In this case modify or copy active and backup configs for bird and trigger bird to reload i.e. to chance the metric or other properties of routes announced via radv

But this is just wild guessing within 5 minutes :see_no_evil: