Sounds like this is "expected behavior". While gateway4 is available for
all interfaces, it simply adds a new default route for the interface,
always at a metric of 100 (if I'm not mistaken, but definitely always at
the same metric value). In any case, the metric value is up to the
default for networkd.

The solution around this is to set up your own default gateway via an
explicit route:

route:
  - to: 0.0.0.0/0
    via: x.x.x.x
    metric: 50

Specifying the exact metric value such that it gains the right priority,
if the interfaces are expected to behave with different priorities (ie.
you usually want to use eth0, but if it happens to be down we'll use
eth1).

For more complex scenarios, you will indeed want policy routing, which
is also supported in 18.04 using netplan > 0.34 (18.04 released with
netplan 0.37.1). This requires the use of "routes" along with "routing-
policy". We've put an example on the netplan.io website on how to do
this: https://netplan.io/examples#source-routing

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1766527

Title:
  [ubuntu 18.04][netplan] Machine network goes down when second gateway
  is configured

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-power-systems/+bug/1766527/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to