nixos/networkd: use the route section for default routes

With systemd v242 using the `Gateway` attribute of the `[Network]`
section will lead to "onlink" routes on all the device that are matched
by the default configuration (typically all devices) causing multiple
default routes (even on localhost).

We can only avoid that - while keeping our default route option - when
we mark the route as explicitly not on link. Only gateways that are
within a subnet of one of the assigned interface addresses will be
installed into the routing table.
wip/yesman
Andreas Rammhold 5 years ago
parent a32cd7d84a
commit d600da7045
No known key found for this signature in database
GPG Key ID: 74908259861E8386
  1. 9
      nixos/modules/tasks/network-interfaces-systemd.nix

@ -59,7 +59,14 @@ in
in {
DHCP = override (dhcpStr cfg.useDHCP);
} // optionalAttrs (gateway != [ ]) {
gateway = override gateway;
routes = override [
{
routeConfig = {
Gateway = gateway;
GatewayOnlink = false;
};
}
];
} // optionalAttrs (domains != [ ]) {
domains = override domains;
};

Loading…
Cancel
Save