AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

i365Finds Editorial is the independent research and editorial organization behind 365 Wiki. We follow changes in tools, products, services, entertainment, and digital life around the world, turning scattered and fast-moving information into clearly sourced, well-structured public content that is easier to understand and compare.
Indexed 91,206 Wiki articles

How DNS-over-HTTPS (DoH) Interacts with Active WireGuard and OpenVPN Tunnels

Juliette Le Bars · 365Finds Editorial

Enabling DNS-over-HTTPS (DoH) in your browser while connected to a WireGuard or OpenVPN tunnel does not provide "double encryption" for your lookups. It splits your network stack into two competing layers.

At 365Finds, we regularly see privacy-conscious users turn on DoH in Firefox or Chrome, connect to an encrypted tunnel, and assume their traffic has gained an extra layer of impenetrable armor. The actual networking reality is messier, frequently irritating, and occasionally harmful to privacy. When you understand how operating system interface binding and application sockets interact, the illusion disappears.

The Architectural Collision: Layer 3 vs Layer 7

WireGuard and OpenVPN operate at Layer 3 of the OSI model. When you establish a tunnel, your operating system creates a virtual network interface—typically named wg0 or tun0. The VPN software then modifies the kernel routing table, inserting a default gateway route (0.0.0.0/0 and ::/0) pointing at this virtual adapter.

Under normal operating conditions, when a desktop application wants to reach example.com, it invokes the standard operating system stub resolver via POSIX getaddrinfo or Windows DnsQuery_W. The operating system formats a standard DNS query—traditionally UDP over port 53—and transmits it according to interface metrics and binding rules. If your tunnel is configured with a full routing table and an internal DNS server (such as DNS = 10.2.0.1), the request leaves through wg0 directly to the VPN operator's resolver.

Standard VPN Flow:
Browser -> OS Stub Resolver (getaddrinfo) -> Port 53 UDP -> wg0/tun0 Interface -> VPN Internal DNS Resolver

Browser-based DoH breaks this chain completely.

When you enable "Secure DNS" or "Max Protection" DoH in Chrome, Firefox, Edge, or Brave, the browser bypasses the operating system's resolver altogether. The browser treats DNS resolution as standard web traffic. It packages standard DNS wire-format messages inside an HTTP/2 or HTTP/3 POST or GET request directed at an HTTPS endpoint over TCP port 443 (such as https://cloudflare-dns.com/dns-query or https://dns.google/dns-query).

Browser DoH Flow over VPN:
Browser -> Application Layer HTTPS (TCP 443) -> wg0/tun0 Tunnel -> VPN Exit Node -> Public DoH Provider (e.g. Cloudflare)

Because this DoH query is plain HTTPS traffic bound for port 443, your kernel routing table sees it as generic outbound traffic. If you are running a full-tunnel VPN, that HTTPS connection gets wrapped inside WireGuard or OpenVPN UDP packets, traverses the tunnel, and emerges at the VPN exit node.

The query reaches the DoH server encrypted from your local ISP, yes. But it completely bypasses your VPN provider's intended resolver.

PropertyNative VPN DNS (wg0 / tun0)Browser DoH over Full-Tunnel VPNBrowser DoH over Split-Tunnel VPN
Resolution LayerLayer 3 / OS stub resolverLayer 7 / Browser internal clientLayer 7 / Browser internal client
Transport ProtocolUDP / TCP port 53HTTPS over TCP / UDP port 443HTTPS over TCP / UDP port 443
Query DestinationVPN internal gateway resolverThird-party public resolver (Cloudflare; Google; NextDNS)Third-party public resolver
Path TraversedEncrypted tunnelEncrypted tunnel to VPN exit nodePhysical network adapter (WAN / Wi-Fi) if bypassed
Local / Intranet DNSResolves corporate / home LANCompletely broken; fails or times outBroken unless fallback is permitted
Anonymity PoolShared across all VPN exit usersTied to DoH account or separate server logsExposes ISP IP or personalized DoH endpoint

Why This Creates Real Privacy Risks

The common assumption is: "If the DoH query travels inside the VPN tunnel to the exit node, what is the harm? My ISP still can't see it."

That is true regarding your local ISP. But at 365Finds, we look at the entire threat model, and DoH over a VPN creates two serious side effects that many users overlook.

1. The Identity Correlation Trap

Most reputable, privacy-first VPNs route your DNS queries to a dedicated, co-located resolver that does not log queries and shares outgoing requests among hundreds of active users on that same node. Your traffic blends into a large crowd.

When you override that setup with browser DoH, you hand your entire browsing history directly to a third party like Cloudflare or Google. If you configure a personalized resolver—such as a custom NextDNS profile or personal AdGuard Home instance—your browser sends your unique profile token in the HTTPS path on every single lookup:

https://dns.nextdns.io/abc1234/device-name

Even though the connection emerges from a shared VPN IP address, your unique identifier is stamped onto every lookup. You have effectively stripped away the collective anonymity provided by the VPN.

2. Stealth DNS Leaks via Split Tunneling and IPv6

The interaction turns catastrophic when you introduce split tunneling or incomplete IPv6 routing.

Many VPN clients implement split tunneling by routing specific IP ranges through wg0 and sending the rest through the physical adapter (eth0 or wlan0). If you use an application-level split tunnel to exclude certain streaming or banking apps, or if your WireGuard configuration defines:

AllowedIPs = 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16

Your browser's DoH connection to 1.1.1.1:443 or 8.8.8.8:443 is routed over your physical network interface directly to your ISP gateway. The lookup leaves your machine entirely unencrypted by the VPN. Because DoH looks identical to ordinary web traffic, your VPN's leak-prevention mechanisms will not intercept it.

Furthermore, if your WireGuard profile sets AllowedIPs = 0.0.0.0/0 but omits ::/0, and your ISP provides native IPv6, your browser will happily open an IPv6 DoH socket over your raw physical interface. Your ISP sees the destination IP of your resolver, and the DoH provider sees your true home IPv6 address.

Captive Portals and Intranet Breakage

Beyond privacy leaks, stacking DoH on top of an active tunnel causes frequent functional headaches.

When you connect to hotel, airport, or cafe Wi-Fi, the network uses a captive portal. It intercepts port 53 DNS queries or port 80 HTTP requests to redirect you to an authentication webpage (login.hotelwifi.internal).

If your browser is configured with strict DoH:

  1. The browser refuses to ask the local DHCP-assigned DNS resolver for the gateway IP.
  2. The browser attempts to reach cloudflare-dns.com over HTTPS port 443.
  3. The captive portal firewall blocks outbound port 443 until you log in.
  4. The DoH lookup times out or returns an NXDOMAIN error.
  5. The login splash page never opens, leaving you stranded.

A similar breakdown occurs in corporate or home homelab environments. If your OpenVPN or WireGuard connection is designed to grant access to internal domains (jira.internal or nas.lan), browser DoH fails instantly. Public resolvers know nothing about your private subnets. You end up staring at resolution errors while your terminal's curl commands work without issue.

How Operating Systems Prioritize Resolvers

Operating systems handle interface binding differently, which explains why behavior varies wildly across Windows, Linux, and macOS.

Windows Filtering Platform (WFP) and Multi-Homed DNS

Windows features Smart Multi-Homed Name Resolution. By default, Windows sends DNS queries across all active adapters simultaneously and accepts whichever response arrives first. This is notoriously leak-prone.

OpenVPN mitigates this with the directive:

block-outside-dns

This flag uses the Windows Filtering Platform to drop any outgoing traffic on UDP/TCP port 53 on every adapter except the active TAP/TUN interface.

WireGuard on Windows installs a similar WFP filter during tunnel initialization.

However, because these filters inspect UDP and TCP port 53, they are completely blind to browser DoH running over port 443. As far as WFP is concerned, a DoH lookup is identical to loading a web page over HTTPS.

Linux and systemd-resolved

On modern Linux distributions, systemd-resolved acts as the local caching resolver on 127.0.0.53. When wg-quick brings up a WireGuard interface with a DNS = 10.2.0.1 directive, it typically runs resolvectl under the hood.

To prevent leaks on Linux, the tunnel interface must be marked as the routing domain for all queries:

resolvectl dns wg0 10.2.0.1
resolvectl domain wg0 '~.'

The ~. (search root) tells systemd-resolved that all global queries belong strictly to wg0. But again, if Firefox or Chrome has DoH enabled, the browser never calls 127.0.0.53. It ignores nsswitch.conf, ignores resolvectl, and opens a direct TCP socket.

Step-by-Step Verification: Where Do Your Queries Go?

Do not rely on simple web page badges that claim "You are protected." You should observe the network traffic directly.

1. Inspect the Physical Interface with tcpdump or Wireshark

On Linux or macOS, identify your physical network adapter (for example, eth0 or en0) and your tunnel adapter (wg0 or utun3).

Run a packet capture on the physical interface while browsing:

sudo tcpdump -i eth0 -n "port 53 or (port 443 and (host 1.1.1.1 or host 8.8.8.8))"

If you see packets appearing on eth0 when you open new domains in your browser, your queries are bypassing the tunnel.

Now inspect the tunnel interface:

sudo tcpdump -i wg0 -n "port 53 or port 443"

If DoH is active and routed through the tunnel, you will see TLS handshake packets to your DoH server's IP address on wg0, and zero port 53 traffic.

2. Run an Extended DNS Leak Test

Visit an inspection service such as DNSLeakTest. Perform the extended test.

365Finds Recommendation

At 365Finds, our stance is clear: Disable browser-level DoH whenever you are connected to a trusted, privacy-focused WireGuard or OpenVPN tunnel.

Running DoH inside a full VPN tunnel does not add privacy. It fragments your security perimeter. It overrides the VPN's internal, privacy-hardened DNS, destroys your anonymity by tying queries to personal DoH identifiers, and breaks local domain resolution.

Recommended Configurations

  1. In Your Browser: Set Secure DNS to "Off" or "Default OS Resolver".
    • In Firefox: Settings -> Privacy & Security -> DNS over HTTPS -> Select "Off" or "Default Protection".
    • In Chrome / Brave / Edge: Settings -> Privacy and security -> Security -> Turn off "Use secure DNS".
  2. In WireGuard (wg0.conf): Ensure your configuration explicitly routes all traffic and assigns an internal resolver:
    [Interface]
    Address = 10.2.0.2/32, fd00::2/128
    PrivateKey = [CLIENT_PRIVATE_KEY]
    DNS = 10.2.0.1
    
    [Peer]
    PublicKey = [SERVER_PUBLIC_KEY]
    Endpoint = 198.51.100.1:51820
    AllowedIPs = 0.0.0.0/0, ::/0
    
  3. In OpenVPN (client.ovpn): Enforce strict DNS binding on Windows:
    redirect-gateway def1
    dhcp-option DNS 10.8.0.1
    block-outside-dns
    

If you operate on an untrusted VPN (such as a mandatory corporate proxy where you intentionally wish to conceal specific lookups), using DoH is a deliberate bypass mechanism. But for personal privacy and leak prevention, letting the VPN manage DNS at Layer 3 remains the cleanest, most reliable architecture.

References