Right now, MAAS correctly models static routes with a ‘metric’ value. On deployment, every static route can be added to the kernel, and if there is a conflict the route with the lowest metric is selected.
The default gateway is a route. It just happens to be a special case route of least preference (because it has the shortest possible prefix length). Even least-preference routes should be able to have a metric, for two reasons:
-
In case we want to add every default gateway to the kernel, then the kernel will know which one to select in case of an unreachable gateway.
-
In case we can only add one gateway, we can pick the lowest-metric route to supply to the deployment.
Currently having two subnets with a default gw results in two default routes like these being deployed:
default via 10.0.0.1 dev eth1 proto static
default via 10.0.1.1 dev eth0 proto static
We should have a metric here to be able to explicitly prio default routes
Note this is a cross-post from https://bugs.launchpad.net/maas/+bug/1674866