My primary internet is through my cable provider, but I have a LTE USB stick as a backup for when the primary is down. I wrote a little script that constantly pings over both interfaces, and switches to the fallback if the primary is down. I do this by setting the route metrics of the two interfaces via uci network.$interface_name.metric=$new_metric
. I set the metric of the interface I want active to 10, and the one that is inactive to 20.
This works fine for IPv4, but I recently got IPv6 working on the LTE connection (previously a software issue on the USB stick caused IPv4 only to work). Unfortunately, I immediately found that all IPv6 traffic started going over the LTE connection, while IPv4 traffic was going over the primary connection. It looks like setting the interface metric this way only sets it on the IPv4 default route, not the IPv6 default route.
Is there a way to easily do this for IPv6? I much prefer setting the metric via the uci
command, as I don’t have to worry about parsing ip
output to figure out the default route lines, and then crafting the proper ip
command to update the route.