This site explains how digital privacy tools work — encryption, tracking, and identity protection. It is not legal or cybersecurity advice. What this is.

How a VPN DNS Query Bypasses a Local Resolver

Every time a device needs to translate a domain name into a routable IP address, it issues a DNS query. Under ordinary network conditions, that query travels in plaintext to a resolver operated by an internet service provider or configured manually on the local network. A VPN changes this path — not by encrypting the DNS protocol itself, but by redirecting the query so it never reaches the local resolver at all.

This redirection is a distinct mechanism from the broader work of encrypting traffic inside the tunnel. The tunnel handles payload data; DNS redirection handles the name-resolution step that precedes any connection. Understanding the two as separate operations clarifies both what a VPN accomplishes for DNS privacy and where that protection has its own boundaries.

Take Back Control of Your Windows PC and Its Privacy

Copy-paste command-line guides to switch off Windows tracking, see which apps are talking to the internet, and automate PC upkeep. For Windows 10 and 11.

Learn more

How DNS Queries Travel Through a VPN Tunnel, Step by Step

When a VPN client is active, it installs a virtual network interface on the device and rewrites the system's routing table. The routing table change causes all outbound IP traffic — including UDP packets on port 53, which carry standard DNS queries — to be directed toward the virtual interface rather than the physical one connected to the local network.

The VPN client software intercepts the DNS query at this virtual interface before the operating system's stub resolver or the ISP-assigned resolver ever receives it. The client wraps the query inside the encrypted tunnel protocol — typically TLS-based or a modern datagram protocol — and forwards it as ordinary encrypted tunnel traffic to the VPN server endpoint. From the perspective of any observer on the local network, the packet looks like generic encrypted data vpn traffic, not a DNS request.

At the VPN server, the tunnel is terminated. The server unwraps the inner DNS query and forwards it to a DNS resolver that the VPN provider controls or has configured. That resolver performs the standard recursive lookup — querying root servers, top-level domain servers, and authoritative nameservers — and returns the answer. The resolved IP address travels back through the tunnel to the client, which passes it to the application that originated the request.

The entire round trip through the data vpn tunnel means that neither the local router, nor the ISP's resolver, nor any passive observer on the local segment sees the domain name being queried. What they observe is an encrypted stream of packets between the device and the VPN server's IP address.

Technical Components Involved in VPN DNS Redirection

Stub resolver (operating system layer). The OS stub resolver is the component that receives DNS requests from applications and ordinarily forwards them to a configured upstream resolver. When a VPN client is active, it typically overrides the stub resolver's upstream address, pointing it to a loopback address or virtual interface that the VPN client controls. The stub resolver itself is unmodified; only its forwarding target changes.

Virtual network interface and routing table. The VPN client creates a virtual network adapter (commonly a TUN or TAP device) and inserts routes with a lower metric than the physical interface. Lower-metric routes take precedence, so DNS packets are captured by the virtual interface before they can exit through the physical adapter toward the ISP's resolver. This is the same routing infrastructure that underlies the broader process of authenticating the VPN server and establishing the encrypted channel.

Tunnel protocol encapsulation. The DNS query, once intercepted, is encapsulated inside the tunnel protocol's datagram or stream. The encapsulation adds encryption and integrity protection. The outer packet carries only the VPN server's IP address as a destination; the inner DNS query is not visible in the packet headers seen by network observers.

VPN provider's DNS resolver. The resolver at the far end of the tunnel handles the recursive lookup. Its position outside the local ISP's network means the ISP cannot log the query. Whether the VPN provider's resolver logs queries is a separate policy question, not a technical property of the tunnel protocol itself.

DNS-over-TLS / DNS-over-HTTPS (optional layer). Some VPN implementations add a second layer of DNS encryption by forwarding queries from the VPN server to its upstream resolver using DNS-over-TLS (port 853) or DNS-over-HTTPS. This protects the segment between the VPN server and its resolver but does not affect what happens inside the tunnel between the client and the VPN server.

Where VPN DNS Redirection Breaks Down or Produces Unexpected Results

DNS leaks. A DNS leak occurs when one or more DNS queries escape the tunnel and reach a resolver outside it — typically the ISP's resolver — while the VPN is nominally active. Leaks arise from several distinct causes. Some operating systems maintain a secondary DNS resolution path for IPv6 even when the VPN only routes IPv4 traffic. Some applications bypass the OS stub resolver entirely and issue their own DNS queries using hardcoded resolver addresses; these queries are not intercepted by the VPN client's routing rules. Split-tunnel configurations, which route only some traffic through the VPN, frequently exclude DNS, producing leaks for any domain queried during a split-tunnel session.

WebRTC and application-layer bypasses. Browser engines that implement WebRTC can perform STUN binding requests that reveal the device's local and public IP addresses independently of the DNS path. While not a DNS leak in the strict sense, this mechanism can expose network identity in ways the VPN tunnel does not address.

Captive portal interruptions. On networks that use captive portals — hotel Wi-Fi, airport networks — the portal's authentication mechanism often requires DNS queries to resolve to the portal's IP before the network grants full access. A VPN that routes all DNS through the tunnel may prevent the captive portal from functioning, because the portal's DNS intercept never receives the query. Some VPN clients include captive portal detection logic that temporarily bypasses DNS redirection; during that window, DNS queries travel outside the tunnel.

NXDOMAIN hijacking by ISPs. Even when the VPN is not in use, some ISPs intercept NXDOMAIN responses — replies indicating a domain does not exist — and substitute their own IP addresses to redirect users to search or advertising pages. This manipulation occurs at the resolver level and is invisible to the application. A VPN's DNS redirection removes this particular manipulation for queries that travel through the tunnel, but it does not retroactively affect queries made before the tunnel was established.

Kill switch gaps and DNS. A VPN kill switch blocks all traffic if the tunnel drops, preventing data from flowing over the unprotected physical interface. However, in implementations where the kill switch activates after a brief tunnel-drop event rather than simultaneously, a small window may exist during which the OS reverts to its pre-VPN DNS configuration and issues queries to the ISP resolver before the kill switch fires.

What DNS Leak Tests and Protocol Audits Actually Measure

A DNS leak test works by having the client resolve a set of unique subdomains under a domain the test operator controls. The test's authoritative nameserver logs which resolver IP addresses query those subdomains. If a resolver IP belonging to the ISP appears in that log while the VPN is active, a leak is confirmed for that query path. The test does not measure whether the VPN provider's own resolver logs queries; it only measures whether queries escaped the tunnel.

Independent protocol audits of VPN clients typically examine the routing table modifications the client makes, the DNS override mechanism, and whether IPv6 DNS is also redirected. An audit can confirm that the software correctly intercepts queries under normal conditions. It cannot confirm the behavior of the VPN provider's resolver infrastructure after the query exits the tunnel, because that infrastructure is outside the scope of client-side code review.

The FTC has noted in its guidance on internet privacy that DNS query data constitutes browsing history, because the sequence of domains queried over time reveals the sites a device has attempted to reach. This classification is relevant to evaluating a VPN provider's DNS resolver: the resolver that receives the query has access to the same category of data the ISP's resolver would have had. A no-logs policy is a contractual or operational claim about what the resolver operator retains; it is not a property that a protocol audit of the tunnel can verify or falsify.

CISA's guidance on encrypted DNS protocols distinguishes between encrypting the path to the resolver and trusting the resolver itself. Tunnel-based DNS redirection addresses the former — it moves the query off the local network — but the latter depends entirely on the operational practices of whoever runs the resolver at the tunnel's far end. No technical measurement from the client side can confirm what a remote resolver does with query logs after the response is sent.

VPN-based DNS redirection is a routing and encapsulation mechanism: it moves the point at which a DNS query becomes visible from the local network to the VPN provider's network. The shift in visibility is real and measurable, and the conditions under which it fails — split tunnels, application bypasses, captive portal interruptions — are equally concrete and testable.

Sources

Note: This explains how digital privacy and security tools work technically. It is not legal or cybersecurity advice, and it is not a substitute for a reader's own judgment about a real security concern. Check the cited sources for current guidance.

5 desks. How it works, not what to do.

Start from the top