AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

i365Finds Editorial is the independent research and editorial organization behind 365 Wiki. We follow changes in tools, products, services, entertainment, and digital life around the world, turning scattered and fast-moving information into clearly sourced, well-structured public content that is easier to understand and compare.
Indexed 89,154 Wiki articles

Configuring Policy-Based Routing on a VPN Router for Specific Devices

Boris Graf · 365Finds Editorial

To route specific local devices through an encrypted VPN tunnel while keeping the rest of your network on direct internet, you configure policy-based routing (PBR) on your router. Instead of forcing every packet through an encrypted interface, PBR matches outbound traffic by source IP address or MAC address and steers matching packets into the VPN client gateway while allowing unmatched packets to follow the default WAN gateway.

At 365Finds, we consider whole-network VPN routing a flawed compromise for modern households. Forcing an entire household through a single tunnel breaks local banking apps, degrades real-time gaming with unnecessary latency, disrupts smart TV local casting, and chokes high-speed fiber connections behind router CPU encryption limits. Selective routing is the practical architecture: it gives high-risk devices or region-shifting hardware dedicated cryptographic tunnels without collateral damage to the rest of the household.

       [ Local Network Clients ]
            |              |
   [ Streaming Box / ]   [ Gaming Console / ]
   [ Work Laptop     ]   [ Smart Home Hub   ]
     (192.168.1.50)        (192.168.1.60)
            |                   |
            v                   v
     [ Policy Match ]     [ Default Route ]
            |                   |
            v                   v
      [ tun0 / wg0 ]         [ WAN / ISP ]
            |                   |
    (Encrypted Tunnel)   (Direct Low Latency)

Step 0: Fix IP Addresses Before Creating Rules

Policy-based routing rules mapped to dynamic DHCP addresses inevitably break. The moment a client renews its lease and grabs a different IP, your routing policy either fails silently or routes the wrong hardware through your encrypted gateway.

  1. Navigate to your router's DHCP server settings (typically LAN > DHCP Server or Network > Interfaces > LAN).
  2. Create a static DHCP reservation for every machine targeted for selective routing (for example, assign 192.168.1.50 to your streaming box and 192.168.1.51 to a work laptop).
  3. Disable MAC address randomization (known as "Private Wi-Fi Address" on iOS, macOS, Android, and Windows) on client devices connecting to your home Wi-Fi network. If the device randomizes its MAC address, it receives an unexpected IP from the pool and bypasses IP-based policies.
  4. Ensure your local subnet (RFC 1918 ranges such as 192.168.1.0/24) is exempted from VPN redirection so local printers, Network Attached Storage (NAS), and casting protocols continue working without interruption.

Method 1: Asuswrt-Merlin (VPN Director)

Stock Asus routers provide a simplified interface called VPN Fusion, but Asuswrt-Merlin's VPN Director is substantially more reliable, handling state management and kill switches with granular precision.

1. Establish the VPN Client

Navigate to VPN > VPN Client. Configure your WireGuard or OpenVPN connection using your provider's configuration file. Verify that the tunnel status displays a connected state and receives an assigned virtual IP address.

2. Configure VPN Director Rules

Navigate to VPN > VPN Director. Rules are evaluated sequentially from top to bottom; the first matching rule dictates the outbound interface.

  1. Click the Add (+) icon in the rule table.
  2. Set Interface to your active VPN client (for example, WireGuard or OVPN1).
  3. Set Enable to Yes.
  4. In Local IP, enter the static IP of your target client (for example, 192.168.1.50/32 or an IP range like 192.168.1.50-192.168.1.55).
  5. Leave Remote IP set to 0.0.0.0/0 (or blank) to route all outbound internet traffic from this device through the tunnel.
  6. Click Apply.
Interface    Local IP           Remote IP     Description
WireGuard    192.168.1.50/32    0.0.0.0/0     Streaming Box Tunnel
WireGuard    192.168.1.51/32    0.0.0.0/0     Work Laptop Tunnel

All other network clients without an explicit rule match will bypass the VPN and exit through the default WAN gateway.

3. Prevent DNS Leaks via DNS Director

Routing payload data through a VPN while sending DNS requests across your ISP gateway exposes browsing behavior. In Asuswrt-Merlin:


Method 2: GL.iNet Routers (Firmware v4.x Policy Mode)

GL.iNet travel and home routers feature a purpose-built policy engine layered directly over OpenWrt.

  1. Log in to the web Admin Panel (192.168.8.1).
  2. Navigate to VPN > VPN Dashboard and confirm your WireGuard or OpenVPN client is connected.
  3. In the top right corner of the VPN Dashboard, change the operational mode from Global Mode to Policy Mode.
  4. Click on Policy Settings (or VPN Policies depending on sub-version).
  5. Choose MAC Address as the policy type if you want hardware-level tracking, or choose Domain / IP if you prefer IP management.
  6. Under rule execution, select Only allow the following use VPN.
  7. Click Add, check the target device from the client list (or enter its MAC/IP manually), and click Apply.
  8. Uncheck Use VPN for all processes on the router. This keeps router-level maintenance services (such as NTP time sync, firmware update checks, and DDNS) on the direct WAN connection so they do not stall if the VPN drops.

Method 3: OpenWrt with pbr (nftables-based Policy Routing)

Modern OpenWrt versions (22.03 and later) run on nftables and fw4. The dedicated pbr package replaces legacy routing scripts with clean, high-performance packet marking.

1. Install the PBR Engine and Web Interface

Connect to your router via SSH or the LuCI web interface and install the required packages:

opkg update
opkg install pbr luci-app-pbr

If you plan to use domain-based routing alongside IP rules, install dnsmasq-full to support dynamic nftset resolution:

opkg remove dnsmasq
opkg install dnsmasq-full

2. Configure Policy Routing in LuCI

  1. Open LuCI and go to Services > Policy Routing.
  2. Under the Configuration tab, confirm that both your default WAN interface (wan) and your VPN interface (for example, wg0 or tun0) are detected and listed under supported interfaces.
  3. Switch to the Policies tab and click Add.
  4. Configure the rule:
    • Name: vpn_streaming_box
    • Interface: Select your VPN interface (wg0).
    • Source Address: 192.168.1.50
    • Destination Address: Leave blank to match all external traffic.
  5. Click Save & Apply.
  6. On the PBR Overview page, click Restart to generate the underlying nftables mark rules and routing tables.

Method 4: pfSense and OPNsense (Firewall Gateway Rules)

In enterprise-grade BSD router platforms like pfSense and OPNsense, policy routing is managed entirely through firewall rule evaluation and outbound NAT mapping.

1. Assign the VPN Interface and Verify Gateway

  1. Navigate to Interfaces > Assignments. Map your OpenVPN or WireGuard client instance to an interface (e.g., OPT1 / VPN_WAN).
  2. Navigate to System > Routing > Gateways and verify that a gateway pointing to your VPN interface is active and reporting low packet loss.

2. Create an IP Alias

  1. Navigate to Firewall > Aliases > IP.
  2. Click Add.
  3. Name the alias VPN_Selective_Hosts.
  4. Enter the static IPs of all target devices (192.168.1.50, 192.168.1.51).
  5. Save and apply changes.

3. Configure Outbound NAT

By default, pfSense uses automatic outbound NAT. When forcing traffic out of a non-default gateway, manual translation rules are necessary:

  1. Navigate to Firewall > NAT > Outbound.
  2. Select Hybrid Outbound NAT and click Save.
  3. Add a mapping rule:
    • Interface: VPN_WAN
    • Source: Single host or alias -> VPN_Selective_Hosts (or your LAN subnet)
    • Translation Target: Interface Address
  4. Save and apply changes.

4. Create the LAN Policy Rule

  1. Navigate to Firewall > Rules > LAN.
  2. Rules evaluate from top to bottom; the first rule that matches passes or blocks the traffic.
  3. First, verify you have a rule passing local network traffic (RFC 1918) using the default routing table:
    • Source: LAN net | Destination: RFC1918_Networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) | Gateway: default.
  4. Add a rule for your VPN hosts immediately below your local bypass rule and above the default LAN-to-any rule:
    • Action: Pass
    • Interface: LAN
    • Address Family: IPv4
    • Source: Single host or alias -> VPN_Selective_Hosts
    • Destination: Any
    • Advanced Options > Gateway: Select your VPN_WAN_GW gateway.
  5. Save and apply changes.
  6. Go to Diagnostics > States > Reset States and clear existing states. Active connections established prior to rule creation will remain on the old gateway until terminated.

Common Failure Modes and Diagnostic Checklist

When policy routing misbehaves, the breakdown rarely stems from the core routing table itself. At 365Finds, our troubleshooting across multiple router implementations points to three recurring snags:

ProblemRoot CauseFix
Target device shows ISP IPPersistent connection state tableReset router state tables or toggle client Wi-Fi off and on.
Target device leaks DNSQueries bypass tunnel via router local resolverEnforce interface-level DNS or redirect port 53/853 to VPN DNS.
Streaming app detects VPN bypassIPv6 dual-stack bypassDisable IPv6 on the target device or block IPv6 WAN egress.
Local printer/NAS unreachableSubnet traffic routed to tunnelAdd an explicit bypass rule for RFC 1918 local subnets above VPN rules.
Rule stops working after rebootDynamic IP reassignmentVerify static DHCP reservation and turn off client MAC randomization.

To verify rule isolation, run an IP and WebRTC leak test simultaneously on both a targeted device and an untargeted gaming console or desktop. The targeted device must reflect your VPN provider's remote exit node and DNS endpoints, while the gaming console must register your direct ISP public IP with single-digit local latency.

References