October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

What NetworkManager Dispatcher Events Mean and When They Run

A practical guide to NetworkManager Dispatcher event names, timing, script selection, environment variables, and race conditions.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NetworkManager Dispatcher runs administrator-provided scripts when NetworkManager reports certain changes. The action name passed to each script identifies the event: pre-up and pre-down are transition hooks, while up and down report completed activation or deactivation. These events are useful for network-related automation, but they do not guarantee internet access, application readiness, or even that the reported state is still current when a script runs.

What a dispatcher action tells you

Dispatcher is a D-Bus-activated service that runs administrator-provided scripts in response to NetworkManager events. For ordinary invocations, the script receives the interface name as its first argument and the action as its second. The interface argument has exceptions: it is none for hostname, and empty for connectivity-change and dns-change. Device and VPN events can also refer to different interface variables depending on the case.

As an Amazon Associate I earn from qualifying purchases.

The official NetworkManager-dispatcher reference manual defines these actions and their environment. The key distinction is timing: a pre- event occurs before a clean transition completes; its corresponding event without the prefix describes the completed change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Network and VPN event meanings

Action Meaning and timing
pre-up The interface is connected but not yet fully activated. Scripts run late in activation, and NetworkManager waits for them before reporting the interface fully activated.
up The interface has been activated.
pre-down The interface is about to be deactivated but remains connected. NetworkManager waits for applicable scripts before disconnecting it. This clean-transition hook is not emitted for forced losses such as lost carrier or a fading Wi-Fi signal.
down The interface has been deactivated.
vpn-pre-up The VPN is connected but not yet fully activated. It uses the pre-up hook location, and NetworkManager waits before reporting the VPN fully activated.
vpn-up The VPN connection has been activated.
vpn-pre-down The VPN is about to be deactivated but is still connected. NetworkManager waits for applicable scripts before disconnection. Unexpected VPN termination or general connectivity loss does not emit this clean pre-down event.
vpn-down The VPN connection has been deactivated.

Other dispatcher actions

Action When it runs and notable detail
hostname The system hostname has been updated. The interface argument is none, and no environment variable is set for this action.
dhcp4-change The DHCPv4 lease changed, for example through renewal or rebinding.
dhcp6-change The DHCPv6 lease changed.
connectivity-change NetworkManager’s connectivity state changed, such as going online or losing connectivity. The interface argument is empty.
reapply The connection was reapplied on the device.
dns-change DNS configuration changed, including when NetworkManager is configured not to manage resolv.conf. In that case, active connection DNS settings may be found at /run/NetworkManager/resolv.conf. The interface argument is empty.
device-add A special action for a generic connection whose generic.device-handler property names a handler script. Only one script runs, from dispatcher.d/device; additional interface and connection information is provided.

When pre-up is—and is not—a readiness signal

pre-up runs late in a profile’s activation, and NetworkManager waits for its scripts before it tells applications the interface is fully activated. The NetworkManager-wait-online manual describes this timing. It does not mean a remote host is reachable, a particular application can connect, or every other startup dependency is ready. Use it as a hook for network-transition work, not as a universal test of service availability.

How NetworkManager selects and runs scripts

Scripts are found in /{etc,usr/lib}/NetworkManager/dispatcher.d and applicable subdirectories, then run in alphabetical order. If identically named scripts exist in both locations, the /etc version takes precedence. A valid script must be a regular executable file owned by root, not writable by group or others, and not setuid.

Ordinary scripts receive useful environment values such as NM_DISPATCHER_ACTION, CONNECTION_UUID, CONNECTION_ID, CONNECTION_DBUS_PATH, CONNECTION_FILENAME, CONNECTION_EXTERNAL, DEVICE_IFACE, and DEVICE_IP_IFACE. IP configuration variables are exported where applicable; VPN invocations can include VPN-prefixed interface and address variables. Connection user settings are exposed as CONNECTION_USER_ variables after key encoding. The exact environment varies by action, so consult the reference manual for the complete action-specific list.

Scripts run one at a time and asynchronously from NetworkManager’s main process. A long-running script can be killed. If the work may take an arbitrary amount of time, start a child process and return promptly. A script symlinked into /etc/NetworkManager/dispatcher.d/no-wait.d/ runs immediately in parallel, without waiting for preceding scripts to terminate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose an event and handle stale actions safely

  • Use pre-up or vpn-pre-up for work that must finish before NetworkManager reports activation complete; use up or vpn-up for work that follows activation.
  • Use pre-down or vpn-pre-down for cleanup that needs a clean disconnect opportunity. Do not rely on these events to handle sudden link failure or unexpected VPN termination.
  • Choose the VPN-specific action when the transition belongs to a VPN rather than the underlying device. Check the relevant interface argument and environment variables instead of assuming one interface name applies to every case.
  • Keep ordered work short. Use no-wait.d only when parallel execution is acceptable, or launch a child process if lengthy work should not hold up the dispatcher.
  • Recheck current device or connection state before taking consequential action. An event already queued can still run after a newer event has made it obsolete—for example, an up script may run after the interface has gone down.

The action identifies why a script was queued; it is not a guarantee that the same condition still holds at execution time.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.