Router VPN Split Tunneling with WireGuard: How to Configure
In this article
- What Is Split Tunneling and Why Use It?
- How WireGuard Differs from OpenVPN for Split Tunneling
- Configuring Split Tunneling on OpenWrt
- Configuring on AsusWRT (Merlin) and pfSense
- Choosing What to Route: IPs, Domains, or Apps
- Common Pitfalls and Troubleshooting
- Cost and Performance Considerations
- Frequently Asked Questions
Router VPN split tunneling with WireGuard lets you choose which devices or traffic use the VPN tunnel and which use your regular internet connection, all from your router. You configure it by defining routing rules or policy-based routing in your router's firmware (like OpenWrt, AsusWRT, or pfSense) that direct only selected IPs, subnets, or domains through the WireGuard interface. This guide explains the key concepts, configuration steps, and common pitfalls.
What Is Split Tunneling and Why Use It?
Split tunneling is a VPN feature that divides your internet traffic into two paths: some goes through the encrypted VPN tunnel, the rest goes directly to your ISP. On a router, this applies to the whole network, so you can, for example, send your smart TV's traffic through the VPN (to bypass geo-blocks) while keeping your gaming console on the direct connection (to reduce latency).
Benefits include:
- Lower bandwidth usage on the VPN server, which often has data caps.
- Reduced latency for latency-sensitive apps like gaming or VoIP.
- Access to local network devices (printers, NAS) while still using the VPN for internet.
- Avoid breaking services that block VPN IPs (e.g., some banking sites).
How WireGuard Differs from OpenVPN for Split Tunneling
WireGuard is a modern VPN protocol that uses kernel-level cryptography and a simpler configuration model. Unlike OpenVPN, which often uses a TUN interface and complex routing tables, WireGuard uses a network interface (usually wg0) with a single peer and a set of allowed IPs. Split tunneling in WireGuard is handled by the AllowedIPs parameter:
AllowedIPs = 0.0.0.0/0routes all traffic through the tunnel (full tunnel).AllowedIPs = 192.168.1.0/24routes only traffic destined for that subnet through the tunnel.
On a router, you can set AllowedIPs to a specific range (e.g., the VPN server's subnet) and then use policy routing to direct only certain LAN clients to the wg0 interface. This is more efficient than OpenVPN's user-space routing and works well on low-power routers.
Configuring Split Tunneling on OpenWrt
OpenWrt is a popular open-source router firmware that supports WireGuard natively. Here's a step-by-step approach:
- Install WireGuard: In LuCI (web interface), go to System → Software, install
wireguard-toolsandluci-app-wireguard. - Create the WireGuard interface: Network → Interfaces → Add new interface, name it
wg0, protocol WireGuard. Enter the private key, listen port, and peer details (public key, endpoint, allowed IPs). For split tunneling, set AllowedIPs to the VPN server's subnet (e.g.,10.0.0.0/24) initially. - Set up policy routing: Install
ip-fullandiproute2. Then create a custom routing table (e.g., table 100) and add rules to route specific clients towg0.
Example commands (run via SSH):
ip rule add from 192.168.1.100 table 100 priority 1000
ip route add default dev wg0 table 100This routes all traffic from IP 192.168.1.100 through the VPN, while others use the normal default route. To make it persistent, add the commands to /etc/rc.local or use the LuCI firewall custom rules.
Configuring on AsusWRT (Merlin) and pfSense
AsusWRT-Merlin (for Asus routers) has a built-in VPN client with a “Policy Routing” tab. You can select “VPN” or “WAN” for each LAN IP or MAC address. Steps:
- Go to VPN → WireGuard Client, fill in the server details.
- In the “Policy Routing” section, add a rule: source IP (e.g., 192.168.1.50) → interface “VPN” (the WireGuard tunnel).
- Save and apply. The router automatically creates the necessary routing rules.
pfSense (a firewall/router distribution) uses a different approach: you create a WireGuard interface, then add rules in the firewall to route traffic based on source or destination. For example, create an alias for “VPN Clients” and add a rule in LAN: source = VPN Clients, gateway = WireGuard gateway. This gives fine-grained control.
Choosing What to Route: IPs, Domains, or Apps
You can split by:
- IP address: simplest, but IPs can change (especially for CDN-hosted services).
- Domain names: more flexible, but requires DNS-based routing (e.g., using dnsmasq with ipset on OpenWrt).
- Application: not directly possible on a router, but you can route by port number (e.g., all traffic on port 443 to VPN).
For domain-based routing, you can use a script that resolves domains and adds their IPs to an ipset, then routes that ipset through the VPN. This is more advanced but avoids the “IP changed” problem.
Common Pitfalls and Troubleshooting
- DNS leaks: Ensure DNS queries for VPN clients go through the tunnel. Set the VPN DNS server in the DHCP options for those clients, or use a DNS filter.
- Routing conflicts: If both the VPN and WAN default routes exist, the router may send traffic via the wrong gateway. Use policy routing with a separate table to force the VPN route.
- Firewall rules: On OpenWrt, you may need to add a firewall rule to allow forwarding from LAN to wg0. Check that the zone for wg0 is set to WAN or a custom zone.
- MTU issues: WireGuard's default MTU is 1420 bytes. If you see packet loss or slow speeds, try lowering it to 1280.
- Kill switch: If you want to prevent traffic from leaking when the VPN drops, add a rule that blocks traffic to the WAN for the VPN clients when the wg0 interface is down (e.g., using a netwatch script).
Cost and Performance Considerations
Split tunneling can reduce the load on your VPN provider, but the router's CPU still handles encryption. WireGuard is faster than OpenVPN on most routers because it runs in the kernel, but on low-end hardware (e.g., 400 MHz MIPS), throughput may be limited to 50-100 Mbps. If you need high speed, consider using a router with a faster CPU or offload to a dedicated device like a Raspberry Pi.
There is no extra cost for split tunneling itself; you pay for the VPN service (if any) and the router hardware. Some VPN providers offer their own router firmware with split tunneling built-in, but those are often limited to their service.
Frequently Asked Questions
Can I use split tunneling with WireGuard on any router?
Most routers that support WireGuard (via firmware like OpenWrt, DD-WRT, AsusWRT-Merlin, pfSense) can do split tunneling. Stock firmware from many ISPs does not support it, so you may need to flash a custom firmware.
Does split tunneling affect my VPN's security?
Split tunneling only routes selected traffic through the VPN, so the rest is not encrypted. If you want full privacy, use full tunneling. For specific use cases (e.g., accessing local devices), split tunneling is safe as long as you don't send sensitive data on the direct connection.
How do I route only certain domains through the VPN?
You need a DNS-based solution. On OpenWrt, use dnsmasq with ipset: create a set of domains, resolve them to IPs, and add a routing rule for that ipset. This is more complex but doable with scripts.
Why is my VPN traffic slow even with split tunneling?
Possible reasons: router CPU bottleneck, MTU mismatch, or the VPN server's bandwidth. Check the router's CPU usage during a speed test, and try adjusting MTU.
Can I have multiple VPN clients with different routing rules?
Yes, you can create multiple WireGuard interfaces (e.g., wg0, wg1) with different peers and then assign different LAN clients to each via policy routing. This is common in advanced setups.
Does split tunneling work with IPv6?
Yes, but you must configure IPv6 routing separately. Most routers have separate IPv6 routing tables; you'll need to add rules for IPv6 addresses as well.