2B. VPN DNS with Direct Fallback — Advanced IPv4

4 Total views across this article’s versions; includes the historical baseline where available.

Advanced IPv4 controls · Simple VPN and DNS policies

Prefer host-wide DNS through the VPN, but permit one designated direct DNS provider when the preferred service fails. DNS fallback never changes selected applications’ payload route.

Read Prepare an Advanced IPv4 Deployment, Repair Windows and Health Checks, and Operate, Restart and Withdraw alongside this guide. These advanced examples use dedicated systemd-managed OpenVPN instances; the simple walkthrough remains a separate alternative.

Follow the shared Ubuntu 24.04 implementation walkthrough for this use case: configuration, source build, guarded installation, controlled handoff, operating commands and rollback. Select ipv4 and this case in the source bundle. The policy below supplies its DNS scope, application boundaries and permitted failure behavior. OpenVPN Community 2.6 is the reference; exact-build capability checks remain required. Linux execution is deferred.

Define the policy

Traffic Required provider/path
Selected application DNS Selected VPN DNS or designated direct fallback
Other application and host-service DNS Same selected DNS mode
Selected application payload VPN A
Other application payload Direct

DNS scope: Host-wide upstream DNS. This covers conventional upstream unicast DNS in the declared host contexts. Controlled application resolution is required; port-53 filtering alone does not establish that arbitrary encrypted DNS or proxies cannot bypass it. Local stub access is not a separate upstream permission. Protected IPv6 is blocked during this IPv4 phase; the later IPv6 series is separate.

The two permissions for an application are independent. Losing DNS does not revoke healthy known-address payload, and losing payload does not revoke healthy DNS. A common tunnel, physical underlay or protection failure can affect both when both actually depend on it.

Prepare this use case

  1. Inventory all host resolver contexts and declare the two allowed provider/path pairs. A direct candidate probe needs its own confined permission; it must not proxy application lookups before selection.

  2. Select the return policy: automatic fallback with manual return, or automatic fallback with qualified automatic return. Record this choice durably with the selected provider.

  3. Keep selected payload bound to VPN A in both DNS modes. A working direct resolver is available to selected applications even when their payload is blocked, but cannot carry that payload directly.

Complete the deployment worksheet with the shared preparation inventory. It is documentation data, not a loadable configuration. Retain the simple counterpart as an alternative; do not run its mode-switch helper beside the advanced owner.

Activate and observe

Follow the closed-first activation sequence. Install and verify the independent route restrictions before any controlled transport attempt or application grant. Admit only the named OpenVPN instance and numeric peer needed for this use case. Then qualify each DNS/payload class separately and read back the actual resolver/route selection in its client context.

At startup, each permitted class must release before its fifteen-minute allowance expires. Successful release begins its own 120-second confirmation. Record the selected provider, class state, OpenVPN invocation, current checks, attempt count and remaining authority; an interface or an “active” service alone does not prove useful traffic is flowing.

Respond to failure

Observed condition Required behavior
Preferred DNS fails; payload remains healthy Close failed DNS and qualify the designated fallback. Keep healthy known-address payload working.
Fallback qualifies while payload VPN is unavailable Release permitted direct DNS for both groups. Keep selected payload blocked.
Unselected preferred candidate fails while fallback works Keep fallback selected. Continue its checks; retain the preferred path’s repair schedule.
Preferred repair enters cooldown or final lockout Keep already selected healthy fallback working. Do not give the preferred path a fresh allowance.
Selected fallback fails too Close affected DNS. Select only an independently qualified permitted replacement with valid authority; otherwise keep DNS denied. Healthy payload may continue.

Unavailable, degraded and unknown required service all invoke the relevant loss response. Keep static no-escape restrictions installed before detection, during repair and after lockout. Use the shared repair rules and report the actual failure reason. A remote DNS error does not automatically authorize a tunnel restart.

Work through one incident

Preferred DNS fails at 00:00. Direct candidate rounds complete at 00:02, 00:07 and 00:12, spanning ten seconds; each operation stays within its own limit. Assume selection and actual-client verification finish at 00:25. DNS then opens and confirms through 02:25. These elapsed times are examples, not new deadlines. Preferred repair may fail at 15:00 and 45:00 without closing healthy selected fallback.

These are constructed operating examples. They are not measured Linux timings. Check failures, expired evidence, failed publication or unknown controls can close the relevant class earlier than an outer repair deadline.

Return, restart and withdraw

Manual return waits for an explicit operator selection with current authority and fresh checks. Automatic return requires the preferred path’s qualification and at least sixty seconds of healthy fallback residence; those periods overlap. Failure of fallback can waive residence only for an independently qualified permitted replacement with valid authority. See the retained manual-return and automatic-return explanations.

An explicit operator recovery restart or host boot may replenish the affected allowance once while preserving provider selection and manual holds. Automatic crash/reconnect loops retain counters. Revalidate each class before reopening; restoring a saved provider is not restoring a saved health result. Follow the restart procedure and withdrawal sequence. Close and verify the owned gates before removing owned policy; never fall through to an unapproved route during rollback.

Check the boundary before acceptance

Test a third resolver, direct payload from a VPN-selected application, and application access through the candidate probe identity. All remain forbidden. A failed candidate must not be selected merely because the active path failed.

Apply the shared IPv4 failure and acceptance procedure, including existing connections, application-context lookups, stale events, crash/boot resets and expired permissions. Record actual route/packet evidence and state transitions separately. These checks remain unexecuted on Linux.