Linux systemd and Network Status

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

systemd-based boot scripts rely on the $network boot facility to express their dependency on the network status (note that '$' is the conventional way to refer to a boot facility and it does not imply variable substitution). According to the Linux specifications, $network can be used to signal that basic network support is available. This definition is rather vague.

In systemd, three target units take the role of $network:

  • network.target, if reached, indicates that the network management stack is up. This carries little meaning during startup: whether any network interface is already configured is undefined. The primary purpose is to be used during shutdown. Shutdown ordering of units in systemd is in reverse of the startup ordering, any unit that declares After=network.target can be sure it is stopped before the network is shut down. This allows services to cleanly terminate connections. Those services should place an After=network.target dependency and avoid Wants=network.target or even Requires=network.target.
  • network-online.target
  • network-pre.target