Sub topic 13
Split tunnelling, full tunnelling and DNS
This chapter assumes you know what a routing table and a default route are, how WireGuard peers are configured, and how a tunnel appears as an ordinary network interface. It covers which traffic goes into a tunnel and which name server answers the queries.
Routing decides what enters the tunnel
A tunnel interface only carries packets that the routing table sends to it. The VPN client chooses between two policies.
- Full tunnel: all traffic goes through the VPN, including the default route.
- Split tunnel: only traffic for selected networks goes through the VPN. Everything else uses the normal local connection.
In WireGuard, the AllowedIPs setting of a peer does two jobs. It acts as a routing list for outgoing packets. It also acts as a source filter for incoming packets from that peer.
[Peer]
PublicKey = <server-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25With this peer section the client is in split-tunnel mode, because only 10.8.0.0/24 is routed into the tunnel. Changing the line to the default routes makes it a full tunnel.
[Peer]
PublicKey = <server-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 0.0.0.0/0, ::/0Including ::/0 matters. If you list only the IPv4 default route and the host has working IPv6, IPv6 traffic keeps leaving through the local network and bypasses the VPN.
What happens to the VPN's own packets
In a full tunnel, the encrypted packets still have to reach the VPN server's public address. If the default route pointed into the tunnel, those outer packets would be routed into the tunnel as well, which creates a loop. VPN software avoids this by adding a more specific route, or a policy rule, so that the server's public IP goes out through the physical interface. The wg-quick tool does this with a firewall mark and a routing rule.
DNS is a separate decision
Routing does not decide where DNS queries go. The resolver settings do, and the VPN client must set them. The DNS = 10.8.0.1 line in the client configuration tells wg-quick to use the VPN's resolver.
Two common failures follow from this.
- DNS leak: the traffic goes through the tunnel, but queries still go to the local network's resolver. The local network sees which names you look up.
- Unreachable internal names: in a split tunnel the client keeps its local resolver, so names such as
intranet.corp.exampledo not resolve, even though the routes to the internal addresses exist.
Split DNS fixes the second problem. Queries for the internal domain go to the VPN resolver, and all other queries go to the local one. On Linux with systemd-resolved, you can set this per interface.
resolvectl dns wg0 10.8.0.1
resolvectl domain wg0 "~corp.example"The ~ prefix makes corp.example a routing-only domain. Queries for it go to wg0, and nothing else is sent there.
Choosing between them
| Criterion | Split tunnel | Full tunnel |
|---|---|---|
| Load on the VPN link | Only internal traffic | All traffic |
| Local devices such as printers | Still reachable | Often unreachable |
| Central filtering and logging | Only for internal traffic | Covers all traffic |
| Protection on untrusted Wi-Fi | Internet traffic is unprotected | All traffic is encrypted to the VPN server |
| Risk | The client bridges the internet and the internal network | The VPN server sees all traffic |
Check the result with ip route get 1.1.1.1 and resolvectl query example.com. The first shows which interface a packet will use. The second shows which resolver answered.
Exercise
A client uses AllowedIPs = 0.0.0.0/0 and DNS = 10.8.0.1. A user on a dual-stack network finds that sites still see their real IPv6 address. What is wrong, and what is the fix?
Show answer
The tunnel only covers IPv4. IPv6 traffic follows the local default route and bypasses the VPN. Add ::/0 to AllowedIPs (and make sure the server routes IPv6), or disable IPv6 on the client.