Separate VPNs, Using an Independent DNS Provider

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

Compare all DNS policies.

You may want to choose your own DNS provider without sending queries through your direct Internet connection. As in Example 4A, DNS uses VPN 1, your newsgroup reader uses VPN 2, and ordinary application connections remain direct. These are separate paths from the same host, not one VPN inside another.

The second variation uses a DNS provider you choose separately, reached through VPN 1. For example, you may prefer a particular resolver regardless of which VPN service carries the connection.

Choose this variation if you want to control the DNS provider independently of the VPN provider. The DNS route still requires VPN 1; choosing a public resolver does not mean reaching it over the direct Internet connection.

Open the Walkthrough Shell

From your ordinary administrator account, open a root login shell first:

sudo -i

Use Bash in that root shell for the remaining setup, checks, and withdrawal. Do not nest another root shell when following a shared section. Confirm root access and retain the original account for comparison tests:

set -euo pipefail
test "$(id -u)" -eq 0
ORDINARY_USER="${SUDO_USER:-}"
test -n "$ORDINARY_USER"
test "$ORDINARY_USER" != root
test "$ORDINARY_USER" != newsvpn
test "$(id -u "$ORDINARY_USER")" -ne 0
id "$ORDINARY_USER"

Stop if the account is not your intended ordinary user. Administrative commands now run without repeated sudo. runuser -u ... -- deliberately runs a test under the named account; testing as root would not exercise the reader’s UID guard. When following a linked foundation check, keep its ordinary-user tests under ORDINARY_USER too; a root request is not the ordinary-account comparison. The examples require runuser as well as the tools listed below. Root login shells, account-specific commands

1. Choose the Provider

Obtain a supported public IPv4 resolver address from your chosen provider. Confirm that VPN 1 permits access to it. The provider’s validity, trust, and availability are your responsibility; this guide does not test or select a provider for you.

Use the same starting topology and application foundation as 4A, including its recovery access, existing shared resolver, IPv6 boundaries, and Ubuntu 24.04 lab baseline. Begin without another DNS example active. This is an alternative configuration, not an additional layer over an installed 4A policy.

2. Apply the Shared Configuration

Use 4A’s command blocks in the order below. You already opened the root shell above; skip 4A’s “Open the Walkthrough Shell” section and keep ORDINARY_USER unchanged. Substitute your independent provider’s address for DNS_UPSTREAM before running its setup block. This replaces 4A’s VPN-native provider choice; everything else stays the same.

DNS_UPSTREAM='REPLACE_WITH_CHOSEN_VARIANT_DNS_IPV4'

Replace that placeholder with the actual address in the setup block. Do not run it literally, and do not merely change the shell variable after rules have already been installed: that would leave the old routes, firewall rules, and resolver settings in place. To change an installed provider, withdraw that configuration using its original values first.

  1. Set the addresses. Use your independent provider for DNS_UPSTREAM; retain and verify each interface’s own local source address.
  2. Restrict DNS to VPN 1. The same rules permit only this address on VPN 1 and the local stub. IPv6 upstream DNS and port 853 remain blocked.
  3. Install the host routes and select the resolver. Keep the terminal unreachable route. Configure only your chosen provider, without adding VPN-native DNS as an alternate.
  4. Permit the reader’s local stub requests. Its application mark, table, source translation, and VPN 2 guard remain unchanged.

Use one configuration once. No additional table, packet mark, resolver service, or DNS switching tool is required for this provider variation.

3. Verify the Provider and Both Paths

Include the public-exit comparison and local-listener isolation check.

Run all of the shared verification commands with this provider’s address. Inspect requests and replies; successful lookups alone do not prove the selected path.

  • Normal upstream UDP and TCP DNS must reach your designated provider through VPN 1. Both ordinary applications and the reader use the existing local stub.
  • Reader connections must use VPN 2; ordinary application connections remain direct. Direct-to-provider queries from the reader must fail rather than use VPN 2 for DNS.
  • Another resolver, the correct resolver on the wrong interface, upstream IPv6 DNS, and port 853 must not become alternatives. Retain the shared checks and application restrictions for other DNS transports.

Perform the DNS route-loss test: fresh upstream lookups must fail while known-address reader connections can continue through VPN 2. Restore the exact route, then perform the application route-loss test: reader connections must fail while DNS through VPN 1 continues. Test both routes absent, then restore each separately. Keep terminal routes and guards throughout.

Use fresh names and connections. A cached answer, a pre-existing connection, or an absent IPv6 route is not proof that the relevant firewall restriction worked. VPN operation and availability monitoring remain separate; these checks do not install either.

4. Withdraw This Example

Stop affected workloads and follow the exact shared withdrawal sequence, retaining the independent provider’s address in DNS_UPSTREAM. Use the shared account-guard inspection and recovery steps: keep a valid original guard, restore it only when absent, and confirm no references remain before emptying the replacement chain. VPN_IF still means application VPN 2. Restore the saved DNS server/domain lists on all three affected interfaces before removing this example’s DNS restrictions. The revised shared setup leaves the resolver’s default-route setting untouched; follow its separate warning if you ran an older draft. Inspect partial setup first; remove only entries owned by this example, then verify the previous policy. Keep the reader stopped until its intended DNS environment and application route are verified.

The independent resolver ordinarily sees VPN 1’s exit address rather than your host’s public address. That does not establish anonymity or unlinkability. VPN 1 can still observe the originating connection, and ordinary DNS beyond the VPN exit is not automatically encrypted. Encrypted upstream DNS is a separate, deferred variation. DNS privacy considerations

Leave the Root Shell

After verification or withdrawal is complete, return to your ordinary shell:

exit

Review History

Preserved pre-review draft (text). Technical source review and local page validation were completed November 26, 2026. These simple examples retain explicit manual route/provider selection. The separate advanced Ubuntu walkthrough covers automatic controls, persistence, installation and rollback using the completed local reference source. Linux runtime validation remains deferred.