![Ivan Sergeev](/assets/img/avatar_default.png)
Add and enable a systemd unit file to bring up or down network with ifup / ifdown, analogous to the skeleton/etc/init.d/S40network init script. Signed-off-by: Ivan Sergeev <vsergeev@kumunetworks.com> [eric.le.bihan.dev@free.fr: - rebase - install service only if systemd-networkd is not selected] Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
22 lines
601 B
Desktop File
22 lines
601 B
Desktop File
[Unit]
|
|
Description=Network Connectivity
|
|
Wants=network.target
|
|
Before=network.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
|
|
# lo is brought up earlier, which will cause the upcoming "ifup -a" to fail
|
|
# with exit code 1, due to an "ip: RTNETLINK answers: File exists" error during
|
|
# its "ip addr add ..." command, subsequently causing this unit to fail even
|
|
# though it is a benign error. Flushing the lo address with the command below
|
|
# before ifup prevents this failure.
|
|
ExecStart=/sbin/ip addr flush dev lo
|
|
|
|
ExecStart=/sbin/ifup -a
|
|
ExecStop=/sbin/ifdown -a
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|