NETWORKD-DISPATCHER(8)

๐Ÿ’– NAME ๐Ÿ’–

Okay bestie, this is the NETWORKD-DISPATCHER(8) manual page ๐ŸŽ€ and it's about networkd-dispatcher, a dispatcher service for systemd-networkd connection status changes ๐ŸŒธ

โœจ SYNOPSIS โœจ

networkd-dispatcher [-h] [-S SCRIPT_DIR] [-T] [-v] [-q]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So okay, this is a dispatcher daemon for systemd-networkd connection status changes ๐Ÿ’… It's basically the cousin of NetworkManager-dispatcher, but way more chill, because it only handles the events that systemd-networkd(8) actually gives it ๐Ÿ™ˆ

The actions you want (scripts) live in directories that match the systemd-networkd operational states, all under SCRIPT_DIR. When the daemon gets the matching event from systemd-networkd, it runs them โœจ

It listens for signals from systemd-networkd over dbus, so it's super light on resources (no polling, no drama) ๐Ÿซถ It's meant to run as a system-wide daemon, as root. That's what makes it perfect for stuff like starting a VPN once a connection is up ๐Ÿ”ฅ

๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

  • -h, --help โ€” Prints the command-line syntax and program options to stdout ๐Ÿ“–
  • -S, --script-dir=SCRIPT_DIR โ€” This is where it looks for scripts ๐Ÿงš Like the PATH environment variable, you can list several directories separated by :. If more than one directory has a script with the same name, the earliest directory wins. It defaults to /etc/networkd-dispatcher:/usr/lib/networkd-dispatcher
  • -T, --run-startup-triggers โ€” Generates events that reflect the state and behavior that already exist when it starts up ๐ŸŒˆ This is clutch if networkd-dispatcher gets launched after systemd-networkd has already started an interface, because the triggers still get belatedly run
  • -v, --verbose โ€” Bumps verbosity up by one level ๐Ÿ“ˆ The default level is WARNING. Each -v moves the log level toward INFO or DEBUG
  • -q, --quiet โ€” Turns verbosity down by one level ๐Ÿคซ Each -q moves the log level toward ERROR or CRITICAL

๐ŸŽ€ CONFIGURATION FILES ๐ŸŽ€

The systemd service reads /etc/default/networkd-dispatcher as an environment file for extra daemon arguments ๐Ÿ’œ

The scripts that run on network changes go into these subdirectories inside SCRIPT_DIR: routable.d/, dormant.d/, no-carrier.d/, off.d/, carrier.d/, degraded.d/, configured.d/, and configuring.d/. The default SCRIPT_DIR is /etc/networkd-dispatcher:/usr/lib/networkd-dispatcher ๐Ÿ“

For info on the network operational states systemd exposes, check out networkctl(1) ๐ŸŒธ

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

Scripts run with some environment variables already set ๐Ÿ’… Some of them might be unset or empty, depending on the type of event. Scripts can use these to do stuff conditionally, like acting on a specific interface or state โœจ

  • IFACE โ€” the interface that triggered the event ๐Ÿฆ‹
  • STATE โ€” the destination state change that the script is currently being invoked for ๐Ÿ’– It can be any value listed as valid for AdministrativeState or OperationalState
  • ESSID โ€” for wlan connections, the ESSID the device is connected to ๐Ÿ“ถ
  • ADDR โ€” the ipv4 address of the device ๐ŸŒ
  • IP_ADDRS โ€” a space-delimited string of the ipv4 address(es) assigned to the device (see note below) ๐Ÿซง
  • IP6_ADDRS โ€” a space-delimited string of the ipv6 address(es) assigned to the device (see note below) ๐Ÿซง
  • AdministrativeState โ€” one of pending, configuring, configured, unmanaged, failed or linger ๐Ÿ‘‘
  • OperationalState โ€” one of off, no-carrier, dormant, carrier, degraded, routable, configuring, or configured ๐Ÿ”ฅ For more info on these states, see the networkctl manpage (man networkctl)

๐Ÿ”— RESOURCES ๐Ÿ”—

GitLab: https://gitlab.com/craftyguy/networkd-dispatcher ๐Ÿงก

๐Ÿ’œ SEE ALSO ๐Ÿ’œ

systemd-networkd(8), networkctl(1) ๐Ÿซถ


That's the whole NETWORKD-DISPATCHER(8) page, bestie ๐ŸŽ€ Last updated 07/11/2024, so it's giving fresh โœจ๐Ÿ’…

๐Ÿ“ฆ where this page comes from