When you connect to a WireGuard VPN, your device has to make a decision for every piece of data it sends: "Should this go through the secure VPN tunnel, or should it go directly to the internet?" The setting that controls this decision is AllowedIPs. How you configure it determines whether you are using a "full-tunnel" or a "split-tunnel" VPN.
Understanding the difference is crucial for customizing your VPN to your exact needs.
Full-Tunneling: Maximum Security
This is the most common and secure configuration. In a full-tunnel setup, all of your device's internet traffic is routed through the WireGuard server.
If you have followed our basic setup guides, you are already using a full-tunnel configuration.
How it works: You tell your client that every possible IP address on the internet should be accessed through the VPN.
The Configuration (AllowedIPs):
In your client's [Peer] section, you set AllowedIPs to 0.0.0.0/0, ::/0. This is a universal catch-all that means "every IPv4 address and every IPv6 address."
[Peer]
PublicKey = YOUR_SERVER_PUBLIC_KEY
Endpoint = your.server.com:51820
AllowedIPs = 0.0.0.0/0, ::/0
Pros:
- Maximum Security: All your traffic is encrypted and hidden from your local ISP or public Wi-Fi network.
- Hides Your IP: Every website you visit sees the IP address of your VPN server, not your actual IP.
- Bypasses Geo-blocks: You can access content as if you were in the server's location.
Cons:
- Potential for Slower Speeds: All your traffic has to travel to the VPN server and back, which can add latency.
- Uses More Bandwidth: Streaming video or downloading large files will use your VPN server's bandwidth.
Split-Tunneling: Maximum Flexibility
In a split-tunnel setup, you decide exactly which traffic goes through the VPN. All other traffic goes directly to the internet as normal.
How it works: You give your client a specific list of IP addresses or subnets that should be accessed through the VPN.
The Configuration (AllowedIPs):
In your client's [Peer] section, you list only the specific IP ranges you want to tunnel.
[Peer]
PublicKey = YOUR_SERVER_PUBLIC_KEY
Endpoint = your.server.com:51820
# Only send traffic for these specific networks through the VPN
AllowedIPs = 10.0.0.0/24, 192.168.1.0/24
Pros:
- Faster General Browsing: Traffic to sites like Google or YouTube goes directly to them, resulting in lower latency.
- Saves Bandwidth: You don't use your server's bandwidth for activities that don't need VPN protection.
- Simultaneous Access: You can access devices on your home network (like a printer) while also being connected to your work's VPN resources.
Cons:
- Less Secure for General Browsing: Your regular internet traffic is not encrypted by the VPN and is visible to your ISP.
- More Complex Setup: You need to know the specific IP addresses of the resources you want to access.
How to Configure a Split-Tunnel
Let's imagine a common use case: you want to use your VPN to securely access your home network (192.168.1.0/24) and your Pi-hole running on the VPN server (10.0.0.1), but you want all other traffic to be fast and direct.
Here’s how you would configure your client:
[Interface]
PrivateKey = YOUR_CLIENT_PRIVATE_KEY_HERE
Address = 10.0.0.3/32
# Use a public DNS. The Pi-hole DNS will only be used for the tunneled traffic.
DNS = 1.1.1.1
[Peer]
PublicKey = YOUR_SERVER_PUBLIC_KEY_HERE
Endpoint = your.server.com:51820
# This is the magic part!
# We are telling the client: "Only use the VPN for these destinations."
AllowedIPs = 192.168.1.0/24, 10.0.0.1/32
What this configuration does:
- If you try to access a device at
192.168.1.50(like a file server at home), the traffic goes through the VPN. - If you try to access your Pi-hole at
10.0.0.1, the traffic goes through the VPN. - If you try to access
google.com, the traffic goes directly to the internet, bypassing the VPN entirely.
Conclusion
Choosing between full-tunnel and split-tunnel depends entirely on your needs.
- Use Full-Tunneling when you are on an untrusted network (like a coffee shop or airport) and security is your top priority.
- Use Split-Tunneling when you are on a trusted network and need to access specific remote resources while maintaining high speeds for your general internet traffic.
The flexibility of the AllowedIPs setting is one of WireGuard's most powerful features. Experiment with it to create the perfect setup for you!