From 9db11c13bfbcd49d602f120542a26ccbcad12d93 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 16 May 2019 15:58:46 +0200 Subject: [PATCH] network.service: Add default route Add the setting of the default route into this service. This is supposed to replace gateway.service which should be removed, if this is merged. The problem with two different services is, that the system looses the route when network.service is stopped. Currently, gateway.service is also stopped, because of a Requires= dependency, but not restarted, when network.service is restarted. Downgrading the dependency to Wants= wouldn't resolve the problem, because the system looses the route anyway when the ip address is removed. If we make sure, that we add the route every time we set the ip address, we can restart network.service without loosing the default route. The services are not independent anyway, because the gateway ip address must be on a local network and thus match the ip address used by this unit. --- misc_systemd_units/network.service | 1 + 1 file changed, 1 insertion(+) diff --git a/misc_systemd_units/network.service b/misc_systemd_units/network.service index 710ce85..931a46e 100644 --- a/misc_systemd_units/network.service +++ b/misc_systemd_units/network.service @@ -9,6 +9,7 @@ RemainAfterExit=yes ExecStart=/usr/sbin/mxnetctl start ExecStart=/sbin/ip addr add ${MX_IPADDR}/20 broadcast 141.14.31.255 dev ${MX_NETDEV} ExecStart=/sbin/ip link set up dev ${MX_NETDEV} +ExecStart=/sbin/ip route add default via 141.14.16.128 ExecStop=/sbin/ip addr del ${MX_IPADDR}/20 dev ${MX_NETDEV} StandardOutput=syslog