Hack to prevent <interface>-cfg.service from breaking the default gateway

Restarting <interface>-cfg.service may cause the interface's IP
addresses to be flushed.  If the default gateway goes through that
interface, then the default gateway is deleted.  So we need to
restart network-setup.target.
This commit is contained in:
Eelco Dolstra 2013-01-07 15:04:19 +01:00
parent 38af598658
commit 2e035ae042

View File

@ -347,6 +347,9 @@ in
echo "configuring interface..."
ip -4 addr flush dev "${i.name}"
ip -4 addr add "${i.ipAddress}/${mask}" dev "${i.name}"
# Ensure that the default gateway remains set.
# (Flushing this interface may have removed it.)
${config.system.build.systemd}/bin/systemctl try-restart --no-block network-setup.service
else
echo "skipping configuring interface"
fi