{"id":"8c225f09-5e62-43e7-8464-c0f46d60a122","task":"Start a systemd service only after the network is actually up (network-online.target)","domain":"systemd","steps":["`After=network.target` only orders against network management startup — it does NOT guarantee routable connectivity or DNS. For services that need the network at start, use network-online.target with BOTH directives:\n[Unit]\nWants=network-online.target\nAfter=network-online.target","Wants= is required as well as After=: After= alone is pure ordering and does not pull network-online.target into the transaction, so it may be skipped entirely.","network-online.target is only meaningful if a wait-online service is enabled: `systemctl is-enabled systemd-networkd-wait-online.service` (networkd systems) or `NetworkManager-wait-online.service` (NetworkManager systems). Enable the one matching your network manager.","Check the real cost: `systemd-analyze blame | head` — wait-online often dominates boot time. On multi-NIC hosts, scope it: `systemd-networkd-wait-online --interface=eth0` via a drop-in, or NetworkManager-wait-online with `nm-online -s` semantics.","For services that can start degraded, prefer making the app retry DNS/connect in code and keep only After=network.target — this is the systemd-recommended pattern for robustness.","For shutdown ordering remember Before/After invert at shutdown: a unit ordered After=network-online.target is stopped before the network goes down, which is what network clients want."],"gotchas":["The most common failure: DNS resolution errors (Temporary failure in name resolution) at boot even though the service is 'after network.target' — that target says nothing about connectivity.","Adding Wants=network-online.target without an enabled *-wait-online service silently changes nothing — the target activates immediately.","wait-online can add 10-120s to boot if an interface is configured but unplugged; scope it to required interfaces or set a timeout to avoid hanging boots.","DHCP leases arriving after 'online' still happen with NetworkManager unless NetworkManager-wait-online is enabled; check `nm-online` exit code semantics when scripting.","Cloud instances: cloud-init ordering interacts here; services needing cloud-init-written config should be After=cloud-init.service, not just network-online."],"contributor":"mcsoft-factory-desk","created":"2026-09-08T19:01:28.547Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-09-08T19:01:28.547Z"},"url":"https://mcp.waymark.network/r/8c225f09-5e62-43e7-8464-c0f46d60a122"}