On this page

Summary: When a VPN is active, your device’s routing table decides which packets enter it. The VPN app adds a virtual network interface and routes that point to it; packets sent there are wrapped inside new packets addressed to the VPN server and sent out over your ordinary Wi-Fi or mobile connection. The server unwraps them and forwards the original traffic to its destination, and replies come back to the server and return through the tunnel. Which traffic actually takes this path is not fixed: it depends on the routes, app rules, and exclusions that the VPN app and the operating system apply.

VPN Advisors is an independent, affiliate-supported website that explains how VPNs work, what they protect, and how to evaluate VPN services. This article follows how internet traffic moves from your device through a VPN tunnel and server before reaching its destination, including how routing determines which traffic enters the tunnel. For a broader explanation of VPN tunneling, encryption, and connection mechanics, see our How Does a VPN Work? guide.

The path at a glance

Outbound packets go from an app to the routing table, into the VPN interface and client, across the local network and ISP to the VPN server, then to the destination. Replies return to the VPN server and back through the tunnel. Excluded traffic goes directly to the local network.

A simplified full-tunnel path. Real implementations differ in which traffic they send to the VPN and in how they keep the VPN’s own packets out of the tunnel.

Step 1: The routing table decides what enters the VPN

Every IP packet a device sends carries a destination IP address. Before sending it, the operating system looks that address up in its routing table: a list of address ranges, each paired with the network interface that should carry traffic for that range. When several entries match, the most specific one (the longest prefix) wins; Android’s VPN documentation states this rule explicitly for VPN routes.

Connecting a VPN adds a virtual network interface next to the real ones. WireGuard, for example, adds an interface named wg0 alongside interfaces such as eth0 or wlan0. The VPN client then installs routes that send some or all destinations to that interface:

  • In a full-tunnel configuration, the routes cover every address. Microsoft’s VPN routing decisions guide describes Windows force tunneling as adding IPv4 and IPv6 default routes for the VPN with a lower metric than other interfaces’ routes.
  • OpenVPN’s def1 option reaches the same result differently: it adds two routes that together cover all IPv4 addresses and are more specific than the existing default route, overriding it without deleting it, as the OpenVPN 2.6 manual explains.
  • On Apple platforms, including the default route in a packet tunnel’s included routes sends any traffic that doesn’t match a more specific rule through the VPN, according to Apple’s Network Extension documentation.
  • In a destination-based split-tunnel configuration, only the listed address ranges go to the VPN, while other destinations normally use the physical interface.

The practical consequence: “all traffic goes through the VPN” really means all traffic that no more specific route, rule, or app setting sends somewhere else. Most of the exceptions described later follow from that.

Step 2: The VPN client wraps each packet for the server

A virtual interface has no cable or radio behind it. Packets routed to it are handed to the VPN software instead; Android’s API describes each read from the VPN interface as returning an outgoing packet that was routed there.

WireGuard’s conceptual overview lays out what happens next in four steps: work out which configured peer the packet’s destination belongs to, encrypt the entire IP packet, look up that peer’s endpoint (an IP address and UDP port), and send the encrypted bytes there over UDP. Other protocols use different formats, but the routing result is the same. The original packet, still addressed to the website or service, becomes the payload of a new packet addressed to the VPN server.

From here on, it helps to keep two packets in mind:

  • Inner packet: the original traffic, carrying the real destination address.
  • Outer packet: the wrapper, addressed from your device to the VPN server.

How the wrapping is encrypted and authenticated is a separate subject from routing. For the traffic path, what matters is that the outer packet’s destination is the VPN server, not the site you’re visiting.

Step 3: The outer packet leaves through your normal connection

The outer packet has to go out over the real network. If the routing table sent it back into the VPN interface, it would loop. Ubuntu’s WireGuard documentation notes that WireGuard can’t simply make its interface the default gateway for this reason: its traffic has to reach the server endpoint outside the tunnel.

Implementations solve this in different ways. Classic setups add an explicit route for the VPN server’s address through the original gateway. WireGuard’s wg-quick tool instead marks packets leaving WireGuard’s own socket so they are exempt from the tunnel’s routing table, as described in WireGuard’s routing documentation. Apple’s platforms always keep traffic that communicates directly with the VPN server out of the tunnel.

The outer packets then cross your Wi-Fi or mobile network and your internet provider like any other traffic. Those networks see packets travelling between your device and the VPN server, with the inner packet carried, encrypted, inside them.

Step 4: The VPN server unwraps and forwards the traffic

The VPN server receives the outer packet, decrypts it, and recovers the inner packet. In WireGuard, the server also checks that the inner packet’s source address is one that peer is allowed to use, and drops the packet if it isn’t.

The inner packet then has to continue to its real destination, which takes configuration on the server side. OpenVPN’s guide to routing all client traffic says the server must handle that traffic, for example by applying network address translation (NAT) toward the internet; Ubuntu’s guide enables IP forwarding and masquerading for the same purpose. With NAT, the server replaces the inner packet’s source address with its outward-facing address, so the destination sees that address rather than your device’s. Other VPN setups can forward packets without NAT when the destination network has a route back to the VPN client.

This is where the tunnel ends. Once the server forwards it, the traffic travels the rest of the way to the destination as ordinary internet traffic.

Step 5: Replies retrace the path in reverse

When NAT is used, the destination replies to the VPN server’s outward-facing address, not directly to your device. In setups without NAT, the network still needs a route for replies to return through the VPN server. The server then directs each reply to the correct VPN client, wraps it in a new outer packet, and sends it back to your device. WireGuard sends to the most recent address from which it received correctly authenticated data, which helps return traffic reach your device when it moves between networks.

Your VPN client unwraps the reply and hands the inner packet to the operating system as though it had arrived on the VPN interface. Android’s API describes this as injecting a packet just as if it had been received from the interface. The app then receives the reply.

The return path mirrors the outbound path only for traffic that left through the VPN. A connection that went out directly through the physical interface gets its replies directly, too.

Traffic that may not follow this path

The steps above describe traffic that the routing table sends to the VPN. The situations below change what actually travels through it. Some are deliberate features; others are leaks.

Traffic that may not follow this path
Situation What happens
Split tunneling by destination Only the address ranges configured for the VPN use it; other destinations normally use the physical interface. Windows uses split-tunnel routes for selected destinations. WireGuard’s AllowedIPs selects a peer for traffic that reaches its interface; tools such as wg-quick can install corresponding system routes.
Per-app rules Some platforms let a VPN include or exclude specific apps. Android normally sends excluded apps over the regular connection, but its Block connections without VPN setting can deny them network access instead.
Apps that choose their own network On Android, app traffic goes through the VPN by default, and apps can’t sidestep it unless the VPN allows bypassing. On Apple platforms, an app that binds a connection to a specific interface overrides the routing table unless the VPN enforces its routes or includes all networks.
Devices on your local network Apple notes that routing-table entries for hosts on the local network take precedence over a VPN’s included routes. Its excludeLocalNetworks setting (on by default in iOS, off in macOS) keeps AirPlay, AirDrop, and similar traffic local when includeAllNetworks or enforceRoutes is active.
Network housekeeping Apple’s Network Extension rules keep certain system traffic outside the tunnel, including DHCP, captive-portal sign-in, cellular-only services such as VoLTE, and companion devices such as Apple Watch. OpenVPN, by contrast, warns that routing everything through the VPN can send DHCP renewals into the tunnel and cost the device its local address lease.
DNS lookups A lookup is separate traffic with its own destination: a DNS server. Whether it enters the tunnel depends on which DNS servers the VPN configures and how they are routed. If an Android VPN sets none, the default network’s DNS servers are used, although queries to those servers may still travel through the tunnel. Ubuntu’s full-tunnel guide treats checking for DNS leaks as part of the setup.
IPv6 traffic Devices often run IPv4 and IPv6 side by side. RFC 7359 explains that a VPN client that only handles IPv4 can leave IPv6 traffic outside the tunnel, sent in the clear. Android normally blocks an address family that the VPN has not configured, but the VPN can explicitly allow that family to use the underlying network.
Routes injected by the local network Because routing decides the path, a more specific route can pull traffic out of the tunnel. The TunnelVision technique (CVE-2024-3661) uses a rogue DHCP server’s option 121 to install such routes while the VPN still appears connected. In their 2024 tests, the researchers found the route-based weakness on Windows, Linux, macOS, and iOS, but not Android, which lacked support for that DHCP option. Additional client protections that block traffic outside the tunnel can reduce the exposure.
Tunnel not connected Behavior depends on the implementation. With Apple’s includeAllNetworks setting, ordinary traffic is dropped when the VPN isn’t connected, including while it reconnects, although designated system traffic remains excluded. When an Android VPN closes its interface, normal networking can resume, unless Block connections without VPN prevents traffic from falling back to the ordinary connection.

Because these behaviors vary by operating system, app, and configuration, the same VPN service can route traffic differently on different devices. No single diagram is exact for every implementation.

Terms that are easy to mix up

Technical sources describe the same parts of the path with different words. These are the distinctions that matter for routing:

Terms that are easy to mix up
Term What it means for the traffic path
Route and routing table A route directs packets for a destination address range toward an interface or next-hop gateway. The routing table holds these routes; app and policy rules can also influence the choice.
VPN interface The virtual network interface the VPN creates, also called a tunnel interface or virtual adapter, or known by a name such as wg0. Routes point traffic to it.
Tunnel The path the outer packets take between your device and the VPN server. A connected tunnel doesn’t mean every packet uses it; routing decides that.
Encryption Protection applied to the inner packet. It determines what an observer can read, not which way the traffic goes.
Endpoint In WireGuard, the IP address and UDP port where outer packets are sent, usually the VPN server in this example. Other sources use “endpoint” for the user’s device, so check the context.
Default route and default gateway The default route handles destinations with no more-specific match. The default gateway, when needed, is the next-hop router used by a route. Full-tunnel VPNs typically install a VPN default route or equivalent covering routes.
Forwarding and NAT Forwarding sends the inner packet toward its destination. Source NAT changes the packet’s source address to an outgoing address, often using masquerading on Linux. Forwarding does not always require NAT when return routes are available.

What routing establishes, and what it doesn’t

Routing answers one question: which path a packet takes. Traffic that goes through the VPN is wrapped between your device and the VPN server and travels normally after that, so the services you contact still receive it once it leaves the server. If you visit an HTTPS website, HTTPS encryption still protects the browser-to-website connection beyond the VPN server. Whether that path adds privacy, hides who you are, or protects a particular activity depends on more than the route, including what the traffic contains, who operates the server, and whether any of the exceptions above apply. TunnelVision illustrates the difference: its researchers did not break the VPN’s encryption, they routed traffic around the tunnel.