Advanced IPv4 controls · Simple VPN and DNS policies
Send host-wide upstream DNS through the designated VPN while selected payload uses that VPN and ordinary payload remains direct. The resolver may be VPN-supplied or one explicitly selected provider reached through the VPN.
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 | Configured resolver through VPN A |
| Other application and host-service DNS | Same resolver through VPN A |
| 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
-
List every host resolver context: selected applications, ordinary applications, host services, local stubs and private namespaces. An isolated selected-application namespace alone does not implement host-wide DNS.
-
Choose the resolver before activation. Bind its upstream requests to VPN A and prohibit direct access to it or another resolver. Keep ordinary application payload on its existing direct route.
-
Record whether the payload and DNS share the same OpenVPN session. Monitor their services separately; share session/protection failure evidence only where the dependency is real.
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 |
|---|---|
| Resolver fails; tunnel/payload still work | Deny upstream DNS for both application groups. Preserve healthy known-address VPN and direct payload. |
| Selected payload fails; VPN DNS still works | Deny selected payload. Keep VPN DNS available to both groups. |
| Shared VPN A session fails | Deny its DNS and selected payload. Ordinary direct payload may continue if independently healthy. |
| DNS recovers while payload remains blocked | Reopen qualified DNS for both groups without waiting for the separate payload repair. |
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
At 00:00 the resolver fails a required DNS check. Both application groups lose upstream DNS, but their healthy known-address connections keep their permitted routes. A direct Internet connection remains present; it is not a DNS fallback. If DNS later qualifies, release DNS independently. Selected payload does not need to pass a separate repair merely to allow a lookup.
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
Restore the configured provider through VPN A. No automatic direct path or different provider is permitted.
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
While DNS is held, try the configured resolver directly and a different direct resolver. Both must be denied for selected applications, ordinary applications and host resolver forwarders. Also verify healthy numeric payload from each group.
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.