[systemd-devel] can I use network-online.target without NM and networkd

Reindl Harald h.reindl at thelounge.net
Mon Mar 25 21:18:06 UTC 2019



Am 25.03.19 um 22:00 schrieb Belisko Marek:
> in my app I need to delay startup until network is really up & running.
> I go through [1] and it mentions that it works only with NetworkManager
> and systemd-networkd. I'm using ifup configuration for network so can I
> use this target to be sure that app will be called only when network is
> up? Thanks.
> 
> [1] - https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

surely, switched months ago to my own network "scripts" because NM is
terrible slow and nobody needs a process running after boot on static
configured networks

[root at testserver:~]$ cat /etc/systemd/system/network-up.service
[Unit]
Description=Network
After=systemd-udev-trigger.service systemd-udev-settle.service
Wants=systemd-udev-trigger.service systemd-udev-settle.service
After=sys-subsystem-net-devices-lan.device
After=sys-subsystem-net-devices-wan.device
Wants=sys-subsystem-net-devices-lan.device
Wants=sys-subsystem-net-devices-wan.device
Before=crond.service timers.target
PartOf=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
SuccessExitStatus=80
ExecStart=/usr/sbin/ipset -file /etc/sysconfig/ipset restore
ExecStart=/usr/sbin/iptables-restore /etc/sysconfig/iptables
ExecStart=/usr/sbin/ip addr add 192.168.196.12/255.255.255.0 broadcast
192.168.196.255 dev lan
ExecStart=/usr/sbin/ip link set dev lan up
ExecStart=/usr/sbin/ip route add default via 192.168.196.2

[Install]
WantedBy=network-online.target
WantedBy=multi-user.target


More information about the systemd-devel mailing list