Default gateway (per-subnet) should have a metric value

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 dev eth1 proto static
default via 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

1 Like

@chrome0, insightful. thanks for the input.

We want the metric value of a default route to be configurable on MAAS Web UI to prioritize multiple default routes.

A host on our deployment has two network interfaces (eth0 and eth1). We want to statically configure a default route using eth0 with less priority (= higher metric value) than a default route using eth1 as the link speed of eth1 is much higher than that of eth0.