summaryrefslogtreecommitdiff
path: root/docs/NETWORK_ONLINE.md
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-17 12:25:52 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-17 12:50:09 +0200
commit45b1321653ba0e508f20eaf2c31772e5b206c0d8 (patch)
treeae689d1e28145bdbcdfdbedbfec6e4ce62312b33 /docs/NETWORK_ONLINE.md
parent3b098432be44cd1fd64bf1cf9a945ebcc39a1ec7 (diff)
downloadsystemd-45b1321653ba0e508f20eaf2c31772e5b206c0d8.tar.gz
docs: say how to delay network-online.target
Could be related to https://access.redhat.com/solutions/4879291. Unfortunately I can't access this page, but the title seems relevant.
Diffstat (limited to 'docs/NETWORK_ONLINE.md')
-rw-r--r--docs/NETWORK_ONLINE.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/NETWORK_ONLINE.md b/docs/NETWORK_ONLINE.md
index 7317d7ef8b..1a81bf4ca4 100644
--- a/docs/NETWORK_ONLINE.md
+++ b/docs/NETWORK_ONLINE.md
@@ -224,3 +224,38 @@ it does not delay boot. It is usually easier to write such a service in a
be (re-)established, but is instead started when the network has connectivity,
and if the network goes away, it fails and relies on the system manager to
restart it if appropriate.
+
+## Modyfing the meaning of `network-online.target`
+
+As described above, the meaning of this target is defined first by which
+implementing services are enabled (`NetworkManager-wait-online.service`,
+`systemd-networkd-wait-online.service`, …), and second by the configuration
+specific to those services.
+
+For example, `systemd-networkd-wait-online.service` will wait until all
+interfaces that are present and managed by
+[systemd-networkd.service(8)](http://www.freedesktop.org/software/systemd/man/systemd-networkd.service.html).
+are fully configured or failed and at least one link is online; see
+[systemd-networkd-wait-online.service(8)](http://www.freedesktop.org/software/systemd/man/systemd-networkd-wait-online.service.html)
+for details. Those conditions are affected by the presence of configuration
+that matches various links, but also by settings like
+`Unmanaged=`, `RequiredForOnline=`, `RequiredFamilyForOnline=`; see
+[systemd.network(5)](http://www.freedesktop.org/software/systemd/man/systemd.socket.html).
+
+It is also possible to plug in additional checks for network state. For
+example, to delay `network-online.target` until some a specific host is
+reachable (the name can be resolved over DNS and the appropriate route has been
+established), the following simple service could be used:
+
+```ini
+[Unit]
+DefaultDependencies=no
+After=nss-lookup.target
+Before=network-online.target
+
+[Service]
+ExecStart=sh -c 'while ! ping -c 1 example.com; do sleep 1; done'
+
+[Install]
+WantedBy=network-online.target
+```