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:
parent
38af598658
commit
2e035ae042
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user