--- title: Observing OpenVPN Reconnects with NetworkManager url: /review/openvpn-networkmanager-reconnects/ hidden: true build: list: never render: always sitemap: disable: true --- [Compare all DNS policies](/review/vpn-dns-decisions/). This is a VPN-operation technical review, focused on observing client lifecycle state. The [DNS routing policies](/review/vpn-dns-decisions/) remain centered on *iproute2* routes and rules, Netfilter restrictions, and resolver selection. They do not require OpenVPN, this observer, or an availability loop. Article prose is unchanged. See the [three-part architecture](/review/vpn-dns-architecture/), [VPN operation guide](/review/vpn-operation-integration/), and separate [DNS availability guide](/review/dns-availability-review/). ## Keep Three Questions Separate | Question | Evidence | | --- | --- | | Where is DNS permitted to go? | Routing rules/tables and firewall policy | | Is the OpenVPN session reconnecting? | Client lifecycle events associated with that connection | | Can the selected DNS service answer now? | A separate DNS availability check | A client event does not install or weaken routing policy. A DNS failure is not proof that OpenVPN is reconnecting. An observer losing its own event stream means **unknown**, not permission to use a less private route. ## What the Source Check Established OpenVPN's management protocol exposes `RECONNECTING`, `CONNECTED`, and other lifecycle states. `state on all` provides state history together with future notifications. Interface existence is insufficient because a reconnect can preserve the tunnel. The management interface supports one client at a time. [OpenVPN management protocol](https://openvpn.net/community-docs/management-interface/) The **NetworkManager-openvpn 1.12.5** release was checked directly against the upstream tarball and published SHA-256 checksum. Its service supplies `--persist-tun` and `--up-restart` and owns a management socket. The inspected handler handles authentication messages but does not subscribe to or forward OpenVPN `>STATE:` notifications. The restart helper can resend IP configuration; that is not a dependable notification of the beginning of peer loss. This is a source finding about that release, not a runtime test of the user's host. [Upstream release](https://download.gnome.org/sources/NetworkManager-openvpn/1.12/), [service source](https://github.com/GNOME/NetworkManager-openvpn/blob/1.12.5/src/nm-openvpn-service.c) NetworkManager exposes the public `VpnState` property and `VpnStateChanged` signal. Its core can map a plug-in transition from STARTED to STARTING to a reconnecting connection state, but the plug-in has to report that transition. The existence of the public API does not establish that every OpenVPN internal reconnect reaches it. [Public VPN API](https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.VPN.Connection.html), [NetworkManager core](https://github.com/NetworkManager/NetworkManager/blob/main/src/core/vpn/nm-vpn-connection.c) Consequently, neither the tunnel interface, a generic active-connection indicator, nor `vpn-up`/`vpn-down` alone is sufficient evidence of internal reconnect coverage. My earlier suggestion that a small dispatcher hook could replace the monitor needs this qualification. Do not attach a second client to NetworkManager's management socket or replace its existing OpenVPN helper scripts to obtain notifications. ## Observe the Installed Combination First The following is a read-only observation procedure, not an automatic failover implementation. Record the installed versions and the intended connection UUID. On Debian/Ubuntu, package versions can be read with: ```bash nmcli --version openvpn --version dpkg-query -W network-manager network-manager-openvpn openvpn nmcli -f NAME,UUID,TYPE connection show --active ``` On another distribution, use its package-query equivalent. Identify one connection by UUID rather than assuming that every OpenVPN message belongs to the same tunnel. ```bash VPN_UUID='REPLACE_WITH_CONNECTION_UUID' nmcli -f GENERAL connection show --active uuid "$VPN_UUID" ``` Find the active connection's D-Bus path in that output. In one terminal, begin observing that object before triggering a controlled reconnect: ```bash ACTIVE_PATH='/org/freedesktop/NetworkManager/ActiveConnection/REPLACE' gdbus monitor --system --dest org.freedesktop.NetworkManager --object-path "$ACTIVE_PATH" ``` In a second terminal, obtain a state snapshot after the subscription is active: ```bash gdbus call --system --dest org.freedesktop.NetworkManager --object-path "$ACTIVE_PATH" --method org.freedesktop.DBus.Properties.Get org.freedesktop.NetworkManager.VPN.Connection VpnState ``` The public VPN states include CONNECT (`3`), ACTIVATED (`5`), FAILED (`6`), and DISCONNECTED (`7`). These are not the plug-in service-state enum, whose numeric values differ. Consult the [VPN API types](https://www.networkmanager.dev/docs/api/latest/nm-vpn-dbus-types.html). A recreated active connection has a new object path; rediscover it by UUID and resubscribe. A stale path or lost bus connection is not a VPN-down event. [GDBus commands](https://manpages.debian.org/bookworm/libglib2.0-bin/gdbus.1.en.html) For diagnosis, inspect the NetworkManager journal and correlate it with the actual OpenVPN process belonging to this activation: ```bash sudo journalctl -b -u NetworkManager -n 100 --no-pager sudo journalctl -b -u NetworkManager -f -o short-monotonic ``` Some distributions route OpenVPN records differently. Confirm the actual unit, identifier, PID, and activation before choosing a filter. Preserve the unfiltered evidence for the target process; do not turn a broad text search for "restart" into a policy trigger. Journal messages can help demonstrate a reconnect, but log wording, delivery, and process identity require validation before any parser could be trusted for automation. Do not enable secret-bearing debug logging just to make an example work. [Journal filtering](https://www.freedesktop.org/software/systemd/man/latest/journalctl.html) ## Validate Internal Reconnects, Not Just Deliberate Disconnects Keep independent recovery access. On a disposable lab connection, arrange loss of the recorded VPN peer path while leaving the host's normal connection available. Use the configured OpenVPN timeout; do not assume a universal interval or overwrite provider-supplied settings. Test an internal restart separately from a NetworkManager deactivate/reactivate operation. Record the OpenVPN evidence, D-Bus events, interface state, and timing together. A passing observation must expose loss of the session even when the interface remains, then distinguish renewed session establishment from subsequent route installation and DNS availability. A reconnect event caused by an administrative restart also must not be mislabeled as proof of a network outage. Include process replacement, changed object paths, rapid reconnects, and loss of the observer itself. Do not infer success from the interface disappearing once, from a later IP-configuration update, or from DNS beginning to work again. The failure transition itself must be observable on the installed versions. ## Boundary for a Future Adapter A reliable automatic adapter needs a supported, verified event path from the OpenVPN client through the connection owner, including internal restarts. The checked plug-in source does not establish that path. Adding state forwarding to the owner, or selecting a version/integration that already supplies it, is separate engineering work; no plug-in patch, management proxy, service, or automatic routing hook is installed by this review. If that integration is later validated, the adapter can report **session unavailable**, **session established**, or **unknown** for one UUID/activation. The routing policy still decides whether direct fallback is permitted. Established means the session exists, not that the selected DNS server is responsive. Any DNS readiness policy belongs to a separate availability discussion. For now, the routing tutorial's explicit mode-switch commands remain independently usable and testable. Reliable automatic internal-reconnect integration is an identified limitation, not a completed feature. No Linux runtime tests have been performed.